You should only need one html page. This is the main html page that
you already have in your project. If you have done swing work, think
of that html page as your JFrame if you will.

I'll run through a simple example that should at least get you on your
feet.

Your html page could define the basic skeleton layout of your app, say
a header at the top, a panel of your links right under it, and the
rest of the bottom portion of the page is content that will change
dynamically depending on the link clicked.

In your html page you could define <div>'s that define where these
panels will go and give them an identifier id.

<div class="header" id="header"></div>
<div class="linksPanel" id="linksPanel"></div>
<div class="contentPanel" id="contentPanel"></div>

 In your corresponding css file, add the necessary definitions to
layout your page, size, borders, etc of each div.

First you could create a class called MyContentPanel. It could be a
singleton with static methods of getInstance() and replaceContent().
This was you will have 1 content panel you can access statically.

public class MyContentPanel extends VerticalPanel
{
  private static MyContentPanel INSTANCE = null;

  // do not allow outside instantiation
  private MyContentPanel()
  {
    //do layout panel stuff etc
  }

  public synchronized static MyContentPanel getInstance()
  {
    if (INSTANCE==null)
      INSTANCE = new MyContentPanel();
    return INSTANCE;
  }

  public static void replaceContent(Widget widget)
  {
     MyContentPanel content = getInstance();
       ..
      remove all current children using getWidgetCount and remove(int)
or remove(Widget)
      ..
      content.add(widget);

  }
}



For your link section, you could create a class called MyLinkPanel
that extends Composite (or maybe HorizontalPanel, etc) that defines
your link panel. You could set up handlers on the links that would be
responsible for firing an event to show a particular page in the
MyContentPanel.

Lets say when you click link1, it needs to show a particular page in
the ContentPanel. Well, create your page again as a class that extends
again, Composite or some panel or whatever. Lets say we call it
MyLoginPage. On the handler on link1 could make a static call to pop
it on the content panel like so:

 MyContentPanel.replaceContent(new MyLoginPage());


Lets say your app is called MyApp, you will have a MyApp.java file
that implements EntryPoint where you will implement the method
onModuleLoad(). This would be responsible do initializing your app by


public class MyApp implements EntryPoint
{
  public void onModuleLoad( )
  {
    RootPanel.get("header").add(new HeaderPanel());
    RootPanel.get("linkPanel").add(new MyLinkPanel());

    // add the singleton panel to the contentPanel div
    RootPanel.get("contentPanel").add(ContentPanel.getInstance());
  }
}



Now that the framework is defined, you can just create new panels
instead of HTML pages and put them in the content panel by calling the
static ContentPanel.replaceContent(widget) method.

Remember, think java, not html. It's kind of why GWT was invented :)



On Aug 11, 2:01 pm, Alexei Telles <alexeitel...@gmail.com> wrote:
> Hello everybody..
>
> I am just beginning with GWT development and this is my first post.
> I have some experience with web development.
>
> I am using Eclipse as IDE for developing.
> I created an GWT project using the GWT plugin for Eclipse.
>
> So far, so good...
> Eclipse created the packages, classes, etc..
>
> I am able to change the client and the server-side, make deploy on
> tomcat.
> Everithing is working fine.
>
> My question is:
>
> I need to develop an application that will heavy many pages.
> Do I need one GWT project to each page of my application?
> Or can I have many HTML's in my WAR folder and only one project?
>
> My idea is to have some links in the top of these pages.
> Each link to a page of the application.
>
> I am not sure how to do that.
> I've searching for in the web, but I got nothing about.
>
> Can anybody give me a little help about?
>
> Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
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