vaadin / vaadin/framework

Add ability to dynamically disable a right click popup menu item for Tree

Open
#624 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement v6 v7
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Originally by andrewv


Hi,

Currently (as I understand it), right click popup menu items on a Tree popup are rendered, based on the Action getIcon() and getCaption() values. I am unable to find any way to disable the individual menu items, like I can for items in the new MenuBar (by calling MenuItem.setCommand(null).

The only workaround I can think of for the moment, is to use HTML for the caption, and change the caption text colour to be (say grey - to "look" disabled), and perform no processing in the Action.Handler.handleAction() when the right click menu item is clicked.

Are you planning to add an explicit isEnabled(), or similar mechanism to the Action interface, to allow a menu item in the right click popup menu to be dynamically disabled ? If not, can you think of any better workarounds ?

Thanks
Andrew


Imported from https://dev.vaadin.com/ issue #2461

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Tree right-click popup implementation and the Action interface, then compare it with MenuBar's MenuItem.setCommand(null) behavior. Done means individual Tree popup menu items can be dynamically disabled and render as disabled rather than merely ignoring clicks.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.