From 9bcd99dcf88caad9df93c44db806145d963a9a57 Mon Sep 17 00:00:00 2001 From: aj Date: Mon, 3 Dec 2018 13:34:09 +0000 Subject: [PATCH] refresh list on open and populate file name to list name --- .../fmframework/fx/FMObjListEditTab.java | 21 +++++++++++-------- .../fx/controller/ControllerMain.java | 2 ++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/sarsoo/fmframework/fx/FMObjListEditTab.java b/src/main/java/sarsoo/fmframework/fx/FMObjListEditTab.java index 56dbeb8..696bcfa 100644 --- a/src/main/java/sarsoo/fmframework/fx/FMObjListEditTab.java +++ b/src/main/java/sarsoo/fmframework/fx/FMObjListEditTab.java @@ -8,7 +8,7 @@ import sarsoo.fmframework.util.FMObjList; import javafx.fxml.FXMLLoader; public class FMObjListEditTab extends Tab { - + public FMObjListEditTab() throws IOException { setText("List"); @@ -21,21 +21,24 @@ public class FMObjListEditTab extends Tab { AnchorPane.setLeftAnchor(pane, 0.0); AnchorPane.setRightAnchor(pane, 0.0); AnchorPane.setBottomAnchor(pane, 0.0); - + // BorderPane setText("list"); - + setContent(pane); - FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController(); - + FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController(); } - + public FMObjListEditTab(FMObjList list) throws IOException { - setText("List"); + if (list.getGroupName() != null) { + setText(list.getGroupName()); + }else { + setText("list"); + } FXMLLoader loader = new FXMLLoader(getClass().getResource("ui/FMObjListPaneEdit.fxml")); @@ -45,12 +48,12 @@ public class FMObjListEditTab extends Tab { AnchorPane.setLeftAnchor(pane, 0.0); AnchorPane.setRightAnchor(pane, 0.0); AnchorPane.setBottomAnchor(pane, 0.0); - + // BorderPane setContent(pane); - FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController(); + FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController(); control.setList(list); control.refresh(); } diff --git a/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java b/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java index 3f26aa7..0bb220b 100644 --- a/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java +++ b/src/main/java/sarsoo/fmframework/fx/controller/ControllerMain.java @@ -680,6 +680,8 @@ public class ControllerMain { ListPersister persist = new ListPersister(); FMObjList list = persist.readListFromFile(file); + list.setGroupName(file.getName()); + list.refresh(); try { addTab(new FMObjListEditTab(list)); } catch (IOException e) {