Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Picturerama
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
Container Registry
Model registry
Operate
Environments
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
Gruppe 12
Picturerama
Commits
ffdb9f2e
Commit
ffdb9f2e
authored
5 years ago
by
Diderik Kramer
Committed by
Olaf Rosendahl
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Feedback/NoPhotosStored/DeleteNoSelectedPhotos
parent
6d63c0e1
No related branches found
No related tags found
1 merge request
!94
Feedback/NoPhotosStored/DeleteNoSelectedPhotos
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/App/Scenes/PhotosScene.java
+34
-17
34 additions, 17 deletions
src/main/App/Scenes/PhotosScene.java
with
34 additions
and
17 deletions
src/main/App/Scenes/PhotosScene.java
+
34
−
17
View file @
ffdb9f2e
...
...
@@ -19,6 +19,8 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
javafx.scene.text.Text
;
import
javafx.stage.Screen
;
/**
...
...
@@ -80,12 +82,21 @@ class PhotosScene extends SceneBuilder {
* Sets up the scroll pane in the search scene with all the photos of the user
*/
private
void
setupImagesInAScrollPane
(){
photoList
.
forEach
(
photo
->
{
PhotoContainer
photoContainer
=
new
PhotoContainer
(
photo
);
scrollPaneVBox
.
getChildren
().
add
(
photoContainer
.
getPhotoContainer
());
photoContainerList
.
add
(
photoContainer
);
checkBoxArrayList
.
add
(
photoContainer
.
getCheckBox
());
});
if
(!
photoList
.
isEmpty
())
{
photoList
.
forEach
(
photo
->
{
PhotoContainer
photoContainer
=
new
PhotoContainer
(
photo
);
scrollPaneVBox
.
getChildren
().
add
(
photoContainer
.
getPhotoContainer
());
photoContainerList
.
add
(
photoContainer
);
checkBoxArrayList
.
add
(
photoContainer
.
getCheckBox
());
});
}
else
{
Text
noPhotosText
=
new
Text
(
"No photos stored. You can upload photos in \"Upload\""
);
Css
.
setText
(
17
,
noPhotosText
);
scrollPaneVBox
.
getChildren
().
add
(
noPhotosText
);
scrollPaneVBox
.
setAlignment
(
Pos
.
CENTER
);
selectAllHBox
.
setDisable
(
true
);
}
scrollPane
.
setContent
(
scrollPaneVBox
);
scrollPane
.
setPrefHeight
(
Screen
.
getPrimary
().
getVisualBounds
().
getHeight
());
scrollPane
.
fitToWidthProperty
().
set
(
true
);
...
...
@@ -221,18 +232,24 @@ class PhotosScene extends SceneBuilder {
*/
private
void
deleteSelectedPhotos
(){
ArrayList
<
Photo
>
selectedPhotos
=
getCheckedPhotos
();
selectedPhotos
.
forEach
(
photo
->
{
photo
.
getAlbums
().
forEach
(
album
->
{
album
.
getPhotos
().
remove
(
photo
);
if
(
selectedPhotos
.
isEmpty
()){
feedbackLabel
.
setText
(
"Unsuccessful: No photos were chosen"
);
Css
.
playFeedBackLabelTransition
(
FeedBackType
.
Error
,
13
,
feedbackLabel
);
}
else
{
selectedPhotos
.
forEach
(
photo
->
{
photo
.
getAlbums
().
forEach
(
album
->
{
album
.
getPhotos
().
remove
(
photo
);
});
UserInfo
.
getUser
().
getPhotos
().
remove
(
photo
);
PhotoContainer
photoContainer
=
photoContainerList
.
stream
().
filter
(
c
->
c
.
getPhoto
().
equals
(
photo
)).
findAny
().
get
();
photoContainer
.
getCheckBox
().
setSelected
(
false
);
scrollPaneVBox
.
getChildren
().
remove
(
photoContainer
.
getPhotoContainer
());
});
UserInfo
.
getUser
().
getPhotos
().
remove
(
photo
);
PhotoContainer
photoContainer
=
photoContainerList
.
stream
().
filter
(
c
->
c
.
getPhoto
().
equals
(
photo
)).
findAny
().
get
();
photoContainer
.
getCheckBox
().
setSelected
(
false
);
scrollPaneVBox
.
getChildren
().
remove
(
photoContainer
.
getPhotoContainer
());
});
Hibernate
.
updateUser
(
UserInfo
.
getUser
());
feedbackLabel
.
setText
(
"Deleted successfully"
);
Css
.
playFeedBackLabelTransition
(
FeedBackType
.
Successful
,
13
,
feedbackLabel
);
Hibernate
.
updateUser
(
UserInfo
.
getUser
());
feedbackLabel
.
setText
(
"Deleted successfully"
);
Css
.
playFeedBackLabelTransition
(
FeedBackType
.
Successful
,
13
,
feedbackLabel
);
}
}
/**
...
...
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