@@ -29,10 +29,10 @@ import com.vaadin.client.widgets.Grid; | |||
import com.vaadin.shared.Range; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.dnd.DropEffect; | |||
import com.vaadin.shared.ui.grid.GridDragSourceExtensionRpc; | |||
import com.vaadin.shared.ui.grid.GridDragSourceExtensionState; | |||
import com.vaadin.shared.ui.grid.GridDragSourceRpc; | |||
import com.vaadin.shared.ui.grid.GridDragSourceState; | |||
import com.vaadin.shared.ui.grid.GridState; | |||
import com.vaadin.ui.GridDragSourceExtension; | |||
import com.vaadin.ui.GridDragSource; | |||
import elemental.events.Event; | |||
import elemental.json.Json; | |||
@@ -41,14 +41,13 @@ import elemental.json.JsonObject; | |||
/** | |||
* Adds HTML5 drag and drop functionality to a {@link com.vaadin.client.widgets.Grid | |||
* Grid}'s rows. This is the client side counterpart of {@link | |||
* GridDragSourceExtension}. | |||
* Grid}'s rows. This is the client side counterpart of {@link GridDragSource}. | |||
* | |||
* @author Vaadin Ltd | |||
* @since | |||
*/ | |||
@Connect(GridDragSourceExtension.class) | |||
public class GridDragSourceExtensionConnector extends | |||
@Connect(GridDragSource.class) | |||
public class GridDragSourceConnector extends | |||
DragSourceExtensionConnector { | |||
private GridConnector gridConnector; | |||
@@ -93,8 +92,7 @@ public class GridDragSourceExtensionConnector extends | |||
protected void sendDragStartEventToServer(Event dragStartEvent) { | |||
// Start server RPC with dragged item keys | |||
getRpcProxy(GridDragSourceExtensionRpc.class) | |||
.dragStart(draggedItemKeys); | |||
getRpcProxy(GridDragSourceRpc.class).dragStart(draggedItemKeys); | |||
} | |||
private List<JsonObject> getDraggedRows(Event dragStartEvent) { | |||
@@ -130,7 +128,7 @@ public class GridDragSourceExtensionConnector extends | |||
DropEffect dropEffect) { | |||
// Send server RPC with dragged item keys | |||
getRpcProxy(GridDragSourceExtensionRpc.class) | |||
getRpcProxy(GridDragSourceRpc.class) | |||
.dragEnd(dropEffect, draggedItemKeys); | |||
} | |||
@@ -204,9 +202,8 @@ public class GridDragSourceExtensionConnector extends | |||
* @return Drag data if present or row data otherwise. | |||
*/ | |||
private JsonObject getDragData(JsonObject row) { | |||
return row.hasKey(GridDragSourceExtensionState.JSONKEY_DRAG_DATA) | |||
? row.getObject(GridDragSourceExtensionState.JSONKEY_DRAG_DATA) | |||
: row; | |||
return row.hasKey(GridDragSourceState.JSONKEY_DRAG_DATA) | |||
? row.getObject(GridDragSourceState.JSONKEY_DRAG_DATA) : row; | |||
} | |||
@Override | |||
@@ -239,7 +236,7 @@ public class GridDragSourceExtensionConnector extends | |||
} | |||
@Override | |||
public GridDragSourceExtensionState getState() { | |||
return (GridDragSourceExtensionState) super.getState(); | |||
public GridDragSourceState getState() { | |||
return (GridDragSourceState) super.getState(); | |||
} | |||
} |
@@ -30,23 +30,23 @@ import com.vaadin.client.widgets.Escalator; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.grid.DropLocation; | |||
import com.vaadin.shared.ui.grid.DropMode; | |||
import com.vaadin.shared.ui.grid.GridDropTargetExtensionRpc; | |||
import com.vaadin.shared.ui.grid.GridDropTargetExtensionState; | |||
import com.vaadin.shared.ui.grid.GridDropTargetRpc; | |||
import com.vaadin.shared.ui.grid.GridDropTargetState; | |||
import com.vaadin.shared.ui.grid.GridState; | |||
import com.vaadin.ui.GridDropTargetExtension; | |||
import com.vaadin.ui.GridDropTarget; | |||
import elemental.events.Event; | |||
import elemental.json.JsonObject; | |||
/** | |||
* Makes Grid an HTML5 drop target. This is the client side counterpart of | |||
* {@link GridDropTargetExtension}. | |||
* {@link GridDropTarget}. | |||
* | |||
* @author Vaadin Ltd | |||
* @since | |||
*/ | |||
@Connect(GridDropTargetExtension.class) | |||
public class GridDropTargetExtensionConnector extends | |||
@Connect(GridDropTarget.class) | |||
public class GridDropTargetConnector extends | |||
DropTargetExtensionConnector { | |||
// Drag over class name suffixes | |||
@@ -89,7 +89,7 @@ public class GridDropTargetExtensionConnector extends | |||
(NativeEvent) dropEvent); | |||
} | |||
getRpcProxy(GridDropTargetExtensionRpc.class) | |||
getRpcProxy(GridDropTargetRpc.class) | |||
.drop(dataTransferText, rowKey, dropLocation); | |||
} | |||
@@ -190,7 +190,7 @@ public class GridDropTargetExtensionConnector extends | |||
} | |||
@Override | |||
public GridDropTargetExtensionState getState() { | |||
return (GridDropTargetExtensionState) super.getState(); | |||
public GridDropTargetState getState() { | |||
return (GridDropTargetState) super.getState(); | |||
} | |||
} |
@@ -20,6 +20,7 @@ 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. | |||
@@ -27,7 +28,7 @@ import com.vaadin.ui.Grid; | |||
* @param <T> | |||
* The Grid bean type. | |||
* @author Vaadin Ltd. | |||
* @see com.vaadin.ui.GridDragSourceExtension#addGridDragStartListener(GridDragStartListener) | |||
* @see GridDragSource#addGridDragStartListener(GridDragStartListener) | |||
* @since | |||
*/ | |||
public class GridDragEndEvent<T> extends DragEndEvent<Grid<T>> { |
@@ -18,6 +18,7 @@ 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. | |||
@@ -25,7 +26,7 @@ import com.vaadin.event.ConnectorEventListener; | |||
* @param <T> | |||
* The Grid bean type. | |||
* @author Vaadin Ltd. | |||
* @see com.vaadin.ui.GridDragSourceExtension#addGridDragEndListener(GridDragEndListener) | |||
* @see GridDragSource#addGridDragEndListener(GridDragEndListener) | |||
* @since | |||
*/ | |||
@FunctionalInterface |
@@ -20,6 +20,7 @@ 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. | |||
@@ -27,7 +28,7 @@ import com.vaadin.ui.Grid; | |||
* @param <T> | |||
* The Grid bean type. | |||
* @author Vaadin Ltd. | |||
* @see com.vaadin.ui.GridDragSourceExtension#addGridDragStartListener(GridDragStartListener) | |||
* @see GridDragSource#addGridDragStartListener(GridDragStartListener) | |||
* @since | |||
*/ | |||
public class GridDragStartEvent<T> extends DragStartEvent<Grid<T>> { |
@@ -18,6 +18,7 @@ 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. | |||
@@ -25,7 +26,7 @@ import com.vaadin.event.ConnectorEventListener; | |||
* @param <T> | |||
* The Grid bean type. | |||
* @author Vaadin Ltd. | |||
* @see com.vaadin.ui.GridDragSourceExtension#addGridDragStartListener(GridDragStartListener) | |||
* @see GridDragSource#addGridDragStartListener(GridDragStartListener) | |||
* @since | |||
*/ | |||
@FunctionalInterface |
@@ -20,6 +20,7 @@ import com.vaadin.event.dnd.DropEvent; | |||
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. | |||
@@ -27,7 +28,7 @@ import com.vaadin.ui.Grid; | |||
* @param <T> | |||
* The Grid bean type. | |||
* @author Vaadin Ltd. | |||
* @see com.vaadin.ui.GridDropTargetExtension#addGridDropListener(GridDropListener) | |||
* @see GridDropTarget#addGridDropListener(GridDropListener) | |||
* @since | |||
*/ | |||
public class GridDropEvent<T> extends DropEvent<Grid<T>> { |
@@ -18,6 +18,7 @@ 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. | |||
@@ -25,7 +26,7 @@ import com.vaadin.event.ConnectorEventListener; | |||
* @param <T> | |||
* The Grid bean type. | |||
* @author Vaadin Ltd. | |||
* @see com.vaadin.ui.GridDropTargetExtension#addGridDropListener(GridDropListener) | |||
* @see GridDropTarget#addGridDropListener(GridDropListener) | |||
* @since | |||
*/ | |||
@FunctionalInterface |
@@ -30,8 +30,8 @@ import com.vaadin.server.SerializableFunction; | |||
import com.vaadin.shared.Registration; | |||
import com.vaadin.shared.ui.dnd.DragSourceState; | |||
import com.vaadin.shared.ui.dnd.DropEffect; | |||
import com.vaadin.shared.ui.grid.GridDragSourceExtensionRpc; | |||
import com.vaadin.shared.ui.grid.GridDragSourceExtensionState; | |||
import com.vaadin.shared.ui.grid.GridDragSourceRpc; | |||
import com.vaadin.shared.ui.grid.GridDragSourceState; | |||
import elemental.json.JsonObject; | |||
@@ -46,7 +46,7 @@ import elemental.json.JsonObject; | |||
* @author Vaadin Ltd. | |||
* @since | |||
*/ | |||
public class GridDragSourceExtension<T> extends DragSourceExtension<Grid<T>> { | |||
public class GridDragSource<T> extends DragSourceExtension<Grid<T>> { | |||
/** | |||
* Drag data generator that appends drag data to each row. | |||
@@ -64,7 +64,7 @@ public class GridDragSourceExtension<T> extends DragSourceExtension<Grid<T>> { | |||
* @param target | |||
* Grid to be extended. | |||
*/ | |||
public GridDragSourceExtension(Grid<T> target) { | |||
public GridDragSource(Grid<T> target) { | |||
super(target); | |||
// Create drag data generator | |||
@@ -76,7 +76,7 @@ public class GridDragSourceExtension<T> extends DragSourceExtension<Grid<T>> { | |||
@Override | |||
protected void registerDragSourceRpc(Grid<T> target) { | |||
registerRpc(new GridDragSourceExtensionRpc() { | |||
registerRpc(new GridDragSourceRpc() { | |||
@Override | |||
public void dragStart(List<String> draggedItemKeys) { | |||
@@ -124,7 +124,7 @@ public class GridDragSourceExtension<T> extends DragSourceExtension<Grid<T>> { | |||
*/ | |||
private void generateDragData(T item, JsonObject jsonObject) { | |||
Optional.ofNullable(generatorFunction).ifPresent(generator -> jsonObject | |||
.put(GridDragSourceExtensionState.JSONKEY_DRAG_DATA, | |||
.put(GridDragSourceState.JSONKEY_DRAG_DATA, | |||
generator.apply(item))); | |||
} | |||
@@ -204,12 +204,12 @@ public class GridDragSourceExtension<T> extends DragSourceExtension<Grid<T>> { | |||
} | |||
@Override | |||
protected GridDragSourceExtensionState getState() { | |||
return (GridDragSourceExtensionState) super.getState(); | |||
protected GridDragSourceState getState() { | |||
return (GridDragSourceState) super.getState(); | |||
} | |||
@Override | |||
protected GridDragSourceExtensionState getState(boolean markAsDirty) { | |||
return (GridDragSourceExtensionState) super.getState(markAsDirty); | |||
protected GridDragSourceState getState(boolean markAsDirty) { | |||
return (GridDragSourceState) super.getState(markAsDirty); | |||
} | |||
} |
@@ -20,8 +20,8 @@ import com.vaadin.event.dnd.grid.GridDropEvent; | |||
import com.vaadin.event.dnd.grid.GridDropListener; | |||
import com.vaadin.shared.Registration; | |||
import com.vaadin.shared.ui.grid.DropMode; | |||
import com.vaadin.shared.ui.grid.GridDropTargetExtensionRpc; | |||
import com.vaadin.shared.ui.grid.GridDropTargetExtensionState; | |||
import com.vaadin.shared.ui.grid.GridDropTargetRpc; | |||
import com.vaadin.shared.ui.grid.GridDropTargetState; | |||
/** | |||
* Makes the rows of a Grid HTML5 drop targets. This is the server side | |||
@@ -32,7 +32,7 @@ import com.vaadin.shared.ui.grid.GridDropTargetExtensionState; | |||
* @author Vaadin Ltd | |||
* @since | |||
*/ | |||
public class GridDropTargetExtension<T> extends DropTargetExtension<Grid<T>> { | |||
public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> { | |||
/** | |||
* Extends a Grid and makes it's rows drop targets for HTML5 drag and drop. | |||
@@ -44,7 +44,7 @@ public class GridDropTargetExtension<T> extends DropTargetExtension<Grid<T>> { | |||
* Grid's row. | |||
* @see GridDropEvent#getDropLocation() | |||
*/ | |||
public GridDropTargetExtension(Grid<T> target, DropMode dropMode) { | |||
public GridDropTarget(Grid<T> target, DropMode dropMode) { | |||
super(target); | |||
setDropMode(dropMode); | |||
@@ -93,7 +93,7 @@ public class GridDropTargetExtension<T> extends DropTargetExtension<Grid<T>> { | |||
@Override | |||
protected void registerDropTargetRpc(Grid<T> target) { | |||
registerRpc( | |||
(GridDropTargetExtensionRpc) (dataTransferText, rowKey, dropLocation) -> { | |||
(GridDropTargetRpc) (dataTransferText, rowKey, dropLocation) -> { | |||
T dropTargetRow = target.getDataCommunicator() | |||
.getKeyMapper().get(rowKey); | |||
@@ -107,12 +107,12 @@ public class GridDropTargetExtension<T> extends DropTargetExtension<Grid<T>> { | |||
} | |||
@Override | |||
protected GridDropTargetExtensionState getState() { | |||
return (GridDropTargetExtensionState) super.getState(); | |||
protected GridDropTargetState getState() { | |||
return (GridDropTargetState) super.getState(); | |||
} | |||
@Override | |||
protected GridDropTargetExtensionState getState(boolean markAsDirty) { | |||
return (GridDropTargetExtensionState) super.getState(markAsDirty); | |||
protected GridDropTargetState getState(boolean markAsDirty) { | |||
return (GridDropTargetState) super.getState(markAsDirty); | |||
} | |||
} |
@@ -27,7 +27,7 @@ import com.vaadin.shared.ui.dnd.DropEffect; | |||
* @author Vaadin Ltd. | |||
* @since | |||
*/ | |||
public interface GridDragSourceExtensionRpc extends ServerRpc { | |||
public interface GridDragSourceRpc extends ServerRpc { | |||
/** | |||
* Called when dragstart event happens on client side. |
@@ -18,12 +18,12 @@ package com.vaadin.shared.ui.grid; | |||
import com.vaadin.shared.ui.dnd.DragSourceState; | |||
/** | |||
* State class containing parameters for GridDragSourceExtension. | |||
* State class containing parameters for GridDragSource. | |||
* | |||
* @author Vaadin Ltd | |||
* @since | |||
*/ | |||
public class GridDragSourceExtensionState extends DragSourceState { | |||
public class GridDragSourceState extends DragSourceState { | |||
/** | |||
* Json key for storing data for a dragged row. |
@@ -24,7 +24,7 @@ import com.vaadin.shared.communication.ServerRpc; | |||
* @author Vaadin Ltd. | |||
* @since | |||
*/ | |||
public interface GridDropTargetExtensionRpc extends ServerRpc { | |||
public interface GridDropTargetRpc extends ServerRpc { | |||
/** | |||
* Called when drop event happens on client side. |
@@ -18,12 +18,12 @@ package com.vaadin.shared.ui.grid; | |||
import com.vaadin.shared.ui.dnd.DropTargetState; | |||
/** | |||
* State class containing parameters for GridDropTargetExtension. | |||
* State class containing parameters for GridDropTarget. | |||
* | |||
* @author Vaadin Ltd | |||
* @since | |||
*/ | |||
public class GridDropTargetExtensionState extends DropTargetState { | |||
public class GridDropTargetState extends DropTargetState { | |||
/** | |||
* Stores the drop mode of the drop target Grid. |
@@ -25,8 +25,8 @@ import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.shared.ui.grid.DropMode; | |||
import com.vaadin.tests.components.AbstractTestUIWithLog; | |||
import com.vaadin.ui.Grid; | |||
import com.vaadin.ui.GridDragSourceExtension; | |||
import com.vaadin.ui.GridDropTargetExtension; | |||
import com.vaadin.ui.GridDragSource; | |||
import com.vaadin.ui.GridDropTarget; | |||
import com.vaadin.ui.HorizontalLayout; | |||
import com.vaadin.ui.Layout; | |||
import com.vaadin.ui.RadioButtonGroup; | |||
@@ -44,7 +44,7 @@ public class GridDragAndDrop extends AbstractTestUIWithLog { | |||
dragSourceComponent.addColumn(Bean::getId).setCaption("ID"); | |||
dragSourceComponent.addColumn(Bean::getValue).setCaption("Value"); | |||
GridDragSourceExtension<Bean> dragSource = new GridDragSourceExtension<>( | |||
GridDragSource<Bean> dragSource = new GridDragSource<>( | |||
dragSourceComponent); | |||
dragSource.setDragDataGenerator(bean -> { | |||
JsonObject ret = Json.createObject(); | |||
@@ -59,7 +59,7 @@ public class GridDragAndDrop extends AbstractTestUIWithLog { | |||
dropTargetComponent.addColumn(Bean::getId).setCaption("ID"); | |||
dropTargetComponent.addColumn(Bean::getValue).setCaption("Value"); | |||
GridDropTargetExtension<Bean> dropTarget = new GridDropTargetExtension<>( | |||
GridDropTarget<Bean> dropTarget = new GridDropTarget<>( | |||
dropTargetComponent, DropMode.ON_TOP); | |||
dropTarget.addGridDropListener(event -> { | |||
log(event.getDataTransferText() + ", targetId=" + event |