gwt - Create custom widget and allow nested sub-elements in UiBinder -
I want to create a custom widget that allows the UIB to specify its nested sub-element in inder like Dockpanel may be
south
, answer
, etc. I looked at the source code of DockPanel
but found a solution.
& lt; My: LeftRightToolbar & gt; & Lt; Left & gt; & Lt; Six buttons / & gt; & Lt; / Left & gt; & Lt; True & gt; & Lt; Six buttons / & gt; & Lt; / True & gt; & Lt; / Mary: LeftRightToolbar & gt; My custom & lt; Left & gt;
and & lt; Right>
can have multiple sub-nodes
update: code>? Code if I add more than one widget does not compile.
First of all - and lieutenant; Left & gt;
and & lt; True & gt;
should be in the same namespace as the LeftRightToolbar
, so it
& lt; My: right>
.
Secondly, you need to annotate two methods in LeftRightToolbar
with comment:
@iChild (tagname = "left") Add Zero (widget widget) {left.add (widget); } @IiChild (tagname = "right") Zero addToRight (widget widget) {right.add (widget); }
Method addToLeft
to & lt; My: left & gt; The
tag will be asked to add the specified widget & lt; My: right> The
tag is controlled by the addToRight
.
If you want to add multiple widgets to your custom tags, then in the container, like FlopNell
.
Comments
Post a Comment