Basically, you could use Command pattern to tie out the widgets from
command actions.

[example] So, there are 4 different widgets (2 links, a button and a
key listener) that trigger the same action .

This may be a good practice.

http://en.wikipedia.org/wiki/Command_pattern

On May 1, 7:48 pm, Jason Essington <[email protected]> wrote:
> The problem is that an object cannot exist in two locations at the  
> same time ... Really, don't you wish you could be at the bar, at the  
> same time you are at home fixing the dishwasher (you're happy, wife's  
> happy)?
>
> The same applies to DOM your <div>|</div> cannot be in two places at  
> once, you can create additional <div>s that look the same, but you  
> can't put the same one in two places.
>
> So, the second time you menu.add(separator) it is automagically moved  
> as that is easier than folding space so it can be in two places at once.
>
> -jason
>
> On May 1, 2009, at 4:12 AM, hezjing wrote:
>
> > Hi
>
> > I want to create a menu contains hyperlinks, and looks like "About  
> > us | Register | Login".
>
> > Here is my code:
>
> >         Hyperlink about = new Hyperlink("About us", "about");
> >         Hyperlink register = new Hyperlink("Register", "register");
> >         Hyperlink login = new Hyperlink("Login", "login");
>
> >         // create a label to show the separator "|"
> >         Label separator = new Label("|");
> >         separator.addStyleName("menu");
>
> >         HorizontalPanel menu = new HorizontalPanel();
> >         menu.add(about);
>
> >         // add the label "|" the 1st time
> >         menu.add(separator);
> >         menu.add(register);
>
> >         // add the label "|" the 2nd time
> >         menu.add(separator);
> >         menu.add(login);
>
> > The first label (or the separator) does not show up :-(
> > It seems that we cannot add a same label more than once.
>
> > The label does nothing but merely to show the separators, do we have  
> > other choice except to create a new label for every separator?
>
> > --
>
> > Hez
--~--~---------~--~----~------------~-------~--~----~
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