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
f361488f
Commit
f361488f
authored
2 years ago
by
Trym Hamer Gudvangen
Browse files
Options
Downloads
Patches
Plain Diff
feat: delete links that no longer reference passage
parent
44fe1c77
No related branches found
No related tags found
2 merge requests
!34
Feat/create story gui
,
!7
Feat/part three
Pipeline
#230645
failed
2 years ago
Stage: checkstyle
Stage: compile
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/NewStoryView.java
+16
-6
16 additions, 6 deletions
...tnu/idatt2001/group_30/paths/view/views/NewStoryView.java
with
16 additions
and
6 deletions
src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/NewStoryView.java
+
16
−
6
View file @
f361488f
...
@@ -7,7 +7,6 @@ import edu.ntnu.idatt2001.group_30.paths.model.Passage;
...
@@ -7,7 +7,6 @@ import edu.ntnu.idatt2001.group_30.paths.model.Passage;
import
edu.ntnu.idatt2001.group_30.paths.model.Story
;
import
edu.ntnu.idatt2001.group_30.paths.model.Story
;
import
static
edu
.
ntnu
.
idatt2001
.
group_30
.
paths
.
PathsSingleton
.
INSTANCE
;
import
static
edu
.
ntnu
.
idatt2001
.
group_30
.
paths
.
PathsSingleton
.
INSTANCE
;
import
edu.ntnu.idatt2001.group_30.paths.view.components.common.DefaultText
;
import
edu.ntnu.idatt2001.group_30.paths.view.components.common.DefaultText
;
import
edu.ntnu.idatt2001.group_30.paths.view.components.pop_up.AlertDialog
;
import
edu.ntnu.idatt2001.group_30.paths.view.components.pop_up.AlertDialog
;
import
edu.ntnu.idatt2001.group_30.paths.view.components.pop_up.PassagePopUp
;
import
edu.ntnu.idatt2001.group_30.paths.view.components.pop_up.PassagePopUp
;
...
@@ -27,6 +26,7 @@ import javafx.scene.layout.VBox;
...
@@ -27,6 +26,7 @@ import javafx.scene.layout.VBox;
import
javafx.scene.text.Text
;
import
javafx.scene.text.Text
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
public
class
NewStoryView
extends
View
<
BorderPane
>
{
public
class
NewStoryView
extends
View
<
BorderPane
>
{
...
@@ -63,9 +63,7 @@ public class NewStoryView extends View<BorderPane> {
...
@@ -63,9 +63,7 @@ public class NewStoryView extends View<BorderPane> {
HBox
titleBox
=
new
HBox
(
labelText
,
textField
);
HBox
titleBox
=
new
HBox
(
labelText
,
textField
);
titleBox
.
setSpacing
(
20
);
titleBox
.
setSpacing
(
20
);
textField
.
setOnKeyTyped
(
event
->
{
textField
.
setOnKeyTyped
(
event
->
title
=
textField
.
getText
());
title
=
textField
.
getText
();
});
titleBox
.
setAlignment
(
Pos
.
CENTER
);
titleBox
.
setAlignment
(
Pos
.
CENTER
);
...
@@ -87,7 +85,11 @@ public class NewStoryView extends View<BorderPane> {
...
@@ -87,7 +85,11 @@ public class NewStoryView extends View<BorderPane> {
removePassageButton
=
new
Button
(
"Remove Passage"
);
removePassageButton
=
new
Button
(
"Remove Passage"
);
removePassageButton
.
setDisable
(
true
);
removePassageButton
.
setDisable
(
true
);
removePassageButton
.
setOnAction
(
e
->
passages
.
remove
(
passageTable
.
getSelectionModel
().
getSelectedItem
()));
removePassageButton
.
setOnAction
(
e
->
{
passages
.
forEach
(
passage
->
passage
.
getLinks
().
removeIf
(
link
->
Objects
.
equals
(
link
.
getReference
(),
passageTable
.
getSelectionModel
().
getSelectedItem
().
getTitle
())));
passages
.
remove
(
passageTable
.
getSelectionModel
().
getSelectedItem
());
});
editPassageButton
=
new
Button
(
"Edit Passage"
);
editPassageButton
=
new
Button
(
"Edit Passage"
);
editPassageButton
.
setDisable
(
true
);
editPassageButton
.
setDisable
(
true
);
...
@@ -95,7 +97,15 @@ public class NewStoryView extends View<BorderPane> {
...
@@ -95,7 +97,15 @@ public class NewStoryView extends View<BorderPane> {
Passage
selectedPassage
=
passageTable
.
getSelectionModel
().
getSelectedItem
();
Passage
selectedPassage
=
passageTable
.
getSelectionModel
().
getSelectedItem
();
if
(
selectedPassage
!=
null
)
{
if
(
selectedPassage
!=
null
)
{
Passage
updatedPassage
=
new
PassagePopUp
(
passages
,
selectedPassage
).
getPassage
();
Passage
updatedPassage
=
new
PassagePopUp
(
passages
,
selectedPassage
).
getPassage
();
if
(
updatedPassage
!=
null
)
{
if
(
updatedPassage
!=
null
&&
!
selectedPassage
.
equals
(
updatedPassage
))
{
passages
.
forEach
(
passage
->
{
System
.
out
.
println
(
passage
.
getTitle
());
System
.
out
.
println
(
passage
.
getLinks
());
passage
.
getLinks
().
replaceAll
(
link
->
link
.
getReference
().
equals
(
selectedPassage
.
getTitle
())
?
new
Link
(
link
.
getText
(),
updatedPassage
.
getTitle
())
:
link
);
});
passages
.
remove
(
selectedPassage
);
passages
.
remove
(
selectedPassage
);
passages
.
add
(
updatedPassage
);
passages
.
add
(
updatedPassage
);
}
}
...
...
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