diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2021-07-27 11:41:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-27 11:41:25 +0300 |
commit | 8b7502379a3940629a7cdd444f9fa8aaa8eefea4 (patch) | |
tree | 631daa69311f378f658125a591e0a711a35a13d7 /client/src | |
parent | 528ca57d03c59891f264554e9f07be0785467373 (diff) | |
download | vaadin-framework-8b7502379a3940629a7cdd444f9fa8aaa8eefea4.tar.gz vaadin-framework-8b7502379a3940629a7cdd444f9fa8aaa8eefea4.zip |
Checkstyle fixes. (#12349)
- Added and completed JavaDocs.
- Fixed a typo in logging.
- Removed an unused parameter in a private method.
Diffstat (limited to 'client/src')
17 files changed, 342 insertions, 17 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java b/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java index f4dd7a80f4..a3771ac65e 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java @@ -209,6 +209,9 @@ public class DDEventHandleStrategy { // prevent text selection on IE event.getNativeEvent().preventDefault(); return true; + default: + // NOP + break; } return false; } @@ -272,6 +275,9 @@ public class DDEventHandleStrategy { case Event.ONMOUSEUP: handleMouseUp(targetElement, event, mediator); break; + default: + // NOP + break; } } @@ -360,6 +366,9 @@ public class DDEventHandleStrategy { * * @param mediator * VDragAndDropManager data accessor + * @param clearServerCallback + * {@code true} if server communication callback should be + * cleaned up, {@code false} otherwise */ protected void handleDragLeave(DDManagerMediator mediator, boolean clearServerCallback) { diff --git a/client/src/main/java/com/vaadin/client/ui/dd/DDUtil.java b/client/src/main/java/com/vaadin/client/ui/dd/DDUtil.java index 7b505f3988..7428e694fb 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/DDUtil.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/DDUtil.java @@ -22,8 +22,31 @@ import com.vaadin.client.WidgetUtil; import com.vaadin.shared.ui.dd.HorizontalDropLocation; import com.vaadin.shared.ui.dd.VerticalDropLocation; +/** + * Utility class for drag and drop handling. + * + * @author Vaadin Ltd + */ public class DDUtil { + /** Utility classes shouldn't be instantiated. */ + private DDUtil() { + } + + /** + * Get vertical drop location. + * + * @param element + * the drop target element + * @param event + * the latest {@link NativeEvent} that relates to this drag + * operation + * @param topBottomRatio + * the ratio that determines how big portion of the element on + * each end counts for indicating desire to drop above or below + * the element rather than on top of it + * @return the drop location + */ public static VerticalDropLocation getVerticalDropLocation(Element element, NativeEvent event, double topBottomRatio) { int offsetHeight = element.getOffsetHeight(); @@ -31,6 +54,22 @@ public class DDUtil { topBottomRatio); } + /** + * Get vertical drop location. + * + * @param element + * the drop target element + * @param offsetHeight + * the height of an element relative to the layout + * @param event + * the latest {@link NativeEvent} that relates to this drag + * operation + * @param topBottomRatio + * the ratio that determines how big portion of the element on + * each end counts for indicating desire to drop above or below + * the element rather than on top of it + * @return the drop location + */ public static VerticalDropLocation getVerticalDropLocation(Element element, int offsetHeight, NativeEvent event, double topBottomRatio) { int clientY = WidgetUtil.getTouchOrMouseClientY(event); @@ -38,6 +77,22 @@ public class DDUtil { topBottomRatio); } + /** + * Get vertical drop location. + * + * @param element + * the drop target element + * @param offsetHeight + * the height of an element relative to the layout + * @param clientY + * the y-coordinate of the latest event that relates to this drag + * operation + * @param topBottomRatio + * the ratio that determines how big portion of the element on + * each end counts for indicating desire to drop above or below + * the element rather than on top of it + * @return the drop location + */ public static VerticalDropLocation getVerticalDropLocation(Element element, int offsetHeight, int clientY, double topBottomRatio) { @@ -57,6 +112,20 @@ public class DDUtil { } } + /** + * Get horizontal drop location. + * + * @param element + * the drop target element + * @param event + * the latest {@link NativeEvent} that relates to this drag + * operation + * @param leftRightRatio + * the ratio that determines how big portion of the element on + * each end counts for indicating desire to drop beside the + * element rather than on top of it + * @return the drop location + */ public static HorizontalDropLocation getHorizontalDropLocation( Element element, NativeEvent event, double leftRightRatio) { int clientX = WidgetUtil.getTouchOrMouseClientX(event); diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java b/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java index ac3f9c9b34..bc3c95e77b 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java @@ -42,6 +42,7 @@ public abstract class VAbstractDropHandler implements VDropHandler { * details about {@link AcceptCriterion} are saved. * * @param uidl + * the accept criterion UIDL */ public void updateAcceptRules(UIDL uidl) { criterioUIDL = uidl; @@ -107,9 +108,19 @@ public abstract class VAbstractDropHandler implements VDropHandler { * drag is on a valid drop location. * * @param drag + * the drag event */ protected abstract void dragAccepted(VDragEvent drag); + /** + * Validates the given drag event when all existing DnD-related tasks are + * completed, and triggers the callback if the validation was successful. + * + * @param cb + * the callback that handles acceptance if the target is valid + * @param event + * the drag event + */ protected void validate(final VAcceptCallback cb, final VDragEvent event) { Command checkCriteria = () -> acceptCriteria.accept(event, criterioUIDL, cb); diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCallback.java b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCallback.java index e64d5dc119..e01c253235 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCallback.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCallback.java @@ -32,6 +32,9 @@ public interface VAcceptCallback { * icon or empahsis the target if the target accepts the transferable. If * the drag and drop operation ends or the {@link VAbstractDropHandler} has * changed before response arrives, the method is never called. + * + * @param event + * the drag event */ public void accepted(VDragEvent event); diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriteria.java b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriteria.java index 7704d15ddf..b35cb4c174 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriteria.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriteria.java @@ -29,10 +29,21 @@ import com.vaadin.ui.dnd.DropTargetExtension; public class VAcceptCriteria { private static VAcceptCriterionFactory impl; + /** Singleton. */ + private VAcceptCriteria() { + } + static { impl = GWT.create(VAcceptCriterionFactory.class); } + /** + * Returns the accept criterion that matches the given identifier. + * + * @param name + * the identifier + * @return the accept criterion + */ public static VAcceptCriterion get(String name) { return impl.get(name); } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterion.java b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterion.java index 3c0afd61cb..a614f5c13d 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterion.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterion.java @@ -33,8 +33,11 @@ public abstract class VAcceptCriterion { * transferable. If drop target is valid, callback is used. * * @param drag + * the drag event * @param configuration + * accept criterion UIDL * @param callback + * the callback that handles acceptance if the target is valid */ public void accept(final VDragEvent drag, UIDL configuration, final VAcceptCallback callback) { @@ -53,8 +56,28 @@ public abstract class VAcceptCriterion { } } + /** + * Returns whether a client-side check accepts the drop attempt. + * + * @param drag + * the drag event + * @param configuration + * accept criterion UIDL + * @return {@code true} if a drop attempt is accepted, {@code false} + * otherwise + */ protected abstract boolean accept(VDragEvent drag, UIDL configuration); + /** + * Returns whether a server side check is needed for determining acceptance. + * + * @param drag + * the drag event + * @param criterioUIDL + * accept criterion UIDL + * @return {@code true} if a server side check is needed, {@code false} + * otherwise + */ public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) { return false; } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterionFactory.java b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterionFactory.java index d41a6c09b6..6edfb3487c 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterionFactory.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VAcceptCriterionFactory.java @@ -28,5 +28,12 @@ import com.vaadin.ui.dnd.DropTargetExtension; @Deprecated public abstract class VAcceptCriterionFactory { + /** + * Returns the accept criterion that matches the given identifier. + * + * @param name + * the identifier + * @return the accept criterion + */ public abstract VAcceptCriterion get(String name); } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java index 993bc57175..2fb4baead1 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -65,6 +65,7 @@ import com.vaadin.shared.ui.dd.DragEventType; @Deprecated public class VDragAndDropManager { + /** Style name for the active drag source. */ public static final String ACTIVE_DRAG_SOURCE_STYLENAME = "v-active-drag-source"; /** @@ -77,11 +78,15 @@ public class VDragAndDropManager { public interface DDManagerMediator { /** * Returns DnD manager instance. + * + * @return the manager */ VDragAndDropManager getManager(); /** * Returns current drag event. + * + * @return the event */ VDragEvent getDragEvent(); @@ -164,7 +169,7 @@ public class VDragAndDropManager { } } - /* + /** * #13381, #14796. The drag only actually starts when the mouse move or * touch move event is more than 3 pixel away. */ @@ -195,10 +200,16 @@ public class VDragAndDropManager { private DDEventHandleStrategy eventHandleStrategy; /** - * If dragging is currently on a drophandler, this field has reference to it + * If dragging is currently on a drophandler, this field has reference to + * it. */ private VDropHandler currentDropHandler; + /** + * Returns the current drop handler. + * + * @return current drop handler, or {@code null} if one doesn't exist + */ public VDropHandler getCurrentDropHandler() { return currentDropHandler; } @@ -209,6 +220,7 @@ public class VDragAndDropManager { * . * * @param currentDropHandler + * the current drop handler */ public void setCurrentDropHandler(VDropHandler currentDropHandler) { this.currentDropHandler = currentDropHandler; @@ -218,6 +230,12 @@ public class VDragAndDropManager { private HandlerRegistration deferredStartRegistration; + /** + * Returns the current drag and drop manager instance. If one doesn't exist + * yet, it's created. + * + * @return the current drag and drop manager + */ public static VDragAndDropManager get() { if (instance == null) { instance = GWT.create(VDragAndDropManager.class); @@ -225,7 +243,7 @@ public class VDragAndDropManager { return instance; } - /* Singleton */ + /** Singleton. */ protected VDragAndDropManager() { } @@ -252,11 +270,14 @@ public class VDragAndDropManager { * methods on it called automatically. * * @param transferable - * @param nativeEvent + * the VTransferable instance that represents the original + * dragged element + * @param startEvent + * the native event that starts the drag * @param handleDragEvents * if true, {@link VDragAndDropManager} handles the drag and drop * operation GWT event preview. - * @return + * @return the drag event */ public VDragEvent startDrag(VTransferable transferable, final NativeEvent startEvent, final boolean handleDragEvents) { @@ -400,6 +421,14 @@ public class VDragAndDropManager { return currentDrag; } + /** + * Updates drag image position. + * + * @param gwtEvent + * the event whose coordinates should be used + * @param dragImage + * the image to position + */ protected void updateDragImagePosition(NativeEvent gwtEvent, Element dragImage) { if (gwtEvent != null && dragImage != null) { @@ -416,7 +445,9 @@ public class VDragAndDropManager { * implement HasDropHandler. Returns DropHandler from that. * * @param element - * @return + * the topmost element that is a potential drag target + * @return the drop handler from the given element or its closest ancestor + * that has one, or {@code null} if there is no such thing */ protected VDropHandler findDragTarget(Element element) { try { @@ -570,6 +601,8 @@ public class VDragAndDropManager { * interrupted() method for cleanup. * * @param acceptCallback + * the callback that should handle the matching server response + * when it arrives */ public void visitServer(VDragEventServerCallback acceptCallback) { doRequest(DragEventType.ENTER); @@ -631,6 +664,12 @@ public class VDragAndDropManager { } + /** + * Handle the server response for drag and drop. + * + * @param valueMap + * DnD value map from the response + */ public void handleServerResponse(ValueMap valueMap) { if (serverCallback == null) { return; @@ -721,6 +760,12 @@ public class VDragAndDropManager { return serverCallback != null; } + /** + * Returns the application connection for the current drag source. If there + * is no current drag source, returns {@code null} instead. + * + * @return the application connection, or {@code null} if not found + */ protected ApplicationConnection getCurrentDragApplicationConnection() { if (currentDrag == null) { return null; @@ -754,6 +799,7 @@ public class VDragAndDropManager { * command in queue here. * * @param command + * the command to execute */ public void executeWhenReady(Command command) { if (isBusy()) { diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java index 8e59cb88f1..6d9a8b92be 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java @@ -66,21 +66,35 @@ public class VDragEvent { id = eventId++; } + /** + * Returns the VTransferable instance that represents the original dragged + * element. + * + * @return the transferable instance + */ public VTransferable getTransferable() { return transferable; } /** - * Returns the the latest {@link NativeEvent} that relates to this drag and - * drop operation. For example on {@link VDropHandler#dragEnter(VDragEvent)} - * this is commonly a {@link MouseOverEvent}. + * Returns the latest {@link NativeEvent} that relates to this drag and drop + * operation. For example on {@link VDropHandler#dragEnter(VDragEvent)} this + * is commonly a {@link MouseOverEvent}. * - * @return + * @return the latest event */ public NativeEvent getCurrentGwtEvent() { return currentGwtEvent; } + /** + * Sets the latest {@link NativeEvent} that relates to this drag and drop + * operation. For example on {@link VDropHandler#dragEnter(VDragEvent)} this + * is commonly a {@link MouseOverEvent}. + * + * @param event + * the latest event + */ public void setCurrentGwtEvent(NativeEvent event) { currentGwtEvent = event; } @@ -114,6 +128,9 @@ public class VDragEvent { /** * @deprecated As of 7.2, call or override {@link #setElementOver(Element)} * instead + * @param targetElement + * target element over which DnD event has happened + * @see #getElementOver() */ @Deprecated public void setElementOver( @@ -123,6 +140,9 @@ public class VDragEvent { /** * @since 7.2 + * @param targetElement + * target element over which DnD event has happened + * @see #getElementOver() */ public void setElementOver(Element targetElement) { setElementOver(DOM.asOld(targetElement)); @@ -142,6 +162,9 @@ public class VDragEvent { * to HTML5 DataTransfer * * @param node + * a cloned node or other representation of the original element + * that is dragged + * * @deprecated As of 7.2, call or override {@link #setDragImage(Element)} * instead */ @@ -164,6 +187,8 @@ public class VDragEvent { * to HTML5 DataTransfer * * @param node + * a cloned node or other representation of the original element + * that is dragged * * @since 7.2 */ @@ -178,7 +203,7 @@ public class VDragEvent { * * TODO clean up when drop handler changes * - * @return + * @return the drop details */ public Map<String, Object> getDropDetails() { return dropDetails; @@ -241,6 +266,7 @@ public class VDragEvent { * Automatically tries to create a proxy image from given element. * * @param element + * the original element that is dragged * @param alignImageToEvent * if true, proxy image is aligned to start event, else next to * mouse cursor @@ -284,6 +310,7 @@ public class VDragEvent { * Automatically tries to create a proxy image from given element. * * @param element + * the original element that is dragged * @param alignImageToEvent * if true, proxy image is aligned to start event, else next to * mouse cursor diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragEventServerCallback.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragEventServerCallback.java index 71840ba014..d436b93b52 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragEventServerCallback.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragEventServerCallback.java @@ -26,6 +26,14 @@ import com.vaadin.shared.ui.dnd.DropTargetRpc; @Deprecated public interface VDragEventServerCallback { + /** + * Handle the server response for drag and drop. + * + * @param accepted + * {@code true} if the target accepts the transferable + * @param response + * DnD data within the server response + */ public void handleResponse(boolean accepted, UIDL response); } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDropHandler.java b/client/src/main/java/com/vaadin/client/ui/dd/VDropHandler.java index a1301db337..863f005bd1 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDropHandler.java @@ -73,11 +73,14 @@ public interface VDropHandler { * though mouse is not moved. * * @param currentDrag + * the latest drag event */ public void dragOver(VDragEvent currentDrag); /** * Returns the ComponentConnector with which this DropHandler is associated. + * + * @return the connector */ public ComponentConnector getConnector(); @@ -85,6 +88,8 @@ public interface VDropHandler { * Returns the application connection to which this {@link VDropHandler} * belongs to. DragAndDropManager uses this function to send Transferable to * server side. + * + * @return the application connection */ public ApplicationConnection getApplicationConnection(); diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VHasDropHandler.java b/client/src/main/java/com/vaadin/client/ui/dd/VHasDropHandler.java index aa8e7a739b..8d8f68532f 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VHasDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VHasDropHandler.java @@ -29,5 +29,10 @@ import com.vaadin.client.extensions.DropTargetExtensionConnector; */ @Deprecated public interface VHasDropHandler { + /** + * Returns the drop handler for this widget. + * + * @return the drop handler + */ public VDropHandler getDropHandler(); } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java index 45ab084768..154df0b102 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java @@ -28,15 +28,29 @@ import com.vaadin.client.extensions.DropTargetExtensionConnector; */ @Deprecated public class VHtml5DragEvent extends NativeEvent { + /** Singleton. */ protected VHtml5DragEvent() { } + /** + * Returns type values, or {@code ["Text","Url","Html"]} if types are not + * supported. + * + * @return types + */ public final native JsArrayString getTypes() /*-{ // IE does not support types, return some basic values return this.dataTransfer.types ? this.dataTransfer.types : ["Text","Url","Html"]; }-*/; + /** + * Returns the data for the given type as text. + * + * @param type + * the type whose data to retrieve + * @return the data as text + */ public final native String getDataAsText(String type) /*-{ var v = this.dataTransfer.getData(type); @@ -47,8 +61,11 @@ public class VHtml5DragEvent extends NativeEvent { * Works on FF 3.6 and possibly with gears. * * @param index - * @return + * the index of the file to get + * @return the file as text + * @deprecated this method is no longer used internally */ + @Deprecated public final native String getFileAsString(int index) /*-{ if (this.dataTransfer.files.length > 0 && this.dataTransfer.files[0].getAsText) { @@ -57,6 +74,12 @@ public class VHtml5DragEvent extends NativeEvent { return null; }-*/; + /** + * Sets the drop effect value. + * + * @param effect + * the drop effect + */ public final native void setDropEffect(String effect) /*-{ try { @@ -64,21 +87,45 @@ public class VHtml5DragEvent extends NativeEvent { } catch (e) {} }-*/; + /** + * Returns whether drop effect is allowed or not. + * + * @return {@code true} id drop effect is allowed, {@code false} otherwise + */ public final native String getEffectAllowed() /*-{ return this.dataTransfer.effectAllowed; }-*/; + /** + * Sets whether drop effect is allowed or not. + * + * @param effect + * {@code true} id drop effect should be allowed, {@code false} + * otherwise + */ public final native void setEffectAllowed(String effect) /*-{ this.dataTransfer.effectAllowed = effect; }-*/; + /** + * Returns the transfer file count. + * + * @return the file count + */ public final native int getFileCount() /*-{ return this.dataTransfer.files ? this.dataTransfer.files.length : 0; }-*/; + /** + * Returns the file indicated by the given index. + * + * @param fileIndex + * the index of the file + * @return the file + */ public final native VHtml5File getFile(int fileIndex) /*-{ return this.dataTransfer.files[fileIndex]; @@ -88,6 +135,11 @@ public class VHtml5DragEvent extends NativeEvent { * Detects if dropped element is a file. <br> * Always returns <code>true</code> on Safari even if the dropped element is * a folder. + * + * @param fileIndex + * the index of the element to check + * @return {@code true} if the dropped element is a file, {@code false} + * otherwise */ public final native boolean isFile(int fileIndex) /*-{ @@ -113,6 +165,14 @@ public class VHtml5DragEvent extends NativeEvent { return true; }-*/; + /** + * Adds a data String with the given flavor identifier. + * + * @param flavor + * the identifier + * @param data + * the data + */ public final native void setHtml5DataFlavor(String flavor, String data) /*-{ this.dataTransfer.setData(flavor, data); diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5File.java b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5File.java index 7d2af383a8..57a93b8f13 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5File.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5File.java @@ -28,24 +28,37 @@ import com.google.gwt.core.client.JavaScriptObject; @Deprecated public class VHtml5File extends JavaScriptObject { + /** Singleton. */ protected VHtml5File() { } + /** + * Returns the name value. + * + * @return the name + */ public final native String getName() /*-{ return this.name; }-*/; + /** + * Returns the type value. + * + * @return the type + */ public final native String getType() /*-{ return this.type; }-*/; - /* + /** * Browser implementations support files >2GB dropped and report the value * as long. Due to JSNI limitations this value needs to be sent as double * and then cast back to a long value. * www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html#important + * + * @return the size */ public final native double getSize() /*-{ diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VNot.java b/client/src/main/java/com/vaadin/client/ui/dd/VNot.java index 47a5444612..c4ccb652d7 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VNot.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VNot.java @@ -38,9 +38,9 @@ public final class VNot extends VAcceptCriterion { public void accept(VDragEvent drag, UIDL configuration, VAcceptCallback callback) { if (crit1 == null) { - crit1 = getCriteria(drag, configuration, 0); + crit1 = getCriteria(configuration, 0); if (crit1 == null) { - getLogger().info("Not criteria didn't found a child criteria"); + getLogger().info("Not criteria didn't find a child criteria"); return; } } @@ -55,8 +55,7 @@ public final class VNot extends VAcceptCriterion { } } - private VAcceptCriterion getCriteria(VDragEvent drag, UIDL configuration, - int i) { + private VAcceptCriterion getCriteria(UIDL configuration, int i) { UIDL childUIDL = configuration.getChildUIDL(i); return VAcceptCriteria.get(childUIDL.getStringAttribute("name")); } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java b/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java index cbdfac02c1..21210ec790 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VTransferable.java @@ -61,14 +61,42 @@ public class VTransferable { this.component = component; } + /** + * Returns previously saved data that is referred to by the given + * identifier. + * + * @param dataFlavor + * the identifier for the data object + * @return the data object, or {@code null} if not found + * + * @see #setData(String, Object) + */ public Object getData(String dataFlavor) { return variables.get(dataFlavor); } + /** + * Stores any type of named data that can be useful during the DnD + * operation. + * + * @param dataFlavor + * the identifier for the data object, should not be {@code null} + * @param value + * the data to store, should not be {@code null} + */ public void setData(String dataFlavor, Object value) { variables.put(dataFlavor, value); } + /** + * Returns a collection of stored identifiers that each correspond with one + * stored data object. + * + * @return the collection of identifiers, can be empty if no data has been + * stored yet + * + * @see #setData(String, Object) + */ public Collection<String> getDataFlavors() { return variables.keySet(); } diff --git a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java index 797f647218..4e22bc254b 100644 --- a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java @@ -35,6 +35,7 @@ import com.vaadin.shared.ui.draganddropwrapper.DragAndDropWrapperServerRpc; import com.vaadin.ui.DragAndDropWrapper; /** + * A connector class for the DragAndDropWrapper. * * @author Vaadin Ltd * @deprecated Replaced in 8.1 with {@link DragSourceExtensionConnector} and |