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

If no ExpandCollapseListener set, don't put handles on nodes with no children. #8

Open
nishihatapalmer opened this issue Oct 19, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@nishihatapalmer
Copy link
Owner

nishihatapalmer commented Oct 19, 2023

If the code is not dynamically responding to expand/collapse events and a node has no children, then there is no point in putting an expand / collapse handle on it.

Add logic to only add these when a listener exists that might handle it.

Other thoughts - you may have a listener for some reason, but you aren't dynamically updating the tree. Maybe have yet another setting to explicitly set whether nodes with no children have handles?

Have to think about whether this makes sense - would we automatically put handles on as soon as a listener is set? Have update listeners vs. non update listeners? Could get into situation where you set a listener and you get handles, when you already said you don't want them.

@nishihatapalmer nishihatapalmer added the enhancement New feature or request label Oct 21, 2023
@nishihatapalmer
Copy link
Owner Author

  • Nodes that don't allow children don't need handles.
  • The question is whether nodes that allow children, but have a current child count of zero should have them.
  • If a child of a visible parent is inserted, then it would need handles.
  • If there are no listeners defined, then nodes cannot be dynamically added on expand, so no need for handles.

So, only need to decide what to do when a listener is set. Could state whether it is read-only or potentially modifies tree. If it can modify tree, then we need handles. If it's a read only listener, we don't. Bug prone maybe.

@nishihatapalmer
Copy link
Owner Author

What if we want a tree expanded and don't want the user to be able to expand or collapse any further nodes?

Control over which nodes get handles seems to be more general than just the dynamic tree use-case.

@nishihatapalmer
Copy link
Owner Author

So we'd have a HandleStrategy or HandlePolicy object that controls which nodes get handles and what the conditions for that are.

@nishihatapalmer
Copy link
Owner Author

nishihatapalmer commented Oct 25, 2023

The TreeCellRenderer renders the handles, but doesn't control if they can expand or collapse.

Should this be in sync, so the table model should be able to determine if a node can expand or collapse, and then the renderer should reflect this when rendering the handles?

Would we want nodes that have no expand or collapse handles but which can still be expanded or collapsed through a key press or tree click? I can see we might want to be able to programmatically collapse or expand nodes but not show visible handles (to respond to user input directly).

@nishihatapalmer
Copy link
Owner Author

So handles are all about visual indication to users that they can control expand or collapse through user input directly.

But should not prevent programmatic expand or collapse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant