Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
paths
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolai Hollup Brand
paths
Commits
2bfe2204
Commit
2bfe2204
authored
2 years ago
by
Trym Hamer Gudvangen
Browse files
Options
Downloads
Patches
Plain Diff
feat: create a passage pop up
parent
3cac670a
No related branches found
No related tags found
2 merge requests
!34
Feat/create story gui
,
!7
Feat/part three
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/pop_up/PassagePopUp.java
+54
-0
54 additions, 0 deletions
...1/group_30/paths/view/components/pop_up/PassagePopUp.java
with
54 additions
and
0 deletions
src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/pop_up/PassagePopUp.java
0 → 100644
+
54
−
0
View file @
2bfe2204
package
edu.ntnu.idatt2001.group_30.paths.view.components.pop_up
;
import
edu.ntnu.idatt2001.group_30.paths.model.Passage
;
import
javafx.geometry.Pos
;
import
javafx.scene.control.*
;
import
javafx.scene.layout.VBox
;
public
class
PassagePopUp
{
private
TextField
titleField
;
private
TextArea
contentArea
;
private
Button
saveButton
;
public
PassagePopUp
()
{
titleField
=
new
TextField
();
titleField
.
setPromptText
(
"Enter the title of the passage"
);
contentArea
=
new
TextArea
();
contentArea
.
setPromptText
(
"Enter the content of the passage"
);
saveButton
=
new
Button
(
"Save"
);
VBox
content
=
new
VBox
(
new
Label
(
"Passage Title:"
),
titleField
,
new
Label
(
"Passage Content:"
),
contentArea
,
saveButton
);
content
.
setAlignment
(
Pos
.
CENTER
);
content
.
setSpacing
(
20
);
PopUp
<
VBox
,
?>
popUp
=
PopUp
.<
VBox
>
create
()
.
withTitle
(
"Create a Passage"
)
.
withoutCloseButton
()
.
withContent
(
content
)
.
withDialogSize
(
400
,
500
);
saveButton
.
setOnAction
(
e
->
{
if
(
titleField
.
getText
().
isBlank
()
||
contentArea
.
getText
().
isBlank
())
{
AlertDialog
.
showWarning
(
"The title or content cannot be blank."
);
}
else
{
Passage
newPassage
=
new
Passage
(
titleField
.
getText
(),
contentArea
.
getText
());
//TODO: save the new passage
popUp
.
close
();
}
});
popUp
.
showAndWait
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment