I created this class and it worked:

package ve.com.rapipago.pagueaqui.vista.client.componente;

import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.ValueUpdater;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.client.ui.AbstractImagePrototype;

public class ClickableImageResourceCell extends AbstractCell<ImageResource>
{
    public ClickableImageResourceCell() {
        super("click");
    }

    @Override
    public void render(Context context, ImageResource value,
                       SafeHtmlBuilder sb) {
        if (value != null) {
            SafeHtml html =

 
SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(value).getHTML());
            sb.append(html);
        }
    }

    @Override
    public void onBrowserEvent(Context context, Element parent,
ImageResource resource,
                               NativeEvent event,
                               ValueUpdater<ImageResource> valueUpdater) {
        super.onBrowserEvent(context, parent, resource, event,
valueUpdater);
        if ("click".equals(event.getType())) {
            onClick(resource, event);
        }
    }

    public void onClick(ImageResource resource,
                        NativeEvent event) {
    }
}

Hope its useful.

Regards,

Néstor Boscán

2011/4/1 Néstor Boscán <[email protected]>

> Hi
>
> I'm trying to change the CSS style of a button inside a ButtonCell so I can
> set an image but the getStyleName method on ButtonCell won't do anything in
> the HTML. Also the styleName that you set on the column is not applied to
> the TD cell but the column in the column group. So I haven't found a way to
> set a CSS style for the button.
>
> Regards,
>
> Néstor Boscán
>

-- 
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