alles ausgelagert

This commit is contained in:
Michael Hayder 2025-01-09 23:34:54 +01:00
parent 717f2a9faa
commit 60ae3894f6
15 changed files with 207 additions and 30 deletions

View File

@ -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 ");
@ -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<ActionEvent>() {
@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<ActionEvent>() {
@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 {
}
//}
}

View File

@ -18,7 +18,7 @@ public class CreateFile {
} catch (IOException e) {
System.out.println("An error occurred."),
System.out.println("An error occurred.");
e.printStackTrace();
}

View File

@ -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;
}

View File

@ -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<String> 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<String> list1 ) {
/*
//Button reload = new Button("Reload");
//GridPane.setConstraints(reload, 1, 8);
reload.setOnAction(new EventHandler<ActionEvent>() {
@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<String> list1 = new ListView();
ObservableList<String> items = FXCollections.observableArrayList(filter.filterRemoveWithRegex(".smart", filesDirectory));
//ObservableList<String> items = FXCollections.observableArrayList(filter.getSmartTargetName(filesDirectory));
//list1.getItems().addAll(items);
//list1.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
//list1.getSelectionModel().getSelectedItems().addListener((ListChangeListener<? super String>) 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<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
ObservableList<String> 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<String> 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;
}
}

View File

@ -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();
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.