From da737cb5603afd9ef831c9aa0e7db1cf99b2a878 Mon Sep 17 00:00:00 2001 From: Ikram Maalej Date: Wed, 7 Apr 2021 13:56:05 +0200 Subject: [PATCH] code improvement --- .../production/forms/dataeditor/AddDocStrucTypeDialog.java | 6 ++++++ .../includes/metadataEditor/dialogs/addDocStrucType.xhtml | 3 ++- .../WEB-INF/templates/includes/metadataEditor/gallery.xhtml | 3 ++- .../includes/metadataEditor/logicalStructure.xhtml | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java index 151a408dae5..df555ce6df0 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/AddDocStrucTypeDialog.java @@ -91,6 +91,7 @@ public class AddDocStrucTypeDialog { private boolean linkSubDialogVisible = false; private static final String PREVIEW_MODE = "preview"; private static final String LIST_MODE = "list"; + private TreeNode previouslySelectedLogicalNode; /** * Backing bean for the add doc struc type dialog of the metadata editor. @@ -427,6 +428,7 @@ private void checkSelectedLogicalNode() { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); if (structureTreeNode.getDataObject() instanceof View) { if (Objects.nonNull(selectedLogicalNode.getParent())) { + previouslySelectedLogicalNode = selectedLogicalNode; dataEditor.getStructurePanel().setSelectedLogicalNode(selectedLogicalNode.getParent()); } } @@ -658,6 +660,10 @@ public void resetValues() { selectFirstPageOnAddNodeSelectedItem = null; selectLastPageOnAddNodeSelectedItem = null; docStructPositionSelectionSelectedItem = LAST_CHILD_OF_CURRENT_ELEMENT; + if (Objects.nonNull(previouslySelectedLogicalNode)) { + dataEditor.getStructurePanel().setSelectedLogicalNode(previouslySelectedLogicalNode); + previouslySelectedLogicalNode = null; + } } /** diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml index 0a9262caab3..5d3c31867a9 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/dialogs/addDocStrucType.xhtml @@ -274,9 +274,10 @@ oncomplete="updateMetadataEditorView(true);"/> + oncomplete="PF('dialogAddDocStrucType').hide();"/> diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml index b5ba229fa3e..4f6063a130b 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml @@ -35,7 +35,8 @@ imagePreviewForm:mediaViewData logicalTree physicalTree - mediaContextMenu + imagePreviewForm:stripeContextMenu + imagePreviewForm:mediaContextMenu metadataAccordion:logicalMetadataWrapperPanel"/> - +