diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2017-05-12 11:33:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-12 11:33:55 +0300 |
commit | 76892855a7c3f37a1fef5caee3c0debf6aa712e2 (patch) | |
tree | 5f990c860d922439528b548c22d3df8bc45c03d4 /server/src/main/java/com/vaadin/event | |
parent | 22848f3420b5aded4d35c84f368dd9c44041200f (diff) | |
download | vaadin-framework-76892855a7c3f37a1fef5caee3c0debf6aa712e2.tar.gz vaadin-framework-76892855a7c3f37a1fef5caee3c0debf6aa712e2.zip |
Refactor Html5 DnD feature based on API review (#9306)
* Refactor Html5 DnD client side based on API review
- Moved classes to "correct" packages.
- Removed method DragSourceExtension.clearDataTransferText()
- Remove ButtonDragSource in favor of more generic API
Diffstat (limited to 'server/src/main/java/com/vaadin/event')
24 files changed, 8 insertions, 1375 deletions
diff --git a/server/src/main/java/com/vaadin/event/Transferable.java b/server/src/main/java/com/vaadin/event/Transferable.java index f75974a1cc..1f0ed866c1 100644 --- a/server/src/main/java/com/vaadin/event/Transferable.java +++ b/server/src/main/java/com/vaadin/event/Transferable.java @@ -18,9 +18,9 @@ package com.vaadin.event; import java.io.Serializable; import java.util.Collection; -import com.vaadin.event.dnd.DragSourceExtension; -import com.vaadin.event.dnd.DropEvent; import com.vaadin.ui.Component; +import com.vaadin.ui.dnd.DragSourceExtension; +import com.vaadin.ui.dnd.event.DropEvent; /** * Transferable wraps the data that is to be imported into another component. diff --git a/server/src/main/java/com/vaadin/event/dd/DragAndDropEvent.java b/server/src/main/java/com/vaadin/event/dd/DragAndDropEvent.java index 6f66036e5a..6bf8a7f319 100644 --- a/server/src/main/java/com/vaadin/event/dd/DragAndDropEvent.java +++ b/server/src/main/java/com/vaadin/event/dd/DragAndDropEvent.java @@ -19,7 +19,7 @@ import java.io.Serializable; import com.vaadin.event.Transferable; import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; -import com.vaadin.event.dnd.DropEvent; +import com.vaadin.ui.dnd.event.DropEvent; /** * DragAndDropEvent wraps information related to drag and drop operation. It is diff --git a/server/src/main/java/com/vaadin/event/dd/DragSource.java b/server/src/main/java/com/vaadin/event/dd/DragSource.java index 8a3c8c32dc..6361925864 100644 --- a/server/src/main/java/com/vaadin/event/dd/DragSource.java +++ b/server/src/main/java/com/vaadin/event/dd/DragSource.java @@ -19,8 +19,8 @@ import java.util.Map; import com.vaadin.event.Transferable; import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; -import com.vaadin.event.dnd.DragSourceExtension; import com.vaadin.ui.Component; +import com.vaadin.ui.dnd.DragSourceExtension; /** * DragSource is a {@link Component} that builds a {@link Transferable} for a diff --git a/server/src/main/java/com/vaadin/event/dd/DropHandler.java b/server/src/main/java/com/vaadin/event/dd/DropHandler.java index d6183940e9..a96b6206d5 100644 --- a/server/src/main/java/com/vaadin/event/dd/DropHandler.java +++ b/server/src/main/java/com/vaadin/event/dd/DropHandler.java @@ -21,7 +21,7 @@ import com.vaadin.event.Transferable; import com.vaadin.event.dd.acceptcriteria.AcceptAll; import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion; -import com.vaadin.event.dnd.DropListener; +import com.vaadin.ui.dnd.event.DropListener; /** * DropHandlers contain the actual business logic for drag and drop operations. diff --git a/server/src/main/java/com/vaadin/event/dd/DropTarget.java b/server/src/main/java/com/vaadin/event/dd/DropTarget.java index 3d346418c0..5202718109 100644 --- a/server/src/main/java/com/vaadin/event/dd/DropTarget.java +++ b/server/src/main/java/com/vaadin/event/dd/DropTarget.java @@ -17,8 +17,8 @@ package com.vaadin.event.dd; import java.util.Map; -import com.vaadin.event.dnd.DropTargetExtension; import com.vaadin.ui.Component; +import com.vaadin.ui.dnd.DropTargetExtension; /** * DropTarget is an interface for components supporting drop operations. A diff --git a/server/src/main/java/com/vaadin/event/dd/TargetDetails.java b/server/src/main/java/com/vaadin/event/dd/TargetDetails.java index 4a22958952..710fc5792f 100644 --- a/server/src/main/java/com/vaadin/event/dd/TargetDetails.java +++ b/server/src/main/java/com/vaadin/event/dd/TargetDetails.java @@ -17,7 +17,7 @@ package com.vaadin.event.dd; import java.io.Serializable; -import com.vaadin.event.dnd.DropEvent; +import com.vaadin.ui.dnd.event.DropEvent; /** * TargetDetails wraps drop target related information about diff --git a/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java b/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java index fadc1877cf..3ede6a20e0 100644 --- a/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java +++ b/server/src/main/java/com/vaadin/event/dd/TargetDetailsImpl.java @@ -18,8 +18,8 @@ package com.vaadin.event.dd; import java.util.HashMap; import java.util.Map; -import com.vaadin.event.dnd.DropEvent; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.ui.dnd.event.DropEvent; /** * A HashMap backed implementation of {@link TargetDetails} for terminal diff --git a/server/src/main/java/com/vaadin/event/dnd/ButtonDragSource.java b/server/src/main/java/com/vaadin/event/dnd/ButtonDragSource.java deleted file mode 100644 index 3d0d93dfa2..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/ButtonDragSource.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import com.vaadin.annotations.Widgetset; -import com.vaadin.shared.ui.dnd.ButtonDragSourceState; -import com.vaadin.ui.Button; - -/** - * Extension to make Button a drag source for HTML5 drag and drop functionality. - * - * @author Vaadin Ltd. - * @since 8.1 - */ -@Widgetset("com.vaadin.DefaultWidgetSet") -public class ButtonDragSource extends DragSourceExtension<Button> { - - public ButtonDragSource(Button target) { - super(target); - } - - @Override - protected ButtonDragSourceState getState() { - return (ButtonDragSourceState) super.getState(); - } - - @Override - protected ButtonDragSourceState getState(boolean markAsDirty) { - return (ButtonDragSourceState) super.getState(markAsDirty); - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DragEndEvent.java b/server/src/main/java/com/vaadin/event/dnd/DragEndEvent.java deleted file mode 100644 index 5e0739d2d9..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DragEndEvent.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import com.vaadin.shared.ui.dnd.DropEffect; -import com.vaadin.shared.ui.dnd.EffectAllowed; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Component; - -/** - * HTML5 drag end event. - * - * @param <T> - * Type of the component that was dragged. - * @author Vaadin Ltd - * @see DragSourceExtension#addDragEndListener(DragEndListener) - * @since 8.1 - */ -public class DragEndEvent<T extends AbstractComponent> extends Component.Event { - private final DropEffect dropEffect; - - /** - * Creates a drag end event. - * - * @param source - * Component that was dragged. - * @param dropEffect - * Drop effect from {@code DataTransfer.dropEffect} object. - */ - public DragEndEvent(T source, DropEffect dropEffect) { - super(source); - - this.dropEffect = dropEffect; - } - - /** - * Get drop effect of the dragend event. The value will be the desired - * action, that is the dropEffect value of the last dragenter or dragover - * event. The value depends on the effectAllowed parameter of the drag - * source, the dropEffect parameter of the drop target, and its drag over - * and drop criteria. - * <p> - * If the drop is not successful, the value will be {@code NONE}. - * <p> - * In case the desired drop effect is {@code MOVE}, the data being dragged - * should be removed from the source. - * - * @return The {@code DataTransfer.dropEffect} parameter of the client side - * dragend event. - * @see DragSourceExtension#setEffectAllowed(EffectAllowed) - * @see DropTargetExtension#setDropEffect(DropEffect) - * @see DropTargetExtension#setDragOverCriteria(String) - * @see DropTargetExtension#setDropCriteria(String) - */ - public DropEffect getDropEffect() { - return dropEffect; - } - - /** - * Returns whether the drag event was cancelled. This is a shorthand for - * {@code dropEffect == NONE}. - * - * @return {@code true} if the drop event was cancelled, {@code false} - * otherwise. - */ - public boolean isCanceled() { - return getDropEffect() == DropEffect.NONE; - } - - /** - * Returns the drag source component where the dragend event occurred. - * - * @return Component which was dragged. - */ - @Override - @SuppressWarnings("unchecked") - public T getComponent() { - return (T) super.getComponent(); - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DragEndListener.java b/server/src/main/java/com/vaadin/event/dnd/DragEndListener.java deleted file mode 100644 index 55b55b2bcd..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DragEndListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.lang.reflect.Method; - -import com.vaadin.event.ConnectorEventListener; -import com.vaadin.ui.AbstractComponent; - -/** - * Interface to be implemented when creating a dragend listener on a drag - * source for HTML5 drag and drop. - * - * @param <T> - * Type of draggable component. - * @author Vaadin Ltd - * @see DragSourceExtension#addDragEndListener(DragEndListener) - * @since 8.1 - */ -@FunctionalInterface -public interface DragEndListener<T extends AbstractComponent> extends - ConnectorEventListener { - static final Method DRAGEND_METHOD = DragEndListener.class - .getDeclaredMethods()[0]; - - /** - * Called when dragend event is fired. - * - * @param event - * Server side dragend event. - */ - void dragEnd(DragEndEvent<T> event); -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java b/server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java deleted file mode 100644 index 7ff84757d9..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DragSourceExtension.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.util.Objects; - -import com.vaadin.server.AbstractExtension; -import com.vaadin.server.Resource; -import com.vaadin.shared.Registration; -import com.vaadin.shared.ui.dnd.DragSourceRpc; -import com.vaadin.shared.ui.dnd.DragSourceState; -import com.vaadin.shared.ui.dnd.DropEffect; -import com.vaadin.shared.ui.dnd.EffectAllowed; -import com.vaadin.ui.AbstractComponent; - -/** - * Extension to make a component drag source for HTML5 drag and drop - * functionality. - * - * @param <T> - * Type of the component to be extended. - * @author Vaadin Ltd - * @since 8.1 - */ -public class DragSourceExtension<T extends AbstractComponent> extends - AbstractExtension { - - private Registration dragStartListenerHandle; - private Registration dragEndListenerHandle; - - /** - * Stores the server side drag data that is available for the drop target if - * it is in the same UI. - */ - private Object dragData; - - /** - * Extends {@code target} component and makes it a drag source. - * - * @param target - * Component to be extended. - */ - public DragSourceExtension(T target) { - - registerDragSourceRpc(target); - - super.extend(target); - - initListeners(); - } - - /** - * Initializes the event listeners this drag source is using. - */ - protected void initListeners() { - - // Set current extension as active drag source in the UI - dragStartListenerHandle = addDragStartListener( - event -> getUI().setActiveDragSource(this)); - - // Remove current extension as active drag source from the UI - dragEndListenerHandle = addDragEndListener( - event -> getUI().setActiveDragSource(null)); - } - - /** - * Register server RPC. - * - * @param target - * Extended component. - */ - protected void registerDragSourceRpc(T target) { - registerRpc(new DragSourceRpc() { - @Override - public void dragStart() { - DragStartEvent<T> event = new DragStartEvent<>(target, - getState(false).effectAllowed); - fireEvent(event); - } - - @Override - public void dragEnd(DropEffect dropEffect) { - DragEndEvent<T> event = new DragEndEvent<>(target, dropEffect); - fireEvent(event); - } - }); - } - - @Override - public void remove() { - super.remove(); - - // Remove listeners attached on construction - dragStartListenerHandle.remove(); - dragEndListenerHandle.remove(); - } - - /** - * Sets the allowed effects for the current drag source element. Used for - * setting client side {@code DataTransfer.effectAllowed} parameter for the - * drag event. - * <p> - * By default the value is {@link EffectAllowed#UNINITIALIZED} which is - * equivalent to {@link EffectAllowed#ALL}. - * - * @param effect - * Effects to allow for this draggable element. Cannot be {@code - * null}. - */ - public void setEffectAllowed(EffectAllowed effect) { - if (effect == null) { - throw new IllegalArgumentException("Allowed effect cannot be null"); - } - if (!Objects.equals(getState(false).effectAllowed, effect)) { - getState().effectAllowed = effect; - } - } - - /** - * Returns the allowed effects for the current drag source element. Used to - * set client side {@code DataTransfer.effectAllowed} parameter for the drag - * event. - * - * @return Effects that are allowed for this draggable element. - */ - public EffectAllowed getEffectAllowed() { - return getState(false).effectAllowed; - } - - /** - * Sets data for this drag source element. The data is set for the client - * side draggable element using the {@code DataTransfer.setData("text", - * data)} method. - * - * @param data - * Data to be set for the client side draggable element. - */ - public void setDataTransferText(String data) { - getState().dataTransferText = data; - } - - /** - * Returns the data stored with type {@code "text"} in this drag source - * element. - * - * @return Data of type {@code "text"} stored in this drag source element. - */ - public String getDataTransferText() { - return getState(false).dataTransferText; - } - - /** - * Clears data of type {@code "text"} in this drag source element. - */ - public void clearDataTransferText() { - getState().dataTransferText = null; - } - - /** - * Set server side drag data. This data is available in the drop event and - * can be used to transfer data between drag source and drop target if they - * are in the same UI. - * - * @param data - * Data to transfer to drop event. - */ - public void setDragData(Object data) { - dragData = data; - } - - /** - * Get server side drag data. This data is available in the drop event and - * can be used to transfer data between drag source and drop target if they - * are in the same UI. - * - * @return Server side drag data if set, otherwise {@literal null}. - */ - public Object getDragData() { - return dragData; - } - - /** - * Attaches dragstart listener for the current drag source. {@link - * DragStartListener#dragStart(DragStartEvent)} is called when dragstart - * event happens on the client side. - * - * @param listener - * Listener to handle dragstart event. - * @return Handle to be used to remove this listener. - */ - public Registration addDragStartListener(DragStartListener<T> listener) { - return addListener(DragSourceState.EVENT_DRAGSTART, - DragStartEvent.class, listener, - DragStartListener.DRAGSTART_METHOD); - } - - /** - * Attaches dragend listener for the current drag source. {@link - * DragEndListener#dragEnd(DragEndEvent)} is called when dragend - * event happens on the client side. - * - * @param listener - * Listener to handle dragend event. - * @return Handle to be used to remove this listener. - */ - public Registration addDragEndListener(DragEndListener<T> listener) { - return addListener(DragSourceState.EVENT_DRAGEND, DragEndEvent.class, - listener, DragEndListener.DRAGEND_METHOD); - } - - /** - * Set a custom drag image for the current drag source. - * - * @param imageResource - * Resource of the image to be displayed as drag image. - */ - public void setDragImage(Resource imageResource) { - setResource(DragSourceState.RESOURCE_DRAG_IMAGE, imageResource); - } - - @Override - protected DragSourceState getState() { - return (DragSourceState) super.getState(); - } - - @Override - protected DragSourceState getState(boolean markAsDirty) { - return (DragSourceState) super.getState(markAsDirty); - } - - /** - * Returns the component this extension is attached to. - * - * @return Extended component. - */ - @Override - @SuppressWarnings("unchecked") - public T getParent() { - return (T) super.getParent(); - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DragStartEvent.java b/server/src/main/java/com/vaadin/event/dnd/DragStartEvent.java deleted file mode 100644 index 2022f42a00..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DragStartEvent.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import com.vaadin.shared.ui.dnd.EffectAllowed; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Component; - -/** - * HTML5 drag start event. - * - * @param <T> - * Type of the component that is dragged. - * @author Vaadin Ltd - * @see DragSourceExtension#addDragStartListener(DragStartListener) - * @since 8.1 - */ -public class DragStartEvent<T extends AbstractComponent> extends - Component.Event { - private final EffectAllowed effectAllowed; - - /** - * Creates a drag start event. - * - * @param source - * Component that is dragged. - * @param effectAllowed - * Allowed effects from {@code DataTransfer.effectAllowed} object. - */ - public DragStartEvent(T source, EffectAllowed effectAllowed) { - super(source); - - this.effectAllowed = effectAllowed; - } - - /** - * Returns the {@code effectAllowed} parameter of this event. - * - * @return This event's {@code effectAllowed} parameter. - */ - public EffectAllowed getEffectAllowed() { - return effectAllowed; - } - - /** - * Returns the drag source component where the dragstart event occurred. - * - * @return Component which is dragged. - */ - @Override - @SuppressWarnings("unchecked") - public T getComponent() { - return (T) super.getComponent(); - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DragStartListener.java b/server/src/main/java/com/vaadin/event/dnd/DragStartListener.java deleted file mode 100644 index 530a0f113b..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DragStartListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.lang.reflect.Method; - -import com.vaadin.event.ConnectorEventListener; -import com.vaadin.ui.AbstractComponent; - -/** - * Interface to be implemented when creating a dragstart listener on a drag - * source for HTML5 drag and drop. - * - * @param <T> - * Type of draggable component. - * @author Vaadin Ltd - * @see DragSourceExtension#addDragStartListener(DragStartListener) - * @since 8.1 - */ -@FunctionalInterface -public interface DragStartListener<T extends AbstractComponent> extends - ConnectorEventListener { - static final Method DRAGSTART_METHOD = DragStartListener.class - .getDeclaredMethods()[0]; - - /** - * Called when dragstart event is fired. - * - * @param event - * Server side dragstart event. - */ - void dragStart(DragStartEvent<T> event); -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DropEvent.java b/server/src/main/java/com/vaadin/event/dnd/DropEvent.java deleted file mode 100644 index caa80a88ae..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DropEvent.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.util.Optional; - -import com.vaadin.shared.ui.dnd.DropEffect; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Component; - -/** - * Server side drop event. Fired when an HTML5 drop happens. - * - * @param <T> - * Type of the drop target component. - * @author Vaadin Ltd - * @see DropTargetExtension#addDropListener(DropListener) - * @since 8.1 - */ -public class DropEvent<T extends AbstractComponent> extends Component.Event { - private final String dataTransferText; - private final DragSourceExtension<? extends AbstractComponent> dragSourceExtension; - private final AbstractComponent dragSource; - private final DropEffect dropEffect; - - /** - * Creates a server side drop event. - * - * @param target - * Component that received the drop. - * @param dataTransferText - * Data of type {@code "text"} from the {@code DataTransfer} - * object. - * @param dropEffect - * the desired drop effect - * @param dragSourceExtension - * Drag source extension of the component that initiated the drop - * event. - */ - public DropEvent(T target, String dataTransferText, DropEffect dropEffect, - DragSourceExtension<? extends AbstractComponent> dragSourceExtension) { - super(target); - - this.dataTransferText = dataTransferText; - this.dropEffect = dropEffect; - - this.dragSourceExtension = dragSourceExtension; - this.dragSource = Optional.ofNullable(dragSourceExtension) - .map(DragSourceExtension::getParent).orElse(null); - } - - /** - * Get data of type {@code "text"} from the client side {@code DataTransfer} - * object. - * - * @return Data of type {@code "text"} if exists in the client side {@code - * DataTransfer} object, otherwise {@literal null}. - */ - public String getDataTransferText() { - return dataTransferText; - } - - /** - * Get the desired dropEffect for the drop event. - * <p> - * <em>NOTE: Currently you cannot trust this to work on all browsers! - * https://github.com/vaadin/framework/issues/9247 For Chrome & IE11 it is - * never set and always returns {@link DropEffect#NONE} even though the drop - * succeeded!</em> - * - * @return the drop effect - */ - public DropEffect getDropEffect() { - return dropEffect; - } - - /** - * Returns the drag source component if the drag originated from a component - * in the same UI as the drop target component, or an empty optional. - * - * @return Drag source component or an empty optional. - */ - public Optional<AbstractComponent> getDragSourceComponent() { - return Optional.ofNullable(dragSource); - } - - /** - * Returns the extension of the drag source component if the drag originated - * from a component in the same UI as the drop target component, or an empty - * optional. - * - * @return Drag source extension or an empty optional - */ - public Optional<DragSourceExtension<? extends AbstractComponent>> getDragSourceExtension() { - return Optional.ofNullable(dragSourceExtension); - } - - /** - * Gets the server side drag data. This data can be set during the drag - * start event on the server side and can be used to transfer data between - * drag source and drop target when they are in the same UI. - * - * @return Optional server side drag data if set and the drag source and the - * drop target are in the same UI, otherwise empty {@code Optional}. - * @see DragSourceExtension#setDragData(Object) - */ - public Optional<Object> getDragData() { - return getDragSourceExtension().map(DragSourceExtension::getDragData); - } - - /** - * Returns the drop target component where the drop event occurred. - * - * @return Component on which a drag source was dropped. - */ - @Override - @SuppressWarnings("unchecked") - public T getComponent() { - return (T) super.getComponent(); - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DropListener.java b/server/src/main/java/com/vaadin/event/dnd/DropListener.java deleted file mode 100644 index c10f51569c..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DropListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.lang.reflect.Method; - -import com.vaadin.event.ConnectorEventListener; -import com.vaadin.ui.AbstractComponent; - -/** - * Interface to be implemented when creating a drop listener on a drop target - * for HTML5 drag and drop. - * - * @param <T> - * Type of the drop target component. - * @author Vaadin Ltd - * @see DropTargetExtension#addDropListener(DropListener) - * @since 8.1 - */ -@FunctionalInterface -public interface DropListener<T extends AbstractComponent> extends - ConnectorEventListener { - static final Method DROP_METHOD = DropListener.class - .getDeclaredMethods()[0]; - - /** - * Called when drop event is fired. - * - * @param event - * Server side drop event. - */ - void drop(DropEvent<T> event); -} diff --git a/server/src/main/java/com/vaadin/event/dnd/DropTargetExtension.java b/server/src/main/java/com/vaadin/event/dnd/DropTargetExtension.java deleted file mode 100644 index 53266a2eea..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/DropTargetExtension.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.util.Objects; - -import com.vaadin.server.AbstractExtension; -import com.vaadin.shared.Registration; -import com.vaadin.shared.ui.dnd.DropEffect; -import com.vaadin.shared.ui.dnd.DropTargetRpc; -import com.vaadin.shared.ui.dnd.DropTargetState; -import com.vaadin.ui.AbstractComponent; - -/** - * Extension to add drop target functionality to a widget for using HTML5 drag - * and drop. - * - * @param <T> - * Type of the component to be extended. - * @author Vaadin Ltd - * @since 8.1 - */ -public class DropTargetExtension<T extends AbstractComponent> - extends AbstractExtension { - - /** - * Extends {@code target} component and makes it a drop target. - * - * @param target - * Component to be extended. - */ - public DropTargetExtension(T target) { - - registerDropTargetRpc(target); - - super.extend(target); - } - - /** - * Register server RPC. - * - * @param target - * Extended component. - */ - protected void registerDropTargetRpc(T target) { - registerRpc((DropTargetRpc) (dataTransferText, dropEffect) -> { - DropEvent<T> event = new DropEvent<>(target, dataTransferText, - DropEffect.valueOf(dropEffect.toUpperCase()), - getUI().getActiveDragSource()); - - fireEvent(event); - }); - } - - /** - * Sets the drop effect for the current drop target. This is set to the - * dropEffect on {@code dragenter} and {@code dragover} events. - * <p> - * <em>NOTE: If the drop effect that doesn't match the dropEffect / - * effectAllowed of the drag source, it DOES NOT prevent drop on IE and - * Safari! For FireFox and Chrome the drop is prevented if there they don't - * match.</em> - * <p> - * Default value is browser dependent and can depend on e.g. modifier keys. - * <p> - * From Moz Foundation: "You can modify the dropEffect property during the - * dragenter or dragover events, if for example, a particular drop target - * only supports certain operations. You can modify the dropEffect property - * to override the user effect, and enforce a specific drop operation to - * occur. Note that this effect must be one listed within the effectAllowed - * property. Otherwise, it will be set to an alternate value that is - * allowed." - * - * @param dropEffect - * the drop effect to be set or {@code null} to not modify - */ - public void setDropEffect(DropEffect dropEffect) { - if (!Objects.equals(getState(false).dropEffect, dropEffect)) { - getState().dropEffect = dropEffect; - } - } - - /** - * Returns the drop effect for the current drop target. - * - * @return The drop effect of this drop target or {@code null} if none set - * @see #setDropEffect(DropEffect) - */ - public DropEffect getDropEffect() { - return getState(false).dropEffect; - } - - /** - * Sets criteria to allow drop on this drop target. The script executes when - * something is dragged on top of the target, and the drop is not allowed in - * case the script returns {@code false}. - * <p> - * <b>IMPORTANT:</b> Construct the criteria script carefully and do not - * include untrusted sources such as user input. Always keep in mind that - * the script is executed on the client as is. - * <p> - * Example: - * - * <pre> - * target.setDropCriteria( - * // If dragged source contains a URL, allow it to be dropped - * "if (event.dataTransfer.types.includes('text/uri-list')) {" - * + " return true;" + "}" + - * - * // Otherwise cancel the event" - * "return false;"); - * </pre> - * - * @param criteriaScript - * JavaScript to be executed when drop event happens or - * {@code null} to clear. - */ - public void setDropCriteria(String criteriaScript) { - if (!Objects.equals(getState(false).dropCriteria, criteriaScript)) { - getState().dropCriteria = criteriaScript; - } - } - - /** - * Gets the criteria script that determines whether a drop is allowed. If - * the script returns {@code false}, then it is determined the drop is not - * allowed. - * - * @return JavaScript that executes when drop event happens. - * @see #setDropCriteria(String) - */ - public String getDropCriteria() { - return getState(false).dropCriteria; - } - - /** - * Attaches drop listener for the current drop target. - * {@link DropListener#drop(DropEvent)} is called when drop event happens on - * the client side. - * - * @param listener - * Listener to handle drop event. - * @return Handle to be used to remove this listener. - */ - public Registration addDropListener(DropListener<T> listener) { - return addListener(DropEvent.class, listener, DropListener.DROP_METHOD); - } - - @Override - protected DropTargetState getState() { - return (DropTargetState) super.getState(); - } - - @Override - protected DropTargetState getState(boolean markAsDirty) { - return (DropTargetState) super.getState(markAsDirty); - } - - /** - * Returns the component this extension is attached to. - * - * @return Extended component. - */ - @Override - @SuppressWarnings("unchecked") - public T getParent() { - return (T) super.getParent(); - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/FileDropEvent.java b/server/src/main/java/com/vaadin/event/dnd/FileDropEvent.java deleted file mode 100644 index 7ad5f410bf..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/FileDropEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.util.Collection; -import java.util.List; - -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Component; -import com.vaadin.ui.Html5File; - -/** - * File drop event that contains the collection of files dropped on a file drop - * target. - * - * @param <T> - * Type of the file drop target component. - * @author Vaadin Ltd - * @see FileDropHandler - * @since 8.1 - */ -public class FileDropEvent<T extends AbstractComponent> extends - Component.Event { - - private final Collection<Html5File> files; - - /** - * Creates a file drop event. - * - * @param target - * The file drop target component. - * @param files - * Collection of files. - */ - public FileDropEvent(T target, Collection<Html5File> files) { - super(target); - - this.files = files; - } - - /** - * Gets the collection of files dropped onto the file drop target component. - * - * @return Collection of files that were dropped onto the file drop target - * component. - */ - public Collection<Html5File> getFiles() { - return files; - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/FileDropHandler.java b/server/src/main/java/com/vaadin/event/dnd/FileDropHandler.java deleted file mode 100644 index 5e74e44349..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/FileDropHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd; - -import java.io.Serializable; - -import com.vaadin.ui.AbstractComponent; - -/** - * Handles the drop event on a file drop target. - * - * @param <T> - * Type of the file drop target component. - * @author Vaadin Ltd - * @see FileDropEvent - * @see com.vaadin.ui.FileDropTarget - * @since 8.1 - */ -public interface FileDropHandler<T extends AbstractComponent> extends - Serializable { - - /** - * Handles the drop event. The method is called when files are dropped onto - * the file drop target this handler is registered to. - * - * @param event - * The file drop event containing the list of files that were - * dropped onto the component. - */ - public void drop(FileDropEvent<T> event); -} diff --git a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndEvent.java b/server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndEvent.java deleted file mode 100644 index 06c583fc57..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd.grid; - -import java.util.Set; - -import com.vaadin.event.dnd.DragEndEvent; -import com.vaadin.shared.ui.dnd.DropEffect; -import com.vaadin.ui.Grid; -import com.vaadin.ui.GridDragSource; - -/** - * Drop event on an HTML5 drop target {@link Grid} row. - * - * @param <T> - * The Grid bean type. - * @author Vaadin Ltd. - * @see GridDragSource#addGridDragStartListener(GridDragStartListener) - * @since 8.1 - */ -public class GridDragEndEvent<T> extends DragEndEvent<Grid<T>> { - - private final Set<T> draggedItems; - - /** - * Creates a drag end event. - * - * @param source - * Grid component in which the items were dragged. - * @param dropEffect - * Drop effect from {@code DataTransfer.dropEffect} object. - * @param draggedItems - * Set of items having been dragged. - */ - public GridDragEndEvent(Grid<T> source, DropEffect dropEffect, - Set<T> draggedItems) { - super(source, dropEffect); - - this.draggedItems = draggedItems; - } - - /** - * Get the dragged row items. - * - * @return Set of row items that were being dragged. - */ - public Set<T> getDraggedItems() { - return draggedItems; - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndListener.java b/server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndListener.java deleted file mode 100644 index eb2b90fa64..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd.grid; - -import java.lang.reflect.Method; - -import com.vaadin.event.ConnectorEventListener; -import com.vaadin.ui.GridDragSource; - -/** - * Drop listener for HTML5 drop on a Grid row. - * - * @param <T> - * The Grid bean type. - * @author Vaadin Ltd. - * @see GridDragSource#addGridDragEndListener(GridDragEndListener) - * @since 8.1 - */ -@FunctionalInterface -public interface GridDragEndListener<T> extends ConnectorEventListener { - - static final Method DRAG_END_METHOD = GridDragEndListener.class - .getDeclaredMethods()[0]; - - /** - * Invoked when the user has dropped the dragged grid rows, or canceled the - * drag. - * - * @param event - * The drag end event. - */ - void dragEnd(GridDragEndEvent<T> event); -} diff --git a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartEvent.java b/server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartEvent.java deleted file mode 100644 index 35691d20c2..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd.grid; - -import java.util.Set; - -import com.vaadin.event.dnd.DragStartEvent; -import com.vaadin.shared.ui.dnd.EffectAllowed; -import com.vaadin.ui.Grid; -import com.vaadin.ui.GridDragSource; - -/** - * Drag start event on an HTML5 drag source {@link Grid} row. - * - * @param <T> - * The Grid bean type. - * @author Vaadin Ltd. - * @see GridDragSource#addGridDragStartListener(GridDragStartListener) - * @since 8.1 - */ -public class GridDragStartEvent<T> extends DragStartEvent<Grid<T>> { - - private final Set<T> draggedItems; - - /** - * Creates a drag start event. - * - * @param source - * The source grid where the rows are being dragged from. - * @param effectAllowed - * Allowed effect from {@code DataTransfer.effectAllowed} object. - * @param draggedItems - * Set of items being dragged. - */ - public GridDragStartEvent(Grid<T> source, EffectAllowed effectAllowed, - Set<T> draggedItems) { - super(source, effectAllowed); - - this.draggedItems = draggedItems; - } - - /** - * Get the dragged row items. - * - * @return Set of row items that are being dragged. - */ - public Set<T> getDraggedItems() { - return draggedItems; - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartListener.java b/server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartListener.java deleted file mode 100644 index 0d1e071eea..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd.grid; - -import java.lang.reflect.Method; - -import com.vaadin.event.ConnectorEventListener; -import com.vaadin.ui.GridDragSource; - -/** - * Drag start listener for HTML5 drag start on a Grid row. - * - * @param <T> - * The Grid bean type. - * @author Vaadin Ltd. - * @see GridDragSource#addGridDragStartListener(GridDragStartListener) - * @since 8.1 - */ -@FunctionalInterface -public interface GridDragStartListener<T> extends ConnectorEventListener { - - static final Method DRAG_START_METHOD = GridDragStartListener.class - .getDeclaredMethods()[0]; - - /** - * Invoked when the user has started dragging grid's rows. - * - * @param event - * The drag start event. - */ - void dragStart(GridDragStartEvent<T> event); -} diff --git a/server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java b/server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java deleted file mode 100644 index df634cf559..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd.grid; - -import com.vaadin.event.dnd.DragSourceExtension; -import com.vaadin.event.dnd.DropEvent; -import com.vaadin.shared.ui.dnd.DropEffect; -import com.vaadin.shared.ui.grid.DropLocation; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Grid; -import com.vaadin.ui.GridDropTarget; - -/** - * Drop event on an HTML5 drop target {@link Grid} row. - * - * @param <T> - * The Grid bean type. - * @author Vaadin Ltd. - * @see GridDropTarget#addGridDropListener(GridDropListener) - * @since 8.1 - */ -public class GridDropEvent<T> extends DropEvent<Grid<T>> { - - private final T dropTargetRow; - private final DropLocation dropLocation; - - /** - * Creates a Grid row drop event. - * - * @param target - * Grid that received the drop. - * @param dataTransferText - * Data of type {@code "text"} from the {@code DataTransfer} - * object. - * @param dropEffect - * the desired drop effect - * @param dragSourceExtension - * Drag source extension of the component that initiated the drop - * event. - * @param dropTargetRow - * Target row that received the drop. - * @param dropLocation - * Location of the drop within the target row. - */ - public GridDropEvent(Grid<T> target, String dataTransferText, - DropEffect dropEffect, - DragSourceExtension<? extends AbstractComponent> dragSourceExtension, - T dropTargetRow, DropLocation dropLocation) { - super(target, dataTransferText, dropEffect, dragSourceExtension); - - this.dropTargetRow = dropTargetRow; - this.dropLocation = dropLocation; - } - - /** - * Get the row item source of this event. - * - * @return The row item this event was originated from. - */ - public T getDropTargetRow() { - return dropTargetRow; - } - - /** - * Get the location of the drop within the row. - * - * @return Location of the drop within the row. - */ - public DropLocation getDropLocation() { - return dropLocation; - } -} diff --git a/server/src/main/java/com/vaadin/event/dnd/grid/GridDropListener.java b/server/src/main/java/com/vaadin/event/dnd/grid/GridDropListener.java deleted file mode 100644 index 0bd48db2ca..0000000000 --- a/server/src/main/java/com/vaadin/event/dnd/grid/GridDropListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2016 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.event.dnd.grid; - -import java.lang.reflect.Method; - -import com.vaadin.event.ConnectorEventListener; -import com.vaadin.ui.GridDropTarget; - -/** - * Drop listener for HTML5 drop on a Grid row. - * - * @param <T> - * The Grid bean type. - * @author Vaadin Ltd. - * @see GridDropTarget#addGridDropListener(GridDropListener) - * @since 8.1 - */ -@FunctionalInterface -public interface GridDropListener<T> extends ConnectorEventListener { - - static final Method DROP_METHOD = GridDropListener.class - .getDeclaredMethods()[0]; - - /** - * Called when drop event is fired on a Grid row. - * - * @param event - * Server side drop event. - */ - void drop(GridDropEvent<T> event); -} |