how to make communicate "two rootPanels"?

3 views
Skip to first unread message

loveley

unread,
Nov 26, 2009, 11:18:12 AM11/26/09
to google-we...@googlegroups.com
hi,

I think I found a method to have some GWT components on a HTML page,
nothing miraculous : I create the components in eclipse, assign them to
a RootPanel.get("truc"); and in the HTML page generated by eclipse I add
a div with the id="truc".
If I want to modify the HTML page I only have to keep the script tag and
the id I mentioned above.

but I have a question : is there a way to make two components (ie
identified by its rootPanel) communicate, in the java code and in a way
that e.g. in a first component I enter in a textBox a string "abc", I
click on a button in this component, and immediately the second
component's label has as text the content of the textBox?

thank you,

olivier.








___________________________________________________________________________
Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail et son interface r�volutionnaire.
http://fr.mail.yahoo.com

Jeune

unread,
Nov 29, 2009, 12:27:35 AM11/29/09
to Google Web Toolkit
Just reading your question, I think it's possible. I am doing
something similar right now.
I put values in a hidden input box with an id and then I add a click
handler to a button in a panel. When I click the button it gets the
values in the hidden input box and displays them in the panel.
> Yahoo! Mail r invente le mail ! D couvrez le nouveau Yahoo! Mail et son interface r volutionnaire.http://fr.mail.yahoo.com

loveley

unread,
Nov 29, 2009, 2:19:32 PM11/29/09
to google-we...@googlegroups.com
hello,

thank you, but I did not really understand what you mean. the hidden
input box , it's an HTML component or is it coded in GWT?and if it is in
GWT, is it an an other root panel?

olivier.

Jeune a �crit :
> --
>
> 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-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>





___________________________________________________________________________
Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail et son interface r�volutionnaire.
http://fr.mail.yahoo.com

Jose Luis Roberto Asuncion

unread,
Nov 29, 2009, 3:00:46 PM11/29/09
to google-we...@googlegroups.com
Hi, the hidden input box is coded in the HTML page generated from GWT. But it's not what you need. 

You need a textbox where you want to input something. So put it in the HTML page and give it an id. 

Back in GWT, retrieve the contents of the text box and then make a new panel, put the contents of the text box there and then add it to the root panel. 

On Mon, Nov 30, 2009 at 3:19 AM, loveley <lolv...@yahoo.fr> wrote:
hello,

thank you, but I did not really understand what you mean. the hidden
input box , it's an HTML component or is it coded in GWT?and if it is in
GWT, is it an an other root panel?

olivier.

Jeune a écrit :
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.

loveley

unread,
Nov 29, 2009, 9:03:23 PM11/29/09
to google-we...@googlegroups.com
hi,
ok, but how to "Back in GWT, retrieve the contents of the text box"?
what is the statement?

olivier.

Jose Luis Roberto Asuncion a �crit :
> Hi, the hidden input box is coded in the HTML page generated from GWT.
> But it's not what you need.
>
> You need a textbox where you want to input something. So put it in the
> HTML page and give it an id.
>
> Back in GWT, retrieve the contents of the text box and then make a new
> panel, put the contents of the text box there and then add it to the
> root panel.
>
> - Jeune
> http://jeungun.wordpress.com
>
>
> On Mon, Nov 30, 2009 at 3:19 AM, loveley <lolv...@yahoo.fr
> <mailto:lolv...@yahoo.fr>> wrote:
>
> hello,
>
> thank you, but I did not really understand what you mean. the hidden
> input box , it's an HTML component or is it coded in GWT?and if it
> is in
> GWT, is it an an other root panel?
>
> olivier.
>
> Jeune a �crit :
> > Just reading your question, I think it's possible. I am doing
> > something similar right now.
> > I put values in a hidden input box with an id and then I add a click
> > handler to a button in a panel. When I click the button it gets the
> > values in the hidden input box and displays them in the panel.
> >
> >
> > On Nov 27, 12:18 am, loveley <lolve...@yahoo.fr
> <mailto:google-we...@googlegroups.com>.
> > To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com
> <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
> >
> >
> >
> >
>
>
>
>
>
> ___________________________________________________________________________
> Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail
> et son interface r�volutionnaire.
> http://fr.mail.yahoo.com
>
> --
>
> 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-we...@googlegroups.com
> <mailto:google-we...@googlegroups.com>.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com
> <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>
> --
>
> 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-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.





___________________________________________________________________________
Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail et son interface r�volutionnaire.
http://fr.mail.yahoo.com

Jose Luis Roberto Asuncion

unread,
Nov 30, 2009, 12:29:42 AM11/30/09
to google-we...@googlegroups.com
Oh I see, what I meant was if this was your code in the html:

<input type="text" value="" id="my_textbox">

in the GWT entry point class, 

place a button beside that textbox and add a Click Handler 

Button button = new Button("click here");
button.addClickHandler(new ButtonClickHandler());

RootPanel.get().add(button);

