1 package autotest.common.table; 2 3 import com.google.gwt.event.dom.client.ClickEvent; 4 import com.google.gwt.event.dom.client.ClickHandler; 5 import com.google.gwt.user.client.ui.Composite; 6 import com.google.gwt.user.client.ui.FocusWidget; 7 8 9 public class TableClickWidget extends Composite implements ClickHandler { 10 11 private FocusWidget widget; 12 private TableWidgetClickListener listener; 13 private int row; 14 private int cell; 15 16 public static interface TableWidgetClickListener { onClick(TableClickWidget widget)17 public void onClick(TableClickWidget widget); 18 } 19 TableClickWidget(FocusWidget widget, TableWidgetClickListener listener, int row, int cell)20 public TableClickWidget(FocusWidget widget, TableWidgetClickListener listener, 21 int row, int cell) { 22 this.widget = widget; 23 this.row = row; 24 this.cell = cell; 25 this.listener = listener; 26 27 initWidget(widget); 28 widget.addClickHandler(this); 29 } 30 onClick(ClickEvent event)31 public void onClick(ClickEvent event) { 32 listener.onClick(this); 33 } 34 getRow()35 public int getRow() { 36 return row; 37 } 38 getCell()39 public int getCell() { 40 return cell; 41 } 42 getContainedWidget()43 public FocusWidget getContainedWidget() { 44 return widget; 45 } 46 } 47