alt
This commit is contained in:
parent
a5378e8ee7
commit
f3b146309f
@ -1,6 +1,9 @@
|
||||
package net.altimate.app;
|
||||
import java.io.File;
|
||||
import java.lang.Object;
|
||||
import java.lang.Class;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -21,6 +24,9 @@ import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
import java.io.*;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
@ -31,8 +37,7 @@ public class App extends Application {
|
||||
Scene sceneCreate;
|
||||
Scene sceneList;
|
||||
|
||||
public final String filesDirectory = "/tmp/files";
|
||||
|
||||
public static String filesDirectory = "/home/mic/files";
|
||||
|
||||
|
||||
|
||||
@ -67,6 +72,9 @@ public class App extends Application {
|
||||
|
||||
private void navigationButtons(Stage primaryStage, GridPane grid, Label label) {
|
||||
|
||||
StartUpCheck.checkFilesDirectory(filesDirectory);
|
||||
|
||||
|
||||
boolean reloadValue = false;
|
||||
|
||||
Button home = new Button("Home");
|
||||
@ -282,6 +290,10 @@ public class App extends Application {
|
||||
});
|
||||
|
||||
|
||||
// Filter.getSmartTargetName(filesDirectory);
|
||||
|
||||
Filter filter = new Filter();
|
||||
|
||||
int filesDirTmpLength = ListFilesInDir.listFilesInDir(filesDirectory).length;
|
||||
String filesDirTmp[] = new String[filesDirTmpLength];
|
||||
filesDirTmp = ListFilesInDir.listFilesInDir(filesDirectory);
|
||||
@ -300,6 +312,7 @@ public class App extends Application {
|
||||
|
||||
ListView<String> list1 = new ListView<String>();
|
||||
ObservableList<String> items = FXCollections.observableArrayList(filesShow);
|
||||
//ObservableList<String> items = FXCollections.observableArrayList(Filter.getSmartTargetName(filesDirectory));
|
||||
//list1.getItems().addAll(items);
|
||||
//list1.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
||||
//list1.getSelectionModel().getSelectedItems().addListener((ListChangeListener<? super String>) c -> selectionChanged());
|
||||
|
||||
35
src/main/java/net/altimate/app/Filter.java
Normal file
35
src/main/java/net/altimate/app/Filter.java
Normal file
@ -0,0 +1,35 @@
|
||||
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]);
|
||||
String regex = "\\|";
|
||||
String[] nameOfTarget = filesContent[i].replaceAll("^\\[", "").replaceAll("^\\]", "").split(regex);
|
||||
filesShow[i] = nameOfTarget[0];
|
||||
}
|
||||
|
||||
public String[] getfilesContent() {
|
||||
System.out.println("test");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
37
src/main/java/net/altimate/app/StartUpCheck.java
Normal file
37
src/main/java/net/altimate/app/StartUpCheck.java
Normal file
@ -0,0 +1,37 @@
|
||||
package net.altimate.app;
|
||||
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.ButtonBar;
|
||||
import javafx.scene.control.ButtonType;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Optional;
|
||||
|
||||
public class StartUpCheck {
|
||||
public static void checkFilesDirectory(String filesDirectory) {
|
||||
if (Files.isDirectory(Paths.get(filesDirectory))) {
|
||||
System.out.println(System.getProperty("user.home"));
|
||||
} else {
|
||||
|
||||
ButtonType foo = new ButtonType("Erzeugen", ButtonBar.ButtonData.OK_DONE);
|
||||
ButtonType bar = new ButtonType("Beenden", ButtonBar.ButtonData.CANCEL_CLOSE);
|
||||
Alert alert = new Alert(Alert.AlertType.WARNING,
|
||||
"Das Verzeichnis zum speichern der Daten existiert nicht, soll es angelegt werden?",
|
||||
foo,
|
||||
bar);
|
||||
|
||||
alert.setTitle("Konfigurationsproblem");
|
||||
Optional<ButtonType> result = alert.showAndWait();
|
||||
|
||||
if (result.orElse(bar) == foo) {
|
||||
//formatGotIt = true;
|
||||
System.out.println(true);
|
||||
String homePlusDir = "/home/mic/files";
|
||||
new File(homePlusDir).mkdirs();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/net/altimate/app/StartUpCheck.class
Normal file
BIN
target/classes/net/altimate/app/StartUpCheck.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user