I try the following method but fail, the click event and keydown event has no respond.
package com.mycompany.project.client; > > import com.google.gwt.cell.client.AbstractCell; > import com.google.gwt.cell.client.ValueUpdater; > import com.google.gwt.dom.client.NativeEvent; > import com.google.gwt.safehtml.shared.SafeHtmlBuilder; > import com.google.gwt.user.client.Element; > import com.google.gwt.user.client.Window; > > // ClickableImageCell extends ClickableTextCell > /* > * > http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/cell/client/AbstractCell.html#AbstractCell%28java.lang.String...%29 > */ > public class ClickableImageCell2 extends AbstractCell<String>{ > > public ClickableImageCell2() { > /* > * Let the parent class know that our cell responds to click > events and > * keydown events. > */ > super("click", "keydown"); > } > > public void onBrowserEvent(Context context, Element parent, String > value, > NativeEvent event, ValueUpdater<String> valueUpdater) { > // Check that the value is not null. > if (value == null) { > return; > } > > // Call the super handler, which handlers the enter key. > super.onBrowserEvent(context, parent, value, event, > valueUpdater); > > // On click, perform the same action that we perform on enter. > if ("click".equals(event.getType())) { > this.onEnterKeyDown(context, parent, value, event, > valueUpdater); > } > } > > /** > * By convention, cells that respond to user events should handle the > enter > * key. This provides a consistent user experience when users use > keyboard > * navigation in the widget. > */ > protected void onEnterKeyDown(Context context, Element parent, > String value, NativeEvent event, ValueUpdater<String> > valueUpdater) { > Window.alert("You clicked " + value); > } > > > > @Override > public void render(Context context, String value, SafeHtmlBuilder sb) { > // TODO Auto-generated method stub > if (value != null){ > sb.appendHtmlConstant("<img src =\"" + value + "\" > alt=\"image\" />"); > } > } > > } > > what is the problem? I see the doc and it said > *AbstractCell<http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/cell/client/AbstractCell.html#AbstractCell%28java.lang.String...%29> > *(java.lang.String... consumedEvents) > Construct a new > AbstractCell<http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/cell/client/AbstractCell.html>with > the specified consumed events. and I already pass "click" and "keydown" in the constructor. -- 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/-/UKdX2lqaAHcJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.