read/write
This commit is contained in:
parent
f3b146309f
commit
7cb9ac2af3
@ -1,4 +1,5 @@
|
||||
package net.altimate.app;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.Object;
|
||||
import java.lang.Class;
|
||||
@ -96,6 +97,7 @@ public class App extends Application {
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
primaryStage.setScene(sceneList);
|
||||
//ListFilesInDir.listFilesInDir("/home/mic/files");
|
||||
}
|
||||
});
|
||||
|
||||
@ -288,12 +290,12 @@ public class App extends Application {
|
||||
System.out.println("theoretischer reload des Inhaltes");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Filter.getSmartTargetName(filesDirectory);
|
||||
|
||||
Filter filter = new Filter();
|
||||
|
||||
//filter.getSmartTargetName(filesDirectory);
|
||||
|
||||
|
||||
/*
|
||||
int filesDirTmpLength = ListFilesInDir.listFilesInDir(filesDirectory).length;
|
||||
String filesDirTmp[] = new String[filesDirTmpLength];
|
||||
filesDirTmp = ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
@ -308,10 +310,10 @@ public class App extends Application {
|
||||
String[] nameOfTarget = filesContent[i].replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
|
||||
filesShow[i] = nameOfTarget[0];
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
ListView<String> list1 = new ListView<String>();
|
||||
ObservableList<String> items = FXCollections.observableArrayList(filesShow);
|
||||
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);
|
||||
@ -322,6 +324,11 @@ public class App extends Application {
|
||||
|
||||
//ObservableList selectedIndices = list1.getSelectionModel().getSelectedIndices();
|
||||
|
||||
String[] filesContent = new String[30];
|
||||
filesContent[0] ="000000";
|
||||
filesContent[1] ="1111111";
|
||||
|
||||
|
||||
|
||||
Button button = new Button("Read Selected Value");
|
||||
GridPane.setConstraints(button, 2, 8);
|
||||
@ -333,11 +340,51 @@ public class App extends Application {
|
||||
System.out.println("o = " + o + " (" + o.getClass() + ")");
|
||||
System.out.println(filesContent[(int) o]);
|
||||
|
||||
final TextField max = new TextField(filesContent[(int) o]);
|
||||
String[] ar = filter.filterSplitValues((int) o, filesDirectory );
|
||||
|
||||
final TextField max = new TextField(ar[0]);
|
||||
max.setPrefColumnCount(20);
|
||||
max.setPromptText("Ist es realistisch selbst erreichbar ?");
|
||||
GridPane.setConstraints(max, 2, 5);
|
||||
max.setPromptText("max");
|
||||
GridPane.setConstraints(max, 1, 1);
|
||||
grid.getChildren().add(max);
|
||||
|
||||
|
||||
//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);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,35 +1,65 @@
|
||||
package net.altimate.app;
|
||||
|
||||
|
||||
|
||||
public class Filter {
|
||||
|
||||
public static String filesDirectory = "/home/mic/files";
|
||||
|
||||
ListFilesInDir listFilesInDir = new ListFilesInDir();
|
||||
// public static String[] getSmartTargetName (String filesDirectory) {
|
||||
int filesDirTmpLength = listFilesInDir(filesDirectory).length;
|
||||
String filesDirTmp[] = new String[filesDirTmpLength];
|
||||
filesDirTmp = 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]);
|
||||
public String[] filterRemoveWithRegex(String filterRegex, String filesDirectory) {
|
||||
|
||||
String process[] = listFilesInDir.listFilesInDir(filesDirectory);
|
||||
|
||||
for (int i = 0; i < process.length; ++i) {
|
||||
process[i] = process[i].replaceAll(filterRegex, "");
|
||||
}
|
||||
return process;
|
||||
}
|
||||
|
||||
public String[] filterSplitValues(int choosenFileNumber, String filesDirectory) {
|
||||
|
||||
String process[] = listFilesInDir.listFilesInDir(filesDirectory);
|
||||
String filesContent = ReadFile.readFile(filesDirectory + "/" + process[choosenFileNumber]);
|
||||
System.out.println(filesContent);
|
||||
|
||||
//for (int i = 0; i < ength; ++i) {
|
||||
|
||||
String regex = "\\|";
|
||||
String[] nameOfTarget = filesContent[i].replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
|
||||
filesShow[i] = nameOfTarget[0];
|
||||
}
|
||||
|
||||
public String[] getfilesContent() {
|
||||
System.out.println("test");
|
||||
String[] nameOfTarget = filesContent.replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
|
||||
//filesShow[i] = nameOfTarget[0];
|
||||
//}
|
||||
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);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
@ -5,7 +5,8 @@ import static java.util.regex.Pattern.matches;
|
||||
|
||||
|
||||
public class ListFilesInDir {
|
||||
public static String[] listFilesInDir(String directory) {
|
||||
|
||||
public String[] listFilesInDir(String directory) {
|
||||
|
||||
File filesInDir = null;
|
||||
File[] paths;
|
||||
@ -16,15 +17,6 @@ public class ListFilesInDir {
|
||||
|
||||
try {
|
||||
filesInDir = new File(directory);
|
||||
//paths = filesInDir.listFiles();
|
||||
|
||||
|
||||
//for(File path:paths) {
|
||||
// System.out.println(path.getName().matches(".smart"));
|
||||
// System.out.println("ok");
|
||||
//
|
||||
|
||||
|
||||
} catch(Exception efile){
|
||||
|
||||
efile.printStackTrace();
|
||||
@ -46,12 +38,11 @@ public class ListFilesInDir {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//return filesInDir.list();
|
||||
System.out.println("ListFilesInDir wurde aufgerufen");
|
||||
return filter;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
BIN
target/classes/net/altimate/app/App$1.class
Normal file
BIN
target/classes/net/altimate/app/App$1.class
Normal file
Binary file not shown.
BIN
target/classes/net/altimate/app/App$2.class
Normal file
BIN
target/classes/net/altimate/app/App$2.class
Normal file
Binary file not shown.
BIN
target/classes/net/altimate/app/App$3.class
Normal file
BIN
target/classes/net/altimate/app/App$3.class
Normal file
Binary file not shown.
BIN
target/classes/net/altimate/app/App$4.class
Normal file
BIN
target/classes/net/altimate/app/App$4.class
Normal file
Binary file not shown.
BIN
target/classes/net/altimate/app/App.class
Normal file
BIN
target/classes/net/altimate/app/App.class
Normal file
Binary file not shown.
BIN
target/classes/net/altimate/app/Filter.class
Normal file
BIN
target/classes/net/altimate/app/Filter.class
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user