Class DragHandle


  • public class DragHandle
    extends Object
    Drag handle implementation. Drag handles are used for moving or resizing widgets. This is a minimal-case component, meant to be used specifically as a drag handle attached to another widget or element. As such, it does not provide access to the events it's listening to (from the point of view of this component, there really is no use for that). For the more general, event-providing interface that this component is based on, see DragAndDropHandler.
    Since:
    7.6
    • Constructor Detail

      • DragHandle

        public DragHandle​(String baseName)
        Creates a new DragHandle.
        Parameters:
        baseName - CSS style name to use for this DragHandle element. This parameter is supplied to the constructor (rather than added later) both to provide the "-dragged" style and to make sure that the drag handle can be properly styled (it's otherwise invisible)
        Since:
        7.7.5
      • DragHandle

        public DragHandle​(String baseName,
                          DragHandle.DragHandleCallback callback)
        Creates a new DragHandle.
        Parameters:
        baseName - CSS style name to use for this DragHandle element. This parameter is supplied to the constructor (rather than added later) both to provide the "-dragged" style and to make sure that the drag handle can be properly styled (it's otherwise invisible)
        callback - Callback object allows hooking up the drag handle to the rest of the program logic
    • Method Detail

      • setCallback

        public void setCallback​(DragHandle.DragHandleCallback dragHandleCallback)
        Sets the user-facing drag handle callback method. This allows code using the DragHandle to react to the situations where a drag handle first touched, when it's moved and when it's released.
        Parameters:
        dragHandleCallback - the callback object to use (can be null)
        Since:
        7.7.5
      • getParent

        public com.google.gwt.dom.client.Element getParent()
        Returns the current parent element for this drag handle. May be null.
        Returns:
        an Element or null
      • getElement

        public com.google.gwt.dom.client.Element getElement()
        Gets the element used as actual drag handle.
        Returns:
        an Element
      • addTo

        public void addTo​(com.google.gwt.dom.client.Element elem)
        Adds this drag handle to an HTML element.
        Parameters:
        elem - an element
      • removeFromParent

        public void removeFromParent()
        Removes this drag handle from whatever it was attached to.
      • addStyleName

        public void addStyleName​(String styleName)
        Adds CSS style name to the drag handle element.
        Parameters:
        styleName - a CSS style name
      • removeStyleName

        public void removeStyleName​(String styleName)
        Removes existing style name from drag handle element.
        Parameters:
        styleName - a CSS style name