Skip to content

Commit

Permalink
code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
IkramMaalej committed Apr 8, 2021
1 parent a8d76ec commit da737cb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -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;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@
oncomplete="updateMetadataEditorView(true);"/>
<p:commandButton value="#{msgs.cancel}"
icon="fa fa-times fa-lg"
action="#{DataEditorForm.addDocStrucTypeDialog.resetValues}"
iconPos="secondary"
styleClass="secondary right"
onclick="PF('dialogAddDocStrucType').hide();"/>
oncomplete="PF('dialogAddDocStrucType').hide();"/>
</h:panelGroup>

<!-- submit buttons for linking processes -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
imagePreviewForm:mediaViewData
logicalTree
physicalTree
mediaContextMenu
imagePreviewForm:stripeContextMenu
imagePreviewForm:mediaContextMenu
metadataAccordion:logicalMetadataWrapperPanel"/>
<p:remoteCommand name="setGalleryViewMode"
action="#{DataEditorForm.galleryPanel.setGalleryViewMode}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
imagePreviewForm:mediaViewData
contextMenuLogicalTree
physicalTree
imagePreviewForm:stripeContextMenu
imagePreviewForm:mediaContextMenu
metadataAccordion:logicalMetadataWrapperPanel"/>
<p:ajax event="contextMenu"
Expand Down Expand Up @@ -84,7 +85,7 @@
process="@this"
oncomplete="PF('dialogAddDocStrucType').show()"
update="dialogAddDocStrucTypeDialog">
<f:actionListener binding="#{DataEditorForm.addDocStrucTypeDialog.preparePreselectedViews()}"/>
<f:actionListener binding="#{DataEditorForm.addDocStrucTypeDialog.preparePreselectedViews()}"/>
</p:menuitem>
<p:menuitem value="#{msgs.changeDocstructType}"
rendered="#{DataEditorForm.structurePanel.selectedLogicalNode.data.dataObject['class'].simpleName ne 'View'}"
Expand Down

0 comments on commit da737cb

Please sign in to comment.