From e02646a2b5c1f727b621e732cfab0fa8cfe1bb42 Mon Sep 17 00:00:00 2001 From: firm1 Date: Sat, 4 Feb 2017 18:17:20 +0100 Subject: [PATCH] don't collapse when add/remove node --- .../zestedesavoir/zestwriter/view/com/MdTreeCell.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java b/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java index 6735e4136..261a5d9df 100644 --- a/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java +++ b/src/main/java/com/zestedesavoir/zestwriter/view/com/MdTreeCell.java @@ -196,7 +196,8 @@ private void initContextMenu(ContentNode item) { File extFile = new File(extract.getFilePath()); FunctionTreeFactory.performCreateNewFile(extFile); saveManifestJson(); - index.openContent(content); + // add visual node + getTreeItem().getChildren().add(getTreeItem().getChildren().size()-1, FunctionTreeFactory.buildChild(new TreeItem<>((ContentNode) extract))); } }); @@ -229,7 +230,8 @@ private void initContextMenu(ContentNode item) { dirFile.mkdir(); } saveManifestJson(); - index.openContent(content); + // refresh visual + getTreeItem().getChildren().add(getTreeItem().getChildren().size()-1, FunctionTreeFactory.buildChild(new TreeItem<>((ContentNode) container))); } }); @@ -266,7 +268,8 @@ private void initContextMenu(ContentNode item) { ((Content) index.getSummary().getRoot().getValue()).setLicence(paramContent.get("licence").toString()); baseFilePath = ((Content) index.getSummary().getRoot().getValue()).getBasePath(); saveManifestJson(); - index.openContent(content); + // refresh visual + index.getSummary().refresh(); } } catch (Exception e) { logger.error(e.getMessage(), e); @@ -340,6 +343,7 @@ private void initContextMenu(ContentNode item) { currentNode.getChildren().forEach(x -> parentNode.getChildren().add(x)); parentNode.getChildren().remove(currentNode); saveManifestJson(); + // resfresh visual index.openContent(content); });