Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CB3791B18 for ; Tue, 26 Apr 2011 15:41:33 +0000 (UTC) Received: (qmail 24630 invoked by uid 500); 26 Apr 2011 15:41:33 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 24611 invoked by uid 500); 26 Apr 2011 15:41:33 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 24603 invoked by uid 99); 26 Apr 2011 15:41:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 15:41:33 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,RFC_ABUSE_POST,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 216.139.236.26 is neither permitted nor denied by domain of rborrelli@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 15:41:27 +0000 Received: from ben.nabble.com ([192.168.236.152]) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1QEkNu-0006ww-IL for user@pivot.apache.org; Tue, 26 Apr 2011 08:41:06 -0700 Date: Tue, 26 Apr 2011 08:41:06 -0700 (PDT) From: lello To: user@pivot.apache.org Message-ID: <1303832466544-2866066.post@n3.nabble.com> In-Reply-To: References: <1303826545138-2865710.post@n3.nabble.com> <1303831032760-2865959.post@n3.nabble.com> <49531E1E-B612-4146-98EC-5F003C439721@verizon.net> <1303831517679-2865996.post@n3.nabble.com> Subject: Re: Disable Menu.Item MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Sorry, I'll try to write something asap. Greg Brown-2 wrote: > > 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. > -- View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Disable-Menu-Item-tp2865710p2866066.html Sent from the Apache Pivot - Users mailing list archive at Nabble.com.