On Mar 17, 9:34 pm, Deepali Bhandari <[email protected]> wrote:
> Hi
> I have a cell table in which the first column, is a button cell. I
> need to be able to add style to it. I am unable to find code samples
> for it.
> I would also like to be able to click on the button cell. Somewhere I
> saw usage of fieldupdater but am unclear on it/
>
> --thanks.

I finally figured out how to add style for button cell. Essentially a
button cell renders an htm button. All you need to do is to extend a
ButtonCell class, then override the render method. In the render
method implementation append the html string on the SafehtmlBuilder.
Like so  with style attribute on the html button, basically yes
intercepting the html.
 private class MyButtonCell extends ButtonCell
    {
        /**
         * Constructor.
         */
        public MyButtonCell()
        {
            super();

        }

        /*
         * (non-Javadoc)
         * @see
com.google.gwt.cell.client.ButtonCell#render(com.google.gwt.cell.client.Cell.Context,
         * com.google.gwt.safehtml.shared.SafeHtml,
com.google.gwt.safehtml.shared.SafeHtmlBuilder)
         */
        @Override
        public void render(final Context context, final SafeHtml data,
final SafeHtmlBuilder sb)
        {

            sb.appendHtmlConstant("<button type=\"button\" style=
\"width=30px;text-align:center;border-radius:50px;font-family:
Helvetica, Verdana, sans-serif; font-size: 0.9em;font-weight: bold;
font-weight: bold;\""
                + "tabindex=\"-1\">");

            if (data != null)
            {
                sb.append(data);
            }
            sb.appendHtmlConstant("</button>");
        }

    }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to