*/
public class GridClickEvent extends AbstractGridMouseEvent<GridClickHandler> {
+ public static final Type<GridClickHandler> TYPE = new Type<GridClickHandler>(
+ BrowserEvents.CLICK, new GridClickEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridClickEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridClickEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridClickHandler> getAssociatedType() {
+ return TYPE;
}
@Override
public class GridDoubleClickEvent
extends AbstractGridMouseEvent<GridDoubleClickHandler> {
+ public static final Type<GridDoubleClickHandler> TYPE = new Type<GridDoubleClickHandler>(
+ BrowserEvents.DBLCLICK, new GridDoubleClickEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridDoubleClickEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridDoubleClickEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridDoubleClickHandler> getAssociatedType() {
+ return TYPE;
}
@Override
handler.onDoubleClick(this);
}
}
-
}
*/
public class GridKeyDownEvent extends AbstractGridKeyEvent<GridKeyDownHandler> {
+ public static final Type<GridKeyDownHandler> TYPE = new Type<GridKeyDownHandler>(
+ BrowserEvents.KEYDOWN, new GridKeyDownEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridKeyDownEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridKeyDownEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridKeyDownHandler> getAssociatedType() {
+ return TYPE;
}
@Override
public class GridKeyPressEvent
extends AbstractGridKeyEvent<GridKeyPressHandler> {
+ public static final Type<GridKeyPressHandler> TYPE = new Type<GridKeyPressHandler>(
+ BrowserEvents.KEYPRESS, new GridKeyPressEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridKeyPressEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridKeyPressEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridKeyPressHandler> getAssociatedType() {
+ return TYPE;
}
@Override
*/
public class GridKeyUpEvent extends AbstractGridKeyEvent<GridKeyUpHandler> {
+ public static final Type<GridKeyUpHandler> TYPE = new Type<GridKeyUpHandler>(
+ BrowserEvents.KEYUP, new GridKeyUpEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridKeyUpEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridKeyUpEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
}
@Override
}
}
+ @Override
+ public Type<GridKeyUpHandler> getAssociatedType() {
+ return TYPE;
+ }
+
@Override
protected String getBrowserEventType() {
return BrowserEvents.KEYUP;
public static abstract class AbstractGridKeyEvent<HANDLER extends AbstractGridKeyEventHandler>
extends KeyEvent<HANDLER> {
- private Grid<?> grid;
- private final Type<HANDLER> associatedType = new Type<>(
- getBrowserEventType(), this);
- private final CellReference<?> targetCell;
+ /**
+ * @since 7.7.9
+ */
+ public AbstractGridKeyEvent() {
+ }
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public AbstractGridKeyEvent(Grid<?> grid, CellReference<?> targetCell) {
- this.grid = grid;
- this.targetCell = targetCell;
}
protected abstract String getBrowserEventType();
/**
- * Gets the Grid instance for this event.
+ * Gets the Grid instance for this event, if it originated from a Grid.
*
- * @return grid
+ * @return the grid this event originated from, or {@code null} if this
+ * event did not originate from a grid
*/
public Grid<?> getGrid() {
- return grid;
+ EventTarget target = getNativeEvent().getEventTarget();
+ if (!Element.is(target)) {
+ return null;
+ }
+ return WidgetUtil.findWidget(Element.as(target), Grid.class);
}
/**
- * Gets the focused cell for this event.
+ * Gets the reference of target cell for this event, if this event
+ * originated from a Grid.
*
- * @return focused cell
+ * @return target cell, or {@code null} if this event did not originate
+ * from a grid
*/
public CellReference<?> getFocusedCell() {
- return targetCell;
+ return getGrid().getEventCell();
}
@Override
protected void dispatch(HANDLER handler) {
EventTarget target = getNativeEvent().getEventTarget();
- if (Element.is(target)
+ Grid<?> grid = getGrid();
+ if (Element.is(target) && grid != null
&& !grid.isElementInChildWidget(Element.as(target))) {
Section section = Section.FOOTER;
final RowContainer container = grid.cellFocusHandler.containerWithFocus;
if (container == grid.escalator.getHeader()) {
section = Section.HEADER;
- } else if (container == grid.escalator.getBody()) {
+ } else if (container == getGrid().escalator.getBody()) {
section = Section.BODY;
}
}
protected abstract void doDispatch(HANDLER handler, Section section);
-
- @Override
- public Type<HANDLER> getAssociatedType() {
- return associatedType;
- }
}
public static abstract class AbstractGridMouseEvent<HANDLER extends AbstractGridMouseEventHandler>
extends MouseEvent<HANDLER> {
- private Grid<?> grid;
- private final CellReference<?> targetCell;
- private final Type<HANDLER> associatedType = new Type<>(
- getBrowserEventType(), this);
+ /**
+ * @since 7.7.9
+ */
+ public AbstractGridMouseEvent() {
+ }
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public AbstractGridMouseEvent(Grid<?> grid,
CellReference<?> targetCell) {
- this.grid = grid;
- this.targetCell = targetCell;
}
protected abstract String getBrowserEventType();
/**
- * Gets the Grid instance for this event.
+ * Gets the Grid instance for this event, if it originated from a Grid.
*
- * @return grid
+ * @return the grid this event originated from, or {@code null} if this
+ * event did not originate from a grid
*/
public Grid<?> getGrid() {
- return grid;
+ EventTarget target = getNativeEvent().getEventTarget();
+ if (!Element.is(target)) {
+ return null;
+ }
+ return WidgetUtil.findWidget(Element.as(target), Grid.class);
}
/**
- * Gets the reference of target cell for this event.
+ * Gets the reference of target cell for this event, if this event
+ * originated from a Grid.
*
- * @return target cell
+ * @return target cell, or {@code null} if this event did not originate
+ * from a grid
*/
public CellReference<?> getTargetCell() {
- return targetCell;
+ Grid<?> grid = getGrid();
+ if (grid == null) {
+ return null;
+ }
+ return grid.getEventCell();
}
@Override
return;
}
+ Grid<?> grid = getGrid();
+ if (grid == null) {
+ // Target is not an element of a grid
+ return;
+ }
+
Element targetElement = Element.as(target);
if (grid.isElementInChildWidget(targetElement)) {
// Target is some widget inside of Grid
}
protected abstract void doDispatch(HANDLER handler, Section section);
-
- @Override
- public Type<HANDLER> getAssociatedType() {
- return associatedType;
- }
}
private static final String CUSTOM_STYLE_PROPERTY_NAME = "customStyle";
*/
private static final double DETAILS_ROW_INITIAL_HEIGHT = 50;
- private EventCellReference<T> eventCell = new EventCellReference<>(this);
- private GridKeyDownEvent keyDown = new GridKeyDownEvent(this, eventCell);
- private GridKeyUpEvent keyUp = new GridKeyUpEvent(this, eventCell);
- private GridKeyPressEvent keyPress = new GridKeyPressEvent(this, eventCell);
- private GridClickEvent clickEvent = new GridClickEvent(this, eventCell);
- private GridDoubleClickEvent doubleClickEvent = new GridDoubleClickEvent(
- this, eventCell);
+ private EventCellReference<T> eventCell = new EventCellReference<T>(this);
private class CellFocusHandler {
*/
public HandlerRegistration addBodyKeyDownHandler(
BodyKeyDownHandler handler) {
- return addHandler(handler, keyDown.getAssociatedType());
+ return addHandler(handler, GridKeyDownEvent.TYPE);
}
/**
* @return the registration for the event
*/
public HandlerRegistration addBodyKeyUpHandler(BodyKeyUpHandler handler) {
- return addHandler(handler, keyUp.getAssociatedType());
+ return addHandler(handler, GridKeyUpEvent.TYPE);
}
/**
*/
public HandlerRegistration addBodyKeyPressHandler(
BodyKeyPressHandler handler) {
- return addHandler(handler, keyPress.getAssociatedType());
+ return addHandler(handler, GridKeyPressEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderKeyDownHandler(
HeaderKeyDownHandler handler) {
- return addHandler(handler, keyDown.getAssociatedType());
+ return addHandler(handler, GridKeyDownEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderKeyUpHandler(
HeaderKeyUpHandler handler) {
- return addHandler(handler, keyUp.getAssociatedType());
+ return addHandler(handler, GridKeyUpEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderKeyPressHandler(
HeaderKeyPressHandler handler) {
- return addHandler(handler, keyPress.getAssociatedType());
+ return addHandler(handler, GridKeyPressEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterKeyDownHandler(
FooterKeyDownHandler handler) {
- return addHandler(handler, keyDown.getAssociatedType());
+ return addHandler(handler, GridKeyDownEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterKeyUpHandler(
FooterKeyUpHandler handler) {
- return addHandler(handler, keyUp.getAssociatedType());
+ return addHandler(handler, GridKeyUpEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterKeyPressHandler(
FooterKeyPressHandler handler) {
- return addHandler(handler, keyPress.getAssociatedType());
+ return addHandler(handler, GridKeyPressEvent.TYPE);
}
/**
* @return the registration for the event
*/
public HandlerRegistration addBodyClickHandler(BodyClickHandler handler) {
- return addHandler(handler, clickEvent.getAssociatedType());
+ return addHandler(handler, GridClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderClickHandler(
HeaderClickHandler handler) {
- return addHandler(handler, clickEvent.getAssociatedType());
+ return addHandler(handler, GridClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterClickHandler(
FooterClickHandler handler) {
- return addHandler(handler, clickEvent.getAssociatedType());
+ return addHandler(handler, GridClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addBodyDoubleClickHandler(
BodyDoubleClickHandler handler) {
- return addHandler(handler, doubleClickEvent.getAssociatedType());
+ return addHandler(handler, GridDoubleClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderDoubleClickHandler(
HeaderDoubleClickHandler handler) {
- return addHandler(handler, doubleClickEvent.getAssociatedType());
+ return addHandler(handler, GridDoubleClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterDoubleClickHandler(
FooterDoubleClickHandler handler) {
- return addHandler(handler, doubleClickEvent.getAssociatedType());
+ return addHandler(handler, GridDoubleClickEvent.TYPE);
}
/**
for (int row : details) {
setDetailsVisible(row, false);
}
-
super.onDetach();
}
*/
public class GridClickEvent extends AbstractGridMouseEvent<GridClickHandler> {
+ public static final Type<GridClickHandler> TYPE = new Type<GridClickHandler>(
+ BrowserEvents.CLICK, new GridClickEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridClickEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridClickEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridClickHandler> getAssociatedType() {
+ return TYPE;
}
@Override
public class GridDoubleClickEvent
extends AbstractGridMouseEvent<GridDoubleClickHandler> {
+ public static final Type<GridDoubleClickHandler> TYPE = new Type<GridDoubleClickHandler>(
+ BrowserEvents.DBLCLICK, new GridDoubleClickEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridDoubleClickEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridDoubleClickEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridDoubleClickHandler> getAssociatedType() {
+ return TYPE;
}
@Override
handler.onDoubleClick(this);
}
}
-
}
*/
public class GridKeyDownEvent extends AbstractGridKeyEvent<GridKeyDownHandler> {
+ public static final Type<GridKeyDownHandler> TYPE = new Type<GridKeyDownHandler>(
+ BrowserEvents.KEYDOWN, new GridKeyDownEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridKeyDownEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridKeyDownEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridKeyDownHandler> getAssociatedType() {
+ return TYPE;
}
@Override
public class GridKeyPressEvent
extends AbstractGridKeyEvent<GridKeyPressHandler> {
+ public static final Type<GridKeyPressHandler> TYPE = new Type<GridKeyPressHandler>(
+ BrowserEvents.KEYPRESS, new GridKeyPressEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridKeyPressEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridKeyPressEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
+ }
+
+ @Override
+ public Type<GridKeyPressHandler> getAssociatedType() {
+ return TYPE;
}
@Override
*/
public class GridKeyUpEvent extends AbstractGridKeyEvent<GridKeyUpHandler> {
+ public static final Type<GridKeyUpHandler> TYPE = new Type<GridKeyUpHandler>(
+ BrowserEvents.KEYUP, new GridKeyUpEvent());
+
+ /**
+ * @since 7.7.9
+ */
+ public GridKeyUpEvent() {
+ }
+
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public GridKeyUpEvent(Grid<?> grid, CellReference<?> targetCell) {
- super(grid, targetCell);
}
@Override
}
}
+ @Override
+ public Type<GridKeyUpHandler> getAssociatedType() {
+ return TYPE;
+ }
+
@Override
protected String getBrowserEventType() {
return BrowserEvents.KEYUP;
public static abstract class AbstractGridKeyEvent<HANDLER extends AbstractGridKeyEventHandler>
extends KeyEvent<HANDLER> {
- private Grid<?> grid;
- private final Type<HANDLER> associatedType = new Type<HANDLER>(
- getBrowserEventType(), this);
- private final CellReference<?> targetCell;
+ /**
+ * @since 7.7.9
+ */
+ public AbstractGridKeyEvent() {
+ }
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public AbstractGridKeyEvent(Grid<?> grid, CellReference<?> targetCell) {
- this.grid = grid;
- this.targetCell = targetCell;
}
protected abstract String getBrowserEventType();
/**
- * Gets the Grid instance for this event.
+ * Gets the Grid instance for this event, if it originated from a Grid.
*
- * @return grid
+ * @return the grid this event originated from, or {@code null} if this
+ * event did not originate from a grid
*/
public Grid<?> getGrid() {
- return grid;
+ EventTarget target = getNativeEvent().getEventTarget();
+ if (!Element.is(target)) {
+ return null;
+ }
+ return WidgetUtil.findWidget(Element.as(target), Grid.class);
}
/**
- * Gets the focused cell for this event.
+ * Gets the reference of target cell for this event, if this event
+ * originated from a Grid.
*
- * @return focused cell
+ * @return target cell, or {@code null} if this event did not originate
+ * from a grid
*/
public CellReference<?> getFocusedCell() {
- return targetCell;
+ return getGrid().getEventCell();
}
@Override
protected void dispatch(HANDLER handler) {
EventTarget target = getNativeEvent().getEventTarget();
- if (Element.is(target)
+ Grid<?> grid = getGrid();
+ if (Element.is(target) && grid != null
&& !grid.isElementInChildWidget(Element.as(target))) {
Section section = Section.FOOTER;
final RowContainer container = grid.cellFocusHandler.containerWithFocus;
if (container == grid.escalator.getHeader()) {
section = Section.HEADER;
- } else if (container == grid.escalator.getBody()) {
+ } else if (container == getGrid().escalator.getBody()) {
section = Section.BODY;
}
-
doDispatch(handler, section);
}
}
protected abstract void doDispatch(HANDLER handler, Section section);
-
- @Override
- public Type<HANDLER> getAssociatedType() {
- return associatedType;
- }
}
public static abstract class AbstractGridMouseEvent<HANDLER extends AbstractGridMouseEventHandler>
extends MouseEvent<HANDLER> {
- private Grid<?> grid;
- private final CellReference<?> targetCell;
- private final Type<HANDLER> associatedType = new Type<HANDLER>(
- getBrowserEventType(), this);
+ /**
+ * @since 7.7.9
+ */
+ public AbstractGridMouseEvent() {
+ }
+ /**
+ * @deprecated This constructor's arguments are no longer used. Use the
+ * no-args constructor instead.
+ */
+ @Deprecated
public AbstractGridMouseEvent(Grid<?> grid,
CellReference<?> targetCell) {
- this.grid = grid;
- this.targetCell = targetCell;
}
protected abstract String getBrowserEventType();
/**
- * Gets the Grid instance for this event.
+ * Gets the Grid instance for this event, if it originated from a Grid.
*
- * @return grid
+ * @return the grid this event originated from, or {@code null} if this
+ * event did not originate from a grid
*/
public Grid<?> getGrid() {
- return grid;
+ EventTarget target = getNativeEvent().getEventTarget();
+ if (!Element.is(target)) {
+ return null;
+ }
+ return WidgetUtil.findWidget(Element.as(target), Grid.class);
}
/**
- * Gets the reference of target cell for this event.
+ * Gets the reference of target cell for this event, if this event
+ * originated from a Grid.
*
- * @return target cell
+ * @return target cell, or {@code null} if this event did not originate
+ * from a grid
*/
public CellReference<?> getTargetCell() {
- return targetCell;
+ Grid<?> grid = getGrid();
+ if (grid == null) {
+ return null;
+ }
+ return grid.getEventCell();
}
@Override
return;
}
+ Grid<?> grid = getGrid();
+ if (grid == null) {
+ // Target is not an element of a grid
+ return;
+ }
+
Element targetElement = Element.as(target);
if (grid.isElementInChildWidget(targetElement)) {
// Target is some widget inside of Grid
}
protected abstract void doDispatch(HANDLER handler, Section section);
-
- @Override
- public Type<HANDLER> getAssociatedType() {
- return associatedType;
- }
}
private static final String CUSTOM_STYLE_PROPERTY_NAME = "customStyle";
private static final double DETAILS_ROW_INITIAL_HEIGHT = 50;
private EventCellReference<T> eventCell = new EventCellReference<T>(this);
- private GridKeyDownEvent keyDown = new GridKeyDownEvent(this, eventCell);
- private GridKeyUpEvent keyUp = new GridKeyUpEvent(this, eventCell);
- private GridKeyPressEvent keyPress = new GridKeyPressEvent(this, eventCell);
- private GridClickEvent clickEvent = new GridClickEvent(this, eventCell);
- private GridDoubleClickEvent doubleClickEvent = new GridDoubleClickEvent(
- this, eventCell);
private class CellFocusHandler {
*/
public HandlerRegistration addBodyKeyDownHandler(
BodyKeyDownHandler handler) {
- return addHandler(handler, keyDown.getAssociatedType());
+ return addHandler(handler, GridKeyDownEvent.TYPE);
}
/**
* @return the registration for the event
*/
public HandlerRegistration addBodyKeyUpHandler(BodyKeyUpHandler handler) {
- return addHandler(handler, keyUp.getAssociatedType());
+ return addHandler(handler, GridKeyUpEvent.TYPE);
}
/**
*/
public HandlerRegistration addBodyKeyPressHandler(
BodyKeyPressHandler handler) {
- return addHandler(handler, keyPress.getAssociatedType());
+ return addHandler(handler, GridKeyPressEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderKeyDownHandler(
HeaderKeyDownHandler handler) {
- return addHandler(handler, keyDown.getAssociatedType());
+ return addHandler(handler, GridKeyDownEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderKeyUpHandler(
HeaderKeyUpHandler handler) {
- return addHandler(handler, keyUp.getAssociatedType());
+ return addHandler(handler, GridKeyUpEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderKeyPressHandler(
HeaderKeyPressHandler handler) {
- return addHandler(handler, keyPress.getAssociatedType());
+ return addHandler(handler, GridKeyPressEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterKeyDownHandler(
FooterKeyDownHandler handler) {
- return addHandler(handler, keyDown.getAssociatedType());
+ return addHandler(handler, GridKeyDownEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterKeyUpHandler(
FooterKeyUpHandler handler) {
- return addHandler(handler, keyUp.getAssociatedType());
+ return addHandler(handler, GridKeyUpEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterKeyPressHandler(
FooterKeyPressHandler handler) {
- return addHandler(handler, keyPress.getAssociatedType());
+ return addHandler(handler, GridKeyPressEvent.TYPE);
}
/**
* @return the registration for the event
*/
public HandlerRegistration addBodyClickHandler(BodyClickHandler handler) {
- return addHandler(handler, clickEvent.getAssociatedType());
+ return addHandler(handler, GridClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderClickHandler(
HeaderClickHandler handler) {
- return addHandler(handler, clickEvent.getAssociatedType());
+ return addHandler(handler, GridClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterClickHandler(
FooterClickHandler handler) {
- return addHandler(handler, clickEvent.getAssociatedType());
+ return addHandler(handler, GridClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addBodyDoubleClickHandler(
BodyDoubleClickHandler handler) {
- return addHandler(handler, doubleClickEvent.getAssociatedType());
+ return addHandler(handler, GridDoubleClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addHeaderDoubleClickHandler(
HeaderDoubleClickHandler handler) {
- return addHandler(handler, doubleClickEvent.getAssociatedType());
+ return addHandler(handler, GridDoubleClickEvent.TYPE);
}
/**
*/
public HandlerRegistration addFooterDoubleClickHandler(
FooterDoubleClickHandler handler) {
- return addHandler(handler, doubleClickEvent.getAssociatedType());
+ return addHandler(handler, GridDoubleClickEvent.TYPE);
}
/**
--- /dev/null
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ContentMode;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+public class GridClientMemoryLeak extends AbstractTestUI {
+
+ private static final String INSTRUCTIONS = "This UI is for manually testing that the client side grid does not leak memory. "
+ + "Steps to take:\n"
+ + "\t1. Click the newGrid button 1-n times\n"
+ + "\t2. Capture a JS heap dump in your browser\n"
+ + "\t3. The heap dump should only contain 1 instance of each of the following:\n"
+ + "\t\tGrid, GridKeyDownEvent, GridKeyPressEvent, GridKeyUpEvent, GridClickEvent, GridDoubleClickEvent";
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Label instructionLabel = new Label(INSTRUCTIONS,
+ ContentMode.PREFORMATTED);
+ final VerticalLayout layout = new VerticalLayout();
+ final Button btn = new Button("newGrid");
+ btn.addClickListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ layout.removeComponent(layout.getComponent(1));
+ layout.addComponent(new Grid<String>());
+ }
+ });
+ layout.addComponent(instructionLabel);
+ layout.addComponent(btn);
+ layout.addComponent(new Grid<String>());
+ addComponent(layout);
+ }
+}