Package com.vaadin.ui

Class DragAndDropWrapper

    • 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
      • changeVariables

        public void changeVariables​(Object source,
                                    Map<String,​Object> variables)
        Description copied from interface: VariableOwner
        Called when one or more variables handled by the implementing class are changed.
        Specified by:
        changeVariables in interface VariableOwner
        Parameters:
        source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
        variables - the Mapping from variable names to new variable values.
      • paintContent

        public void paintContent​(PaintTarget target)
                          throws PaintException
        Description copied from interface: LegacyComponent

        Paints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.

        It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.

        Specified by:
        paintContent in interface LegacyComponent
        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)
      • readDesign

        public void readDesign​(org.jsoup.nodes.Element design,
                               DesignContext designContext)
        Description copied from interface: Component
        Reads the component state from the given design.

        The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.

        It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.

        This method must not modify the design.

        Specified by:
        readDesign in interface Component
        Overrides:
        readDesign in class AbstractComponent
        Parameters:
        design - The element to obtain the state from
        designContext - The DesignContext instance used for parsing the design
      • writeDesign

        public void writeDesign​(org.jsoup.nodes.Element design,
                                DesignContext designContext)
        Description copied from interface: Component
        Writes the component state to the given design.

        The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.

        This method must not modify the component state.

        Specified by:
        writeDesign in interface Component
        Overrides:
        writeDesign in class AbstractComponent
        Parameters:
        design - The element to write the component state to. Any previous attributes or child nodes are not cleared.
        designContext - The DesignContext instance used for writing the design