Browse Source

Add/fill in missing @since tags for 8.1 (#9106)

tags/8.1.0.alpha6^0
Henri Sara 7 years ago
parent
commit
37219932b9
23 changed files with 152 additions and 142 deletions
  1. 4
    2
      client/src/main/java/com/vaadin/client/communication/MessageHandler.java
  2. 19
    21
      client/src/main/java/com/vaadin/client/connectors/grid/GridDragSourceConnector.java
  3. 8
    9
      client/src/main/java/com/vaadin/client/connectors/grid/GridDropTargetConnector.java
  4. 16
    11
      client/src/main/java/com/vaadin/client/ui/VButton.java
  5. 3
    2
      client/src/main/java/com/vaadin/client/widget/escalator/RowContainer.java
  6. 5
    5
      server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndEvent.java
  7. 3
    3
      server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndListener.java
  8. 5
    5
      server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartEvent.java
  9. 3
    3
      server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartListener.java
  10. 9
    9
      server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java
  11. 3
    3
      server/src/main/java/com/vaadin/event/dnd/grid/GridDropListener.java
  12. 2
    0
      server/src/main/java/com/vaadin/server/VaadinSession.java
  13. 1
    1
      server/src/main/java/com/vaadin/ui/ComponentRootSetter.java
  14. 1
    1
      server/src/main/java/com/vaadin/ui/Composite.java
  15. 22
    19
      server/src/main/java/com/vaadin/ui/GridDragSource.java
  16. 28
    27
      server/src/main/java/com/vaadin/ui/GridDropTarget.java
  17. 1
    1
      shared/src/main/java/com/vaadin/shared/composite/CompositeState.java
  18. 1
    1
      shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java
  19. 7
    8
      shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java
  20. 4
    4
      shared/src/main/java/com/vaadin/shared/ui/grid/GridDragSourceRpc.java
  21. 1
    1
      shared/src/main/java/com/vaadin/shared/ui/grid/GridDragSourceState.java
  22. 5
    5
      shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetRpc.java
  23. 1
    1
      shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetState.java

+ 4
- 2
client/src/main/java/com/vaadin/client/communication/MessageHandler.java View File

@@ -813,8 +813,8 @@ public class MessageHandler {

JsArrayString detachedArray = detachedConnectors.dump();
for (int i = 0; i < detachedArray.length(); i++) {
ServerConnector connector = getConnectorMap().getConnector(
detachedArray.get(i));
ServerConnector connector = getConnectorMap()
.getConnector(detachedArray.get(i));

Profiler.enter(
"unregisterRemovedConnectors unregisterConnector");
@@ -1701,6 +1701,8 @@ public class MessageHandler {
* establishing a push connection with the client.
*
* @return the push connection identifier string
*
* @since 8.1
*/
public String getPushId() {
return pushId;

+ 19
- 21
client/src/main/java/com/vaadin/client/connectors/grid/GridDragSourceConnector.java View File

@@ -33,7 +33,6 @@ import com.vaadin.client.widget.escalator.RowContainer;
import com.vaadin.client.widget.grid.selection.SelectionModel;
import com.vaadin.client.widgets.Escalator;
import com.vaadin.client.widgets.Grid;
import com.vaadin.server.Page;
import com.vaadin.shared.Range;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.dnd.DropEffect;
@@ -48,15 +47,15 @@ import elemental.json.JsonArray;
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 GridDragSource}.
* 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 GridDragSource}.
*
* @author Vaadin Ltd
* @since
* @since 8.1
*/
@Connect(GridDragSource.class)
public class GridDragSourceConnector extends
DragSourceExtensionConnector {
public class GridDragSourceConnector extends DragSourceExtensionConnector {

private static final String STYLE_SUFFIX_DRAG_BADGE = "-drag-badge";

@@ -69,7 +68,7 @@ public class GridDragSourceConnector extends

@Override
protected void extend(ServerConnector target) {
this.gridConnector = (GridConnector) target;
gridConnector = (GridConnector) target;

// Set newly added rows draggable
getGridBody().setNewEscalatorRowCallback(
@@ -92,9 +91,8 @@ public class GridDragSourceConnector extends
Element draggedRowElement = (Element) event.getTarget();

Element badge = DOM.createSpan();
badge.setClassName(
gridConnector.getWidget().getStylePrimaryName() + "-row"
+ STYLE_SUFFIX_DRAG_BADGE);
badge.setClassName(gridConnector.getWidget().getStylePrimaryName()
+ "-row" + STYLE_SUFFIX_DRAG_BADGE);
badge.setInnerHTML(draggedItemKeys.size() + "");

badge.getStyle().setMarginLeft(
@@ -107,7 +105,8 @@ public class GridDragSourceConnector extends

draggedRowElement.appendChild(badge);

// Remove badge on the next animation frame. Drag image will still contain the badge.
// Remove badge on the next animation frame. Drag image will still
// contain the badge.
AnimationScheduler.get().requestAnimationFrame(timestamp -> {
badge.removeFromParent();
}, (Element) event.getTarget());
@@ -128,9 +127,8 @@ public class GridDragSourceConnector extends

@Override
protected String createDataTransferText(Event dragStartEvent) {
JsonArray dragData = toJsonArray(
getDraggedRows(dragStartEvent).stream().map(this::getDragData)
.collect(Collectors.toList()));
JsonArray dragData = toJsonArray(getDraggedRows(dragStartEvent).stream()
.map(this::getDragData).collect(Collectors.toList()));
return dragData.toJson();
}

@@ -174,8 +172,8 @@ public class GridDragSourceConnector extends
DropEffect dropEffect) {

// Send server RPC with dragged item keys
getRpcProxy(GridDragSourceRpc.class)
.dragEnd(dropEffect, draggedItemKeys);
getRpcProxy(GridDragSourceRpc.class).dragEnd(dropEffect,
draggedItemKeys);
}

/**
@@ -183,9 +181,9 @@ public class GridDragSourceConnector extends
* allowed and a selected row is dragged.
*
* @param draggedRow
* Data of dragged row.
* Data of dragged row.
* @return {@code true} if multiple rows are dragged, {@code false}
* otherwise.
* otherwise.
*/
private boolean dragMultipleRows(JsonObject draggedRow) {
SelectionModel<JsonObject> selectionModel = getGrid()
@@ -208,7 +206,7 @@ public class GridDragSourceConnector extends
* Get all selected rows from a subset of rows defined by {@code range}.
*
* @param range
* Range of indexes.
* Range of indexes.
* @return List of data of all selected rows in the given range.
*/
private List<JsonObject> getSelectedRowsInRange(Range range) {
@@ -228,7 +226,7 @@ public class GridDragSourceConnector extends
* Converts a list of {@link JsonObject}s to a {@link JsonArray}.
*
* @param objects
* List of json objects.
* List of json objects.
* @return Json array containing all json objects.
*/
private JsonArray toJsonArray(List<JsonObject> objects) {
@@ -244,7 +242,7 @@ public class GridDragSourceConnector extends
* otherwise.
*
* @param row
* Row data.
* Row data.
* @return Drag data if present or row data otherwise.
*/
private JsonObject getDragData(JsonObject row) {

+ 8
- 9
client/src/main/java/com/vaadin/client/connectors/grid/GridDropTargetConnector.java View File

@@ -43,11 +43,10 @@ import elemental.json.JsonObject;
* {@link GridDropTarget}.
*
* @author Vaadin Ltd
* @since
* @since 8.1
*/
@Connect(GridDropTarget.class)
public class GridDropTargetConnector extends
DropTargetExtensionConnector {
public class GridDropTargetConnector extends DropTargetExtensionConnector {

/**
* Current style name
@@ -97,8 +96,8 @@ public class GridDropTargetConnector extends
(NativeEvent) dropEvent);
}

getRpcProxy(GridDropTargetRpc.class)
.drop(dataTransferText, rowKey, dropLocation);
getRpcProxy(GridDropTargetRpc.class).drop(dataTransferText, rowKey,
dropLocation);
}

private JsonObject getRowData(TableRowElement row) {
@@ -120,8 +119,8 @@ public class GridDropTargetConnector extends
} else if (getState().dropMode == DropMode.ON_TOP_OR_BETWEEN) {
if (getRelativeY(target, event) < getState().dropThreshold) {
return DropLocation.ABOVE;
} else if (target.getOffsetHeight() - getRelativeY(target, event)
< getState().dropThreshold) {
} else if (target.getOffsetHeight()
- getRelativeY(target, event) < getState().dropThreshold) {
return DropLocation.BELOW;
} else {
return DropLocation.ON_TOP;
@@ -138,8 +137,8 @@ public class GridDropTargetConnector extends
@Override
protected void onDragEnter(Event event) {
// Generate style names for the drop target
String styleRow =
gridConnector.getWidget().getStylePrimaryName() + "-row";
String styleRow = gridConnector.getWidget().getStylePrimaryName()
+ "-row";
styleDragCenter = styleRow + STYLE_SUFFIX_DRAG_CENTER;
styleDragTop = styleRow + STYLE_SUFFIX_DRAG_TOP;
styleDragBottom = styleRow + STYLE_SUFFIX_DRAG_BOTTOM;

+ 16
- 11
client/src/main/java/com/vaadin/client/ui/VButton.java View File

@@ -424,7 +424,10 @@ public class VButton extends FocusWidget implements ClickHandler {
* held down.
*
* @param enabled
* {@literal true} if capturing enabled, {@literal false} otherwise
* {@literal true} if capturing enabled, {@literal false}
* otherwise
*
* @since 8.1
*/
public void setCapturingEnabled(boolean enabled) {
capturingEnabled = enabled;
@@ -434,7 +437,9 @@ public class VButton extends FocusWidget implements ClickHandler {
* Returns if the widget's capturing of mouse events are enabled.
*
* @return {@literal true} if mouse capturing is enabled, {@literal false}
* otherwise
* otherwise
*
* @since 8.1
*/
public boolean isCapturingEnabled() {
return capturingEnabled;
@@ -443,28 +448,28 @@ public class VButton extends FocusWidget implements ClickHandler {
private static native int getHorizontalBorderAndPaddingWidth(Element elem)
/*-{
// THIS METHOD IS ONLY USED FOR INTERNET EXPLORER, IT DOESN'T WORK WITH OTHERS
var convertToPixel = function(elem, value) {
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// Remember the original values
var left = elem.style.left, rsLeft = elem.runtimeStyle.left;
// Put in the new values to get a computed value out
elem.runtimeStyle.left = elem.currentStyle.left;
elem.style.left = value || 0;
var ret = elem.style.pixelLeft;
// Revert the changed values
elem.style.left = left;
elem.runtimeStyle.left = rsLeft;
return ret;
}
var ret = 0;
var sides = ["Right","Left"];
for(var i=0; i<2; i++) {
var side = sides[i];
@@ -478,7 +483,7 @@ public class VButton extends FocusWidget implements ClickHandler {
ret += parseInt(value.substr(0, value.length-2));
}
}
// Padding -------------------------------------------------------
value = elem.currentStyle["padding"+side];
if ( !/^\d+(px)?$/i.test( value ) && /^\d/.test( value ) ) {
@@ -487,7 +492,7 @@ public class VButton extends FocusWidget implements ClickHandler {
ret += parseInt(value.substr(0, value.length-2));
}
}
return ret;
}-*/;


+ 3
- 2
client/src/main/java/com/vaadin/client/widget/escalator/RowContainer.java View File

@@ -125,8 +125,9 @@ public interface RowContainer {
* the escalator.
*
* @param consumer
* A Consumer function that receives the newly added table row
* elements.
* A Consumer function that receives the newly added table
* row elements.
* @since 8.1
*/
public void setNewEscalatorRowCallback(
Consumer<List<TableRowElement>> consumer);

+ 5
- 5
server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndEvent.java View File

@@ -26,10 +26,10 @@ import com.vaadin.ui.GridDragSource;
* Drop event on an HTML5 drop target {@link Grid} row.
*
* @param <T>
* The Grid bean type.
* The Grid bean type.
* @author Vaadin Ltd.
* @see GridDragSource#addGridDragStartListener(GridDragStartListener)
* @since
* @since 8.1
*/
public class GridDragEndEvent<T> extends DragEndEvent<Grid<T>> {

@@ -39,11 +39,11 @@ public class GridDragEndEvent<T> extends DragEndEvent<Grid<T>> {
* Creates a drag end event.
*
* @param source
* Grid component in which the items were dragged.
* Grid component in which the items were dragged.
* @param dropEffect
* Drop effect from {@code DataTransfer.dropEffect} object.
* Drop effect from {@code DataTransfer.dropEffect} object.
* @param draggedItems
* Set of items having been dragged.
* Set of items having been dragged.
*/
public GridDragEndEvent(Grid<T> source, DropEffect dropEffect,
Set<T> draggedItems) {

+ 3
- 3
server/src/main/java/com/vaadin/event/dnd/grid/GridDragEndListener.java View File

@@ -24,10 +24,10 @@ import com.vaadin.ui.GridDragSource;
* Drop listener for HTML5 drop on a Grid row.
*
* @param <T>
* The Grid bean type.
* The Grid bean type.
* @author Vaadin Ltd.
* @see GridDragSource#addGridDragEndListener(GridDragEndListener)
* @since
* @since 8.1
*/
@FunctionalInterface
public interface GridDragEndListener<T> extends ConnectorEventListener {
@@ -40,7 +40,7 @@ public interface GridDragEndListener<T> extends ConnectorEventListener {
* drag.
*
* @param event
* The drag end event.
* The drag end event.
*/
void dragEnd(GridDragEndEvent<T> event);
}

+ 5
- 5
server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartEvent.java View File

@@ -26,10 +26,10 @@ import com.vaadin.ui.GridDragSource;
* Drag start event on an HTML5 drag source {@link Grid} row.
*
* @param <T>
* The Grid bean type.
* The Grid bean type.
* @author Vaadin Ltd.
* @see GridDragSource#addGridDragStartListener(GridDragStartListener)
* @since
* @since 8.1
*/
public class GridDragStartEvent<T> extends DragStartEvent<Grid<T>> {

@@ -39,11 +39,11 @@ public class GridDragStartEvent<T> extends DragStartEvent<Grid<T>> {
* Creates a drag start event.
*
* @param source
* The source grid where the rows are being dragged from.
* The source grid where the rows are being dragged from.
* @param effectAllowed
* Allowed effect from {@code DataTransfer.effectAllowed} object.
* Allowed effect from {@code DataTransfer.effectAllowed} object.
* @param draggedItems
* Set of items being dragged.
* Set of items being dragged.
*/
public GridDragStartEvent(Grid<T> source, EffectAllowed effectAllowed,
Set<T> draggedItems) {

+ 3
- 3
server/src/main/java/com/vaadin/event/dnd/grid/GridDragStartListener.java View File

@@ -24,10 +24,10 @@ import com.vaadin.ui.GridDragSource;
* Drag start listener for HTML5 drag start on a Grid row.
*
* @param <T>
* The Grid bean type.
* The Grid bean type.
* @author Vaadin Ltd.
* @see GridDragSource#addGridDragStartListener(GridDragStartListener)
* @since
* @since 8.1
*/
@FunctionalInterface
public interface GridDragStartListener<T> extends ConnectorEventListener {
@@ -39,7 +39,7 @@ public interface GridDragStartListener<T> extends ConnectorEventListener {
* Invoked when the user has started dragging grid's rows.
*
* @param event
* The drag start event.
* The drag start event.
*/
void dragStart(GridDragStartEvent<T> event);
}

+ 9
- 9
server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java View File

@@ -26,10 +26,10 @@ import com.vaadin.ui.GridDropTarget;
* Drop event on an HTML5 drop target {@link Grid} row.
*
* @param <T>
* The Grid bean type.
* The Grid bean type.
* @author Vaadin Ltd.
* @see GridDropTarget#addGridDropListener(GridDropListener)
* @since
* @since 8.1
*/
public class GridDropEvent<T> extends DropEvent<Grid<T>> {

@@ -40,17 +40,17 @@ public class GridDropEvent<T> extends DropEvent<Grid<T>> {
* Creates a Grid row drop event.
*
* @param target
* Grid that received the drop.
* Grid that received the drop.
* @param dataTransferText
* Data of type {@code "text"} from the {@code DataTransfer}
* object.
* Data of type {@code "text"} from the {@code DataTransfer}
* object.
* @param dragSourceExtension
* Drag source extension of the component that initiated the drop
* event.
* Drag source extension of the component that initiated the drop
* event.
* @param dropTargetRow
* Target row that received the drop.
* Target row that received the drop.
* @param dropLocation
* Location of the drop within the target row.
* Location of the drop within the target row.
*/
public GridDropEvent(Grid<T> target, String dataTransferText,
DragSourceExtension<? extends AbstractComponent> dragSourceExtension,

+ 3
- 3
server/src/main/java/com/vaadin/event/dnd/grid/GridDropListener.java View File

@@ -24,10 +24,10 @@ import com.vaadin.ui.GridDropTarget;
* Drop listener for HTML5 drop on a Grid row.
*
* @param <T>
* The Grid bean type.
* The Grid bean type.
* @author Vaadin Ltd.
* @see GridDropTarget#addGridDropListener(GridDropListener)
* @since
* @since 8.1
*/
@FunctionalInterface
public interface GridDropListener<T> extends ConnectorEventListener {
@@ -39,7 +39,7 @@ public interface GridDropListener<T> extends ConnectorEventListener {
* Called when drop event is fired on a Grid row.
*
* @param event
* Server side drop event.
* Server side drop event.
*/
void drop(GridDropEvent<T> event);
}

+ 2
- 0
server/src/main/java/com/vaadin/server/VaadinSession.java View File

@@ -1424,6 +1424,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* establishing a push connection with the client.
*
* @return the push connection identifier string
*
* @since 8.1
*/
public String getPushId() {
assert hasLock();

+ 1
- 1
server/src/main/java/com/vaadin/ui/ComponentRootSetter.java View File

@@ -20,7 +20,7 @@ import java.io.Serializable;
/**
* Internal utility class.
*
* @since
* @since 8.1
* @author Vaadin Ltd
*/
public class ComponentRootSetter implements Serializable {

+ 1
- 1
server/src/main/java/com/vaadin/ui/Composite.java View File

@@ -44,7 +44,7 @@ import com.vaadin.shared.ui.ContentMode;
* </p>
*
* @author Vaadin Ltd.
* @since
* @since 8.1
*/
public class Composite extends AbstractComponent implements HasComponents {


+ 22
- 19
server/src/main/java/com/vaadin/ui/GridDragSource.java View File

@@ -42,9 +42,9 @@ import elemental.json.JsonObject;
* that ONLY visible rows are taken into account.
*
* @param <T>
* The Grid bean type.
* The Grid bean type.
* @author Vaadin Ltd.
* @since
* @since 8.1
*/
public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {

@@ -62,7 +62,7 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* Extends a Grid and makes it's rows draggable.
*
* @param target
* Grid to be extended.
* Grid to be extended.
*/
public GridDragSource(Grid<T> target) {
super(target);
@@ -118,13 +118,14 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* function is set by the user of this extension.
*
* @param item
* Row item for data generation.
* Row item for data generation.
* @param jsonObject
* Row data in json format.
* Row data in json format.
*/
private void generateDragData(T item, JsonObject jsonObject) {
Optional.ofNullable(generatorFunction).ifPresent(generator -> jsonObject
.put(GridDragSourceState.JSONKEY_DRAG_DATA,
Optional.ofNullable(generatorFunction)
.ifPresent(generator -> jsonObject.put(
GridDragSourceState.JSONKEY_DRAG_DATA,
generator.apply(item)));
}

@@ -134,16 +135,17 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* {@link JsonObject} to be appended to the row data.
* <p>
* Example:
*
* <pre>
* dragSourceExtension.setDragDataGenerator(item -> {
* JsonObject dragData = Json.createObject();
* dragData.put("someKey", item.getValue());
* return dragData;
* });
* dragSourceExtension.setDragDataGenerator(item -> {
* JsonObject dragData = Json.createObject();
* dragData.put("someKey", item.getValue());
* return dragData;
* });
* </pre>
*
* @param generator
* Function to be executed on row data generation.
* Function to be executed on row data generation.
*/
public void setDragDataGenerator(
SerializableFunction<T, JsonObject> generator) {
@@ -154,13 +156,14 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* Setting the data transfer text for this drag source is not supported.
*
* @throws UnsupportedOperationException
* Setting dataTransferText is not supported, since the drag data is
* set for each row based on the data provided by the generator.
* Setting dataTransferText is not supported, since the drag
* data is set for each row based on the data provided by the
* generator.
* @see #setDragDataGenerator(SerializableFunction)
*/
@Override
public void setDataTransferText(String data) throws
UnsupportedOperationException {
public void setDataTransferText(String data)
throws UnsupportedOperationException {
throw new UnsupportedOperationException(
"Setting dataTransferText is not supported");
}
@@ -169,7 +172,7 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* Attaches dragstart listener for the current drag source grid.
*
* @param listener
* Listener to handle the dragstart event.
* Listener to handle the dragstart event.
* @return Handle to be used to remove this listener.
* @see GridDragStartEvent
*/
@@ -184,7 +187,7 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* Attaches dragend listener for the current drag source grid.
*
* @param listener
* Listener to handle the dragend event.
* Listener to handle the dragend event.
* @return Handle to be used to remove this listener.
* @see GridDragEndEvent
*/

+ 28
- 27
server/src/main/java/com/vaadin/ui/GridDropTarget.java View File

@@ -28,9 +28,9 @@ import com.vaadin.shared.ui.grid.GridDropTargetState;
* counterpart of GridDropTargetExtensionConnector.
*
* @param <T>
* Type of the Grid bean.
* Type of the Grid bean.
* @author Vaadin Ltd
* @since
* @since 8.1
*/
public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {

@@ -38,10 +38,10 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {
* Extends a Grid and makes it's rows drop targets for HTML5 drag and drop.
*
* @param target
* Grid to be extended.
* Grid to be extended.
* @param dropMode
* Drop mode that describes the allowed drop locations within the
* Grid's row.
* Drop mode that describes the allowed drop locations within the
* Grid's row.
* @see GridDropEvent#getDropLocation()
*/
public GridDropTarget(Grid<T> target, DropMode dropMode) {
@@ -54,8 +54,8 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {
* Sets the drop mode of this drop target.
*
* @param dropMode
* Drop mode that describes the allowed drop locations within the
* Grid's row.
* Drop mode that describes the allowed drop locations within the
* Grid's row.
* @see GridDropEvent#getDropLocation()
*/
public void setDropMode(DropMode dropMode) {
@@ -77,12 +77,12 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {
}

/**
* Attaches drop listener for the current drop target. {@link
* GridDropListener#drop(GridDropEvent)} is called when drop event happens
* on the client side.
* Attaches drop listener for the current drop target.
* {@link GridDropListener#drop(GridDropEvent)} is called when drop event
* happens on the client side.
*
* @param listener
* Listener to handle drop event.
* Listener to handle drop event.
* @return Handle to be used to remove this listener.
*/
public Registration addGridDropListener(GridDropListener<T> listener) {
@@ -99,19 +99,20 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {
* <li>within {@code threshold} pixels from the top of a row results in a
* drop event with {@link com.vaadin.shared.ui.grid.DropLocation#ABOVE
* DropLocation.ABOVE}</li>
* <li>within {@code threshold} pixels from the bottom of a row results in
* a drop event with {@link com.vaadin.shared.ui.grid.DropLocation#BELOW
* <li>within {@code threshold} pixels from the bottom of a row results in a
* drop event with {@link com.vaadin.shared.ui.grid.DropLocation#BELOW
* DropLocation.BELOW}</li>
* <li>anywhere else within the row results in a drop event with {@link
* com.vaadin.shared.ui.grid.DropLocation#ON_TOP DropLocation.ON_TOP}</li>
* <li>anywhere else within the row results in a drop event with
* {@link com.vaadin.shared.ui.grid.DropLocation#ON_TOP
* DropLocation.ON_TOP}</li>
* </ul>
* The value only has an effect when drop mode is set to {@link
* DropMode#ON_TOP_OR_BETWEEN}.
* The value only has an effect when drop mode is set to
* {@link DropMode#ON_TOP_OR_BETWEEN}.
* <p>
* Default is 5 pixels.
*
* @param threshold
* The threshold from the top and bottom of the row in pixels.
* The threshold from the top and bottom of the row in pixels.
*/
public void setDropThreshold(int threshold) {
getState().dropThreshold = threshold;
@@ -129,18 +130,18 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {

@Override
protected void registerDropTargetRpc(Grid<T> target) {
registerRpc(
(GridDropTargetRpc) (dataTransferText, rowKey, dropLocation) -> {
registerRpc((GridDropTargetRpc) (dataTransferText, rowKey,
dropLocation) -> {

T dropTargetRow = target.getDataCommunicator()
.getKeyMapper().get(rowKey);
T dropTargetRow = target.getDataCommunicator().getKeyMapper()
.get(rowKey);

GridDropEvent<T> event = new GridDropEvent<>(target,
dataTransferText, getUI().getActiveDragSource(),
dropTargetRow, dropLocation);
GridDropEvent<T> event = new GridDropEvent<>(target,
dataTransferText, getUI().getActiveDragSource(),
dropTargetRow, dropLocation);

fireEvent(event);
});
fireEvent(event);
});
}

@Override

+ 1
- 1
shared/src/main/java/com/vaadin/shared/composite/CompositeState.java View File

@@ -21,7 +21,7 @@ import com.vaadin.shared.AbstractComponentState;
* Shared state for Composite.
*
* @author Vaadin Ltd
* @since
* @since 8.1
*/
public class CompositeState extends AbstractComponentState {
}

+ 1
- 1
shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java View File

@@ -19,7 +19,7 @@ package com.vaadin.shared.ui.grid;
* Defines drop locations within a Grid row.
*
* @author Vaadin Ltd.
* @since
* @since 8.1
*/
public enum DropLocation {


+ 7
- 8
shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java View File

@@ -19,20 +19,19 @@ package com.vaadin.shared.ui.grid;
* Defines the locations within the Grid row where an element can be dropped.
*
* @author Vaadin Ltd.
* @since
* @since 8.1
*/
public enum DropMode {

/**
* The drop event can happen between Grid rows. The drop is above a row
* when the cursor is over the top 50% of a row, otherwise below the
* row.
* The drop event can happen between Grid rows. The drop is above a row when
* the cursor is over the top 50% of a row, otherwise below the row.
*/
BETWEEN,

/**
* The drop event can happen on top of Grid rows. The target of the drop
* is the row under the cursor at the time of the drop event.
* The drop event can happen on top of Grid rows. The target of the drop is
* the row under the cursor at the time of the drop event.
*/
ON_TOP,

@@ -40,8 +39,8 @@ public enum DropMode {
* The drop event can happen either on top of or between Grid rows. The drop
* is either
* <ul>
* <li><i>above</i> a row when the cursor is over a specified portion of
* the top part of the row,</li>
* <li><i>above</i> a row when the cursor is over a specified portion of the
* top part of the row,</li>
* <li><i>below</i> when the cursor is over a specified portion of the
* bottom part of the row, or</li>
* <li><i>on top</i> when the cursor is over the row but doesn't match the

+ 4
- 4
shared/src/main/java/com/vaadin/shared/ui/grid/GridDragSourceRpc.java View File

@@ -25,7 +25,7 @@ import com.vaadin.shared.ui.dnd.DropEffect;
* corresponding client side events happen on the drag source Grid.
*
* @author Vaadin Ltd.
* @since
* @since 8.1
*/
public interface GridDragSourceRpc extends ServerRpc {

@@ -33,7 +33,7 @@ public interface GridDragSourceRpc extends ServerRpc {
* Called when dragstart event happens on client side.
*
* @param draggedItemKeys
* Keys of the items in Grid being dragged.
* Keys of the items in Grid being dragged.
*/
public void dragStart(List<String> draggedItemKeys);

@@ -41,10 +41,10 @@ public interface GridDragSourceRpc extends ServerRpc {
* Called when dragend event happens on client side.
*
* @param dropEffect
* Drop effect of the dragend event, extracted from {@code
* Drop effect of the dragend event, extracted from {@code
* DataTransfer.dropEffect} parameter.
* @param draggedItemKeys
* Keys of the items in Grid having been dragged.
* Keys of the items in Grid having been dragged.
*/
public void dragEnd(DropEffect dropEffect, List<String> draggedItemKeys);
}

+ 1
- 1
shared/src/main/java/com/vaadin/shared/ui/grid/GridDragSourceState.java View File

@@ -21,7 +21,7 @@ import com.vaadin.shared.ui.dnd.DragSourceState;
* State class containing parameters for GridDragSource.
*
* @author Vaadin Ltd
* @since
* @since 8.1
*/
public class GridDragSourceState extends DragSourceState {


+ 5
- 5
shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetRpc.java View File

@@ -22,7 +22,7 @@ import com.vaadin.shared.communication.ServerRpc;
* drop target Grid.
*
* @author Vaadin Ltd.
* @since
* @since 8.1
*/
public interface GridDropTargetRpc extends ServerRpc {

@@ -30,12 +30,12 @@ public interface GridDropTargetRpc extends ServerRpc {
* Called when drop event happens on client side.
*
* @param dataTransferText
* Data of type {@code "text"} from the {@code DataTransfer}
* object.
* Data of type {@code "text"} from the {@code DataTransfer}
* object.
* @param rowKey
* Key of the row on which the drop event occured.
* Key of the row on which the drop event occured.
* @param dropLocation
* Location of the drop within the row.
* Location of the drop within the row.
*/
public void drop(String dataTransferText, String rowKey,
DropLocation dropLocation);

+ 1
- 1
shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetState.java View File

@@ -21,7 +21,7 @@ import com.vaadin.shared.ui.dnd.DropTargetState;
* State class containing parameters for GridDropTarget.
*
* @author Vaadin Ltd
* @since
* @since 8.1
*/
public class GridDropTargetState extends DropTargetState {


Loading…
Cancel
Save