static context refresh
This commit is contained in:
parent
46dfeeb83b
commit
c605971aad
@ -9,6 +9,8 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
@ -111,7 +113,7 @@ public class App extends Application {
|
|||||||
Button list = new Button("List");
|
Button list = new Button("List");
|
||||||
list.setPrefSize(100, 20);
|
list.setPrefSize(100, 20);
|
||||||
hbox.getChildren().clear();
|
hbox.getChildren().clear();
|
||||||
//list.setOnAction(e -> primaryStage.setScene(sceneList));
|
|
||||||
|
|
||||||
|
|
||||||
Button test = new Button("Test");
|
Button test = new Button("Test");
|
||||||
@ -123,6 +125,7 @@ public class App extends Application {
|
|||||||
list.setOnAction(new EventHandler<ActionEvent>() {
|
list.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent e) {
|
public void handle(ActionEvent e) {
|
||||||
|
SceneList.refreshList();
|
||||||
primaryStage.setScene(sceneList.getScene());
|
primaryStage.setScene(sceneList.getScene());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package net.altimate.app;
|
package net.altimate.app;
|
||||||
|
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@ -26,14 +28,25 @@ public class SceneList {
|
|||||||
Button button;
|
Button button;
|
||||||
Button reload;
|
Button reload;
|
||||||
ObservableList selectedIndices;
|
ObservableList selectedIndices;
|
||||||
|
static ListView<String> list1;
|
||||||
|
static Filter filter;
|
||||||
|
|
||||||
|
|
||||||
|
public static void refreshList() {
|
||||||
|
filter = new Filter();
|
||||||
|
ObservableList<String> items = FXCollections.observableArrayList(filter.filterListSMartName(".smart", filesDirectory));
|
||||||
|
list1.setItems(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public SceneList(Stage primaryStage, HBox buttons) {
|
public SceneList(Stage primaryStage, HBox buttons) {
|
||||||
|
|
||||||
ListView<String> list1 = new ListView();
|
//ListView<String> list1 = new ListView();
|
||||||
|
list1 = new ListView();
|
||||||
BorderPane border = new BorderPane();
|
BorderPane border = new BorderPane();
|
||||||
Label label = new Label("This is the list Scene");
|
Label label = new Label("This is the list Scene");
|
||||||
border.setTop(buttons);
|
border.setTop(buttons);
|
||||||
|
|
||||||
border.setLeft(addList(label, list1));
|
border.setLeft(addList(label, list1));
|
||||||
border.setRight(addEdit(label,list1));
|
border.setRight(addEdit(label,list1));
|
||||||
//border.setBottom(addCreateBottom(label));
|
//border.setBottom(addCreateBottom(label));
|
||||||
@ -66,8 +79,8 @@ public class SceneList {
|
|||||||
title.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
title.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||||
vbox.getChildren().add(title);
|
vbox.getChildren().add(title);
|
||||||
|
|
||||||
Filter filter = new Filter();
|
//Filter filter = new Filter();
|
||||||
|
filter = new Filter();
|
||||||
|
|
||||||
//ListView<String> list1 = new ListView();
|
//ListView<String> list1 = new ListView();
|
||||||
ObservableList<String> items = FXCollections.observableArrayList(filter.filterListSMartName(".smart", filesDirectory));
|
ObservableList<String> items = FXCollections.observableArrayList(filter.filterListSMartName(".smart", filesDirectory));
|
||||||
@ -94,12 +107,22 @@ public class SceneList {
|
|||||||
|
|
||||||
vbox.getChildren().addAll(list1, button, reload);
|
vbox.getChildren().addAll(list1, button, reload);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
list.action.Property().addListener(new ChangeListener<String>() {
|
||||||
|
@Override
|
||||||
|
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||||
|
System.out.println("Changed!!!");
|
||||||
|
// object properties oder update methode beim scene bauen in App
|
||||||
|
}
|
||||||
|
});
|
||||||
|
*/
|
||||||
reload.setOnAction(new EventHandler<ActionEvent>() {
|
reload.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(ActionEvent e) {
|
public void handle(ActionEvent e) {
|
||||||
//ObservableList<String> items = FXCollections.observableArrayList(filter.filterRemoveWithRegex(".smart", filesDirectory));
|
ObservableList<String> items = FXCollections.observableArrayList(filter.filterListSMartName(".smart", filesDirectory));
|
||||||
//System.out.println("theoretischer reload des Inhaltes");
|
list1.setItems(items);
|
||||||
System.out.println(filter.filterListSMartName(".smart", filesDirectory));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
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.
Loading…
Reference in New Issue
Block a user