Re: Can CellWidgets contain custom composite widgets ?
after investigating CompositeCell or directly extending AbstractCell,
it is my understanding that to create custom cell,
the only option at the moment is to embed HTML markup in the render method as below.
in other words, we cannot create a custom composite widget with UiBinder,
and add it to the cell.
am I correct on this ?
@Override
public void render(Context context, Contact value, SafeHtmlBuilder sb) {
/*
* Always do a null check on the value. Cell widgets can pass null to
* cells if the underlying data contains a null, or if the data arrives
* out of order.
*/
if (value == null) {
return;
}
// Add a checkbox. If the contact is a favorite, the box will be checked.
sb.appendHtmlConstant("<table><tr><td valign=\"top\">");
if (favorites.contains(value)) {
sb.appendHtmlConstant("<input type=\"checkbox\" checked=checked/>");
} else {
sb.appendHtmlConstant("<input type=\"checkbox\" />");
}
sb.appendHtmlConstant("</td><td>");
// Display the name in big letters.
sb.appendHtmlConstant("<div style=\"size:200%;font-weight:bold;\">");
sb.appendEscaped(value.name);
sb.appendHtmlConstant("</div>");
// Display the address in normal text.
sb.appendHtmlConstant("<div style=\"padding-left:10px;\">");
sb.appendEscaped(value.address);
sb.appendHtmlConstant("</div>");
sb.appendHtmlConstant("</td></tr></table>");
}
--
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-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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home