Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order of logical and physical divisions #5694

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ public void addDocStruc(boolean preview) {
dataEditor.getGalleryPanel().setGalleryViewMode(LIST_MODE);
}
try {
dataEditor.getStructurePanel().preserve();
dataEditor.refreshStructurePanel();
dataEditor.getPaginationPanel().show();
} catch (UnknownTreeNodeDataException e) {
Helper.setErrorMessage(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,14 @@ private LogicalDivision preserveLogicalAndPhysicalRecursive(TreeNode treeNode) t
}
}
}
/*
PhysicalDivisions assigned to multiple LogicalDivisions may lead to wrong order value. The order will be
incremented for each occurrence and not just the last one. The LogicalDivisions containing those
PhysicalDivisions must be set to the order value of their first PhysicalDivision.
*/
if (!structure.getViews().isEmpty()) {
structure.setOrder(structure.getViews().getFirst().getPhysicalDivision().getOrder());
}
return structure;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ private static void handlePosition(Workpiece workpiece, LogicalDivision logicalD
List<Integer> siblingOrderValues = Stream.concat(logicalDivision.getChildren().stream()
.map(Division::getOrder), Stream.of(structureOrder)).sorted().collect(Collectors.toList());

// new order must be set at correction location between existing siblings
logicalDivision.getChildren().add(siblingOrderValues.indexOf(structureOrder), newStructure);
// new order must be set at correct location between existing siblings
logicalDivision.getChildren().add(siblingOrderValues.lastIndexOf(structureOrder), newStructure);
}
break;
case FIRST_CHILD_OF_CURRENT_ELEMENT:
Expand Down