From cb94fddd421988ecceb6aafa384a59cfde94cd41 Mon Sep 17 00:00:00 2001 From: Arved Solth Date: Tue, 18 Jan 2022 13:19:39 +0100 Subject: [PATCH 1/2] Show process id and title for linked processes in metadata editor --- .../production/forms/dataeditor/StructurePanel.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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 385765e77a5..0034eed7fa8 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 @@ -508,7 +508,8 @@ private Collection buildStructureTreeRecursively(LogicalDivision structure .processIdFromUri(structure.getLink().getUri())) { StructuralElementViewInterface view = dataEditor.getRulesetManagement().getStructuralElementView( type, dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); - node = new StructureTreeNode(view.getLabel(), view.isUndefined(), true, structure); + node = new StructureTreeNode("[" + child.getId() + "] " + view.getLabel() + " - " + + child.getTitle(), view.isUndefined(), true, structure); } } catch (DataException e) { Helper.setErrorMessage("metadataReadError", e.getMessage(), logger, e); @@ -623,11 +624,12 @@ private String buildViewLabel(View view) { * parent node to which the new node is to be added * @return the generated node so that you can add children to it */ - private DefaultTreeNode addTreeNode(String type, boolean linked, Object dataObject, DefaultTreeNode parent) { + private DefaultTreeNode addTreeNode(Process parentProcess, String type, boolean linked, Object dataObject, + DefaultTreeNode parent) { StructuralElementViewInterface structuralElementView = dataEditor.getRulesetManagement().getStructuralElementView(type, dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); - return addTreeNode(structuralElementView.getLabel(), structuralElementView.isUndefined(), linked, dataObject, - parent); + return addTreeNode("[" + parentProcess.getId() + "] " + structuralElementView.getLabel() + " - " + + parentProcess.getTitle(), structuralElementView.isUndefined(), linked, dataObject, parent); } /** @@ -704,7 +706,7 @@ private void addParentLinksRecursive(Process child, DefaultTreeNode tree) { if (Objects.isNull(logicalDivision.getType())) { break; } else { - parentNode = addTreeNode(logicalDivision.getType(), true, null, parentNode); + parentNode = addTreeNode(parent, logicalDivision.getType(), true, null, parentNode); parentNode.setExpanded(true); } } From 4fff8cda7108481696a5469727cf59debc266bb8 Mon Sep 17 00:00:00 2001 From: Arved Solth Date: Tue, 18 Jan 2022 13:25:08 +0100 Subject: [PATCH 2/2] Resolve some code issues --- .../forms/dataeditor/StructurePanel.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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 0034eed7fa8..9e7b8b49ed9 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 @@ -147,7 +147,7 @@ public void clear() { } void deleteSelectedStructure() { - if (!getSelectedStructure().isPresent()) { + if (getSelectedStructure().isEmpty()) { /* * No element is selected or the selected element is not a structure * but, for example, a physical division. @@ -612,24 +612,20 @@ private String buildViewLabel(View view) { * Adds a tree node to the given parent node. The tree node is set to * ‘expanded’. * + * @param parentProcess + * parent process of current process * @param type * the internal name of the type of node, to be resolved through * the rule set - * @param linked - * whether the node is a link. If so, it will be marked with a - * link symbol. - * @param dataObject - * the internal object represented by the node * @param parent * parent node to which the new node is to be added * @return the generated node so that you can add children to it */ - private DefaultTreeNode addTreeNode(Process parentProcess, String type, boolean linked, Object dataObject, - DefaultTreeNode parent) { + private DefaultTreeNode addTreeNode(Process parentProcess, String type, DefaultTreeNode parent) { StructuralElementViewInterface structuralElementView = dataEditor.getRulesetManagement().getStructuralElementView(type, dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); return addTreeNode("[" + parentProcess.getId() + "] " + structuralElementView.getLabel() + " - " - + parentProcess.getTitle(), structuralElementView.isUndefined(), linked, dataObject, parent); + + parentProcess.getTitle(), structuralElementView.isUndefined(), true, null, parent); } /** @@ -706,7 +702,7 @@ private void addParentLinksRecursive(Process child, DefaultTreeNode tree) { if (Objects.isNull(logicalDivision.getType())) { break; } else { - parentNode = addTreeNode(parent, logicalDivision.getType(), true, null, parentNode); + parentNode = addTreeNode(parent, logicalDivision.getType(), parentNode); parentNode.setExpanded(true); } } @@ -1256,7 +1252,7 @@ void moveViews(LogicalDivision toElement, } } - private void checkLogicalDragDrop(StructureTreeNode dragNode, StructureTreeNode dropNode) throws Exception { + private void checkLogicalDragDrop(StructureTreeNode dragNode, StructureTreeNode dropNode) { LogicalDivision dragStructure = (LogicalDivision) dragNode.getDataObject(); LogicalDivision dropStructure = (LogicalDivision) dropNode.getDataObject();