files edit
This commit is contained in:
parent
2ccc2cbb0b
commit
a5378e8ee7
@ -6,6 +6,7 @@ import java.util.Arrays;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.Event;
|
||||
@ -62,6 +63,8 @@ public class App extends Application {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void navigationButtons(Stage primaryStage, GridPane grid, Label label) {
|
||||
|
||||
boolean reloadValue = false;
|
||||
@ -200,6 +203,8 @@ public class App extends Application {
|
||||
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() + "|" +
|
||||
@ -207,10 +212,12 @@ public class App extends Application {
|
||||
messBar.getText() + "|" +
|
||||
attraktiv.getText() + "|" +
|
||||
realistisch.getText() + "|" +
|
||||
state + "|" +
|
||||
seconds + "|" +
|
||||
date
|
||||
};
|
||||
|
||||
long seconds = System.currentTimeMillis() / 1000l;
|
||||
|
||||
CreateFile.writeFile(filesDirectory + "/" + seconds + ".smart", createSmart);
|
||||
|
||||
} else {
|
||||
@ -270,61 +277,92 @@ public class App extends Application {
|
||||
reload.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
System.out.println("theoretischer reload des Inhaltes");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//System.out.println(Arrays.stream(ListFilesInDir.listFilesInDir(filesDirectory)).toList());
|
||||
int filesDirTmpLength = ListFilesInDir.listFilesInDir(filesDirectory).length;
|
||||
String filesDirTmp[] = new String[filesDirTmpLength];
|
||||
filesDirTmp = ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
String filesDir[][] = new String[filesDirTmpLength][filesDirTmpLength];
|
||||
//String filesDir[][] = new String[filesDirTmpLength][filesDirTmpLength];
|
||||
String filesContent[] = new String[filesDirTmpLength];
|
||||
String filesShow[] = new String[filesDirTmpLength];
|
||||
|
||||
|
||||
for (int i = 0; i < filesDirTmpLength; ++i) {
|
||||
filesDir[i][0] = filesDirTmp[i];
|
||||
String readTheFile = filesDirectory + "/" + filesDirTmp[i];
|
||||
filesDir[i][1] = ReadFile.readFile(filesDirectory + "/" + filesDirTmp[i]);
|
||||
//filesDir[0][i] = ReadFile.readFile(filesDirTmp[i]);
|
||||
//ReadFile.readFile(filesDirTmp[i]);
|
||||
|
||||
|
||||
System.out.println("da: " + filesDir[i][0]);
|
||||
System.out.println("da tmp: " + filesDir[i][1]);
|
||||
System.out.println(i);
|
||||
//System.out.println("inhalt file: " + filesDir[i][i]);
|
||||
|
||||
filesContent[i] = ReadFile.readFile(filesDirectory + "/" + filesDirTmp[i]);
|
||||
String regex = "\\|";
|
||||
String[] nameOfTarget = filesContent[i].replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
|
||||
filesShow[i] = nameOfTarget[0];
|
||||
}
|
||||
//System.out.println(ReadFile.readFile("/tmp/files/123.smart"));
|
||||
//ReadFile.readFile("/tmp/files/123.smart");
|
||||
|
||||
//System.out.println("dada: " + filesDirTmp[0]);
|
||||
|
||||
//filesDirTmp = Arrays.copyOf(ListFilesInDir.listFilesInDir(filesDirectory), ListFilesInDir.listFilesInDir(filesDirectory).length);
|
||||
//new String[ListFilesInDir.listFilesInDir(filesDirectory).length][ListFilesInDir.listFilesInDir(filesDirectory).length];
|
||||
|
||||
|
||||
//filesDir[][] = ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
//System.out.println(filesDir.length);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ListView<String> list1 = new ListView<String>();
|
||||
ObservableList<String> items = FXCollections.observableArrayList (ListFilesInDir.listFilesInDir(filesDirectory));
|
||||
ObservableList<String> items = FXCollections.observableArrayList(filesShow);
|
||||
//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);
|
||||
|
||||
//String fileName = "/tmp/files/1735938766.smart";
|
||||
//ReadFile.readFile(fileName);
|
||||
//ObservableList selectedIndices = list1.getSelectionModel().getSelectedIndices();
|
||||
|
||||
//System.out.println(ReadFile.readFile(fileName));
|
||||
|
||||
Button button = new Button("Read Selected Value");
|
||||
GridPane.setConstraints(button, 2, 8);
|
||||
grid.getChildren().add(button);
|
||||
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]);
|
||||
|
||||
final TextField max = new TextField(filesContent[(int) o]);
|
||||
max.setPrefColumnCount(20);
|
||||
max.setPromptText("Ist es realistisch selbst erreichbar ?");
|
||||
GridPane.setConstraints(max, 2, 5);
|
||||
grid.getChildren().add(max);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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() + ")");
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
//ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
//ListView<String> list1 = new ListView<String>();
|
||||
//ObservableList<String> items = FXCollections.observableArrayList (ListFilesInDir.listFilesInDir(filesDirectory));
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user