But I want to know which TreeItem the user clicked on. Because in the
TreeItem I am storing a java object using the setUserObject and I use this
java object to construct the menu.

On Fri, Nov 7, 2008 at 6:28 PM, walden <[EMAIL PROTECTED]> wrote:

>
> Then construct your TreeItem with Label instead of text, and attach a
> ClickListener to the Label.
>
> On Nov 7, 2:00 am, "Litty Preeth" <[EMAIL PROTECTED]> wrote:
> > Actually I wanted a popup menu when user clicks on the TreeItem. I
> couldnt
> > find any ClickListener for TreeItem so I used onSelect.
> >
> > - Litty
> >
> >
> >
> > On Fri, Nov 7, 2008 at 4:26 AM, walden <[EMAIL PROTECTED]>
> wrote:
> >
> > > I'm not sure he will see popping up a menu on item selection as normal
> > > behavior to begin with.  Maybe you should implement context menu
> > > listeners on your tree item widgets instead.
> >
> > > On Nov 6, 11:15 am, "Litty Preeth" <[EMAIL PROTECTED]> wrote:
> > > > Okk.. Actually in my tree, I have a popup menu for each item on the
> > > > onTreeItemSelected event. The menu comes just below the selected
> item.
> > > Now
> > > > if a user is clicking some where outside the tree item, he will see a
> > > popup
> > > > menu appearing below the item gettng selected. This he wont feel as a
> > > normal
> > > > behavior.
> >
> > > > Hope you understood my point.
> >
> > > > - Litty
> >
> > > > On Thu, Nov 6, 2008 at 9:23 PM, walden <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > It all depends on your expectations ;-).
> >
> > > > > Actually, I do see the logic of selecting the node by clicking a
> spot
> > > > > in the tree whose vertical location is unambiguously associated
> with
> > > > > that node.  My real question to you now is this: what is your
> > > > > particular use case?  What is it you cannot do because of this
> > > > > "feature"?
> >
> > > > > Also, I suggest you look at the code in the Tree widget where
> ONCLICK
> > > > > is handled (onBrowserEvent).  You will see that the Tree
> > > > > implementation traps click events at the top level and goes to
> quite a
> > > > > bit of trouble to resolve them to a tree item.  If you need to
> change
> > > > > this, it may not be easy.
> >
> > > > > Walden
> >
> > > > > On Nov 5, 1:26 pm, "Litty Preeth" <[EMAIL PROTECTED]> wrote:
> > > > > > Walden,
> >
> > > > > > But then a user will expect to select a tree node by clicking on
> the
> > > node
> > > > > > only rite? I dont feel that the node getting selected when you
> click
> > > else
> > > > > > where is an expected behavior.
> >
> > > > > > - Litty
> >
> > > > > > On Wed, Nov 5, 2008 at 10:51 PM, walden <
> [EMAIL PROTECTED]
> >
> > > > > wrote:
> >
> > > > > > > Litty,
> >
> > > > > > > Yeah, I see it now.  It looks as if this is by design.  If you
> need
> > > an
> > > > > > > area to the right of the Tree (outside the Tree but inside the
> > > > > > > ScrollPanel) where you can click without selecting a TreeItem
> > > (why?),
> > > > > > > then you can probably achieve that by setting the Tree's width
> so
> > > it
> > > > > > > does not fill the width of the ScrollPanel.  What effect are
> you
> > > > > > > trying to achieve?
> >
> > > > > > > Walden
> >
> > > > > > > On Nov 5, 8:21 am, "Litty Preeth" <[EMAIL PROTECTED]>
> wrote:
> > > > > > > > Hi Walden,
> >
> > > > > > > > I tried using gwt-1.5.2 and gwt-1.5.
> >
> > > > > > > > If gwt-1.5.2 is used on IE6 it happens only for the child
> node.
> > > Root
> > > > > > > level
> > > > > > > > nodes are working fine. But on IE7 and Firefox it is
> reproducible
> > > for
> > > > > all
> > > > > > > > the nodes.
> >
> > > > > > > > If gwt-1.5 is used on IE6 everything works fine. But on
> Firefox
> > > it is
> > > > > > > > reproducible for all the nodes.
> >
> > > > > > > > You can use this code below to reproduce the issue.
> >
> > > > > > > > TreeTest.java
> > > > > > > > package com.test.client;
> >
> > > > > > > > import com.google.gwt.core.client.EntryPoint;
> > > > > > > > import com.google.gwt.user.client.Window;
> > > > > > > > import com.google.gwt.user.client.ui.RootPanel;
> > > > > > > > import com.google.gwt.user.client.ui.Tree;
> > > > > > > > import com.google.gwt.user.client.ui.TreeItem;
> > > > > > > > import com.google.gwt.user.client.ui.TreeListener;
> >
> > > > > > > > /**
> > > > > > > >  * Entry point classes define <code>onModuleLoad()</code>.
> > > > > > > >  */
> > > > > > > > public class TreeTest implements EntryPoint {
> >
> > > > > > > >     Tree myTree;
> >
> > > > > > > >     /**
> > > > > > > >      * This is the entry point method.
> > > > > > > >      */
> > > > > > > >     public void onModuleLoad() {
> > > > > > > >         myTree = new Tree();
> > > > > > > >         for (int i = 0; i < 10; i++) {
> > > > > > > >             TreeItem prItm = new TreeItem("Parent_" + i);
> > > > > > > >             TreeItem chItm = new TreeItem("Child_" + i);
> > > > > > > >             prItm.addItem(chItm);
> > > > > > > >             myTree.addItem(prItm);
> > > > > > > >         }
> > > > > > > >         myTree.addTreeListener(treeListener);
> > > > > > > >         RootPanel.get().add(myTree);
> > > > > > > >     }
> >
> > > > > > > >     TreeListener treeListener = new TreeListener() {
> > > > > > > >         public void onTreeItemSelected(TreeItem item) {
> > > > > > > >             Window.alert(item.getText() + " selected");
> > > > > > > >         }
> >
> > > > > > > >         public void onTreeItemStateChanged(TreeItem item) {
> > > > > > > >             // TODO Auto-generated method stub
> > > > > > > >         }
> > > > > > > >     };
> >
> > > > > > > > }
> >
> > > > > > > > TreeTest.css
> > > > > > > > .gwt-Tree {
> > > > > > > >     border: 1px solid blue;
> > > > > > > >     margin-left: 30px;
> >
> > > > > > > > }
> >
> > > > > > > > .gwt-Tree .gwt-TreeItem {
> > > > > > > >     border: 1px solid red;
> >
> > > > > > > > }
> >
> > > > > > > > - Litty
> >
> > > > > > > > On Wed, Nov 5, 2008 at 2:27 AM, walden <
> > > [EMAIL PROTECTED]>
> > > > > > > wrote:
> >
> > > > > > > > > What version of GWT are you using?  I'm trying the same
> thing
> > > in
> > > > > the
> > > > > > > > > GWT showcase and not getting the result you are.
> >
> > > > > > > > > On Nov 4, 10:51 am, "Litty Preeth" <[EMAIL PROTECTED]>
> > > wrote:
> > > > > > > > > > Hi Walden,
> >
> > > > > > > > > > I put a border to the TreeItem and also a border to the
> tree
> > > > > itself.
> > > > > > > So
> > > > > > > > > if I
> > > > > > > > > > click outside the border of the TreeItem, but inside the
> > > border
> > > > > of
> > > > > > > the
> > > > > > > > > tree;
> > > > > > > > > > the item in the vertical level where I click gets
> selected.
> >
> > > > > > > > > > - Litty
> >
> > > > > > > > > > On Tue, Nov 4, 2008 at 9:10 PM, walden <
> > > > > [EMAIL PROTECTED]>
> > > > > > > > > wrote:
> >
> > > > > > > > > > > Litty,
> >
> > > > > > > > > > > How can you be sure you are actually clicking outside
> the
> > > > > TreeItem?
> >
> > > > > > > > > > > Walden
> >
> > > > > > > > > > > On Nov 4, 12:27 am, Litty Preeth <
> [EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > > > > > > > Hi All,
> >
> > > > > > > > > > > > I have a Tree on my page which I have added into a
> > > > > ScrollPanel.
> > > > > > > My
> > > > > > > > > > > > problem is that if I click even outside the TreeItem
> (but
> > > > > within
> > > > > > > the
> > > > > > > > > > > > scrollpanel) the item is getting selected
> > > (onTreeItemSelected
> > > > > of
> > > > > > > the
> > > > > > > > > > > > TreeListener gets fired). Please help me on this
> issue.
> >
> > > > > > > > > > > > Thanks in advance,
> > > > > > > > > > > > Litty- Hide quoted text -
> >
> > > > > > > > > > - Show quoted text -- Hide quoted text -
> >
> > > > > > > > - Show quoted text -- Hide quoted text -
> >
> > > > > > - Show quoted text -- Hide quoted text -
> >
> > > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to