public class ButtonClickHandler implements ClickHandler(){
    public void onClick(ClickEvent e){
         String textInInputBox =
                RootPanel.get("my_textbox").getElement().getAttribute("value");
                RootPanel.get().add(new Label(StringInInputBox));
    }
}

Notice that in the click handler I try to retrieve the contents of your input box by getting it by its Id using RootPanel. You can also use the DOM class to do this if that doesn't work.

Best,

Jeune

On Mon, Nov 30, 2009 at 10:03 AM, loveley <lolv...@yahoo.fr> wrote:
hi,
ok, but how to "Back in GWT, retrieve the contents of the text box"?
what is the statement?

olivier.

Jose Luis Roberto Asuncion a écrit :

> Hi, the hidden input box is coded in the HTML page generated from GWT.
> But it's not what you need.
>
> You need a textbox where you want to input something. So put it in the
> HTML page and give it an id.
>
> Back in GWT, retrieve the contents of the text box and then make a new
> panel, put the contents of the text box there and then add it to the
> root panel.
>
> - Jeune
> http://jeungun.wordpress.com
>
>
> On Mon, Nov 30, 2009 at 3:19 AM, loveley <lolv...@yahoo.fr
> <mailto:lolv...@yahoo.fr>> wrote:
>
>     hello,
>
>     thank you, but I did not really understand what you mean. the hidden
>     input box , it's an HTML component or is it coded in GWT?and if it
>     is in
>     GWT, is it an an other root panel?
>
>     olivier.
>
>     Jeune a écrit :
>     Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail
>     et son interface révolutionnaire.

>     http://fr.mail.yahoo.com
>
>     --
>
>     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-we...@googlegroups.com
>     <mailto:google-we...@googlegroups.com>.
>     To unsubscribe from this group, send email to
>     google-web-tool...@googlegroups.com
>     <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>.
>     For more options, visit this group at
>     http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>
> --
>
> 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-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.





___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

philippe

unread,
Nov 30, 2009, 4:56:32 AM11/30/09
to Google Web Toolkit
Hi Olivier,

I suggest you rather use an object that will keep a reference to your
widget.

Thus, you can access them without going through the rootPanel.

ex:

class ElementsManager() {
private final TextBox myBox;
public ElementsManager() {
super();
myBox = new TextBox(...)
}
public String getTextOfMyBox() {
return this.myBox.getText();
}
...
}





On 30 nov, 06:29, Jose Luis Roberto Asuncion <jose.asunc...@gmail.com>
wrote:
> Oh I see, what I meant was if this was your code in the html:
>
> <input type="text" value="" id="my_textbox">
>
> in the GWT entry point class,
>
> place a button beside that textbox and add a Click Handler
>
> Button button = new Button("click here");
> button.addClickHandler(new ButtonClickHandler());
>
> RootPanel.get().add(button);
>
> public class ButtonClickHandler implements ClickHandler(){
>     public void onClick(ClickEvent e){
>          String textInInputBox =
>
>  RootPanel.get("my_textbox").getElement().getAttribute("value");
>                 RootPanel.get().add(new Label(StringInInputBox));
>     }
>
> }
>
> Notice that in the click handler I try to retrieve the contents of your
> input box by getting it by its Id using
> RootPanel<http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...>.
> You can also use the
> DOM<http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g...>class
> to do this if that doesn't work.
>
> Best,
>
> Jeunehttp://jeungun.wordpress.com
>
> On Mon, Nov 30, 2009 at 10:03 AM, loveley <lolve...@yahoo.fr> wrote:
> > hi,
> > ok, but how to "Back in GWT, retrieve the contents of the text box"?
> > what is the statement?
>
> > olivier.
>
> > Jose Luis Roberto Asuncion a écrit :
> > > Hi, the hidden input box is coded in the HTML page generated from GWT.
> > > But it's not what you need.
>
> > > You need a textbox where you want to input something. So put it in the
> > > HTML page and give it an id.
>
> > > Back in GWT, retrieve the contents of the text box and then make a new
> > > panel, put the contents of the text box there and then add it to the
> > > root panel.
>
> > > - Jeune
> > >http://jeungun.wordpress.com
>
> > >     google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>
> > >     <mailto:google-web-toolkit%2Bunsu...@googlegroups.com<google-web-toolkit%252Buns...@googlegroups.com>
> > >.
> > >     > For more options, visit this group at
> > >    http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > ___________________________________________________________________________
> > >     Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail
> > >     et son interface révolutionnaire.
> > >    http://fr.mail.yahoo.com
>
> > >     --
>
> > >     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-we...@googlegroups.com
> > >     <mailto:google-we...@googlegroups.com>.
> > >     To unsubscribe from this group, send email to
> > >     google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>
> > >     <mailto:google-web-toolkit%2Bunsu...@googlegroups.com<google-web-toolkit%252Buns...@googlegroups.com>
> > >.
> > >     For more options, visit this group at
> > >    http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > > --
>
> > > 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-we...@googlegroups.com
> > .
> > > To unsubscribe from this group, send email to
> > > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>
> > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > ___________________________________________________________________________
> > Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son
> > interface révolutionnaire.
> >http://fr.mail.yahoo.com
>
> > --
>
> > 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-we...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>

