Add event listener to SpanElement

2010-03-17 Thread Yossi
Hi

I have a widget TableElement. One of its cells contains SpanElment. No
matter what I tried I did not manage to add onClick listener to this
cell.

Can someone please explain how this could be achieved?

Thanks

-- 
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-tool...@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.



Re: Is it possible to set an onLoad event listener on an IFrameElement?

2009-07-17 Thread Jason Morris

Hi Jake,

Unfortunately the DOM structure is bound more to the JavaScript way of doing 
things than Widgets. In 
JavaScript you can't have more than one event listener (of a given event type) 
per element, while 
Widgets may have any number.

So to work around this: GWT Widgets are the only listeners on their nested 
Element object (notice 
they implement the com.google.gwt.user.client.EventListener interface). SO when 
they receive an 
event from the browser, they decode it into a DOMEvent and dispatch it to all 
the Handlers 
registered for that Widget.

Unfortunately there is no simple way to deal with this on the DOM nodes 
themselves, and in 
particular there is no simple way to deal with IFrame loading events. If you 
take a look at how 
FormPanel receives loading events from it's hidden IFrame there are two 
different implementations 
(one for IE6, and the generic implementation).

For normal browsers(com.google.gwt.user.client.ui.impl.FormPanelImplIE6), the 
event is hooked using:
iframe.onload = function() {
IE6 (com.google.gwt.user.client.ui.impl.FormPanelImplIE6) looks like:
iframe.onreadystatechange = function() {
if (iframe.readyState == 'complete') {

Both implementations also ensure that they unhook the events, by assigning 
the listener function 
to null (see FormPanel.onAttach / onDetach). I would consider extending the 
Frame Widget rather than 
using the DOM api directly. Widgets provide loads of useful safety nets that 
you otherwise need to 
write yourself (including attaching multiple Handlers to the element).

Hope this Helps.
//J

Jake wrote:
 Hi all,
 
 I just have a quick question: I know that GWT presents a fairly low-
 level DOM API that wraps native DOM objects. What I'd like to do is
 create a new iframe element, and then set a DOM onLoad listener on it
 so that I can then manipulate the iframe's internal document (its
 contentDocument). It's very easy for me to imagine how to implement
 this, except for the fact that I cannot find a way to set any kind of
 a listener on any of the DOM objects exposed by GWT. I found some blog
 posts that mentioned that GWT's method of event handling had changed
 in 1.6 [0][1], but I'm not sure if that applies only to classes that
 extend Widget, or to the wrapped DOM objects as well. Hopefully I'm
 just missing them.
 
 I'd greatly appreciate any guidance anyone can offer. Thanks,
 
 Jake
 
 [0] 
 http://lemnik.wordpress.com/2009/03/04/gwts-new-event-model-handlers-in-gwt-16/
 [1] http://lemnik.wordpress.com/2009/03/12/using-event-handlers-in-gwt-16/
  
 

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Is it possible to set an onLoad event listener on an IFrameElement?

2009-07-16 Thread Jake

Hi all,

I just have a quick question: I know that GWT presents a fairly low-
level DOM API that wraps native DOM objects. What I'd like to do is
create a new iframe element, and then set a DOM onLoad listener on it
so that I can then manipulate the iframe's internal document (its
contentDocument). It's very easy for me to imagine how to implement
this, except for the fact that I cannot find a way to set any kind of
a listener on any of the DOM objects exposed by GWT. I found some blog
posts that mentioned that GWT's method of event handling had changed
in 1.6 [0][1], but I'm not sure if that applies only to classes that
extend Widget, or to the wrapped DOM objects as well. Hopefully I'm
just missing them.

I'd greatly appreciate any guidance anyone can offer. Thanks,

Jake

[0] 
http://lemnik.wordpress.com/2009/03/04/gwts-new-event-model-handlers-in-gwt-16/
[1] http://lemnik.wordpress.com/2009/03/12/using-event-handlers-in-gwt-16/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Event/Listener???

2008-12-15 Thread jbroquefere

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
-~--~~~~--~~--~--~---



Re: Event/Listener???

2008-12-15 Thread Arthur Kalmenson

Your example is very vague and hard to follow. However, if you are
asking how to get class A to set a listener on class B, the answer is
to inject class B into class A. Once class A has a reference to class
B, you can add all the listeners you want.

--
Arthur Kalmenson



On Mon, Dec 15, 2008 at 3:53 AM, jbroquefere
jeanbaptiste.roquef...@gmail.com wrote:

 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
-~--~~~~--~~--~--~---



Re: Event/Listener???

2008-12-15 Thread jbroquefere

thanks for that tip

On Dec 15, 3:06 pm, Arthur Kalmenson arthur.k...@gmail.com wrote:
 Your example is very vague and hard to follow. However, if you are
 asking how to get class A to set a listener on class B, the answer is
 to inject class B into class A. Once class A has a reference to class
 B, you can add all the listeners you want.

 --
 Arthur Kalmenson

 On Mon, Dec 15, 2008 at 3:53 AM, jbroquefere

 jeanbaptiste.roquef...@gmail.com wrote:

  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
-~--~~~~--~~--~--~---



Re: Event/Listener???

2008-12-14 Thread Arthur Kalmenson

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
-~--~~~~--~~--~--~---



Event/Listener???

2008-12-13 Thread jbroquefere

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
-~--~~~~--~~--~--~---



Re: Event/Listener???

2008-12-13 Thread mikedshaf...@gmail.com

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
-~--~~~~--~~--~--~---



Re: Event/Listener???

2008-12-13 Thread jbroquefere

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
-~--~~~~--~~--~--~---



Re: Event/Listener???

2008-12-13 Thread jbroquefere

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
-~--~~~~--~~--~--~---