Search code examples
javagwtuibinder

How to define placeholders in Ui-Binder?


I want to create an EditPanel, which basically is always the same, only some TextBox fields differs.

Thus I thought I'd create a Widget, define the layout etc with ui-binder and make it have some kind of placeholder where a widget can be placed in. But how would I do this?

<g:FlowPanel>
<g:Label text="This is an edit panel" />

<<place here my dynamic widget that I want to pass into that class>>

<g:Button text="save" />
<g:Button text="cancel" />
<g:Button text="reset" />
<g:Label text="some more fixed text" />
</g:FlowPanel>

You get the idea what I'm trying to do. But how can I eg create another FlowPanel with some TextBox fields and place it into the EditPanel??


Solution

  • Define one empty panel there like

    <g:HorizontalPanel ui:field="dynamicContentPanel"> </g:HorizontalPanel>
    

    define that in view .

    @UiField
    HorizontalPanel  dynamicContentPanel;
    

    Use like dynamicContentPanel.add(yourDynamicWidget);