11 Jul 2012 4:22 PM #1
possible to Extend a GXT 3.0 Widget, then use uiBinder?
I am extending the GXT Window widget, to build a custom dialog, which works just fine. I'm extending Window, because Dialog really only supports a set of predefined buttons, and I want a resusable Widget class.
I'd like to use UiBinder, and define the layout in the xml file, instead of creating it all through Java code. Does not seem possible though, because the UiBinder support is in the GWT Composite class (subclass of Widget), but the GXT 3.0 Window widget is a subclass of Widget (not Composite). So I can't write a statement like:
initWidget (uiBinder.createAndBindUi (this)); //initWidget inherits from Composite, not Widget
It's not the end of the world, but would be cleaner if I could use UiBinder to define the layout.
12 Jul 2012 5:00 AM #2
UiBinder does *not* depend on Composite. You can use it anywhere you can use a widget (assuming you are building Widgets in your ui.xml file).
Uses ui:field on root widget in ui.xml:
Keeps value of createAndBind and returns it
12 Jul 2012 8:59 AM #3
thanks, that works perfect.
One more related question....the GXT Window widget has a ButtonBar, and from the code side, it's easy to just add a button by writing: buttonBar.add(widget);
Is that possible in uiBinder, or do buttons in the ui.xml file just go there. Looking the HelloWindowUiBinder example right now, seems like the Close button just magically winds up right justified in the window, not sure if it's in the button bar, or not, but there's nothing in the example ui.xml that would specify that.