AbstractCell, is it possible to put ScrollPanel into cell?

25 views
Skip to first unread message

vkrejcirik

unread,
Dec 18, 2010, 5:06:38 AM12/18/10
to Google Web Toolkit
Hi, I would like to put ScrollPanel into AbstractCell. Is it possible?

I have creating html table now in render method. I would like to put
there scroll panel with checkboxes, if it is possilbe. Thanks for all
replies.

private static class ContentWidgetCell extends
AbstractCell<ContentWidget> {

public ContentWidgetCell() {
// cell responds to change events.
super("change");
}

@Override
public void render(ContentWidget value, Object key, SafeHtmlBuilder
sb) {
if (value != null) {

if (value instanceof GenderWidget) {

GenderWidget tempValue = (GenderWidget) value;

sb.appendHtmlConstant("<table>");

for (Gender g : tempValue.getGenders()) {

sb.appendHtmlConstant("<tr><td valign=\"top\">");
sb.appendHtmlConstant("<input type=\"checkbox\" />");
sb.appendHtmlConstant("</td><td>");

// Display the name of gender
sb.appendHtmlConstant("<div style=\"padding-left:10px;\">");
sb.appendEscaped(g.getName());
sb.appendHtmlConstant("</div>");
sb.appendHtmlConstant("</td></tr>");
}

sb.appendHtmlConstant("</table>");

} else {
sb.appendEscaped(value.getName());
}
}
}
...

John LaBanca

unread,
Dec 18, 2010, 11:50:31 AM12/18/10
to google-we...@googlegroups.com
You cannot embed the ScrollPanel widget in a Cell, but you can wrap the table element in a div with a fixed height and set overflow to auto, which will add scrollbars if needed.
sb.appendHtmlConstant("<div style=\"height:100px;overflow:auto;\">");
sb.appendHtmlConstant("<table>");

Alternatively, you could use a multiple select box instead of checkboxes.  It wouldn't include checkboxes, but it allows multiple selection.
<sb.appendHtmlConstant("<select multiple=\"multiple\" size=\"3\">");


Thanks,
John LaBanca
jlab...@google.com



--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


vkrejcirik

unread,
Dec 21, 2010, 5:42:48 AM12/21/10
to Google Web Toolkit
Ok, thanks for reply ;)

On 18 pro, 17:50, John LaBanca <jlaba...@google.com> wrote:
> You cannot embed the ScrollPanel widget in a Cell, but you can wrap the
> table element in a div with a fixed height and set overflow to auto, which
> will add scrollbars if needed.
> sb.appendHtmlConstant("<div style=\"height:100px;overflow:auto;\">");
> sb.appendHtmlConstant("<table>");
>
> Alternatively, you could use a multiple select box instead of checkboxes.
>  It wouldn't include checkboxes, but it allows multiple selection.
> <sb.appendHtmlConstant("<select multiple=\"multiple\" size=\"3\">");
>
> Thanks,
> John LaBanca
> jlaba...@google.com
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages