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 1cb23c8aa94..4a6c7a18842 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 @@ -404,6 +404,7 @@ private void sortMetadataList(List itemList) { * Prepare popup dialog by retrieving available insertion positions and doc struct types for selected element. */ public void prepare() { + checkSelectedLogicalNode(); Optional selectedStructure = dataEditor.getSelectedStructure(); if (selectedStructure.isPresent()) { this.parents = MetadataEditor.getAncestorsOfStructure(selectedStructure.get(), @@ -418,6 +419,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 f5057582c35..9a1580bb5a1 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 24c9d75833f..3d9dd356f6f 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 dd6ee9e1078..b5ba229fa3e 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,6 +35,7 @@ imagePreviewForm:mediaViewData logicalTree physicalTree + mediaContextMenu metadataAccordion:logicalMetadataWrapperPanel"/> - + + + @@ -36,6 +37,7 @@ imagePreviewForm:mediaViewData contextMenuLogicalTree physicalTree + imagePreviewForm:mediaContextMenu metadataAccordion:logicalMetadataWrapperPanel"/> + @(.pageList) + imagePreviewForm:mediaContextMenu"/> - + update="dialogAddDocStrucTypeDialog"> + + + @(.structureElementDataList) + imagePreviewForm:mediaContextMenu"/> + @(.structureElementDataList) + imagePreviewForm:mediaContextMenu"/> + +