tags:

views:

459

answers:

2

Hi,

Warning: Newbie Alert!

I am very new to GWT and are trying to populate the right-hand-side of a HorizontalPanel used in an onModuleLoad() method from another class (containing other widgets) so to keep the code seperate.

What I am trying to acheive is similar to a PHP include where I can alter the code in another class and it will affect the right-hand panel only.

Does this other class have to be a composite widget? Or can I do a similar thing that I do when creating the Entry class?

If so, can anyone recommend a good tutorial example?

Help!

A: 

I'm not sure if you mean you want to load a complete different GWT module on the right-hand panel or simply want to load a different class. I assume the latter.sense.

In such case a GWT TabPanel, but positioned Vertical. This is a combination of a DeckPanel and a TabBarPanel. In GWT there is standard VerticalTabPanel available, but you can find one in the open source cobogw library, see http://www.cobogw.org. An example including source code can be found on the demo page: http://cobogw.googlecode.com/svn/demo/WidgetsDemo.html#VerticalTabPanel

The example also uses a LazyPanel. This means each class is initialized only when the user clicks on the link, which makes startup a lot faster.

Hilbrand
A: 

Just add the reference to the horizontalpanel to some other class (like a controller class or main panel class) and then call into this class from your right side panel. You can even have a controller class that holds this static horizontalpanel with a method like

HorizontalPanel hPanel; //set this from on module load, or controller.create method for instance
public static setRightContents(Panel panel){ 
hPanel.add(panel)
}

and just call this from the other class Controller.setRightContents(myNewRightPanel).

Really you just need to stop thinking this is a website and start thinking more of a thick client application using even driven programming.

adrian