pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gk_br...@verizon.net>
Subject Re: Disable Menu.Item
Date Tue, 26 Apr 2011 15:33:08 GMT
I meant a working example that I can run. Thanks.

On Apr 26, 2011, at 11:25 AM, lello wrote:

> Sure,
> 
> the code should be something like this:
> 
> 
> private MenuHandler treeMenuHandler = new MenuHandler.Adapter() {
> 
>        @Override
>        public boolean configureContextMenu(Component cmpnt, Menu menu, int
> x, int y) {
> 
>            TreeView tv = (TreeView) cmpnt;
>            final Tree.Path groupNodePath = tv.getNodeAt(y);
>            final int treeIndex = tv.getRowIndex(groupNodePath);
> 
>            // Create the context menu
>            Menu.Section menuSection1 = new Menu.Section();
>            Menu.Section menuSection2 = new Menu.Section();
>            Menu.Item newCollectionMenuItem = new Menu.Item("New
> collection");
>            Menu.Item renameCollectionMenuItem = new Menu.Item("Rename
> collection");
>            Menu.Item removeCollectionMenuItem = new Menu.Item("Remove
> collection");
> 
>            if (treeIndex == 0) {
>                menuSection1.add(newCollectionMenuItem);
>                renameCollectionMenuItem.setEnabled(false);
>                removeCollectionMenuItem.setEnabled(false);
>                menuSection2.add(renameCollectionMenuItem);
>                menuSection2.add(removeCollectionMenuItem);
>            }
> 
>            menu.getSections().add(menuSection1);
>            menu.getSections().add(menuSection2);
> 
>            return false;
>        }
>    };
> 
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Disable-Menu-Item-tp2865710p2865996.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Mime
View raw message