Thanks. But i suppose i havent been well understood.
I mean, what you told me works when widgets are in a same class.
What i need is to BUILD a couple event/listener.
i want something like that

Class1.java (Singleton (static))

MyObject myObject = new MyObject();

Class2.java (non static)
Class1.getInstance().myObject.addMyObjectListener(new MyObjectListener
(){
      public void onMyObjectChanged(MyObjectChangedEvent event){
            //HERe access to a widget in Class2
      }
});

Class3.java (non static)
Class1.getInstance().myObject.setValue("blabla");

(in MyObject, method setValue(String blabla) might call something like
fireChangedEvent(); which will notidy every listeners that value has
changed)

I do this using awt/swt and i wanted to do that in GWT to use NON
static method.

or maybe is there an other way to access widget of an other class,
when i click on a treenode ?

On Dec 15, 3:42 am, "Arthur Kalmenson" <arthur.k...@gmail.com> wrote:
> That's exactly how listeners work. Let's say you have a Button,
> TextBox and a Label. Each time the Button is pressed, you want the
> Label to display the text in the TextBox. You would do some like the
> following:
>
> TextBox text = new TextBox();
> Label display = new Label();
> Button button = new Button();
>
> // now you need to add the listeners
> button.addClickListener(new ClickListener() {
>   onClick(Widget arg0) {
>     display.setText(text.getText());
>   }
>
> });
>
> RootPanel.add(text);
> RootPanel.add(display);
> RootPanel.add(button);
>
> Keep in mind that if you want the TextBox and the Label to be
> accessible from the anonymous inner class, you'll need to make them
> fields or final (they can't be local variables).
>
> --
> Arthur Kalmenson
>
> On Sat, Dec 13, 2008 at 4:26 PM, jbroquefere
>
> <jeanbaptiste.roquef...@gmail.com> wrote:
>
> > just a little problem, i WONT have to use static method...
> > I wanted to do something like, in awt/swt, when i fire an event in a
> > class, and i listen to it in an other.
> > Is thre a way to create listeners/event ?
>
> > On 13 déc, 21:45, jbroquefere <jeanbaptiste.roquef...@gmail.com>
> > wrote:
> >> Thank's a lot, exactly what i need.
> >> I just had to seek a little more
>
> >> On 13 déc, 19:47, "mikedshaf...@gmail.com" <mikedshaf...@gmail.com>
> >> wrote:
>
> >> > Take a look inside the mail application that is included with GWT.
> >> > It's in /samples directory.  It's a great example of exactly what
> >> > you're describing.
>
> >> > It's also here:
>
> >> >http://code.google.com/webtoolkit/examples/
>
> >> > Later,
>
> >> > Shaffer
>
> >> > On Dec 13, 9:46 am, jbroquefere <jeanbaptiste.roquef...@gmail.com>
> >> > wrote:
>
> >> > > Hello,
> >> > > my question is simple : How could I call an action when, for exemple,
> >> > > i click on a TreeNode?
> >> > > The situation is 2 class, a tree in the first one, an empty panel in
> >> > > the second one. when i clik on a node, i want to open a Window, or
> >> > > Panel, or Portlet, or, etc... in the empty panel (that is done by a
> >> > > functio in the empty panel' class). but i dont know how to do. maybe
> >> > > using event?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to