loveley

unread,
Nov 30, 2009, 6:48:23 AM11/30/09
to google-we...@googlegroups.com
thanks, it is really what I was searching for.

olivier.

Jose Luis Roberto Asuncion a �crit :
> Oh I see, what I meant was if this was your code in the html:
>
> <input type="text" value="" id="my_textbox">
>
> in the GWT entry point class,
>
> place a button beside that textbox and add a Click Handler
>
> Button button = new Button("click here");
> button.addClickHandler(new ButtonClickHandler());
>
> RootPanel.get().add(button);
>
> public class ButtonClickHandler implements ClickHandler(){
> public void onClick(ClickEvent e){
> String textInInputBox =
>
> RootPanel.get("my_textbox").getElement().getAttribute("value");
> RootPanel.get().add(new Label(StringInInputBox));
> }
> }
>
> Notice that in the click handler I try to retrieve the contents of
> your input box by getting it by its Id using RootPanel
> <http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/RootPanel.html>.
> You can also use the DOM
> <http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/DOM.html>
> class to do this if that doesn't work.
>
> Best,
>
> Jeune
> http://jeungun.wordpress.com
>
> On Mon, Nov 30, 2009 at 10:03 AM, loveley <lolv...@yahoo.fr
> <mailto:lolv...@yahoo.fr>> wrote:
>
> hi,
> ok, but how to "Back in GWT, retrieve the contents of the text box"?
> what is the statement?
>
> olivier.
>
> Jose Luis Roberto Asuncion a �crit :
> > Hi, the hidden input box is coded in the HTML page generated
> from GWT.
> > But it's not what you need.
> >
> > You need a textbox where you want to input something. So put it
> in the
> > HTML page and give it an id.
> >
> > Back in GWT, retrieve the contents of the text box and then make
> a new
> > panel, put the contents of the text box there and then add it to the
> > root panel.
> >
> > - Jeune
> > http://jeungun.wordpress.com
> >
> >
> > On Mon, Nov 30, 2009 at 3:19 AM, loveley <lolv...@yahoo.fr
> <mailto:lolv...@yahoo.fr>
> > <mailto:lolv...@yahoo.fr <mailto:lolv...@yahoo.fr>>> wrote:
> >
> > hello,
> >
> > thank you, but I did not really understand what you mean.
> the hidden
> > input box , it's an HTML component or is it coded in GWT?and
> if it
> > is in
> > GWT, is it an an other root panel?
> >
> > olivier.
> >
> > Jeune a �crit :
> > > Just reading your question, I think it's possible. I am doing
> > > something similar right now.
> > > I put values in a hidden input box with an id and then I
> add a click
> > > handler to a button in a panel. When I click the button it
> gets the
> > > values in the hidden input box and displays them in the panel.
> > >
> > >
> > > On Nov 27, 12:18 am, loveley <lolve...@yahoo.fr
> <mailto:lolve...@yahoo.fr>
> > <mailto:google-we...@googlegroups.com
> <mailto:google-we...@googlegroups.com>>.
> > > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com
> <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>
> > <mailto:google-web-toolkit%2Bunsu...@googlegroups.com
> <mailto:google-web-toolkit%252Buns...@googlegroups.com>>.
> > > For more options, visit this group at
> > http://groups.google.com/group/google-web-toolkit?hl=en.
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> ___________________________________________________________________________
> > Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail
> > et son interface r�volutionnaire.
> > http://fr.mail.yahoo.com
> >
> > --
> >
> > 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-we...@googlegroups.com
> <mailto:google-we...@googlegroups.com>
> > <mailto:google-we...@googlegroups.com
> <mailto:google-we...@googlegroups.com>>.
> > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com
> <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>
> > <mailto:google-web-toolkit%2Bunsu...@googlegroups.com
> <mailto:google-web-toolkit%252Buns...@googlegroups.com>>.
> > For more options, visit this group at
> > http://groups.google.com/group/google-web-toolkit?hl=en.
> >
> >
> >
> >
> > --
> >
> > 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-we...@googlegroups.com
> <mailto:google-we...@googlegroups.com>.
> > To unsubscribe from this group, send email to
> > google-web-tool...@googlegroups.com
> <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> > http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>
>
> ___________________________________________________________________________
> Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail
> et son interface r�volutionnaire.
> http://fr.mail.yahoo.com
>
> --
>
> 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-we...@googlegroups.com
> <mailto:google-we...@googlegroups.com>.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com
> <mailto:google-web-toolkit%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
> --
>
> 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-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.





___________________________________________________________________________
Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail et son interface r�volutionnaire.
http://fr.mail.yahoo.com
Reply all
Reply to author
Forward
0 new messages