Compare commits

..

No commits in common. "a5378e8ee77852bad5fc69a618bee261150bf2fe" and "e18773d1e7b9c4a13af4fe12e1fb271b43ecfb7b" have entirely different histories.

14 changed files with 18 additions and 151 deletions

6
.idea/vcs.xml generated
View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -71,14 +71,6 @@
<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>

View File

@ -2,11 +2,9 @@ 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;
@ -22,8 +20,6 @@ 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 {
@ -63,8 +59,6 @@ public class App extends Application {
}
private void navigationButtons(Stage primaryStage, GridPane grid, Label label) {
boolean reloadValue = false;
@ -203,8 +197,6 @@ 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() + "|" +
@ -212,12 +204,10 @@ 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 {
@ -277,90 +267,22 @@ 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(filesShow);
//list1.getItems().addAll(items);
//list1.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
//list1.getSelectionModel().getSelectedItems().addListener((ListChangeListener<? super String>) c -> selectionChanged());
ObservableList<String> items = FXCollections.observableArrayList (ListFilesInDir.listFilesInDir(filesDirectory));
list1.setItems(items);
GridPane.setConstraints(list1, 0, 1);
grid.getChildren().add(list1);
//ObservableList selectedIndices = list1.getSelectionModel().getSelectedIndices();
String fileName = "/tmp/files/1735938766.smart";
//ReadFile.readFile(fileName);
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);

View File

@ -1,57 +1,29 @@
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();
//for(File path:paths) {
// System.out.println(path.getName().matches(".smart"));
// System.out.println("ok");
//
} catch(Exception efile){
efile.printStackTrace();
}
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++;
}
for(File path:paths) {
System.out.println(path.getName());
}
//return filesInDir.list();
System.out.println("ListFilesInDir wurde aufgerufen");
return filter;
} catch(Exception efile) {
efile.printStackTrace();
}
return filesInDir.list();
}
}

View File

@ -10,13 +10,11 @@ public class ReadFile {
try {
String s = Files.readString(Path.of(fileName));
String s1 = s;
//System.out.println("Es wurde versucht ein file zu lesen");
//System.out.println(s1);
System.out.println(s1);
return s1;
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("ein fehler im einlesen?");
String o = null;
return o;
}

View File

@ -1,8 +0,0 @@
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

View File

@ -1,4 +1 @@
/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