From 0741bfdd8017157625ddeee00391ef69805f6b5c Mon Sep 17 00:00:00 2001 From: Ikram Maalej Date: Fri, 26 Mar 2021 21:42:36 +0100 Subject: [PATCH 1/3] Make the contextMenu in StructurePanel und in GalleryPanel identical --- .../dataeditor/AddDocStrucTypeDialog.java | 14 +++++++ .../forms/dataeditor/DataEditorForm.java | 2 +- .../forms/dataeditor/StructurePanel.java | 1 + .../includes/metadataEditor/gallery.xhtml | 41 +++++++++++++++++-- .../metadataEditor/logicalStructure.xhtml | 17 +++++--- .../metadataEditor/physicalStructure.xhtml | 27 ++++++++++++ 6 files changed, 93 insertions(+), 9 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 b0545a85c36..a32ebd64bcf 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 @@ -408,6 +408,7 @@ private void sortMetadataList(List itemList) { */ public void prepare() { elementsToAddSpinnerValue = 1; + checkSelectedLogicalNode(); Optional selectedStructure = dataEditor.getSelectedStructure(); if (selectedStructure.isPresent()) { this.parents = MetadataEditor.getAncestorsOfStructure(selectedStructure.get(), @@ -422,6 +423,19 @@ public void prepare() { prepareSelectPageOnAddNodeItems(); } + private void checkSelectedLogicalNode() { + //If a view is selected in logical tree then the 'selectedLogicalNode' will be set to the parent of this view + TreeNode selectedLogicalNode = dataEditor.getStructurePanel().getSelectedLogicalNode(); + if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { + StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); + if (structureTreeNode.getDataObject() instanceof View) { + if (Objects.nonNull(selectedLogicalNode.getParent())) { + dataEditor.getStructurePanel().setSelectedLogicalNode(selectedLogicalNode.getParent()); + } + } + } + } + /** * Update lists of available doc struct types that can be added to the currently selected structure element in the * currently selected position. diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java index a7ae8ec6c3b..94f0f000897 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java @@ -582,7 +582,7 @@ void setProcess(Process process) { * * @return value of selectedMedia */ - List> getSelectedMedia() { + public List> getSelectedMedia() { return selectedMedia; } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java index 3f436f8ae88..9c6ee665c6f 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java @@ -1537,6 +1537,7 @@ public void assign() { dataEditor.assignView(includedStructuralElement, viewToAssign, 0); severalAssignments.add(viewToAssign.getMediaUnit()); show(); + dataEditor.getSelectedMedia().clear(); dataEditor.getGalleryPanel().updateStripes(); } } 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 a220dac787c..f03ed716bde 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,8 +35,9 @@ imagePreviewForm:mediaViewData logicalTree physicalTree - metadataAccordion:logicalMetadataWrapperPanel - paginationForm:paginationWrapperPanel"/> + paginationForm:paginationWrapperPanel + imagePreviewForm:mediaContextMenu + metadataAccordion:logicalMetadataWrapperPanel"/> - + + + @@ -37,6 +38,7 @@ contextMenuLogicalTree physicalTree paginationForm:paginationWrapperPanel + imagePreviewForm:mediaContextMenu metadataAccordion:logicalMetadataWrapperPanel"/> + @(.pageList) + imagePreviewForm:mediaContextMenu"/> - + update="dialogAddDocStrucTypeDialog"> + + + @(.structureElementDataList) + imagePreviewForm:mediaContextMenu"/> + @(.structureElementDataList) + imagePreviewForm:mediaContextMenu"/> + + Date: Wed, 7 Apr 2021 13:56:05 +0200 Subject: [PATCH 2/3] code improvement --- .../production/forms/dataeditor/AddDocStrucTypeDialog.java | 6 ++++++ .../includes/metadataEditor/dialogs/addDocStrucType.xhtml | 3 ++- .../WEB-INF/templates/includes/metadataEditor/gallery.xhtml | 1 + .../includes/metadataEditor/logicalStructure.xhtml | 3 ++- 4 files changed, 11 insertions(+), 2 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 a32ebd64bcf..741acf3d0f5 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. @@ -430,6 +431,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()); } } @@ -661,6 +663,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 13bf20953f5..2d9a2351d7f 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 f03ed716bde..57a119bc813 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 @@ -36,6 +36,7 @@ logicalTree physicalTree paginationForm:paginationWrapperPanel + imagePreviewForm:stripeContextMenu imagePreviewForm:mediaContextMenu metadataAccordion:logicalMetadataWrapperPanel"/> - + Date: Wed, 14 Apr 2021 12:46:41 +0200 Subject: [PATCH 3/3] Update Kitodo/src/main/webapp/WEB-INF/templates/includes/metadataEditor/gallery.xhtml Co-authored-by: Arved Solth --- .../WEB-INF/templates/includes/metadataEditor/gallery.xhtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 57a119bc813..370db29f961 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 @@ -364,8 +364,8 @@ icon="fa fa-link fa-sm" styleClass="plain" disabled="#{readOnly}" - rendered="#{DataEditorForm.structurePanel.assignableSeveralTimes and not - DataEditorForm.structurePanel.assignedSeveralTimes and DataEditorForm.selectedMedia.size() eq 1}" + rendered="#{DataEditorForm.structurePanel.assignableSeveralTimes and + DataEditorForm.selectedMedia.size() eq 1}" action="#{DataEditorForm.structurePanel.assign}" process="@this" oncomplete="$('#loadingScreen').hide()"