Monday, November 5, 2012

GWT 2.5 Cell rendering using uiBinder + image

Hi,
Is there an any example - how to add image into Cell with UiBinder?
There is great example in showcase (http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellList) but without uiBinder.
UiBinder file: 
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field='contact' type='com.billmanager.client.model.ClientContact'/>
<ui:with field='res' type='com.billmanager.client.common.Resources'/>
  <g:HTMLPanel>
   <span><ui:text from='{contact.getDisplayName}'/></span>
   <span><ui:text from='{contact.getDisplayEmail}'/></span>
   <g:Image resource='{res.delete}'/>
  </g:HTMLPanel>
</ui:UiBinder> 
 
Do not displays image.

My java class is simple:
 public class ContactCell extends AbstractCell<ClientContact> {

interface MyUiRenderer extends UiRenderer {
void render(SafeHtmlBuilder sb, ClientContact contact);
}
 
private static MyUiRenderer renderer = GWT.create(MyUiRenderer.class);

@Override
public void render(com.google.gwt.cell.client.Cell.Context context, ClientContact value, SafeHtmlBuilder sb) {
renderer.render(sb, value);
}

}

What I thought is to get rendered element (empty) and add image as html, but I don't thing it is the right way. 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/8n_-F-bpQTkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment