* <p>
* DragAndDropEvent instances contains both the dragged data in
* {@link Transferable} (generated by {@link DragSource} and details about the
- * current drop event in {@link DropTargetDetails} (generated by
+ * current drop event in {@link TargetDetails} (generated by
* {@link DropTarget}.
*
* @since 6.3
*/
public class DragAndDropEvent implements Serializable {
private Transferable transferable;
- private DropTargetDetails dropTargetDetails;
+ private TargetDetails dropTargetDetails;
public DragAndDropEvent(Transferable transferable,
- DropTargetDetails dropTargetDetails) {
+ TargetDetails dropTargetDetails) {
this.transferable = transferable;
this.dropTargetDetails = dropTargetDetails;
}
* @return the DropTargetDetails containing drop target related details of
* drag and drop operation
*/
- public DropTargetDetails getDropTargetDetails() {
+ public TargetDetails getDropTargetDetails() {
return dropTargetDetails;
}
* {@link DropHandler}. Implementation may for exmaple translate the drop
* target details provided by the client side (drop target) to meaningful
* server side values. If null is returned the terminal implementation will
- * automatically create a {@link DropTargetDetails} with raw client side
+ * automatically create a {@link TargetDetails} with raw client side
* data.
*
* @see DragSource#getTransferable(Map)
* @return A DropTargetDetails object with the translated data or null to
* use a default implementation.
*/
- public DropTargetDetails translateDropTargetDetails(
+ public TargetDetails translateDropTargetDetails(
Map<String, Object> clientVariables);
}
\ No newline at end of file
+++ /dev/null
-/*
-@ITMillApache2LicenseForJavaFiles@
- */
-package com.vaadin.event.dd;
-
-import java.io.Serializable;
-
-import com.vaadin.ui.Tree.TreeDropTargetDetails;
-
-/**
- * DropTargetDetails wraps drop target related information about
- * {@link DragAndDropEvent}.
- * <p>
- * When a DropTargetDetails object is used in {@link DropHandler} it is often
- * preferable to cast the DropTargetDetail to an implementation provided by
- * DropTarget like {@link TreeDropTargetDetails}. They often provide better
- * typed, drop target specific API.
- *
- * @since 6.3
- *
- */
-public interface DropTargetDetails extends Serializable {
-
- /**
- * Gets target data associated to given string key
- *
- * @param key
- * @return
- */
- public Object getData(String key);
-
- /**
- * @return the drop target on which the {@link DragAndDropEvent} happened.
- */
- public DropTarget getTarget();
-
-}
+++ /dev/null
-/*
-@ITMillApache2LicenseForJavaFiles@
- */
-package com.vaadin.event.dd;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A HashMap backed implementation of {@link DropTargetDetails} for terminal
- * implementation and for extension.
- *
- * @since 6.3
- *
- */
-public class DropTargetDetailsImpl implements DropTargetDetails {
-
- private static final long serialVersionUID = -5099462771593036776L;
- private HashMap<String, Object> data = new HashMap<String, Object>();
- private DropTarget dropTarget;
-
- protected DropTargetDetailsImpl(Map<String, Object> rawDropData) {
- data.putAll(rawDropData);
- }
-
- public DropTargetDetailsImpl(Map<String, Object> rawDropData,
- DropTarget dropTarget) {
- this(rawDropData);
- this.dropTarget = dropTarget;
- }
-
- public Object getData(String key) {
- return data.get(key);
- }
-
- public Object setData(String key, Object value) {
- return data.put(key, value);
- }
-
- public DropTarget getTarget() {
- return dropTarget;
- }
-
-}
\ No newline at end of file
--- /dev/null
+/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+package com.vaadin.event.dd;
+
+import java.io.Serializable;
+
+import com.vaadin.ui.Tree.TreeTargetDetails;
+
+/**
+ * TargetDetails wraps drop target related information about
+ * {@link DragAndDropEvent}.
+ * <p>
+ * When a TargetDetails object is used in {@link DropHandler} it is often
+ * preferable to cast the TargetDetails to an implementation provided by
+ * DropTarget like {@link TreeTargetDetails}. They often provide a better typed,
+ * drop target specific API.
+ *
+ * @since 6.3
+ *
+ */
+public interface TargetDetails extends Serializable {
+
+ /**
+ * Gets target data associated to given string key
+ *
+ * @param key
+ * @return
+ */
+ public Object getData(String key);
+
+ /**
+ * @return the drop target on which the {@link DragAndDropEvent} happened.
+ */
+ public DropTarget getTarget();
+
+}
--- /dev/null
+/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+package com.vaadin.event.dd;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A HashMap backed implementation of {@link TargetDetails} for terminal
+ * implementation and for extension.
+ *
+ * @since 6.3
+ *
+ */
+@SuppressWarnings("serial")
+public class TargetDetailsImpl implements TargetDetails {
+
+ private HashMap<String, Object> data = new HashMap<String, Object>();
+ private DropTarget dropTarget;
+
+ protected TargetDetailsImpl(Map<String, Object> rawDropData) {
+ data.putAll(rawDropData);
+ }
+
+ public TargetDetailsImpl(Map<String, Object> rawDropData,
+ DropTarget dropTarget) {
+ this(rawDropData);
+ this.dropTarget = dropTarget;
+ }
+
+ public Object getData(String key) {
+ return data.get(key);
+ }
+
+ public Object setData(String key, Object value) {
+ return data.put(key, value);
+ }
+
+ public DropTarget getTarget() {
+ return dropTarget;
+ }
+
+}
\ No newline at end of file
package com.vaadin.event.dd.acceptcriteria;
import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.event.dd.DropTargetDetails;
+import com.vaadin.event.dd.TargetDetails;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.gwt.client.ui.dd.VTargetDetailIs;
/**
* Constructs a criterion which ensures that the value there is a value in
- * {@link DropTargetDetails} that equals the reference value.
+ * {@link TargetDetails} that equals the reference value.
*
* @param dataFlavor
* the type of data to be checked
import com.vaadin.event.dd.DragSource;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.DropTargetDetails;
-import com.vaadin.event.dd.DropTargetDetailsImpl;
+import com.vaadin.event.dd.TargetDetails;
+import com.vaadin.event.dd.TargetDetailsImpl;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.VariableOwner;
* source for Transferable, drop target for DragDropDetails).
*/
Transferable transferable = constructTransferable(dropTarget, variables);
- DropTargetDetails dropData = constructDragDropDetails(dropTarget,
+ TargetDetails dropData = constructDragDropDetails(dropTarget,
variables);
DragAndDropEvent dropEvent = new DragAndDropEvent(transferable,
dropData);
* source for Transferable, current target for DragDropDetails).
*/
Transferable transferable = constructTransferable(dropTarget, variables);
- DropTargetDetails dragDropDetails = constructDragDropDetails(
+ TargetDetails dragDropDetails = constructDragDropDetails(
dropTarget, variables);
dragEvent = new DragAndDropEvent(transferable, dragDropDetails);
* @return
*/
@SuppressWarnings("unchecked")
- private DropTargetDetails constructDragDropDetails(DropTarget dropTarget,
+ private TargetDetails constructDragDropDetails(DropTarget dropTarget,
Map<String, Object> variables) {
Map<String, Object> rawDragDropDetails = (Map<String, Object>) variables
.get("evt");
- DropTargetDetails dropData = dropTarget
+ TargetDetails dropData = dropTarget
.translateDropTargetDetails(rawDragDropDetails);
if (dropData == null) {
// Create a default DragDropDetails with all the raw variables
- dropData = new DropTargetDetailsImpl(rawDragDropDetails, dropTarget);
+ dropData = new TargetDetailsImpl(rawDragDropDetails, dropTarget);
}
return dropData;
import com.vaadin.event.Transferable;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.DropTargetDetailsImpl;
+import com.vaadin.event.dd.TargetDetailsImpl;
import com.vaadin.event.dd.acceptcriteria.ClientCriterion;
import com.vaadin.event.dd.acceptcriteria.ClientSideCriterion;
import com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor;
}
public boolean accept(DragAndDropEvent dragEvent) {
- AbstractSelectDropTargetDetails dropTargetData = (AbstractSelectDropTargetDetails) dragEvent
+ AbstractSelectTargetDetails dropTargetData = (AbstractSelectTargetDetails) dragEvent
.getDropTargetDetails();
if (dropTargetData.getTarget() != select) {
return false;
}
/**
- * DropTargetDetails implementation for subclasses of {@link AbstractSelect}
+ * TargetDetails implementation for subclasses of {@link AbstractSelect}
* that implement {@link DropTarget}.
*
* @since 6.3
*/
- public class AbstractSelectDropTargetDetails extends DropTargetDetailsImpl {
+ public class AbstractSelectTargetDetails extends TargetDetailsImpl {
/**
* The item id over which the drag event happened.
* corresponding item Id
*
*/
- protected AbstractSelectDropTargetDetails(
- Map<String, Object> rawVariables) {
+ protected AbstractSelectTargetDetails(Map<String, Object> rawVariables) {
super(rawVariables, (DropTarget) AbstractSelect.this);
// eagar fetch itemid, mapper may be emptied
String keyover = (String) getData("itemIdOver");
import com.vaadin.event.dd.DragSource;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.DropTargetDetails;
-import com.vaadin.event.dd.DropTargetDetailsImpl;
+import com.vaadin.event.dd.TargetDetails;
+import com.vaadin.event.dd.TargetDetailsImpl;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.UploadStream;
import com.vaadin.ui.Upload.Receiver;
import com.vaadin.ui.Upload.UploadException;
+@SuppressWarnings("serial")
@ClientWidget(VDragAndDropWrapper.class)
public class DragAndDropWrapper extends CustomComponent implements DropTarget,
DragSource {
private Map<String, Html5File> receivers = new HashMap<String, Html5File>();
- public class WrapperDropDetails extends DropTargetDetailsImpl {
+ public class WrapperTargetDetails extends TargetDetailsImpl {
- public WrapperDropDetails(Map<String, Object> rawDropData) {
+ public WrapperTargetDetails(Map<String, Object> rawDropData) {
super(rawDropData, DragAndDropWrapper.this);
}
requestRepaint();
}
- public DropTargetDetails translateDropTargetDetails(
+ public TargetDetails translateDropTargetDetails(
Map<String, Object> clientVariables) {
- return new WrapperDropDetails(clientVariables);
+ return new WrapperTargetDetails(clientVariables);
}
public Transferable getTransferable(final Map<String, Object> rawVariables) {
this.dropHandler = dropHandler;
}
- public AbstractSelectDropTargetDetails translateDropTargetDetails(
+ public AbstractSelectTargetDetails translateDropTargetDetails(
Map<String, Object> clientVariables) {
- return new AbstractSelectDropTargetDetails(clientVariables);
+ return new AbstractSelectTargetDetails(clientVariables);
}
/**
* .event.dd.DragAndDropEvent)
*/
public boolean accept(DragAndDropEvent dragEvent) {
- AbstractSelectDropTargetDetails dropTargetData = (AbstractSelectDropTargetDetails) dragEvent
+ AbstractSelectTargetDetails dropTargetData = (AbstractSelectTargetDetails) dragEvent
.getDropTargetDetails();
table = (Table) dragEvent.getDropTargetDetails().getTarget();
ArrayList<Object> visibleItemIds = new ArrayList<Object>(table
import com.vaadin.event.dd.DragSource;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.DropTargetDetails;
+import com.vaadin.event.dd.TargetDetails;
import com.vaadin.event.dd.acceptcriteria.ClientCriterion;
import com.vaadin.event.dd.acceptcriteria.ClientSideCriterion;
import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion;
}
/**
- * A {@link DropTargetDetails} implementation with Tree specific api.
+ * A {@link TargetDetails} implementation with Tree specific api.
*
* @since 6.3
*/
- public class TreeDropTargetDetails extends AbstractSelectDropTargetDetails {
+ public class TreeTargetDetails extends AbstractSelectTargetDetails {
- TreeDropTargetDetails(Map<String, Object> rawVariables) {
+ TreeTargetDetails(Map<String, Object> rawVariables) {
super(rawVariables);
}
* @see
* com.vaadin.event.dd.DropTarget#translateDropTargetDetails(java.util.Map)
*/
- public TreeDropTargetDetails translateDropTargetDetails(
+ public TreeTargetDetails translateDropTargetDetails(
Map<String, Object> clientVariables) {
- return new TreeDropTargetDetails(clientVariables);
+ return new TreeTargetDetails(clientVariables);
}
/**
* .event.dd.DragAndDropEvent)
*/
public boolean accept(DragAndDropEvent dragEvent) {
- AbstractSelectDropTargetDetails dropTargetData = (AbstractSelectDropTargetDetails) dragEvent
+ AbstractSelectTargetDetails dropTargetData = (AbstractSelectTargetDetails) dragEvent
.getDropTargetDetails();
tree = (Tree) dragEvent.getDropTargetDetails().getTarget();
allowedItemIds = getAllowedItemIds(dragEvent, tree);
// must be over tree node and in the middle of it (not top or
// bottom
// part)
- TreeDropTargetDetails eventDetails = (TreeDropTargetDetails) dragEvent
+ TreeTargetDetails eventDetails = (TreeTargetDetails) dragEvent
.getDropTargetDetails();
Object itemIdOver = eventDetails.getItemIdOver();
public boolean accept(DragAndDropEvent dragEvent) {
try {
- TreeDropTargetDetails eventDetails = (TreeDropTargetDetails) dragEvent
+ TreeTargetDetails eventDetails = (TreeTargetDetails) dragEvent
.getDropTargetDetails();
if (eventDetails.getItemIdOver() != null) {
import com.vaadin.ui.Window;
import com.vaadin.ui.AbsoluteLayout.ComponentPosition;
import com.vaadin.ui.DragAndDropWrapper.DragStartMode;
-import com.vaadin.ui.DragAndDropWrapper.WrapperDropDetails;
+import com.vaadin.ui.DragAndDropWrapper.WrapperTargetDetails;
import com.vaadin.ui.DragAndDropWrapper.WrapperTransferable;
public class AcceptAnythingWindow extends Window {
}
public void drop(DragAndDropEvent event) {
- WrapperDropDetails ed = (WrapperDropDetails) event
+ WrapperTargetDetails ed = (WrapperTargetDetails) event
.getDropTargetDetails();
Transferable transferable = event.getTransferable();
TransferableImpl ctr = (TransferableImpl) transferable;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Window;
import com.vaadin.ui.AbsoluteLayout.ComponentPosition;
-import com.vaadin.ui.DragAndDropWrapper.WrapperDropDetails;
+import com.vaadin.ui.DragAndDropWrapper.WrapperTargetDetails;
import com.vaadin.ui.DragAndDropWrapper.WrapperTransferable;
public class AcceptFromComponent extends Window {
public void drop(DragAndDropEvent event) {
- WrapperDropDetails ed = (WrapperDropDetails) event
+ WrapperTargetDetails ed = (WrapperTargetDetails) event
.getDropTargetDetails();
Transferable ctr = event.getTransferable();
if (ctr.getSourceComponent() != null) {
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.DropTargetDetails;
+import com.vaadin.event.dd.TargetDetails;
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.ui.AbstractComponent;
};
}
- public DropTargetDetails translateDropTargetDetails(
+ public TargetDetails translateDropTargetDetails(
Map<String, Object> clientVariables) {
// If component has some special drop details that it needs to
// translate for server side use, developer must return a
import com.vaadin.ui.AbstractSelect.AcceptItem;
import com.vaadin.ui.Table.TableDragMode;
import com.vaadin.ui.Tree.TreeDragMode;
-import com.vaadin.ui.Tree.TreeDropTargetDetails;
+import com.vaadin.ui.Tree.TreeTargetDetails;
/**
* DD playground. Better quality example/prototype codes in {@link DDTest2}.
}
public void drop(DragAndDropEvent event) {
- TreeDropTargetDetails details = (TreeDropTargetDetails) event
+ TreeTargetDetails details = (TreeTargetDetails) event
.getDropTargetDetails();
// TODO set properties, so same sorter could be used in Table
Transferable transferable = event.getTransferable();
import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Window;
-import com.vaadin.ui.AbstractSelect.AbstractSelectDropTargetDetails;
+import com.vaadin.ui.AbstractSelect.AbstractSelectTargetDetails;
import com.vaadin.ui.AbstractSelect.AcceptItem;
import com.vaadin.ui.Table.TableTransferable;
import com.vaadin.ui.Tree.TargetItemAllowsChildren;
data = "-no Text data flawor-";
}
tree3.addItem(data);
- AbstractSelect.AbstractSelectDropTargetDetails dropTargetData = (AbstractSelect.AbstractSelectDropTargetDetails) dropEvent
+ AbstractSelect.AbstractSelectTargetDetails dropTargetData = (AbstractSelect.AbstractSelectTargetDetails) dropEvent
.getDropTargetDetails();
tree3.setParent(data, dropTargetData.getItemIdOver());
* As we also accept only drops on folders, we know dropDetails
* is from Tree and it contains itemIdOver.
*/
- AbstractSelectDropTargetDetails details = (AbstractSelectDropTargetDetails) event
+ AbstractSelectTargetDetails details = (AbstractSelectTargetDetails) event
.getDropTargetDetails();
Object idOver = details.getItemIdOver();
tree1.setParent(itemId, idOver);
dropHandler = new DropHandler() {
public void drop(DragAndDropEvent event) {
- AbstractSelectDropTargetDetails details = (AbstractSelectDropTargetDetails) event
+ AbstractSelectTargetDetails details = (AbstractSelectTargetDetails) event
.getDropTargetDetails();
Transferable transferable = event.getTransferable();
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;
-import com.vaadin.ui.AbstractSelect.AbstractSelectDropTargetDetails;
+import com.vaadin.ui.AbstractSelect.AbstractSelectTargetDetails;
public class DDTest4 extends TestBase {
}
public void drop(DragAndDropEvent dropEvent) {
- AbstractSelectDropTargetDetails dropTargetData = (AbstractSelectDropTargetDetails) dropEvent
+ AbstractSelectTargetDetails dropTargetData = (AbstractSelectTargetDetails) dropEvent
.getDropTargetDetails();
DataBoundTransferable transferable = (DataBoundTransferable) dropEvent
.getTransferable();
import com.vaadin.ui.AbsoluteLayout.ComponentPosition;
import com.vaadin.ui.DragAndDropWrapper.WrapperTransferable.Html5File;
import com.vaadin.ui.Tree.TreeDragMode;
-import com.vaadin.ui.Tree.TreeDropTargetDetails;
+import com.vaadin.ui.Tree.TreeTargetDetails;
import com.vaadin.ui.Upload.Receiver;
public class DDTest6 extends TestBase {
public void drop(DragAndDropEvent dropEvent) {
File file = null;
Folder folder = null;
- TreeDropTargetDetails dropTargetData = (TreeDropTargetDetails) dropEvent
+ TreeTargetDetails dropTargetData = (TreeTargetDetails) dropEvent
.getDropTargetDetails();
folder = (Folder) dropTargetData.getItemIdInto();
if (dropEvent.getTransferable() instanceof DataBoundTransferable) {
MouseEventDetails mouseDownEvent = transferable
.getMouseDownEvent();
- WrapperDropDetails dropTargetDetails = (WrapperDropDetails) dropEvent
+ WrapperTargetDetails dropTargetDetails = (WrapperTargetDetails) dropEvent
.getDropTargetDetails();
MouseEventDetails mouseEvent = dropTargetDetails
.getMouseEvent();
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;
-import com.vaadin.ui.AbstractSelect.AbstractSelectDropTargetDetails;
+import com.vaadin.ui.AbstractSelect.AbstractSelectTargetDetails;
public class DDTest7 extends TestBase {
}
public void drop(DragAndDropEvent dropEvent) {
- AbstractSelectDropTargetDetails dropTargetData = (AbstractSelectDropTargetDetails) dropEvent
+ AbstractSelectTargetDetails dropTargetData = (AbstractSelectTargetDetails) dropEvent
.getDropTargetDetails();
DataBoundTransferable transferable = (DataBoundTransferable) dropEvent
.getTransferable();
import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Tree.TreeDragMode;
-import com.vaadin.ui.Tree.TreeDropTargetDetails;
+import com.vaadin.ui.Tree.TreeTargetDetails;
/**
* DD playground. Better quality example/prototype codes in {@link DDTest2}.
}
public void drop(DragAndDropEvent event) {
- TreeDropTargetDetails details = (TreeDropTargetDetails) event
+ TreeTargetDetails details = (TreeTargetDetails) event
.getDropTargetDetails();
// TODO set properties, so same sorter could be used in Table
Transferable transferable = event.getTransferable();
public void drop(DragAndDropEvent event) {
- WrapperDropDetails ed = (WrapperDropDetails) event
+ WrapperTargetDetails ed = (WrapperTargetDetails) event
.getDropTargetDetails();
Transferable ctr = event.getTransferable();
// use "component" (from DragDropPane) if available, else take
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.DropTargetDetails;
+import com.vaadin.event.dd.TargetDetails;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.event.dd.acceptcriteria.And;
import com.vaadin.event.dd.acceptcriteria.TargetDetailIs;
Iterator<Component> componentIterator = layout
.getComponentIterator();
Component next = componentIterator.next();
- DropTargetDetails dropTargetData = dropEvent
+ TargetDetails dropTargetData = dropEvent
.getDropTargetDetails();
DropTarget target = dropTargetData.getTarget();
while (next != target) {
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.DropTargetDetails;
+import com.vaadin.event.dd.TargetDetails;
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
import com.vaadin.ui.Component;
Iterator<Component> componentIterator = cssLayout
.getComponentIterator();
Component next = componentIterator.next();
- DropTargetDetails dropTargetData = dropEvent
+ TargetDetails dropTargetData = dropEvent
.getDropTargetDetails();
DropTarget target = dropTargetData.getTarget();
while (next != target) {