diff --git a/src/main/java/net/altimate/app/App.java b/src/main/java/net/altimate/app/App.java index 4633e75..530ca71 100644 --- a/src/main/java/net/altimate/app/App.java +++ b/src/main/java/net/altimate/app/App.java @@ -40,8 +40,8 @@ import static java.util.stream.Collectors.toList; public class App extends Application { Scene sceneHome; - Scene sceneCreate; - Scene sceneList; + SceneCreate sceneCreate; + SceneList sceneList; Scene sceneTest; TextField nameSmartZiel; @@ -72,11 +72,18 @@ public class App extends Application { - //SceneCreate setup = new SceneCreate(); - - setupSceneList(primaryStage); + //setupSceneList(primaryStage); setupSceneHome(primaryStage); - SceneCreate.setupSceneCreate(primaryStage); + //setup.setupSceneCreate(primaryStage); + + HBox buttonsList = navigationButtonsNew(primaryStage); + HBox buttonsCreate = navigationButtonsNew(primaryStage); + + + + sceneList = new SceneList(primaryStage, buttonsList); + sceneCreate = new SceneCreate(primaryStage, buttonsCreate); + setupSceneTest(primaryStage); primaryStage.setTitle("Work out a S.M.A.R.T. Target "); @@ -85,7 +92,7 @@ public class App extends Application { } - public HBox navigationButtonsNew(Stage primaryStage) { + public HBox navigationButtonsNew(Stage primaryStage) { HBox hbox = new HBox(); hbox.setPadding(new Insets(15, 12, 15, 12)); hbox.setSpacing(10); @@ -99,10 +106,11 @@ public class App extends Application { Button create = new Button("Create"); create.setPrefSize(100, 20); - create.setOnAction(e -> primaryStage.setScene(sceneCreate)); + create.setOnAction(e -> primaryStage.setScene(sceneCreate.getScene())); Button list = new Button("List"); list.setPrefSize(100, 20); + hbox.getChildren().clear(); //list.setOnAction(e -> primaryStage.setScene(sceneList)); @@ -115,8 +123,7 @@ public class App extends Application { list.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - primaryStage.setScene(sceneList); - //ListFilesInDir.listFilesInDir("/home/mic/files"); + primaryStage.setScene(sceneList.getScene()); } }); @@ -144,7 +151,7 @@ public class App extends Application { Button create = new Button("Create"); GridPane.setConstraints(create, 1, 0); - create.setOnAction(e -> primaryStage.setScene(sceneCreate)); + create.setOnAction(e -> primaryStage.setScene(sceneCreate.getScene())); grid.getChildren().add(create); Button list = new Button("List"); @@ -160,7 +167,7 @@ public class App extends Application { list.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - primaryStage.setScene(sceneList); + primaryStage.setScene(sceneList.getScene()); //ListFilesInDir.listFilesInDir("/home/mic/files"); } }); @@ -205,6 +212,8 @@ public class App extends Application { //border.setCenter(addGridPane()); //border.setRight(addFlowPane()); + + sceneTest = new Scene(border, 600, 300); Label label = new Label("This is the Test Scene"); @@ -453,7 +462,7 @@ public class App extends Application { */ - +/* public void setupSceneList(Stage primaryStage) throws Exception { @@ -563,6 +572,8 @@ public class App extends Application { + */ + @@ -614,6 +625,6 @@ public class App extends Application { - } + //} } diff --git a/src/main/java/net/altimate/app/CreateFile.java b/src/main/java/net/altimate/app/CreateFile.java index c14d1b3..e64dc9d 100644 --- a/src/main/java/net/altimate/app/CreateFile.java +++ b/src/main/java/net/altimate/app/CreateFile.java @@ -18,7 +18,7 @@ public class CreateFile { } catch (IOException e) { - System.out.println("An error occurred."), + System.out.println("An error occurred."); e.printStackTrace(); } diff --git a/src/main/java/net/altimate/app/SceneCreate.java b/src/main/java/net/altimate/app/SceneCreate.java index cac72df..9653545 100644 --- a/src/main/java/net/altimate/app/SceneCreate.java +++ b/src/main/java/net/altimate/app/SceneCreate.java @@ -21,8 +21,7 @@ import java.time.format.DateTimeFormatter; public class SceneCreate { - Scene sceneCreate; - + Scene scene; TextField nameSmartZiel; TextField sinnesSpezifisch; @@ -30,23 +29,21 @@ public class SceneCreate { TextField attraktiv; TextField realistisch; - public static void setupSceneCreate(Stage primaryStage) throws Exception { + public SceneCreate(Stage primaryStage, HBox buttons) throws Exception { BorderPane border = new BorderPane(); - HBox hbox = navigationButtonsNew(primaryStage); - border.setTop(hbox); + border.setTop(buttons); Label label = new Label("This is the create Scene"); - //VBox test = addCreateCenter(label); - //border.setBottom(addCreateBottom(label, test)); - //border.setCenter(test); + border.setCenter(addCreateCenter(label)); border.setBottom(addCreateBottom(label)); + scene = new Scene(border, 600, 300); - System.out.println(label.getLabelFor()); - sceneCreate = new Scene(border, 600, 300); - //App.navigationButtonsNew(primaryStage); + } + public Scene getScene() { + return scene; } public VBox addCreateCenter (Label label){ @@ -88,8 +85,6 @@ public class SceneCreate { vbox.getChildren().addAll(nameSmartZiel, sinnesSpezifisch, messBar, attraktiv, realistisch); - - return vbox; } diff --git a/src/main/java/net/altimate/app/SceneList.java b/src/main/java/net/altimate/app/SceneList.java new file mode 100644 index 0000000..7138a95 --- /dev/null +++ b/src/main/java/net/altimate/app/SceneList.java @@ -0,0 +1,170 @@ +package net.altimate.app; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.ListView; +import javafx.scene.control.TextField; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.scene.text.Font; +import javafx.scene.text.FontWeight; +import javafx.scene.text.Text; +import javafx.stage.Stage; + +import java.util.Arrays; + +import static net.altimate.app.App.filesDirectory; + +public class SceneList { + + Scene scene; + Button button; + Button reload; + ObservableList selectedIndices; + + + public SceneList(Stage primaryStage, HBox buttons) { + + ListView list1 = new ListView(); + BorderPane border = new BorderPane(); + Label label = new Label("This is the list Scene"); + border.setTop(buttons); + border.setLeft(addList(label, list1)); + border.setRight(addEdit(label,list1)); + //border.setBottom(addCreateBottom(label)); + scene = new Scene(border, 600, 300); + } + + public Scene getScene() { + return scene; + } + + public VBox addList(Label label, ListView list1 ) { +/* + //Button reload = new Button("Reload"); + //GridPane.setConstraints(reload, 1, 8); + + reload.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + System.out.println("theoretischer reload des Inhaltes"); + } + }); + Filter filter = new Filter(); + + */ + VBox vbox = new VBox(); + vbox.setPadding(new Insets(10)); + vbox.setSpacing(8); + + Text title = new Text("List S.M.A.R.T Goal"); + title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + vbox.getChildren().add(title); + + Filter filter = new Filter(); + + + //ListView list1 = new ListView(); + ObservableList items = FXCollections.observableArrayList(filter.filterRemoveWithRegex(".smart", filesDirectory)); + //ObservableList items = FXCollections.observableArrayList(filter.getSmartTargetName(filesDirectory)); + //list1.getItems().addAll(items); + //list1.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); + //list1.getSelectionModel().getSelectedItems().addListener((ListChangeListener) c -> selectionChanged()); + + list1.setItems(items); + + + //ObservableList selectedIndices = list1.getSelectionModel().getSelectedIndices(); + + //String[] filesContent = new String[30]; + //filesContent[0] = "000000"; + //filesContent[1] = "1111111"; + + + button = new Button("Read Selected Value"); + reload = new Button("Reload"); + + + + + vbox.getChildren().addAll(list1, button, reload); + + reload.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + ObservableList items = FXCollections.observableArrayList(filter.filterRemoveWithRegex(".smart", filesDirectory)); + System.out.println("theoretischer reload des Inhaltes"); + System.out.println(filter.filterRemoveWithRegex(".smart", filesDirectory)); + } + }); + + return vbox; + } + + public VBox addEdit(Label label,ListView list1 ) { + + + VBox vbox = new VBox(); + vbox.setPadding(new Insets(10)); + vbox.setSpacing(8); + + Text title = new Text("List S.M.A.R.T Goal"); + title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + vbox.getChildren().add(title); + + + Filter filter = new Filter(); + + button.setOnAction(event -> { + selectedIndices = list1.getSelectionModel().getSelectedIndices(); + vbox.getChildren().clear(); + + for (Object o : selectedIndices) { + System.out.println("o = " + o + " (" + o.getClass() + ")"); + //System.out.println(filesContent[(int) o]); + + String[] ar = filter.filterSplitValues((int) o, filesDirectory); + + final TextField max = new TextField(ar[0]); + max.setPrefColumnCount(20); + max.setPromptText("max"); + + //final TextField max2 = new TextField(filesContent[(int) o]); + final TextField max2 = new TextField(ar[1]); + max.setPrefColumnCount(20); + max.setPromptText("max2"); + + final TextField max3 = new TextField(ar[2]); + max.setPrefColumnCount(20); + max.setPromptText("max3"); + + //final TextField max2 = new TextField(filesContent[(int) o]); + final TextField max4 = new TextField(ar[3]); + max.setPrefColumnCount(20); + max.setPromptText("max4"); + + final TextField max5 = new TextField(ar[4]); + max.setPrefColumnCount(20); + max.setPromptText("max5"); + + //final TextField max2 = new TextField(filesContent[(int) o]); + final TextField max6 = new TextField(ar[5]); + max.setPrefColumnCount(20); + max.setPromptText("max6"); + + vbox.getChildren().addAll(max, max2, max3, max4, max5, max6); + //System.out.println(Arrays.toString(list1)); + + } + }); + return vbox; + } +} diff --git a/src/main/java/net/altimate/app/StartUpCheck.java b/src/main/java/net/altimate/app/StartUpCheck.java index 5ea576b..44b7ad7 100644 --- a/src/main/java/net/altimate/app/StartUpCheck.java +++ b/src/main/java/net/altimate/app/StartUpCheck.java @@ -28,8 +28,9 @@ public class StartUpCheck { if (result.orElse(bar) == foo) { //formatGotIt = true; System.out.println(true); - String homePlusDir = "/home/mic/files"; - new File(homePlusDir).mkdirs(); + //String homePlusDir = "/home/mic/files"; + //new File(homePlusDir).mkdirs(); + new File(filesDirectory).mkdirs(); } } diff --git a/target/classes/net/altimate/app/App$1.class b/target/classes/net/altimate/app/App$1.class new file mode 100644 index 0000000..2d37d4d Binary files /dev/null and b/target/classes/net/altimate/app/App$1.class differ diff --git a/target/classes/net/altimate/app/App$2.class b/target/classes/net/altimate/app/App$2.class new file mode 100644 index 0000000..acf0cf9 Binary files /dev/null and b/target/classes/net/altimate/app/App$2.class differ diff --git a/target/classes/net/altimate/app/App$3.class b/target/classes/net/altimate/app/App$3.class new file mode 100644 index 0000000..30e0485 Binary files /dev/null and b/target/classes/net/altimate/app/App$3.class differ diff --git a/target/classes/net/altimate/app/App.class b/target/classes/net/altimate/app/App.class new file mode 100644 index 0000000..3a676f0 Binary files /dev/null and b/target/classes/net/altimate/app/App.class differ diff --git a/target/classes/net/altimate/app/SceneCreate$1.class b/target/classes/net/altimate/app/SceneCreate$1.class new file mode 100644 index 0000000..edfd963 Binary files /dev/null and b/target/classes/net/altimate/app/SceneCreate$1.class differ diff --git a/target/classes/net/altimate/app/SceneCreate$2.class b/target/classes/net/altimate/app/SceneCreate$2.class new file mode 100644 index 0000000..34c2256 Binary files /dev/null and b/target/classes/net/altimate/app/SceneCreate$2.class differ diff --git a/target/classes/net/altimate/app/SceneCreate.class b/target/classes/net/altimate/app/SceneCreate.class new file mode 100644 index 0000000..3a643a1 Binary files /dev/null and b/target/classes/net/altimate/app/SceneCreate.class differ diff --git a/target/classes/net/altimate/app/SceneList$1.class b/target/classes/net/altimate/app/SceneList$1.class new file mode 100644 index 0000000..cb4d054 Binary files /dev/null and b/target/classes/net/altimate/app/SceneList$1.class differ diff --git a/target/classes/net/altimate/app/SceneList.class b/target/classes/net/altimate/app/SceneList.class new file mode 100644 index 0000000..a4a1006 Binary files /dev/null and b/target/classes/net/altimate/app/SceneList.class differ diff --git a/target/classes/net/altimate/app/StartUpCheck.class b/target/classes/net/altimate/app/StartUpCheck.class index 341098f..dc1126c 100644 Binary files a/target/classes/net/altimate/app/StartUpCheck.class and b/target/classes/net/altimate/app/StartUpCheck.class differ