Persist the "Group multiplicities / role names" class diagram layout option (#16)#135
Open
cansin wants to merge 4 commits into
Open
Persist the "Group multiplicities / role names" class diagram layout option (#16)#135cansin wants to merge 4 commits into
cansin wants to merge 4 commits into
Conversation
…ocl#16) The class diagram layout option "Group multiplicities / role names" was not stored in the layout file, so the setting was lost whenever a model was reopened. It now defaults to enabled for class diagrams and is saved to and restored from the layout file. Changes: - Add a "groupmultiplicityrolenames" layout tag and write/read it in DiagramOptions#saveOptions/#loadOptions, guarded by a new layout version (14) for backward compatibility with older layout files. - Default the option to true for class diagrams (ClassDiagramOptions). - Make MultiplicityRolenameWrapper mirror the actual option value instead of blindly toggling on every change, and initialize its grouping state from the option, so a loaded/default value is honored. - Suppress grouping while a layout is being restored (reusing the existing isLoadingLayout flag, now set around layout loading in DiagramView) so restored label positions are not overwritten. Add DiagramOptionsPersistenceTest covering the save/load round-trip, the default value, the layout-version bump and backward compatibility with pre-v14 layout files. https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
The layered-architecture test writes docs/archunit-results/*-failure-report.txt on every run. Only the directory's README is meant to be tracked, so ignore the generated report files. https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
Add @author Cansin Yildiz and @author Claude to the files added in this branch, and update the copyright year to 1999-2026. Co-authored-by: Claude <[email protected]> https://claude.ai/code/session_01A85dAvTAvi2oWkGZH6REEq
a0310f9 to
c750f4c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #16.
The class diagram layout option "Group multiplicities / role names" was not
stored in the layout file, so the setting was lost whenever a model was
reopened. This PR persists the option in the layout file and enables it by
default for class diagrams.
Changes
groupmultiplicityrolenameslayout tag and write/read it inDiagramOptions#saveOptions/#loadOptions, guarded by a bumped layoutversion (
13 → 14) so older layout files remain loadable and unaffected.truefor class diagrams (ClassDiagramOptions).Object, communication and state machine diagrams are unchanged.
MultiplicityRolenameWrappermirror the actual option value instead ofblindly toggling
do_groupon every change, and initialise its groupingstate from the option, so a restored or default value is honoured.
isLoadingLayoutflag, now set around layout loading inDiagramView) sothe restored positions of multiplicities / role names are not overwritten.
Backward compatibility
tag. The
version > 13guard keeps the default and never resets the option,and loading such files does not fail.
Testing
DiagramOptionsPersistenceTest(JUnit 5) covering: the true/falsesave–load round-trip, presence of the option element in the saved XML, the
default value, the layout-version bump, backward compatibility with a
pre-v14 layout file, and that the existing options still round-trip.
use-guisuite is green, including the 129ShellITintegration testsand the ArchUnit layered-architecture test (no new package-dependency
violations).
Notes
wrapper sync and the loading guard) are exercised manually rather than with a
unit test, as they would require a full diagram harness to set up.