refresh list on open and populate file name to list name

This commit is contained in:
aj 2018-12-03 13:34:09 +00:00
parent d80f7151ea
commit 9bcd99dcf8
2 changed files with 14 additions and 9 deletions

View File

@ -8,7 +8,7 @@ import sarsoo.fmframework.util.FMObjList;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
public class FMObjListEditTab extends Tab { public class FMObjListEditTab extends Tab {
public FMObjListEditTab() throws IOException { public FMObjListEditTab() throws IOException {
setText("List"); setText("List");
@ -21,21 +21,24 @@ public class FMObjListEditTab extends Tab {
AnchorPane.setLeftAnchor(pane, 0.0); AnchorPane.setLeftAnchor(pane, 0.0);
AnchorPane.setRightAnchor(pane, 0.0); AnchorPane.setRightAnchor(pane, 0.0);
AnchorPane.setBottomAnchor(pane, 0.0); AnchorPane.setBottomAnchor(pane, 0.0);
// BorderPane // BorderPane
setText("list"); setText("list");
setContent(pane); setContent(pane);
FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController(); FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController();
} }
public FMObjListEditTab(FMObjList list) throws IOException { 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")); FXMLLoader loader = new FXMLLoader(getClass().getResource("ui/FMObjListPaneEdit.fxml"));
@ -45,12 +48,12 @@ public class FMObjListEditTab extends Tab {
AnchorPane.setLeftAnchor(pane, 0.0); AnchorPane.setLeftAnchor(pane, 0.0);
AnchorPane.setRightAnchor(pane, 0.0); AnchorPane.setRightAnchor(pane, 0.0);
AnchorPane.setBottomAnchor(pane, 0.0); AnchorPane.setBottomAnchor(pane, 0.0);
// BorderPane // BorderPane
setContent(pane); setContent(pane);
FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController(); FMObjListPaneEditController control = (FMObjListPaneEditController) loader.getController();
control.setList(list); control.setList(list);
control.refresh(); control.refresh();
} }

View File

@ -680,6 +680,8 @@ public class ControllerMain {
ListPersister persist = new ListPersister(); ListPersister persist = new ListPersister();
FMObjList list = persist.readListFromFile(file); FMObjList list = persist.readListFromFile(file);
list.setGroupName(file.getName());
list.refresh();
try { try {
addTab(new FMObjListEditTab(list)); addTab(new FMObjListEditTab(list));
} catch (IOException e) { } catch (IOException e) {