Heres a simple example, from one of the projects i am doing..

NavTreeView.ui.xml

<g:HTMLPanel styleName="grid_4">

  *          <ubq:NavTreeViewToolBar
ui:field="navTreeToolBar"></ubq:NavTreeViewToolBar>*

            <g:ScrollPanel addStyleNames="{style.scrollit}"
ui:field="navTreeScrollPanel">
                <g:VerticalPanel ui:field="navTreeVp">

                </g:VerticalPanel>
            </g:ScrollPanel>


    </g:HTMLPanel>


The Java code for NavTreeComposite

public class NavTreeView extends Composite{

    private static NavTreeViewUiBinder uiBinder = GWT
            .create(NavTreeViewUiBinder.class);

    interface NavTreeViewUiBinder extends UiBinder<Widget, NavTreeView> {
    }


    @UiField
    VerticalPanel navTreeVp;
    @UiField
    ScrollPanel navTreeScrollPanel;

    *...@uifield**
    NavTreeViewToolBar navTreeToolBar;*

public NavTreeView() {
        initWidget(uiBinder.createAndBindUi(this));
     }
....
...
}

Java Code for the custom tool bar

public class *NavTreeViewToolBar extends Composite* {

    private static NavTreeViewToolBarUiBinder uiBinder = GWT
            .create(NavTreeViewToolBarUiBinder.class);

    interface NavTreeViewToolBarUiBinder extends
            UiBinder<Widget, NavTreeViewToolBar> {
    }

    @UiField
    ClickableHTMLPanel dynamicRecordSetPanel;

public NavTreeViewToolBar() {
        initWidget(uiBinder.createAndBindUi(this));
    }
....
....
}

This is like using any other widgets in the Composite. Also Composite
extends Widget class, so all composites are actually Widgets that can be
added/removed like u work with normal widgets (non-composite ones).
Also notice i am using a custom namespace to include my NavTreeViewToolBar
sub composite into the main NavTreeView Composite. xml.

Hope this helps.

Thanks,
Subhro.

On Thu, Dec 16, 2010 at 11:48 PM, Robert Guest <[email protected]> wrote:

> Can anyone point me to a simple example of a GWT app that uses
> UIBinder and 2 or 3 composites? I really would like to see a working
> example of how to reference one composite from another, both in the
> XML and the Java code.
>
> Thanks,
> Robert
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to