Custom tags in UiBinder files
Asked Answered
Q

2

9

When using a <g:LayoutPanel> in UiBinder.ui.xml files, you can specify <g:layer> tags. Some other Google-built widgets have special tags like that as well - <g:tab> even has a sub-tag, <g:header>.

How can I specify these for my own widgets?

Quartering answered 3/11, 2010 at 0:16 Comment(3)
The question is still interesting two years later: do you know about any improvements?Geo
Yes, there are definite improvements: look up @UiChildQuartering
In fact, check out https://mcmap.net/q/1315996/-gwt-uibinder-how-to-make-a-custom-absolutepanel-which-uses-the-quot-at-quot-elementQuartering
Q
8

The new answer to this question, after some GWT improvements, is at https://mcmap.net/q/1315996/-gwt-uibinder-how-to-make-a-custom-absolutepanel-which-uses-the-quot-at-quot-element . Copied below to avoid moderator deletion (maybe?).

You can use @UiChild to declare special functions in your widgets accessible in UiBinders.

for example,

class MyPanel extends AbsolutePanel {

    @UiChild
    public void addAt(Widget w, String parameter1, String parameter2) {
         ....

Then, in your uiBinder, you can say

<custom:MyPanel>
    <custom:at parameter1="HI" parameter2="Anything you like!">
        <g:AnySingleWidget />
    </custom:at>
</custom:MyPanel>

See @UiChild at http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/uibinder/client/UiChild.html

Quartering answered 12/12, 2012 at 19:7 Comment(0)
H
3

What you're looking for is a custom element parser for UiBinder. See this issue. Unfortunately it's not supported yet.

You might be interested in this post for some guidance on how to extend the current parser on your own.

Herriott answered 3/11, 2010 at 6:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.