You can do it either way depending upon your requirements. If you want your
widgets to maintain their state use singletons with a POJO getter factory
method which is easy to implement. For example, let's say you have a
composite widget YourWidgetClass. Just add the following code to it.
private static YourWidgetClass instance = null;
public static YourWidgetClass getInstance(){
if(null == instance){
instance = new YourWidgetClass(); // or a non default constructor
if you require
}
return instance;
}
private YourWidgetClass(){} // make all your constructors private
Now anywhere you need to reference YourWidgetClass you do so by calling
YourWidgetClass.getInstance() instead of its constructor. Because
YourWidgetClass is now a singleton whatever state it maintains will always
be available.
Jeff
On Wed, Oct 27, 2010 at 7:05 AM, Pablo G.F <[email protected]> wrote:
> I´m a newbie to GWT.
> My scenario is:
>
> My project is a web application. My idea is using a top menubar, with
> some menuItems. Click on one of this menuItems, will "open" a widget
> like a search form with a grid to show results, another kind of form,
> etc. Like if a regular web page with links in a menu bar on top.
> I have to main questions:
>
> a) In case of implementing this with pure GWT, the menu and the pages
> (by pages in this case I mean , widgets composite by forms, grids ,
> etc ). Have I to create all widgets and show/hide them depending on
> the menuItem clicked, or can I create / delete dinamically? Because
> creating them it´s obviously inefficient.
>
> b) I think it would be easier if the menu loads .html pages with GWT
> widgets on them. So the widget loads when the html page loads. But I
> don´t know if this is possible and how to do it with GWT (I mean, the
> menubar made in GWT, acting like a regular HTML menu, like using
> links).
>
> Sorry if it´s not very clear what I´m trying to say, (because I know
> it isnt), but I don´t know exaclty where to start or what to do
> exaclty.
>
> In resume, i want a web application with a menu where to select what
> part of my application to show.
>
> Thanks, and sorry for my English ;)
>
> --
> 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]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
Jeff
--
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.