Compare commits
2 Commits
e18773d1e7
...
a5378e8ee7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5378e8ee7 | ||
|
|
2ccc2cbb0b |
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
8
pom.xml
8
pom.xml
@ -71,6 +71,14 @@
|
||||
<mainClass>net.altimate.app.App</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
||||
|
||||
@ -2,9 +2,11 @@ package net.altimate.app;
|
||||
import java.lang.Object;
|
||||
import java.lang.Class;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
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;
|
||||
@ -20,6 +22,8 @@ import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
||||
public class App extends Application {
|
||||
|
||||
@ -59,6 +63,8 @@ public class App extends Application {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void navigationButtons(Stage primaryStage, GridPane grid, Label label) {
|
||||
|
||||
boolean reloadValue = false;
|
||||
@ -197,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() + "|" +
|
||||
@ -204,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 {
|
||||
@ -267,24 +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");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
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));
|
||||
|
||||
@ -1,29 +1,57 @@
|
||||
package net.altimate.app;
|
||||
import java.io.File;
|
||||
|
||||
import static java.util.regex.Pattern.matches;
|
||||
|
||||
|
||||
public class ListFilesInDir {
|
||||
public static String[] listFilesInDir ( String directory ) {
|
||||
public static String[] listFilesInDir(String directory) {
|
||||
|
||||
File filesInDir = null;
|
||||
File[] paths;
|
||||
String match = "^.*.smart$";
|
||||
|
||||
int count=0;
|
||||
int filterArrayLength=0;
|
||||
|
||||
try {
|
||||
filesInDir = new File(directory);
|
||||
paths = filesInDir.listFiles();
|
||||
//paths = filesInDir.listFiles();
|
||||
|
||||
|
||||
for(File path:paths) {
|
||||
System.out.println(path.getName());
|
||||
}
|
||||
//for(File path:paths) {
|
||||
// System.out.println(path.getName().matches(".smart"));
|
||||
// System.out.println("ok");
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
} catch(Exception efile) {
|
||||
} catch(Exception efile){
|
||||
|
||||
efile.printStackTrace();
|
||||
}
|
||||
return filesInDir.list();
|
||||
|
||||
paths = filesInDir.listFiles();
|
||||
|
||||
for (File path:paths) {
|
||||
if (path.getName().matches(match)) {
|
||||
filterArrayLength++;
|
||||
}
|
||||
}
|
||||
|
||||
String[] filter = new String[filterArrayLength];
|
||||
|
||||
for (File path:paths) {
|
||||
if (path.getName().matches(match)) {
|
||||
filter[count] = path.getName();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//return filesInDir.list();
|
||||
System.out.println("ListFilesInDir wurde aufgerufen");
|
||||
return filter;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,11 +10,13 @@ public class ReadFile {
|
||||
try {
|
||||
String s = Files.readString(Path.of(fileName));
|
||||
String s1 = s;
|
||||
System.out.println(s1);
|
||||
//System.out.println("Es wurde versucht ein file zu lesen");
|
||||
//System.out.println(s1);
|
||||
return s1;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("ein fehler im einlesen?");
|
||||
String o = null;
|
||||
return o;
|
||||
}
|
||||
|
||||
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.
@ -0,0 +1,8 @@
|
||||
net/altimate/app/ReadFile.class
|
||||
net/altimate/app/App$2.class
|
||||
net/altimate/app/App$3.class
|
||||
net/altimate/app/App.class
|
||||
net/altimate/app/ListFilesInDir.class
|
||||
net/altimate/app/App$4.class
|
||||
net/altimate/app/App$1.class
|
||||
net/altimate/app/CreateFile.class
|
||||
@ -1 +1,4 @@
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/App.java
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/CreateFile.java
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/ListFilesInDir.java
|
||||
/home/mic/DM/workspaces/tmp/superclass-app/src/main/java/net/altimate/app/ReadFile.java
|
||||
|
||||
Loading…
Reference in New Issue
Block a user