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
Refactor setLock() and getLock() #9866
Conversation
Thanks for the PR. Please consider adding a release note in the help/en/releasenotes/current-draft-note.shtml file. |
Thanks for the PR. It includes changes to properties files, so the 'Needs L10N' label has been added" |
Codecov Report
@@ Coverage Diff @@
## master #9866 +/- ##
===========================================
+ Coverage 51.7% 51.7% +0.1%
- Complexity 64220 64221 +1
===========================================
Files 5112 5112
Lines 446298 446379 +81
Branches 64477 64518 +41
===========================================
+ Hits 230682 230750 +68
+ Misses 192837 192820 -17
- Partials 22779 22809 +30
Continue to review full report at Codecov.
|
@dsand47 If an item is locked, a lock icon is shown before that node. If the user selects "Lock" on an item, that item and all its descendants are locked. An item can be edited, enabled and disabled if it's not locked. An item can be added if the parent is not locked. An item can be cut or removed if it's not locked and its parent is not locked. This may seem difficult, but my idea is:
I have added a warning dialog if the user tries to edit/cut/remove a system item. You can test this by changing |
@dsand47 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I assume it is ok to unlock a child.
@dsand47
I have earlier added the methods
getLock()
andsetLock()
, but I have never used them. But the way these was implemented wasn't so good. So I have refactorized these methods by moving them from the interfacejmri.jmrit.logixng.Base
tojmri.jmrit.logixng.MaleSocket
.This PR will have a conflict with #9864 that I will resolve once #9864 is merged.
TreeEditor works with female sockets and male sockets, so TreeEditor has access to the methods
getLock()
,setLock()
andisSystem()
. The idea is that the user can lock and unlock a node and I think it would be good if that would lock/unlock all the nodes in the sub tree of that node as well.If a male socket is system (the method isSystem() returns true), then it would be good if the user gets a dialog box asking for confirmation when he tries to edit, cut or delete a node.
The method setSystem() is intended for ImportConditional when importing system Logixs and if a JMRI tool creates internal LogixNGs for its own use.