read/write 2

This commit is contained in:
Michael Hayder 2025-01-07 16:10:04 +01:00
parent 7cb9ac2af3
commit 861630e3ba
8 changed files with 1 additions and 84 deletions

View File

@ -38,7 +38,7 @@ public class App extends Application {
Scene sceneCreate; Scene sceneCreate;
Scene sceneList; Scene sceneList;
public static String filesDirectory = "/home/mic/files"; public static String filesDirectory = System.getProperty("user.home") + "/files";
@ -51,31 +51,20 @@ public class App extends Application {
@Override @Override
public void start(Stage primaryStage) throws Exception { public void start(Stage primaryStage) throws Exception {
//GridPane grid = new GridPane();
//grid.setPadding(new Insets(10, 10, 10, 10));
//grid.setVgap(5);
//grid.setHgap(5);
//Start = new Scene(grid, 600, 300);
setupSceneList(primaryStage); setupSceneList(primaryStage);
setupSceneHome(primaryStage); setupSceneHome(primaryStage);
setupSceneCreate(primaryStage); setupSceneCreate(primaryStage);
primaryStage.setTitle("Work out a S.M.A.R.T. Target "); primaryStage.setTitle("Work out a S.M.A.R.T. Target ");
primaryStage.setScene(sceneHome); primaryStage.setScene(sceneHome);
primaryStage.show(); primaryStage.show();
} }
private void navigationButtons(Stage primaryStage, GridPane grid, Label label) { private void navigationButtons(Stage primaryStage, GridPane grid, Label label) {
StartUpCheck.checkFilesDirectory(filesDirectory); StartUpCheck.checkFilesDirectory(filesDirectory);
boolean reloadValue = false; boolean reloadValue = false;
Button home = new Button("Home"); Button home = new Button("Home");
@ -128,14 +117,6 @@ public class App extends Application {
navigationButtons(primaryStage, grid, label); navigationButtons(primaryStage, grid, label);
//Button button = new Button("Forward");
//button.setOnAction(e -> primaryStage.setScene(sceneList));
//TextField text = new TextField();
//text.setMaxWidth(100);
//layout.getChildren().addAll(label1, button);
} }
public void setupSceneCreate(Stage primaryStage) throws Exception { public void setupSceneCreate(Stage primaryStage) throws Exception {
@ -250,16 +231,6 @@ public class App extends Application {
}); });
//addTextfield(grid, "sinnesSpezifisch", "blash", 1, 1, 1);
//Button button = new Button("Home");
//button.setOnAction(e -> primaryStage.setScene(sceneHome));
//TextField text = new TextField();
//text.setMaxWidth(100);
//layout.getChildren().addAll(label1, button);
} }
@ -292,26 +263,8 @@ public class App extends Application {
}); });
Filter filter = new Filter(); Filter filter = new Filter();
//filter.getSmartTargetName(filesDirectory);
/*
int filesDirTmpLength = ListFilesInDir.listFilesInDir(filesDirectory).length;
String filesDirTmp[] = new String[filesDirTmpLength];
filesDirTmp = ListFilesInDir.listFilesInDir(filesDirectory);
//String filesDir[][] = new String[filesDirTmpLength][filesDirTmpLength];
String filesContent[] = new String[filesDirTmpLength];
String filesShow[] = new String[filesDirTmpLength];
for (int i = 0; i < filesDirTmpLength; ++i) {
filesContent[i] = ReadFile.readFile(filesDirectory + "/" + filesDirTmp[i]);
String regex = "\\|";
String[] nameOfTarget = filesContent[i].replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
filesShow[i] = nameOfTarget[0];
}
*/
ListView<String> list1 = new ListView<String>(); ListView<String> list1 = new ListView<String>();
ObservableList<String> items = FXCollections.observableArrayList( filter.filterRemoveWithRegex(".smart", filesDirectory )); ObservableList<String> items = FXCollections.observableArrayList( filter.filterRemoveWithRegex(".smart", filesDirectory ));
//ObservableList<String> items = FXCollections.observableArrayList(Filter.getSmartTargetName(filesDirectory)); //ObservableList<String> items = FXCollections.observableArrayList(Filter.getSmartTargetName(filesDirectory));

View File

@ -22,44 +22,8 @@ public class Filter {
String filesContent = ReadFile.readFile(filesDirectory + "/" + process[choosenFileNumber]); String filesContent = ReadFile.readFile(filesDirectory + "/" + process[choosenFileNumber]);
System.out.println(filesContent); System.out.println(filesContent);
//for (int i = 0; i < ength; ++i) {
String regex = "\\|"; String regex = "\\|";
String[] nameOfTarget = filesContent.replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex); String[] nameOfTarget = filesContent.replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
//filesShow[i] = nameOfTarget[0];
//}
return nameOfTarget; return nameOfTarget;
} }
//public String[] getSmartTargetName(String filesDirectory) {
// public static String[] getSmartTargetName (String filesDirectory) {
//System.out.println(listFilesInDir.listFilesInDir(filesDirectory).length);
//filterRemoveWithRegex(".*.smart", listFilesInDir.listFilesInDir(filesDirectory));
//int filesDirTmpLength = ListFilesInDir.listFilesInDir(filesDirectory).length;
//String filesDirTmp[] = new String[filesDirTmpLength];
//String[] filesDirTmp = ListFilesInDir.listFilesInDir(filesDirectory);
//String filesDir[][] = new String[filesDirTmpLength][filesDirTmpLength];
//String filesContent[] = new String[filesDirTmpLength];
//String filesShow[] = new String[filesDirTmpLength];
//for (int i = 0; i < filesDirTmpLength; ++i) {
// filesContent[i] = ReadFile.readFile(filesDirectory + "/" + filesDirTmp[i]);
// String regex = "\\|";
// String[] nameOfTarget = filesContent[i].replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
// filesShow[i] = nameOfTarget[0];
//}
// return listFilesInDir.listFilesInDir(filesDirectory);
//}
} }