i'm moving my first steps with gwt to create a simple website. i'm trying to use gwt platform and the gwt designer to create the layouts. the site is so simple that lots of pages have the same layout and differ only for what's in the middle, so i had a "brilliant" idea: why don't u create a general layout in the form of a composite and add in the middle of this composite a simplepanel, so u can add what's different in each page just there. i created the composite and i put a simplepanel in it, but even if i exposed the widget the gwt designer does not let me add any other widget inside this panel when i'm creating the other ui-binder views. am i forgetting something? thx a lot
how to create a composite with a working pane in it
206 views Asked by user888284 At
2
There are 2 answers
0

If you want to have a Composite used in UiBinder that behaves like a panel, you'll have to create a custom element parser for it, but the problem is that there's no public API for doing this in GWT (as of 2.4.0). Maybe gwt-customuibinder can help with that. The alternative is to implement HasWidgets since there's a built-in parser for that.
I'm not sure you should be going the route of trying to create your own
Composite
widget for this purpose. What you described is exactly whatDockLayoutPanel
was created for. Basically, you want a (relatively) constantnorth
(probably logo, possibly navigation),south
(footer of some sort), and maybeeast
/west
for side bars or what have you, and acenter
which changes to display the "current page". There are a great deal of examples ofDockLayoutPanel
being used in this manner- even the Javadoc has a great one. You could easily add a panel to thecenter
, and use that panel as your "main panel".If you want to create your own
Composite
widget which can have some arbitrary children widgets and be used by GWT Designer, you've got a lot of work ahead of you.