2025-01-05 15:12:26 +01:00
|
|
|
package net.altimate.app;
|
2025-01-07 15:14:07 +01:00
|
|
|
|
2025-01-06 22:44:48 +01:00
|
|
|
import java.io.File;
|
2025-01-05 15:12:26 +01:00
|
|
|
import java.lang.Object;
|
|
|
|
|
import java.lang.Class;
|
2025-01-06 22:44:48 +01:00
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.Paths;
|
2025-01-05 15:12:26 +01:00
|
|
|
import java.time.format.DateTimeFormatter;
|
2025-01-05 19:12:22 +01:00
|
|
|
import java.util.Arrays;
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
import javafx.application.Application;
|
|
|
|
|
import javafx.collections.FXCollections;
|
2025-01-05 23:35:08 +01:00
|
|
|
import javafx.collections.ListChangeListener;
|
2025-01-05 15:12:26 +01:00
|
|
|
import javafx.collections.ObservableList;
|
|
|
|
|
import javafx.event.ActionEvent;
|
|
|
|
|
import javafx.event.Event;
|
|
|
|
|
import javafx.event.EventHandler;
|
|
|
|
|
import javafx.geometry.HPos;
|
|
|
|
|
import javafx.geometry.Insets;
|
|
|
|
|
import javafx.geometry.Pos;
|
|
|
|
|
import javafx.scene.Group;
|
|
|
|
|
import javafx.scene.Node;
|
|
|
|
|
import javafx.scene.Scene;
|
|
|
|
|
import javafx.scene.control.*;
|
2025-01-08 08:52:14 +01:00
|
|
|
import javafx.scene.layout.BorderPane;
|
2025-01-05 15:12:26 +01:00
|
|
|
import javafx.scene.layout.GridPane;
|
2025-01-08 08:52:14 +01:00
|
|
|
import javafx.scene.layout.HBox;
|
2025-01-05 15:12:26 +01:00
|
|
|
import javafx.scene.layout.VBox;
|
2025-01-08 08:52:14 +01:00
|
|
|
import javafx.scene.text.Font;
|
|
|
|
|
import javafx.scene.text.FontWeight;
|
|
|
|
|
import javafx.scene.text.Text;
|
2025-01-05 15:12:26 +01:00
|
|
|
import javafx.stage.Stage;
|
2025-01-06 22:44:48 +01:00
|
|
|
import java.io.*;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-05 19:12:22 +01:00
|
|
|
import static java.util.stream.Collectors.toList;
|
|
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
public class App extends Application {
|
|
|
|
|
|
|
|
|
|
Scene sceneHome;
|
|
|
|
|
Scene sceneCreate;
|
|
|
|
|
Scene sceneList;
|
2025-01-08 08:52:14 +01:00
|
|
|
Scene sceneTest;
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-07 16:10:04 +01:00
|
|
|
public static String filesDirectory = System.getProperty("user.home") + "/files";
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String args[]){
|
|
|
|
|
launch(args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void start(Stage primaryStage) throws Exception {
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
StartUpCheck.checkFilesDirectory(filesDirectory);
|
|
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
setupSceneList(primaryStage);
|
|
|
|
|
setupSceneHome(primaryStage);
|
|
|
|
|
setupSceneCreate(primaryStage);
|
2025-01-08 08:52:14 +01:00
|
|
|
setupSceneTest(primaryStage);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
primaryStage.setTitle("Work out a S.M.A.R.T. Target ");
|
|
|
|
|
primaryStage.setScene(sceneHome);
|
|
|
|
|
primaryStage.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
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;");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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<ActionEvent>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(ActionEvent e) {
|
|
|
|
|
primaryStage.setScene(sceneList);
|
|
|
|
|
//ListFilesInDir.listFilesInDir("/home/mic/files");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*test.setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(ActionEvent e) {
|
|
|
|
|
primaryStage.setScene(sceneTest);
|
|
|
|
|
//ListFilesInDir.listFilesInDir("/home/mic/files");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
return hbox;
|
|
|
|
|
|
|
|
|
|
}
|
2025-01-06 22:44:48 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
private void navigationButtons(Stage primaryStage, GridPane grid) {
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
Button home = new Button("Home");
|
|
|
|
|
GridPane.setConstraints(home, 0, 0);
|
|
|
|
|
home.setOnAction(e -> primaryStage.setScene(sceneHome));
|
|
|
|
|
grid.getChildren().add(home);
|
|
|
|
|
|
|
|
|
|
Button create = new Button("Create");
|
|
|
|
|
GridPane.setConstraints(create, 1, 0);
|
|
|
|
|
create.setOnAction(e -> primaryStage.setScene(sceneCreate));
|
|
|
|
|
grid.getChildren().add(create);
|
|
|
|
|
|
|
|
|
|
Button list = new Button("List");
|
|
|
|
|
GridPane.setConstraints(list, 2, 0);
|
|
|
|
|
//list.setOnAction(e -> primaryStage.setScene(sceneList));
|
|
|
|
|
grid.getChildren().add(list);
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
Button test = new Button("Test");
|
|
|
|
|
GridPane.setConstraints(test, 3, 0);
|
|
|
|
|
//list.setOnAction(e -> primaryStage.setScene(sceneList));
|
|
|
|
|
grid.getChildren().add(test);
|
|
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
list.setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(ActionEvent e) {
|
|
|
|
|
primaryStage.setScene(sceneList);
|
2025-01-07 15:14:07 +01:00
|
|
|
//ListFilesInDir.listFilesInDir("/home/mic/files");
|
2025-01-05 15:12:26 +01:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
|
|
|
|
|
test.setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(ActionEvent e) {
|
|
|
|
|
primaryStage.setScene(sceneTest);
|
|
|
|
|
//ListFilesInDir.listFilesInDir("/home/mic/files");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
}
|
2025-01-08 08:52:14 +01:00
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
// grid, textfieldname , textfield, TextPrefColumnCount, rowColumn, rowIndex
|
|
|
|
|
private void addTextfield(GridPane grid, String textFieldName, String textFieldText, int prefColumnCount, int rowColumn, int rowIndex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final TextField nameSmartZiel = new TextField();
|
|
|
|
|
nameSmartZiel.setPromptText(textFieldText);
|
|
|
|
|
nameSmartZiel.setPrefColumnCount(1);
|
|
|
|
|
GridPane.setConstraints(nameSmartZiel,rowColumn,rowIndex);
|
|
|
|
|
grid.getChildren().add(nameSmartZiel);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
public void setupSceneHome(Stage primaryStage) throws Exception {
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
BorderPane border = new BorderPane();
|
|
|
|
|
HBox hbox = navigationButtonsNew(primaryStage);
|
|
|
|
|
border.setTop(hbox);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
sceneHome = new Scene(border, 600, 300);
|
2025-01-05 15:12:26 +01:00
|
|
|
Label label = new Label("This is the Home Scene");
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
navigationButtonsNew(primaryStage);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setupSceneCreate(Stage primaryStage) throws Exception {
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
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));
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
//border.setBottom(label,addCreateCenter(label));
|
|
|
|
|
System.out.println(label.getLabelFor());
|
|
|
|
|
sceneCreate = new Scene(border, 900, 500);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
navigationButtonsNew(primaryStage);
|
|
|
|
|
//System.out.println(border.getUserData());
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
}
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
public VBox addCreateCenter (Label label){
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
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?");
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
final TextField realistisch = new TextField();
|
|
|
|
|
realistisch.setPrefColumnCount(20);
|
|
|
|
|
realistisch.setPromptText("Ist es realistisch selbst erreichbar ?");
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
final Label checkInlabel = new Label("Terminiert bis");
|
|
|
|
|
checkInlabel.setPrefSize(100, 20);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
Button submit = new Button("Submit");
|
|
|
|
|
submit.setAlignment(Pos.BOTTOM_CENTER);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
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<ActionEvent>() {
|
|
|
|
|
@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<ActionEvent>() {
|
|
|
|
|
@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();
|
2025-01-05 15:12:26 +01:00
|
|
|
final Label checkInlabel = new Label("Terminiert bis");
|
2025-01-08 08:52:14 +01:00
|
|
|
checkInlabel.setPrefSize(100, 20);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
Button submit = new Button("Submit");
|
2025-01-08 08:52:14 +01:00
|
|
|
submit.setAlignment(Pos.BOTTOM_CENTER);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
Button clear = new Button("Clear");
|
2025-01-08 08:52:14 +01:00
|
|
|
clear.setAlignment(Pos.BOTTOM_CENTER);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
hbox.getChildren().addAll(checkInlabel, checkInDatePicker, submit, clear);
|
|
|
|
|
/* ----> Also so ....
|
|
|
|
|
hbox.getChildren().addAll(nameSmartZiel, sinnesSpezifisch,
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
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;
|
|
|
|
|
}
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setupSceneList(Stage primaryStage) throws Exception {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridPane grid = new GridPane();
|
|
|
|
|
grid.setPadding(new Insets(10, 10, 10, 10));
|
|
|
|
|
grid.setVgap(5);
|
|
|
|
|
grid.setHgap(5);
|
|
|
|
|
|
|
|
|
|
//layout.setAlignment(Pos.CENTER);
|
|
|
|
|
|
|
|
|
|
sceneList = new Scene(grid, 600, 300);
|
|
|
|
|
|
|
|
|
|
Label label = new Label();
|
|
|
|
|
|
2025-01-08 08:52:14 +01:00
|
|
|
navigationButtons(primaryStage, grid);
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
Button reload = new Button("Reload");
|
|
|
|
|
GridPane.setConstraints(reload, 1, 8);
|
|
|
|
|
grid.getChildren().add(reload);
|
|
|
|
|
|
|
|
|
|
reload.setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void handle(ActionEvent e) {
|
2025-01-05 23:35:08 +01:00
|
|
|
System.out.println("theoretischer reload des Inhaltes");
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-01-07 15:14:07 +01:00
|
|
|
Filter filter = new Filter();
|
2025-01-05 15:12:26 +01:00
|
|
|
|
2025-01-05 19:12:22 +01:00
|
|
|
|
2025-01-06 22:44:48 +01:00
|
|
|
|
2025-01-05 23:35:08 +01:00
|
|
|
ListView<String> list1 = new ListView<String>();
|
2025-01-07 15:14:07 +01:00
|
|
|
ObservableList<String> items = FXCollections.observableArrayList( filter.filterRemoveWithRegex(".smart", filesDirectory ));
|
2025-01-06 22:44:48 +01:00
|
|
|
//ObservableList<String> items = FXCollections.observableArrayList(Filter.getSmartTargetName(filesDirectory));
|
2025-01-05 23:35:08 +01:00
|
|
|
//list1.getItems().addAll(items);
|
|
|
|
|
//list1.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
|
|
|
|
//list1.getSelectionModel().getSelectedItems().addListener((ListChangeListener<? super String>) c -> selectionChanged());
|
|
|
|
|
list1.setItems(items);
|
|
|
|
|
GridPane.setConstraints(list1, 0, 1);
|
|
|
|
|
grid.getChildren().add(list1);
|
2025-01-05 19:12:22 +01:00
|
|
|
|
2025-01-05 23:35:08 +01:00
|
|
|
//ObservableList selectedIndices = list1.getSelectionModel().getSelectedIndices();
|
2025-01-05 19:12:22 +01:00
|
|
|
|
2025-01-07 15:14:07 +01:00
|
|
|
String[] filesContent = new String[30];
|
|
|
|
|
filesContent[0] ="000000";
|
|
|
|
|
filesContent[1] ="1111111";
|
|
|
|
|
|
|
|
|
|
|
2025-01-05 19:12:22 +01:00
|
|
|
|
2025-01-05 23:35:08 +01:00
|
|
|
Button button = new Button("Read Selected Value");
|
|
|
|
|
GridPane.setConstraints(button, 2, 8);
|
|
|
|
|
grid.getChildren().add(button);
|
2025-01-08 08:52:14 +01:00
|
|
|
|
2025-01-05 23:35:08 +01:00
|
|
|
button.setOnAction(event -> {
|
|
|
|
|
ObservableList selectedIndices = list1.getSelectionModel().getSelectedIndices();
|
|
|
|
|
|
|
|
|
|
for(Object o : selectedIndices){
|
|
|
|
|
System.out.println("o = " + o + " (" + o.getClass() + ")");
|
|
|
|
|
System.out.println(filesContent[(int) o]);
|
|
|
|
|
|
2025-01-07 15:14:07 +01:00
|
|
|
String[] ar = filter.filterSplitValues((int) o, filesDirectory );
|
|
|
|
|
|
|
|
|
|
final TextField max = new TextField(ar[0]);
|
2025-01-05 23:35:08 +01:00
|
|
|
max.setPrefColumnCount(20);
|
2025-01-07 15:14:07 +01:00
|
|
|
max.setPromptText("max");
|
|
|
|
|
GridPane.setConstraints(max, 1, 1);
|
2025-01-05 23:35:08 +01:00
|
|
|
grid.getChildren().add(max);
|
2025-01-07 15:14:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//final TextField max2 = new TextField(filesContent[(int) o]);
|
|
|
|
|
final TextField max2 = new TextField(ar[1]);
|
|
|
|
|
max.setPrefColumnCount(20);
|
|
|
|
|
max.setPromptText("max2");
|
|
|
|
|
GridPane.setConstraints(max2, 1, 2);
|
|
|
|
|
grid.getChildren().add(max2);
|
|
|
|
|
|
|
|
|
|
final TextField max3 = new TextField(ar[2]);
|
|
|
|
|
max.setPrefColumnCount(20);
|
|
|
|
|
max.setPromptText("max3");
|
|
|
|
|
GridPane.setConstraints(max3, 1, 3);
|
|
|
|
|
grid.getChildren().add(max3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//final TextField max2 = new TextField(filesContent[(int) o]);
|
|
|
|
|
final TextField max4 = new TextField(ar[3]);
|
|
|
|
|
max.setPrefColumnCount(20);
|
|
|
|
|
max.setPromptText("max4");
|
|
|
|
|
GridPane.setConstraints(max4, 1, 4);
|
|
|
|
|
grid.getChildren().add(max4);
|
|
|
|
|
|
|
|
|
|
final TextField max5 = new TextField(ar[4]);
|
|
|
|
|
max.setPrefColumnCount(20);
|
|
|
|
|
max.setPromptText("max5");
|
|
|
|
|
GridPane.setConstraints(max5, 1, 5);
|
|
|
|
|
grid.getChildren().add(max5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//final TextField max2 = new TextField(filesContent[(int) o]);
|
|
|
|
|
final TextField max6 = new TextField(ar[5]);
|
|
|
|
|
max.setPrefColumnCount(20);
|
|
|
|
|
max.setPromptText("max6");
|
|
|
|
|
GridPane.setConstraints(max6, 1, 6);
|
|
|
|
|
grid.getChildren().add(max6);
|
|
|
|
|
|
|
|
|
|
|
2025-01-05 23:35:08 +01:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-01-05 19:12:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-05 23:35:08 +01:00
|
|
|
/*
|
|
|
|
|
ListView listView = new ListView();
|
|
|
|
|
|
|
|
|
|
listView.getItems().add("Item 1");
|
|
|
|
|
listView.getItems().add("Item 2");
|
|
|
|
|
listView.getItems().add("Item 3");
|
|
|
|
|
|
|
|
|
|
GridPane.setConstraints(listView, 0, 2);
|
|
|
|
|
grid.getChildren().add(listView);
|
|
|
|
|
|
|
|
|
|
Button button = new Button("Read Selected Value");
|
|
|
|
|
GridPane.setConstraints(button, 2, 8);
|
|
|
|
|
grid.getChildren().add(button);
|
|
|
|
|
|
|
|
|
|
button.setOnAction(event -> {
|
|
|
|
|
ObservableList selectedIndices = listView.getSelectionModel().getSelectedIndices();
|
|
|
|
|
|
|
|
|
|
for(Object o : selectedIndices){
|
|
|
|
|
System.out.println("o = " + o + " (" + o.getClass() + ")");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
*/
|
2025-01-05 15:12:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//ListFilesInDir.listFilesInDir(filesDirectory);
|
|
|
|
|
//ListView<String> list1 = new ListView<String>();
|
|
|
|
|
//ObservableList<String> items = FXCollections.observableArrayList (ListFilesInDir.listFilesInDir(filesDirectory));
|
|
|
|
|
//list1.setItems(items);
|
|
|
|
|
//GridPane.setConstraints(list1, 0, 1);
|
|
|
|
|
//grid.getChildren().add(list1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Button button = new Button("Backward");
|
|
|
|
|
//button.setOnAction(e -> primaryStage.setScene(sceneHome));
|
|
|
|
|
|
|
|
|
|
//TextField text = new TextField();
|
|
|
|
|
//text.setMaxWidth(100);
|
|
|
|
|
|
|
|
|
|
//grid.getChildren().addAll(label, button);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|