diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-10-07 11:48:02 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2015-10-07 09:29:59 +0000 |
commit | 548ee39a92ae3f148940e47cccc13d9679572b53 (patch) | |
tree | cb64d40464f42d3b4149d14b464f72053a8b0965 | |
parent | 869b795e6478c34e6593b5f6ace2fe265973ebbd (diff) | |
download | vaadin-framework-548ee39a92ae3f148940e47cccc13d9679572b53.tar.gz vaadin-framework-548ee39a92ae3f148940e47cccc13d9679572b53.zip |
Remove Grid EditorEvents and Listeners
The EditorEvent API is not mature and useful enough to be present in a
stable release.
Change-Id: Ia982cb1a6e7b6a3518ea0f187993a964aafa1d53
11 files changed, 0 insertions, 518 deletions
diff --git a/client/src/com/vaadin/client/connectors/GridConnector.java b/client/src/com/vaadin/client/connectors/GridConnector.java index 9e57b17714..237d026e5a 100644 --- a/client/src/com/vaadin/client/connectors/GridConnector.java +++ b/client/src/com/vaadin/client/connectors/GridConnector.java @@ -64,10 +64,6 @@ import com.vaadin.client.widget.grid.events.ColumnReorderEvent; import com.vaadin.client.widget.grid.events.ColumnReorderHandler; import com.vaadin.client.widget.grid.events.ColumnVisibilityChangeEvent; import com.vaadin.client.widget.grid.events.ColumnVisibilityChangeHandler; -import com.vaadin.client.widget.grid.events.EditorCloseEvent; -import com.vaadin.client.widget.grid.events.EditorEventHandler; -import com.vaadin.client.widget.grid.events.EditorMoveEvent; -import com.vaadin.client.widget.grid.events.EditorOpenEvent; import com.vaadin.client.widget.grid.events.GridClickEvent; import com.vaadin.client.widget.grid.events.GridDoubleClickEvent; import com.vaadin.client.widget.grid.sort.SortEvent; @@ -752,32 +748,6 @@ public class GridConnector extends AbstractHasComponentsConnector implements getWidget().setDetailsGenerator(customDetailsGenerator); getLayoutManager().registerDependency(this, getWidget().getElement()); - getWidget().addEditorEventHandler(new EditorEventHandler() { - @Override - public void onEditorOpen(EditorOpenEvent e) { - if (hasEventListener(GridConstants.EDITOR_OPEN_EVENT_ID)) { - String rowKey = getRowKey((JsonObject) e.getRow()); - getRpcProxy(GridServerRpc.class).editorOpen(rowKey); - } - } - - @Override - public void onEditorMove(EditorMoveEvent e) { - if (hasEventListener(GridConstants.EDITOR_MOVE_EVENT_ID)) { - String rowKey = getRowKey((JsonObject) e.getRow()); - getRpcProxy(GridServerRpc.class).editorMove(rowKey); - } - } - - @Override - public void onEditorClose(EditorCloseEvent e) { - if (hasEventListener(GridConstants.EDITOR_CLOSE_EVENT_ID)) { - String rowKey = getRowKey((JsonObject) e.getRow()); - getRpcProxy(GridServerRpc.class).editorClose(rowKey); - } - } - }); - layout(); } diff --git a/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java b/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java index cfe56c3775..5089f2f15c 100644 --- a/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java +++ b/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java @@ -23,8 +23,6 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.FocusUtil; -import com.vaadin.client.widget.grid.events.EditorMoveEvent; -import com.vaadin.client.widget.grid.events.EditorOpenEvent; import com.vaadin.client.widgets.Grid.Editor; import com.vaadin.client.widgets.Grid.EditorDomEvent; @@ -114,9 +112,6 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { editRow(event, cell.getRowIndex(), cell.getColumnIndexDOM()); - // FIXME should be in editRow - event.getGrid().fireEvent(new EditorOpenEvent(cell)); - event.getDomEvent().preventDefault(); return true; @@ -147,9 +142,6 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { editRow(event, cell.getRowIndex(), cell.getColumnIndexDOM()); - // FIXME should be in editRow - event.getGrid().fireEvent(new EditorMoveEvent(cell)); - return true; } @@ -188,9 +180,6 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { } editRow(event, rowIndex + rowDelta, colIndex); - - // FIXME should be in editRow - event.getGrid().fireEvent(new EditorMoveEvent(cell)); } return changed; @@ -219,9 +208,6 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { editRow(event, event.getRowIndex(), event.getCell() .getColumnIndexDOM()); - // FIXME should be in editRow - event.getGrid().fireEvent(new EditorMoveEvent(cell)); - return true; } else if (e.getType().equals(BrowserEvents.KEYDOWN) @@ -230,9 +216,6 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { editRow(event, event.getRowIndex(), event.getFocusedColumnIndex() + (e.getShiftKey() ? -1 : +1)); - // FIXME should be in editRow - event.getGrid().fireEvent(new EditorMoveEvent(cell)); - return true; } diff --git a/client/src/com/vaadin/client/widget/grid/events/EditorCloseEvent.java b/client/src/com/vaadin/client/widget/grid/events/EditorCloseEvent.java deleted file mode 100644 index 99f59aa82a..0000000000 --- a/client/src/com/vaadin/client/widget/grid/events/EditorCloseEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.client.widget.grid.events; - -import com.vaadin.client.widget.grid.CellReference; - -/** - * Event that gets fired when an open editor is closed (and not reopened - * elsewhere) - */ -public class EditorCloseEvent extends EditorEvent { - - public EditorCloseEvent(CellReference<?> cell) { - super(cell); - } - - @Override - protected void dispatch(EditorEventHandler handler) { - handler.onEditorClose(this); - } -}
\ No newline at end of file diff --git a/client/src/com/vaadin/client/widget/grid/events/EditorEvent.java b/client/src/com/vaadin/client/widget/grid/events/EditorEvent.java deleted file mode 100644 index eb34033197..0000000000 --- a/client/src/com/vaadin/client/widget/grid/events/EditorEvent.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.client.widget.grid.events; - -import com.google.gwt.event.shared.GwtEvent; -import com.vaadin.client.widget.grid.CellReference; -import com.vaadin.client.widgets.Grid; -import com.vaadin.client.widgets.Grid.Column; - -/** - * Base class for editor events. - */ -public abstract class EditorEvent extends GwtEvent<EditorEventHandler> { - public static final Type<EditorEventHandler> TYPE = new Type<EditorEventHandler>(); - - private CellReference<?> cell; - - protected EditorEvent(CellReference<?> cell) { - this.cell = cell; - } - - @Override - public Type<EditorEventHandler> getAssociatedType() { - return TYPE; - } - - /** - * Get a reference to the Grid that fired this Event. - * - * @return a Grid reference - */ - @SuppressWarnings("unchecked") - public <T> Grid<T> getGrid() { - return (Grid<T>) cell.getGrid(); - } - - /** - * Get a reference to the cell that was active when this Event was fired. - * NOTE: do <i>NOT</i> rely on this information remaining accurate after - * leaving the event handler. - * - * @return a cell reference - */ - @SuppressWarnings("unchecked") - public <T> CellReference<T> getCell() { - return (CellReference<T>) cell; - } - - /** - * Get a reference to the row that was active when this Event was fired. - * NOTE: do <i>NOT</i> rely on this information remaining accurate after - * leaving the event handler. - * - * @return a row data object - */ - @SuppressWarnings("unchecked") - public <T> T getRow() { - return (T) cell.getRow(); - } - - /** - * Get the index of the row that was active when this Event was fired. NOTE: - * do <i>NOT</i> rely on this information remaining accurate after leaving - * the event handler. - * - * @return an integer value - */ - public int getRowIndex() { - return cell.getRowIndex(); - } - - /** - * Get a reference to the column that was active when this Event was fired. - * NOTE: do <i>NOT</i> rely on this information remaining accurate after - * leaving the event handler. - * - * @return a column object - */ - @SuppressWarnings("unchecked") - public <C, T> Column<C, T> getColumn() { - return (Column<C, T>) cell.getColumn(); - } - - /** - * Get the index of the column that was active when this Event was fired. - * NOTE: do <i>NOT</i> rely on this information remaining accurate after - * leaving the event handler. - * - * @return an integer value - */ - public int getColumnIndex() { - return cell.getColumnIndex(); - } - -}
\ No newline at end of file diff --git a/client/src/com/vaadin/client/widget/grid/events/EditorEventHandler.java b/client/src/com/vaadin/client/widget/grid/events/EditorEventHandler.java deleted file mode 100644 index 4f9396a9f1..0000000000 --- a/client/src/com/vaadin/client/widget/grid/events/EditorEventHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.client.widget.grid.events; - -import com.google.gwt.event.shared.EventHandler; - -/** - * Common handler interface for editor events - */ -public interface EditorEventHandler extends EventHandler { - - /** - * Action to perform when the editor has been opened - * - * @param e - * an editor open event object - */ - public void onEditorOpen(EditorOpenEvent e); - - /** - * Action to perform when the editor is re-opened on another row - * - * @param e - * an editor move event object - */ - public void onEditorMove(EditorMoveEvent e); - - /** - * Action to perform when the editor is closed - * - * @param e - * an editor close event object - */ - public void onEditorClose(EditorCloseEvent e); - -}
\ No newline at end of file diff --git a/client/src/com/vaadin/client/widget/grid/events/EditorMoveEvent.java b/client/src/com/vaadin/client/widget/grid/events/EditorMoveEvent.java deleted file mode 100644 index 0e5e2dcd7b..0000000000 --- a/client/src/com/vaadin/client/widget/grid/events/EditorMoveEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.client.widget.grid.events; - -import com.vaadin.client.widget.grid.CellReference; - -/** - * Event that gets fired when an already open editor is closed and re-opened on - * another row - */ -public class EditorMoveEvent extends EditorEvent { - - public EditorMoveEvent(CellReference<?> cell) { - super(cell); - } - - @Override - protected void dispatch(EditorEventHandler handler) { - handler.onEditorMove(this); - } -}
\ No newline at end of file diff --git a/client/src/com/vaadin/client/widget/grid/events/EditorOpenEvent.java b/client/src/com/vaadin/client/widget/grid/events/EditorOpenEvent.java deleted file mode 100644 index df0171945f..0000000000 --- a/client/src/com/vaadin/client/widget/grid/events/EditorOpenEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2000-2014 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.client.widget.grid.events; - -import com.vaadin.client.widget.grid.CellReference; - -/** - * Event that gets fired when the editor is opened - */ -public class EditorOpenEvent extends EditorEvent { - - public EditorOpenEvent(CellReference<?> cell) { - super(cell); - } - - @Override - protected void dispatch(EditorEventHandler handler) { - handler.onEditorOpen(this); - } - -}
\ No newline at end of file diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 0a027349aa..2eefc87f44 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -123,9 +123,6 @@ import com.vaadin.client.widget.grid.events.ColumnReorderEvent; import com.vaadin.client.widget.grid.events.ColumnReorderHandler; import com.vaadin.client.widget.grid.events.ColumnVisibilityChangeEvent; import com.vaadin.client.widget.grid.events.ColumnVisibilityChangeHandler; -import com.vaadin.client.widget.grid.events.EditorCloseEvent; -import com.vaadin.client.widget.grid.events.EditorEvent; -import com.vaadin.client.widget.grid.events.EditorEventHandler; import com.vaadin.client.widget.grid.events.FooterClickHandler; import com.vaadin.client.widget.grid.events.FooterDoubleClickHandler; import com.vaadin.client.widget.grid.events.FooterKeyDownHandler; @@ -1586,7 +1583,6 @@ public class Grid<T> extends ResizeComposite implements focusedColumnIndex = -1; grid.getEscalator().setScrollLocked(Direction.VERTICAL, false); updateSelectionCheckboxesAsNeeded(true); - grid.fireEvent(new EditorCloseEvent(grid.eventCell)); } private void updateSelectionCheckboxesAsNeeded(boolean isEnabled) { @@ -6358,19 +6354,6 @@ public class Grid<T> extends ResizeComposite implements return editor; } - /** - * Add handler for editor open/move/close events - * - * @param handler - * editor handler object - * @return a {@link HandlerRegistration} object that can be used to remove - * the event handler - */ - public HandlerRegistration addEditorEventHandler(EditorEventHandler handler) { - return addHandler(handler, EditorEvent.TYPE); - - } - protected Escalator getEscalator() { return escalator; } diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index 102b38e588..06a3c16fd7 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -588,100 +588,6 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } /** - * Interface for an editor event listener - */ - public interface EditorListener extends Serializable { - - public static final Method EDITOR_OPEN_METHOD = ReflectTools - .findMethod(EditorListener.class, "editorOpened", - EditorOpenEvent.class); - public static final Method EDITOR_MOVE_METHOD = ReflectTools - .findMethod(EditorListener.class, "editorMoved", - EditorMoveEvent.class); - public static final Method EDITOR_CLOSE_METHOD = ReflectTools - .findMethod(EditorListener.class, "editorClosed", - EditorCloseEvent.class); - - /** - * Called when an editor is opened - * - * @param e - * an editor open event object - */ - public void editorOpened(EditorOpenEvent e); - - /** - * Called when an editor is reopened without closing it first - * - * @param e - * an editor move event object - */ - public void editorMoved(EditorMoveEvent e); - - /** - * Called when an editor is closed - * - * @param e - * an editor close event object - */ - public void editorClosed(EditorCloseEvent e); - - } - - /** - * Base class for editor related events - */ - public static abstract class EditorEvent extends Component.Event { - - private Object itemID; - - protected EditorEvent(Grid source, Object itemID) { - super(source); - this.itemID = itemID; - } - - /** - * Get the item (row) for which this editor was opened - */ - public Object getItem() { - return itemID; - } - - } - - /** - * This event gets fired when an editor is opened - */ - public static class EditorOpenEvent extends EditorEvent { - - public EditorOpenEvent(Grid source, Object itemID) { - super(source, itemID); - } - } - - /** - * This event gets fired when an editor is opened while another row is being - * edited (i.e. editor focus moves elsewhere) - */ - public static class EditorMoveEvent extends EditorEvent { - - public EditorMoveEvent(Grid source, Object itemID) { - super(source, itemID); - } - } - - /** - * This event gets fired when an editor is dismissed or closed by other - * means. - */ - public static class EditorCloseEvent extends EditorEvent { - - public EditorCloseEvent(Grid source, Object itemID) { - super(source, itemID); - } - } - - /** * Default error handler for the editor * */ @@ -4302,24 +4208,6 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } @Override - public void editorOpen(String rowKey) { - fireEvent(new EditorOpenEvent(Grid.this, getKeyMapper().get( - rowKey))); - } - - @Override - public void editorMove(String rowKey) { - fireEvent(new EditorMoveEvent(Grid.this, getKeyMapper().get( - rowKey))); - } - - @Override - public void editorClose(String rowKey) { - fireEvent(new EditorCloseEvent(Grid.this, getKeyMapper().get( - rowKey))); - } - - @Override public void contextClick(int rowIndex, String rowKey, String columnId, Section section, MouseEventDetails details) { Object itemId = null; @@ -6513,37 +6401,6 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } /** - * Add an editor event listener - * - * @param listener - * the event listener object to add - */ - public void addEditorListener(EditorListener listener) { - addListener(GridConstants.EDITOR_OPEN_EVENT_ID, EditorOpenEvent.class, - listener, EditorListener.EDITOR_OPEN_METHOD); - addListener(GridConstants.EDITOR_MOVE_EVENT_ID, EditorMoveEvent.class, - listener, EditorListener.EDITOR_MOVE_METHOD); - addListener(GridConstants.EDITOR_CLOSE_EVENT_ID, - EditorCloseEvent.class, listener, - EditorListener.EDITOR_CLOSE_METHOD); - } - - /** - * Remove an editor event listener - * - * @param listener - * the event listener object to remove - */ - public void removeEditorListener(EditorListener listener) { - removeListener(GridConstants.EDITOR_OPEN_EVENT_ID, - EditorOpenEvent.class, listener); - removeListener(GridConstants.EDITOR_MOVE_EVENT_ID, - EditorMoveEvent.class, listener); - removeListener(GridConstants.EDITOR_CLOSE_EVENT_ID, - EditorCloseEvent.class, listener); - } - - /** * Sets the buffered editor mode. The default mode is buffered ( * <code>true</code>). * diff --git a/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java b/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java index 83abc5263e..283c09e67b 100644 --- a/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java +++ b/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java @@ -34,31 +34,6 @@ public interface GridServerRpc extends ServerRpc { boolean userOriginated); /** - * Informs the server that the editor was opened (fresh) on a certain row - * - * @param rowKey - * a key identifying item the editor was opened on - */ - void editorOpen(String rowKey); - - /** - * Informs the server that the editor was reopened (without closing it in - * between) on another row - * - * @param rowKey - * a key identifying item the editor was opened on - */ - void editorMove(String rowKey); - - /** - * Informs the server that the editor was closed - * - * @param rowKey - * a key identifying item the editor was opened on - */ - void editorClose(String rowKey); - - /** * Informs the server that an item has been clicked in Grid. * * @param rowKey diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index 598ac420fc..04d7cbbb09 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -63,10 +63,6 @@ import com.vaadin.ui.Grid.ColumnReorderListener; import com.vaadin.ui.Grid.ColumnVisibilityChangeEvent; import com.vaadin.ui.Grid.ColumnVisibilityChangeListener; import com.vaadin.ui.Grid.DetailsGenerator; -import com.vaadin.ui.Grid.EditorCloseEvent; -import com.vaadin.ui.Grid.EditorListener; -import com.vaadin.ui.Grid.EditorMoveEvent; -import com.vaadin.ui.Grid.EditorOpenEvent; import com.vaadin.ui.Grid.FooterCell; import com.vaadin.ui.Grid.HeaderCell; import com.vaadin.ui.Grid.HeaderRow; @@ -1421,29 +1417,6 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> { } }, null); - createClickAction("Add editor state listener", "Editor", - new Command<Grid, String>() { - @Override - public void execute(Grid grid, String value, Object data) { - grid.addEditorListener(new EditorListener() { - @Override - public void editorOpened(EditorOpenEvent e) { - log("Editor opened"); - } - - @Override - public void editorMoved(EditorMoveEvent e) { - log("Editor moved"); - } - - @Override - public void editorClosed(EditorCloseEvent e) { - log("Editor closed"); - } - }); - } - }, null); - } @SuppressWarnings("boxing") |