From 5ec0f5030583e2270cb87033d234c41dc082a6a4 Mon Sep 17 00:00:00 2001 From: _N0x Date: Sun, 7 Feb 2021 02:47:02 +0100 Subject: [PATCH] continuing --- .gitignore | 4 +- .idea/artifacts/JavaFXApp.xml | 15 -- .idea/compiler.xml | 23 --- .idea/description.html | 2 - .idea/encodings.xml | 6 - .idea/gradle.xml | 4 - .idea/libraries/lib.xml | 16 -- .idea/misc.xml | 9 -- .idea/modules.xml | 8 - .idea/uiDesigner.xml | 125 ---------------- .idea/vcs.xml | 6 - PhotoViewer.iml | 2 +- src/de/thm/tlf/photoViewer/Controller.java | 137 +++++++++--------- .../thm/tlf/photoViewer/PictureHandler.java | 29 ++++ 14 files changed, 101 insertions(+), 285 deletions(-) delete mode 100644 .idea/artifacts/JavaFXApp.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/description.html delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/libraries/lib.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/uiDesigner.xml delete mode 100644 .idea/vcs.xml create mode 100644 src/de/thm/tlf/photoViewer/PictureHandler.java diff --git a/.gitignore b/.gitignore index c8845aa..aed6377 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Default ignored files /shelf/ -/.idea/workspace.xml +/.idea/* # Compiled class file *.class @@ -24,4 +24,4 @@ *.rar # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* \ No newline at end of file +hs_err_pid* diff --git a/.idea/artifacts/JavaFXApp.xml b/.idea/artifacts/JavaFXApp.xml deleted file mode 100644 index 26ea221..0000000 --- a/.idea/artifacts/JavaFXApp.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - $PROJECT_DIR$/out/artifacts/JavaFXApp - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 217af47..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/.idea/description.html b/.idea/description.html deleted file mode 100644 index cc10d56..0000000 --- a/.idea/description.html +++ /dev/null @@ -1,2 +0,0 @@ -Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided. - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 3e3960b..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml deleted file mode 100644 index e8243ae..0000000 --- a/.idea/libraries/lib.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 13e0c9b..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 5844931..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 3b00020..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/PhotoViewer.iml b/PhotoViewer.iml index fb8e866..b8db988 100644 --- a/PhotoViewer.iml +++ b/PhotoViewer.iml @@ -7,6 +7,6 @@ - + \ No newline at end of file diff --git a/src/de/thm/tlf/photoViewer/Controller.java b/src/de/thm/tlf/photoViewer/Controller.java index d4c1695..13afd2e 100644 --- a/src/de/thm/tlf/photoViewer/Controller.java +++ b/src/de/thm/tlf/photoViewer/Controller.java @@ -1,20 +1,18 @@ package de.thm.tlf.photoViewer; import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; +import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.image.Image; import javafx.scene.image.ImageView; -import javafx.scene.layout.BorderPane; -import javafx.scene.layout.GridPane; -import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; +import javafx.scene.layout.*; import javafx.stage.Stage; -import java.io.*; - /** * Controller Class for Image-viewer. * Holds controls for the GUI elements. @@ -23,11 +21,7 @@ import java.io.*; */ public class Controller extends Application { - private PicturePreview[] previews = new PicturePreview[]{ - new PicturePreview("pic/image1.jpg"), - new PicturePreview("pic/image2.jpg"), - new PicturePreview("pic/image3.jpg") - }; + private PictureHandler picHandler = new PictureHandler(); public static void main(String[] args) { launch(args); @@ -37,15 +31,54 @@ public class Controller extends Application { public void start(Stage primaryStage) { /* ############################## * #### MAIN PANE #### - * ############################## - */ + * #############################*/ BorderPane mainPane = new BorderPane(); // #### END MAIN PANE #### + + /* ############################## + * #### BOTTOM PANEL #### + * #############################*/ + BorderPane bottom = new BorderPane(); + bottom.setPadding(new Insets(5,5,5,5)); + + // ZoomSlider -> Bottom Left + HBox bottomLeft = new HBox(); + Slider zoomSlider = new Slider(0, 100, 15); + zoomSlider.setShowTickMarks(true); + // Open Button + Button openFilesButton = new Button("Open Pictures"); + + bottomLeft.getChildren().addAll(openFilesButton, zoomSlider); + bottom.setLeft(bottomLeft); + + HBox bottomMid = new HBox(); + bottomMid.setAlignment(Pos.CENTER); + bottomMid.setSpacing(5); + Button prevPicBtn = new Button("<-"); + Button nextPicBtn = new Button("->"); + Button diashowBtn = new Button("Diashow"); + bottomMid.getChildren().addAll(prevPicBtn, diashowBtn, nextPicBtn); + bottom.setCenter(bottomMid); + + HBox bottomRight = new HBox(); + Button fullScreenBtn = new Button("Fullscreen"); + bottomRight.getChildren().add(fullScreenBtn); + bottom.setRight(bottomRight); + + //Button Actions + prevPicBtn.setOnAction(new EventHandler() { + @Override public void handle(ActionEvent e) { + picHandler.nextPicture(); + } + }); + mainPane.setBottom(bottom); + // #### END BOTTOM PANEL #### + + /* ############################## * #### TOP PANEL #### - * ############################## - */ + * #############################*/ VBox menu = new VBox(); // File Menu Menu fileMenu = new Menu("File"); @@ -63,38 +96,13 @@ public class Controller extends Application { menuBar.getMenus().addAll(fileMenu, aboutMenu); // Adding Menus to Top Panel menu.getChildren().addAll(menuBar); - // Adding Top Panel to Main Pane mainPane.setTop(menu); // #### END TOP PANEL #### - /* ############################## - * #### LEFT PANEL #### - * ############################## - */ - VBox selectionPane = new VBox(); - selectionPane.setPadding(new Insets(5,5,5,5)); - selectionPane.setSpacing(5); - - // Add all previews to the - for(PicturePreview pp: previews){ - ImageView iv = new ImageView(pp.getImage()); - iv.setFitWidth(150); - iv.setSmooth(true); - iv.setPreserveRatio(true); - selectionPane.getChildren().add(iv); - } - - ScrollPane pictureSelector = new ScrollPane(); - pictureSelector.setContent(selectionPane); - - mainPane.setLeft(pictureSelector); - - // #### END LEFT PANEL #### /* ############################## * #### CENTER PANEL #### - * ############################## - */ + * #############################*/ Picture testPic = new Picture("pic/image3.jpg"); ScrollPane currentViewSP = new ScrollPane(); Image image = testPic.getImage(); @@ -112,38 +120,31 @@ public class Controller extends Application { /* ############################## - * #### BOTTOM PANEL #### - * ############################## - */ - BorderPane bottom = new BorderPane(); - bottom.setPadding(new Insets(5,5,5,5)); + * #### LEFT PANEL #### + * #############################*/ + VBox leftPane = new VBox(); + VBox selectionPane = new VBox(); + selectionPane.setPadding(new Insets(5,5,5,5)); + selectionPane.setSpacing(5); - HBox bottomLeft = new HBox(); - Slider zoomSlider = new Slider(0, 100, 15); - zoomSlider.setShowTickMarks(true); - bottomLeft.getChildren().add(zoomSlider); - bottom.setLeft(bottomLeft); + // Add all previews to the + for(PicturePreview pp: picHandler.getPreviews()){ + ImageView iv = new ImageView(pp.getImage()); + iv.setFitWidth(150); + iv.setSmooth(true); + iv.setPreserveRatio(true); + selectionPane.getChildren().add(iv); + } + ScrollPane pictureSelector = new ScrollPane(); + pictureSelector.setContent(selectionPane); - HBox bottomMid = new HBox(); - bottomMid.setAlignment(Pos.CENTER); - bottomMid.setSpacing(5); - Button prevPicBtn = new Button("<-"); - Button nextPicBtn = new Button("->"); - Button diashowBtn = new Button("Diashow"); - bottomMid.getChildren().addAll(prevPicBtn, diashowBtn, nextPicBtn); - bottom.setCenter(bottomMid); - - HBox bottomRight = new HBox(); - Button fullScreenBtn = new Button("Fullscreen"); - bottomRight.getChildren().add(fullScreenBtn); - bottom.setRight(bottomRight); - - mainPane.setBottom(bottom); - - // #### END BOTTOM PANEL #### + leftPane.getChildren().addAll(pictureSelector); + mainPane.setLeft(leftPane); + // #### END LEFT PANEL #### primaryStage.setTitle("Photo Viewer"); primaryStage.setScene(new Scene(mainPane, 1200, 600)); primaryStage.show(); } + } diff --git a/src/de/thm/tlf/photoViewer/PictureHandler.java b/src/de/thm/tlf/photoViewer/PictureHandler.java new file mode 100644 index 0000000..12f1604 --- /dev/null +++ b/src/de/thm/tlf/photoViewer/PictureHandler.java @@ -0,0 +1,29 @@ +package de.thm.tlf.photoViewer; + +public class PictureHandler { + + private PicturePreview[] previews = new PicturePreview[]{ + new PicturePreview("pic/image1.jpg"), + new PicturePreview("pic/image2.jpg"), + new PicturePreview("pic/image3.jpg") + }; + + private int currentPictureID = 0; + + public PicturePreview[] getPreviews(){ + return previews; + } + + public void loadPictures(){ + + } + + public Picture nextPicture(){ + return null; + } + + public Picture prevPicture(){ + return null; + } + +}