Search code examples
gwtuibinder

GWT declarative layout parent porperties


I've built a stackpanel like this

<g:StackPanel ui:field="ticketsPanel">    
  <g:VerticalPanel g:StackPanel-text="Tickets">
   <g:Hyperlink targetHistoryToken='newTickets'>New tickets</g:Hyperlink>
   <g:Hyperlink targetHistoryToken='myTickets'>My tickets</g:Hyperlink>
   <g:Hyperlink targetHistoryToken='allTickets'>All tickets</g:Hyperlink>
  </g:VerticalPanel>
  <g:VerticalPanel>
   <g:Hyperlink>Preferences</g:Hyperlink>
   <g:Hyperlink>My information</g:Hyperlink>
 </g:VerticalPanel>

As you can see, there is a g:StackPanel-text property on each VerticalPanel that defines the name on the StackPanel. I found this on an example in a forum but can't find any documentation or literature on what is happening here..... Is this some kind of "back reference" to a parent property? Does this mean that I can always use something like g:ParentClass-randomProperty="test"?

Any pointer to documentation about this will be really helpful. Thanks!!!


Solution

  • Have a look at the com.google.gwt.uibinder.elementparsers.StackPanelParser class, especially the parse(..) method.

    In there the value of the StackPanel-text attribute (ATTRIBUTE_TEXT) is used to eventually call the add(Widget, String) method (line 49) on the StackPanel object (the exact call for the provided snipped is ticketsPanel.add(f_VerticalPanel1, "Tickets");).

    So basically it is just the header of the added widget.