diff --git a/src/main/java/net/altimate/app/App.java b/src/main/java/net/altimate/app/App.java index b247a3b..a22cdd4 100644 --- a/src/main/java/net/altimate/app/App.java +++ b/src/main/java/net/altimate/app/App.java @@ -22,8 +22,13 @@ import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.*; +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.io.*; import java.util.Optional; @@ -37,6 +42,7 @@ public class App extends Application { Scene sceneHome; Scene sceneCreate; Scene sceneList; + Scene sceneTest; public static String filesDirectory = System.getProperty("user.home") + "/files"; @@ -52,20 +58,70 @@ public class App extends Application { @Override public void start(Stage primaryStage) throws Exception { + StartUpCheck.checkFilesDirectory(filesDirectory); + setupSceneList(primaryStage); setupSceneHome(primaryStage); setupSceneCreate(primaryStage); + setupSceneTest(primaryStage); primaryStage.setTitle("Work out a S.M.A.R.T. Target "); primaryStage.setScene(sceneHome); primaryStage.show(); } - private void navigationButtons(Stage primaryStage, GridPane grid, Label label) { - StartUpCheck.checkFilesDirectory(filesDirectory); + private HBox navigationButtonsNew(Stage primaryStage) { + HBox hbox = new HBox(); + hbox.setPadding(new Insets(15, 12, 15, 12)); + hbox.setSpacing(10); + hbox.setStyle("-fx-background-color: #336699;"); - boolean reloadValue = false; + + Button home = new Button("Home"); + home.setPrefSize(100, 20); + home.setOnAction(e -> primaryStage.setScene(sceneHome)); + + + Button create = new Button("Create"); + create.setPrefSize(100, 20); + create.setOnAction(e -> primaryStage.setScene(sceneCreate)); + + Button list = new Button("List"); + list.setPrefSize(100, 20); + //list.setOnAction(e -> primaryStage.setScene(sceneList)); + + + Button test = new Button("Test"); + test.setPrefSize(100, 20); + test.setOnAction(e -> primaryStage.setScene(sceneTest)); + + hbox.getChildren().addAll(home, create, list, test); + + list.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + primaryStage.setScene(sceneList); + //ListFilesInDir.listFilesInDir("/home/mic/files"); + } + }); + + + /*test.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + primaryStage.setScene(sceneTest); + //ListFilesInDir.listFilesInDir("/home/mic/files"); + } + }); + + */ + + return hbox; + + } + + private void navigationButtons(Stage primaryStage, GridPane grid) { Button home = new Button("Home"); GridPane.setConstraints(home, 0, 0); @@ -82,6 +138,11 @@ public class App extends Application { //list.setOnAction(e -> primaryStage.setScene(sceneList)); grid.getChildren().add(list); + Button test = new Button("Test"); + GridPane.setConstraints(test, 3, 0); + //list.setOnAction(e -> primaryStage.setScene(sceneList)); + grid.getChildren().add(test); + list.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { @@ -90,7 +151,17 @@ public class App extends Application { } }); + + test.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + primaryStage.setScene(sceneTest); + //ListFilesInDir.listFilesInDir("/home/mic/files"); + } + }); + } + // grid, textfieldname , textfield, TextPrefColumnCount, rowColumn, rowIndex private void addTextfield(GridPane grid, String textFieldName, String textFieldText, int prefColumnCount, int rowColumn, int rowIndex) { @@ -104,135 +175,259 @@ public class App extends Application { } + public void setupSceneTest(Stage primaryStage) throws Exception { + //GridPane grid = new GridPane(); + //grid.setPadding(new Insets(10, 10, 10, 10)); + //grid.setVgap(5); + //grid.setHgap(5); + + BorderPane border = new BorderPane(); + HBox hbox = navigationButtonsNew(primaryStage); + border.setTop(hbox); + border.setLeft(addVBoxLeft()); + border.setCenter(addVBoxRight()); + //addStackPane(hbox); // Add stack to HBox in top region + + //border.setCenter(addGridPane()); + //border.setRight(addFlowPane()); + + sceneTest = new Scene(border, 600, 300); + + Label label = new Label("This is the Test Scene"); + + //navigationButtons(primaryStage, hbox, label); + + } + + + public VBox addVBoxLeft() { + VBox vbox = new VBox(); + vbox.setPadding(new Insets(10)); + vbox.setSpacing(8); + + Text title = new Text("Data"); + title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + vbox.getChildren().add(title); + + Hyperlink options[] = new Hyperlink[] { + new Hyperlink("Sales"), + new Hyperlink("Marketing"), + new Hyperlink("Distribution"), + new Hyperlink("Costs")}; + + for (int i=0; i<4; i++) { + VBox.setMargin(options[i], new Insets(0, 0, 0, 8)); + vbox.getChildren().add(options[i]); + } + + return vbox; + } + public VBox addVBoxRight() { + VBox vbox = new VBox(); + vbox.setPadding(new Insets(10)); + vbox.setSpacing(8); + + Text title = new Text("Data"); + title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + vbox.getChildren().add(title); + + Hyperlink options[] = new Hyperlink[] { + new Hyperlink("Mic"), + new Hyperlink("Marc"), + new Hyperlink("Thomas"), + new Hyperlink("Costs")}; + + for (int i=0; i<4; i++) { + VBox.setMargin(options[i], new Insets(0, 0, 0, 8)); + vbox.getChildren().add(options[i]); + } + + return vbox; + } + + + + public void setupSceneHome(Stage primaryStage) throws Exception { - GridPane grid = new GridPane(); - grid.setPadding(new Insets(10, 10, 10, 10)); - grid.setVgap(5); - grid.setHgap(5); - sceneHome = new Scene(grid, 600, 300); + BorderPane border = new BorderPane(); + HBox hbox = navigationButtonsNew(primaryStage); + border.setTop(hbox); + sceneHome = new Scene(border, 600, 300); Label label = new Label("This is the Home Scene"); - navigationButtons(primaryStage, grid, label); + navigationButtonsNew(primaryStage); } public void setupSceneCreate(Stage primaryStage) throws Exception { - GridPane grid = new GridPane(); - grid.setPadding(new Insets(10, 10, 10, 10)); - grid.setVgap(5); - grid.setHgap(5); - sceneCreate = new Scene(grid, 600, 300); + BorderPane border = new BorderPane(); + HBox hbox = navigationButtonsNew(primaryStage); + border.setTop(hbox); + Label label = new Label("This is the create Scene"); + border.setCenter(addCreateCenter(label)); + border.setBottom(addCreateBottom(label)); + //border.setBottom(label,addCreateCenter(label)); + System.out.println(label.getLabelFor()); + sceneCreate = new Scene(border, 900, 500); - Label label = new Label(); - - navigationButtons(primaryStage, grid, label); - - DatePicker checkInDatePicker; - checkInDatePicker = new DatePicker(); - - - final TextField nameSmartZiel = new TextField(); - nameSmartZiel.setPromptText("Gib dm Smart Ziel einen Namen"); - nameSmartZiel.setPrefColumnCount(1); - GridPane.setConstraints(nameSmartZiel,0,1); - grid.getChildren().add(nameSmartZiel); - - final TextField sinnesSpezifisch = new TextField(); - sinnesSpezifisch.setPromptText("wie ist es sinnespezifisch wahrnehmbar"); - sinnesSpezifisch.setPrefColumnCount(1); - //sinnesSpezifisch.getText(); - GridPane.setConstraints(sinnesSpezifisch, 0, 2); - grid.getChildren().add(sinnesSpezifisch); - - final TextField messBar = new TextField(); - messBar.setPrefColumnCount(20); - messBar.setPromptText("Wie ist es messabr, wenn Du es erreicht hat"); - GridPane.setConstraints(messBar, 0, 3); - grid.getChildren().add(messBar); - - final TextField attraktiv = new TextField(); - attraktiv.setPrefColumnCount(20); - attraktiv.setPromptText("Ist es attraktiv?"); - GridPane.setConstraints(attraktiv, 0, 4); - grid.getChildren().add(attraktiv); - - final TextField realistisch = new TextField(); - realistisch.setPrefColumnCount(20); - realistisch.setPromptText("Ist es realistisch selbst erreichbar ?"); - GridPane.setConstraints(realistisch, 0, 5); - grid.getChildren().add(realistisch); - - - final Label checkInlabel = new Label("Terminiert bis"); - grid.add(checkInlabel, 0, 6); - grid.add(checkInDatePicker, 0, 7); - - Button submit = new Button("Submit"); - GridPane.setConstraints(submit, 0, 8); - grid.getChildren().add(submit); - - Button clear = new Button("Clear"); - GridPane.setConstraints(clear, 1, 8); - grid.getChildren().add(clear); - - submit.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent e) { - if ( - (nameSmartZiel.getText() != null && !nameSmartZiel.getText().isEmpty()) - && (sinnesSpezifisch.getText() != null && !sinnesSpezifisch.getText().isEmpty()) - && (messBar.getText() != null && !messBar.getText().isEmpty()) - && (attraktiv.getText() != null && !attraktiv.getText().isEmpty()) - && (realistisch.getText() != null && !realistisch.getText().isEmpty()) - ) { - label.setText( nameSmartZiel.getText() + " " + sinnesSpezifisch.getText() + " " + - messBar.getText() + " " + attraktiv.getText() + " " + realistisch.getText() + ", " - + "thanks" + checkInDatePicker.getValue()); - String date = checkInDatePicker.getValue().format(DateTimeFormatter.ofPattern("dd.MM.yyyy")); - long seconds = System.currentTimeMillis() / 1000l; - String state = "open"; - - String[] createSmart = { - nameSmartZiel.getText() + "|" + - sinnesSpezifisch.getText() + "|" + - messBar.getText() + "|" + - attraktiv.getText() + "|" + - realistisch.getText() + "|" + - state + "|" + - seconds + "|" + - date - }; - - - CreateFile.writeFile(filesDirectory + "/" + seconds + ".smart", createSmart); - - } else { - label.setText("You have not filed out the complete form"); - } - } - }); - - clear.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent e) { - nameSmartZiel.clear(); - sinnesSpezifisch.clear(); - messBar.clear(); - attraktiv.clear(); - realistisch.clear(); - checkInlabel.setText(null); - label.setText(null); - } - }); + navigationButtonsNew(primaryStage); + //System.out.println(border.getUserData()); } + public VBox addCreateCenter (Label label){ + + VBox vbox = new VBox(); + vbox.setPadding(new Insets(10)); + vbox.setSpacing(8); + + Text title = new Text("Create S.M.A.R.T Goal"); + title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + vbox.getChildren().add(title); + + DatePicker checkInDatePicker; + checkInDatePicker = new DatePicker(); + + + final TextField nameSmartZiel = new TextField(); + nameSmartZiel.setPromptText("Gib dm Smart Ziel einen Namen"); + nameSmartZiel.setPrefColumnCount(1); + + nameSmartZiel.setPrefSize(100, 20); + + + final TextField sinnesSpezifisch = new TextField(); + sinnesSpezifisch.setPromptText("wie ist es sinnespezifisch wahrnehmbar"); + sinnesSpezifisch.setPrefColumnCount(1); + sinnesSpezifisch.setPrefSize(100, 20); + + + final TextField messBar = new TextField(); + messBar.setPrefColumnCount(20); + messBar.setPromptText("Wie ist es messabr, wenn Du es erreicht hat"); + messBar.setPrefSize(100, 20); + + + final TextField attraktiv = new TextField(); + attraktiv.setPrefColumnCount(20); + attraktiv.setPromptText("Ist es attraktiv?"); + + + final TextField realistisch = new TextField(); + realistisch.setPrefColumnCount(20); + realistisch.setPromptText("Ist es realistisch selbst erreichbar ?"); + + + final Label checkInlabel = new Label("Terminiert bis"); + checkInlabel.setPrefSize(100, 20); + + Button submit = new Button("Submit"); + submit.setAlignment(Pos.BOTTOM_CENTER); + + Button clear = new Button("Clear"); + clear.setAlignment(Pos.BOTTOM_CENTER); + + + + vbox.getChildren().addAll(nameSmartZiel, sinnesSpezifisch, + messBar, attraktiv, realistisch, checkInlabel, checkInDatePicker, submit, clear); + + + + submit.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + + System.out.println(nameSmartZiel.getText()); + if ( + (nameSmartZiel.getText() != null && !nameSmartZiel.getText().isEmpty()) + && (sinnesSpezifisch.getText() != null && !sinnesSpezifisch.getText().isEmpty()) + && (messBar.getText() != null && !messBar.getText().isEmpty()) + && (attraktiv.getText() != null && !attraktiv.getText().isEmpty()) + && (realistisch.getText() != null && !realistisch.getText().isEmpty()) + ) { + label.setText(nameSmartZiel.getText() + " " + sinnesSpezifisch.getText() + " " + + messBar.getText() + " " + attraktiv.getText() + " " + realistisch.getText() + ", " + + "thanks" + checkInDatePicker.getValue()); + String date = checkInDatePicker.getValue().format(DateTimeFormatter.ofPattern("dd.MM.yyyy")); + long seconds = System.currentTimeMillis() / 1000l; + String state = "open"; + + String[] createSmart = { + nameSmartZiel.getText() + "|" + + sinnesSpezifisch.getText() + "|" + + messBar.getText() + "|" + + attraktiv.getText() + "|" + + realistisch.getText() + "|" + + state + "|" + + seconds + "|" + + date + }; + + + CreateFile.writeFile(filesDirectory + "/" + seconds + ".smart", createSmart); + + } else { + label.setText("You have not filed out the complete form"); + } + } + }); + + clear.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + nameSmartZiel.clear(); + sinnesSpezifisch.clear(); + messBar.clear(); + attraktiv.clear(); + realistisch.clear(); + checkInlabel.setText(null); + label.setText(null); + } + + }); + return vbox; + } + + + public HBox addCreateBottom (Label label){ + HBox hbox = new HBox(); + hbox.setPadding(new Insets(15, 12, 15, 12)); + hbox.setSpacing(10); + //hbox.setStyle("-fx-background-color: #336699;"); + + DatePicker checkInDatePicker; + checkInDatePicker = new DatePicker(); + final Label checkInlabel = new Label("Terminiert bis"); + checkInlabel.setPrefSize(100, 20); + + Button submit = new Button("Submit"); + submit.setAlignment(Pos.BOTTOM_CENTER); + + Button clear = new Button("Clear"); + clear.setAlignment(Pos.BOTTOM_CENTER); + + hbox.getChildren().addAll(checkInlabel, checkInDatePicker, submit, clear); + /* ----> Also so .... + hbox.getChildren().addAll(nameSmartZiel, sinnesSpezifisch, + + messBar, attraktiv, realistisch, checkInlabel, checkInDatePicker, submit, clear); +*/ + + Text title = new Text("Hier möchte ich aber gerne Kalender Submit und Clear einfügen\n und alles absenden können, auch von den Textfieldern"); + title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); + hbox.getChildren().add(title); + return hbox; + } + + + public void setupSceneList(Stage primaryStage) throws Exception { @@ -249,7 +444,7 @@ public class App extends Application { Label label = new Label(); - navigationButtons(primaryStage, grid, label); + navigationButtons(primaryStage, grid); Button reload = new Button("Reload"); GridPane.setConstraints(reload, 1, 8); @@ -286,6 +481,7 @@ public class App extends Application { Button button = new Button("Read Selected Value"); GridPane.setConstraints(button, 2, 8); grid.getChildren().add(button); + button.setOnAction(event -> { ObservableList selectedIndices = list1.getSelectionModel().getSelectedIndices(); diff --git a/target/classes/net/altimate/app/App$1.class b/target/classes/net/altimate/app/App$1.class index c969a02..bfc8159 100644 Binary files a/target/classes/net/altimate/app/App$1.class 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 index c2c8e0e..7e6eee3 100644 Binary files a/target/classes/net/altimate/app/App$2.class 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 index 99205ec..5c2d5d3 100644 Binary files a/target/classes/net/altimate/app/App$3.class and b/target/classes/net/altimate/app/App$3.class differ diff --git a/target/classes/net/altimate/app/App$4.class b/target/classes/net/altimate/app/App$4.class index 7ee8c29..a81fc95 100644 Binary files a/target/classes/net/altimate/app/App$4.class and b/target/classes/net/altimate/app/App$4.class differ diff --git a/target/classes/net/altimate/app/App$5.class b/target/classes/net/altimate/app/App$5.class new file mode 100644 index 0000000..ee2b01d Binary files /dev/null and b/target/classes/net/altimate/app/App$5.class differ diff --git a/target/classes/net/altimate/app/App$6.class b/target/classes/net/altimate/app/App$6.class new file mode 100644 index 0000000..330d14a Binary files /dev/null and b/target/classes/net/altimate/app/App$6.class differ diff --git a/target/classes/net/altimate/app/App.class b/target/classes/net/altimate/app/App.class index 1e697e9..a8df6eb 100644 Binary files a/target/classes/net/altimate/app/App.class and b/target/classes/net/altimate/app/App.class differ diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 846497e..4f6129f 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,4 +1,6 @@ /home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/App.java /home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/CreateFile.java +/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/Filter.java /home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/ListFilesInDir.java /home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/ReadFile.java +/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/StartUpCheck.java