@Override public void accept(final VDragEvent drag, UIDL configuration, final VAcceptCallback callback) { if (lastDragEvent == null || lastDragEvent != drag) { loaded = false; lastDragEvent = drag; } if (loaded) { Object object = drag.getDropDetails().get("itemIdOver"); if (hashSet.contains(object)) { callback.accepted(drag); } } else { VDragEventServerCallback acceptCallback = new VDragEventServerCallback() { @Override public void handleResponse(boolean accepted, UIDL response) { hashSet = new HashSet<String>(); String[] stringArrayAttribute = response.getStringArrayAttribute("allowedIds"); for (int i = 0; i < stringArrayAttribute.length; i++) { hashSet.add(stringArrayAttribute[i]); } loaded = true; if (accepted) { callback.accepted(drag); } } }; VDragAndDropManager.get().visitServer(acceptCallback); } }
/** * @return the current Element used as a drag image (aka drag proxy) or null if drag image is not * currently set for this drag operation. */ public com.google.gwt.user.client.Element getDragImage() { return DOM.asOld(VDragAndDropManager.get().getDragElement()); }
/** * Sets the drag image used for current drag and drop operation. Drag image is displayed next to * mouse cursor during drag and drop. * * <p>The element to be used as drag image will automatically get CSS style name "v-drag-element". * * @param element the dom element to be positioned next to mouse cursor * @param offsetX the horizontal offset of drag image from mouse cursor * @param offsetY the vertical offset of drag image from mouse cursor * @deprecated As of 7.2, call or override {@link #setDragImage(Element,int,int)} instead */ @Deprecated public void setDragImage(com.google.gwt.user.client.Element element, int offsetX, int offsetY) { element.getStyle().setMarginLeft(offsetX, Unit.PX); element.getStyle().setMarginTop(offsetY, Unit.PX); VDragAndDropManager.get().setDragElement(element); }