com.vaadin.ui
Class DragAndDropWrapper

java.lang.Object
  extended by com.vaadin.ui.AbstractComponent
      extended by com.vaadin.ui.AbstractComponentContainer
          extended by com.vaadin.ui.CustomComponent
              extended by com.vaadin.ui.DragAndDropWrapper
All Implemented Interfaces:
DragSource, DropTarget, MethodEventSource, Paintable, Sizeable, VariableOwner, Component, ComponentContainer, Serializable, EventListener

public class DragAndDropWrapper
extends CustomComponent
implements DropTarget, DragSource

See Also:
Serialized Form

Nested Class Summary
static class DragAndDropWrapper.DragStartMode
           
 class DragAndDropWrapper.WrapperTargetDetails
           
 class DragAndDropWrapper.WrapperTransferable
           
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Nested classes/interfaces inherited from interface com.vaadin.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Field Summary
 
Fields inherited from interface com.vaadin.terminal.Sizeable
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Fields inherited from interface com.vaadin.terminal.Sizeable
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
DragAndDropWrapper(Component root)
          Wraps given component in a DragAndDropWrapper.
 
Method Summary
 DragAndDropWrapper.DragStartMode getDragStartMode()
           
 DropHandler getDropHandler()
           
 Transferable getTransferable(Map<String,Object> rawVariables)
          DragSource may convert data added by client side component to meaningful values for server side developer or add other data based on it.
 void paintContent(PaintTarget target)
          Paints any needed component-specific things to the given UIDL stream.
 void setDragStartMode(DragAndDropWrapper.DragStartMode dragStartMode)
           
 void setDropHandler(DropHandler dropHandler)
           
 void setHTML5DataFlavor(String type, Object value)
          Sets data flavors available in the DragAndDropWrapper is used to start an HTML5 style drags.
 TargetDetails translateDropTargetDetails(Map<String,Object> clientVariables)
          Called before the DragAndDropEvent is passed to DropHandler.
 
Methods inherited from class com.vaadin.ui.CustomComponent
addComponent, getComponentCount, getComponentIterator, getComponentType, getCompositionRoot, moveComponentsFrom, removeAllComponents, removeComponent, replaceComponent, setComponentType, setCompositionRoot
 
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, removeListener, removeListener, requestRepaintAll, setEnabled, setHeight, setWidth
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addListener, addStyleName, changeVariables, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, focus, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, hasListeners, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeight, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth, setWidthUnits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setParent, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.vaadin.terminal.Paintable
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId
 
Methods inherited from interface com.vaadin.terminal.VariableOwner
changeVariables, isImmediate
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidth, setWidthUnits
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setParent, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.vaadin.terminal.Paintable
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId
 
Methods inherited from interface com.vaadin.terminal.VariableOwner
changeVariables, isImmediate
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidth, setWidthUnits
 

Constructor Detail

DragAndDropWrapper

public DragAndDropWrapper(Component root)
Wraps given component in a DragAndDropWrapper.

Parameters:
root - the component to be wrapped
Method Detail

setHTML5DataFlavor

public void setHTML5DataFlavor(String type,
                               Object value)
Sets data flavors available in the DragAndDropWrapper is used to start an HTML5 style drags. Most commonly the "Text" flavor should be set. Multiple data types can be set.

Parameters:
type - the string identifier of the drag "payload". E.g. "Text" or "text/html"
value - the value

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Description copied from class: AbstractComponent
Paints any needed component-specific things to the given UIDL stream. The more general AbstractComponent.paint(PaintTarget) method handles all general attributes common to all components, and it calls this method to paint any component-specific attributes to the UIDL stream.

Overrides:
paintContent in class CustomComponent
Parameters:
target - the target UIDL stream where the component should paint itself to
Throws:
PaintException - if the paint operation failed.

getDropHandler

public DropHandler getDropHandler()
Specified by:
getDropHandler in interface DropTarget
Returns:
the drop hanler that will receive the dragged data or null if drops are not currently accepted

setDropHandler

public void setDropHandler(DropHandler dropHandler)

translateDropTargetDetails

public TargetDetails translateDropTargetDetails(Map<String,Object> clientVariables)
Description copied from interface: DropTarget
Called before the DragAndDropEvent is passed to DropHandler. Implementation may for example 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 TargetDetails with raw client side data.

Specified by:
translateDropTargetDetails in interface DropTarget
Parameters:
clientVariables - data passed from the DropTargets client side counterpart.
Returns:
A DropTargetDetails object with the translated data or null to use a default implementation.
See Also:
DragSource.getTransferable(Map)

getTransferable

public Transferable getTransferable(Map<String,Object> rawVariables)
Description copied from interface: DragSource
DragSource may convert data added by client side component to meaningful values for server side developer or add other data based on it.

For example Tree converts item identifiers to generated string keys for the client side. Vaadin developer don't and can't know anything about these generated keys, only about item identifiers. When tree node is dragged client puts that key to Transferables client side counterpart. In Tree.getTransferable(Map) the key is converted back to item identifier that the server side developer can use.

Specified by:
getTransferable in interface DragSource
Parameters:
rawVariables - the data that client side initially included in Transferables client side counterpart.
Returns:
the Transferable instance that will be passed to DropHandler (and/or AcceptCriterion)

setDragStartMode

public void setDragStartMode(DragAndDropWrapper.DragStartMode dragStartMode)

getDragStartMode

public DragAndDropWrapper.DragStartMode getDragStartMode()


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.