<g:tab> does not take have a ui:field attribute

I found this in TabLayoutPanel's javadoc:

The children of a TabLayoutPanel element are laid out in <g:tab>
elements. Each tab can have one widget child and one of two types of
header elements. A <g:header> element can hold html, or a
<g:customHeader> element can hold a widget. (Note that the tags of the
header elements are not capitalized. This is meant to signal that the
head is not a runtime object, and so cannot have a ui:field
attribute.)

However your suggestion led me to another solution

I changed

<g:TabLayoutPanel barUnit='EM' barHeight='3'>
    <g:tab >
       .........
    <g:tab>

    <g:tab >
       .........
    <g:tab>
</g:TabLayoutPanel>

to this

<g:TabLayoutPanel barUnit='EM' barHeight='3' ui:field="tabLayout">
    <g:tab >
       .........
    <g:tab>

    <g:tab >
       .........
    <g:tab>
</g:TabLayoutPanel>

Now the parent widget has reference to TabLayoutPanel and I can add
event handlers to it.

I don't like this very much because the parent module holds
tabLayoutPanel's reference and is responsible for adding event
handlers. I would like the individual tabs or the composites they hold
to receive events directly so that the event registration and handling
logic resides within the tab / composite.

Anyway, I have something working for now, I'll see what more can be
done. Thanks!

If anyone has suggestions about making this more modular please write
in!

Thanks,
Priyank


On Mar 20, 10:35 pm, Tristan <tristan.slomin...@gmail.com> wrote:
> don't know if this will work, but have you tried
>
> <g:tab ui:field='myTab1'>
>
> then in your java code
>
> @UiField
> UIObject myTab1
>
> @UiHandler("myTab1")
> public void onSpellCast(ClickEvent event){
>    ... do stuff
>
> }
>
> On Mar 20, 11:30 am, spacejunkie <priyank.pa...@gmail.com> wrote:
>
> > Hi,
>
> > I'm using UIBinder to define tabbed layout. Each tab and its header is
> > also defined in the XML. The <g:tab> element holds a custom composite
> > for each tab.
>
> > I want to lazily populate the composite - held by a tab - with data
> > when the tab is selected. For this I want to add event handler for tab
> > change.
>
> > Since I do not have reference to TabPanelLayout how can I add event
> > handlers? Is there a work around?
>
> > Regards,
> > Priyank
>
>

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

Reply via email to