views:

176

answers:

2

Is there a way to work with pure HTML in GWT UIBinder.

The problem I am seeing is more of where we have to wrap the style in curly braces. Any link /article/book handling UIBinder in detail would be helpful.

I have already seen the articles in GST website

A: 

You can use it this way which is close to pure HTML:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt;
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
  ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
  ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
  ui:generateLocales="default"
  xmlns:g='urn:import:com.google.gwt.user.client.ui'>

  <ui:style>

    ... CSS ...

  </ui:style>

  <g:HTMLPanel>

    ... HTML and GWT controls ...

  </g:HTMLPanel>

</ui:UiBinder>
ju
A: 

The style name (CSS class name) must be put in curly braces, e.g. <div class="{style.example}">...</div>, when the name is obfuscated by GWT. GWT does this, when you use a CssResource. This is also the case, when you declare it in a <ui:style> block in your .ui.xml file:

<ui:UiBinder ...>
  <ui:style>
    .example {
      ...
    }
  </ui:style>

  <div class="{style.example}">
     ...
  </div>
</ui:UiBinder>

In contrast, when you declare your CSS class in a plain CSS file (which you directly reference form you HTML host page), then you don't put the name in curly braces. In that case, you just use it like

<ui:UiBinder ...>
  <div class="example">...</div>
</ui:UiBinder>
Chris Lercher