
public class Draggable extends Object implements DragStartEvent.HasDragStartHandlers, DragEndEvent.HasDragEndHandlers, DragMoveEvent.HasDragMoveHandlers, DragCancelEvent.HasDragCancelHandlers, DragHandler.HasDragHandlers
CommonStyles.Styles.nodrag() style (as returned by
CommonStyles.get()) it will not trigger a drag operation.| Modifier and Type | Class and Description |
|---|---|
static interface |
Draggable.DraggableAppearance |
| Constructor and Description |
|---|
Draggable(Widget dragComponent)
Creates a new draggable instance.
|
Draggable(Widget dragComponent,
Draggable.DraggableAppearance appearance)
Creates a new draggable instance.
|
Draggable(Widget dragComponent,
Widget handle)
Create a new draggable instance.
|
Draggable(Widget dragComponent,
Widget handle,
Draggable.DraggableAppearance appearance)
Create a new draggable instance.
|
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addDragCancelHandler(DragCancelEvent.DragCancelHandler handler)
Adds a
DragCancelEvent.DragCancelHandler handler for DragCancelEvent events. |
HandlerRegistration |
addDragEndHandler(DragEndEvent.DragEndHandler handler)
Adds a
DragEndEvent.DragEndHandler handler for DragEndEvent events. |
HandlerRegistration |
addDragHandler(DragHandler handler)
Adds a
DragHandler handler for DragStartEvent ,
DragEndEvent, DragCancelEvent, DragMoveEvent
events. |
HandlerRegistration |
addDragMoveHandler(DragMoveEvent.DragMoveHandler handler)
Adds a
DragMoveEvent.DragMoveHandler handler for DragMoveEvent
events. |
HandlerRegistration |
addDragStartHandler(DragStartEvent.DragStartHandler handler)
Adds a
DragStartEvent.DragStartHandler handler for DragStartEvent events. |
void |
cancelDrag()
Cancels the drag if running.
|
Widget |
getContainer()
Returns the drag container.
|
Widget |
getDragHandle()
Returns the drag handle.
|
Widget |
getDragWidget()
Returns the widget being dragged.
|
int |
getStartDragDistance()
Returns the number of pixels the cursor must move before dragging begins.
|
boolean |
isConstrainClient()
Returns true if drag is constrained to the viewport.
|
boolean |
isConstrainHorizontal()
Returns true if horizontal movement is constrained.
|
boolean |
isConstrainVertical()
Returns true if vertical movement is constrained.
|
boolean |
isDragging()
Returns
true if a drag is in progress. |
boolean |
isEnabled()
Returns
true if enabled. |
boolean |
isMoveAfterProxyDrag()
Returns true if the drag widget is moved after a proxy drag.
|
boolean |
isSizeProxyToSource()
Returns true if the proxy element is sized to match the drag widget.
|
boolean |
isUpdateZIndex()
Returns true if the z-index is updated after a drag.
|
boolean |
isUseProxy()
Returns true if proxy element is enabled.
|
void |
release()
Removes the drag handles.
|
void |
setConstrainClient(boolean constrainClient)
True to set constrain movement to the viewport (defaults to true).
|
void |
setConstrainHorizontal(boolean constrainHorizontal)
True to stop horizontal movement (defaults to false).
|
void |
setConstrainVertical(boolean constrainVertical)
True to stop vertical movement (defaults to false).
|
void |
setContainer(Widget container)
Specifies a container to which the drag widget is constrained.
|
void |
setEnabled(boolean enabled)
Enables dragging if the argument is
true, and disables it
otherwise. |
void |
setMoveAfterProxyDrag(boolean moveAfterProxyDrag)
True to move source widget after a proxy drag (defaults to true).
|
void |
setProxy(XElement element)
Sets the proxy element.
|
void |
setProxyStyle(String proxyClass) |
void |
setSizeProxyToSource(boolean sizeProxyToSource)
True to set proxy dimensions the same as the drag widget (defaults to
true).
|
void |
setStartDragDistance(int startDragDistance)
Specifies how far the cursor must move after mousedown to start dragging
(defaults to 2).
|
void |
setUpdateZIndex(boolean updateZIndex)
True if the CSS z-index should be updated on the widget being dragged.
|
void |
setUseProxy(boolean useProxy)
True to use a proxy widget during drag operation (defaults to true).
|
void |
setXConstraint(int left,
int right)
Constrains the horizontal travel.
|
void |
setYConstraint(int top,
int bottom)
Constrains the vertical travel.
|
public Draggable(Widget dragComponent)
dragComponent - the widget to be draggedpublic Draggable(Widget dragComponent, Draggable.DraggableAppearance appearance)
dragComponent - the widget to be draggedappearance - the appearance with which to render the componentpublic Draggable(Widget dragComponent, Widget handle)
dragComponent - the widget to be draggedhandle - the widget drags will be initiated frompublic Draggable(Widget dragComponent, Widget handle, Draggable.DraggableAppearance appearance)
dragComponent - the widget to be draggedhandle - the widget drags will be initiated fromappearance - the appearance with which to render the componentpublic HandlerRegistration addDragCancelHandler(DragCancelEvent.DragCancelHandler handler)
DragCancelEvent.HasDragCancelHandlersDragCancelEvent.DragCancelHandler handler for DragCancelEvent events.addDragCancelHandler in interface DragCancelEvent.HasDragCancelHandlershandler - the handlerpublic HandlerRegistration addDragEndHandler(DragEndEvent.DragEndHandler handler)
DragEndEvent.HasDragEndHandlersDragEndEvent.DragEndHandler handler for DragEndEvent events.addDragEndHandler in interface DragEndEvent.HasDragEndHandlershandler - the handlerpublic HandlerRegistration addDragHandler(DragHandler handler)
DragHandler.HasDragHandlersDragHandler handler for DragStartEvent ,
DragEndEvent, DragCancelEvent, DragMoveEvent
events.addDragHandler in interface DragHandler.HasDragHandlershandler - the handlerpublic HandlerRegistration addDragMoveHandler(DragMoveEvent.DragMoveHandler handler)
DragMoveEvent.HasDragMoveHandlersDragMoveEvent.DragMoveHandler handler for DragMoveEvent
events.addDragMoveHandler in interface DragMoveEvent.HasDragMoveHandlershandler - the handlerpublic HandlerRegistration addDragStartHandler(DragStartEvent.DragStartHandler handler)
DragStartEvent.HasDragStartHandlersDragStartEvent.DragStartHandler handler for DragStartEvent events.addDragStartHandler in interface DragStartEvent.HasDragStartHandlershandler - the handlerpublic void cancelDrag()
public Widget getContainer()
public Widget getDragHandle()
public Widget getDragWidget()
public int getStartDragDistance()
public boolean isConstrainClient()
public boolean isConstrainHorizontal()
public boolean isConstrainVertical()
public boolean isDragging()
true if a drag is in progress.public boolean isEnabled()
true if enabled.public boolean isMoveAfterProxyDrag()
public boolean isSizeProxyToSource()
public boolean isUpdateZIndex()
public boolean isUseProxy()
public void release()
public void setConstrainClient(boolean constrainClient)
constrainClient - true to constrain to viewportpublic void setConstrainHorizontal(boolean constrainHorizontal)
constrainHorizontal - true to stop horizontal movementpublic void setConstrainVertical(boolean constrainVertical)
constrainVertical - true to stop vertical movementpublic void setContainer(Widget container)
container - the containerpublic void setEnabled(boolean enabled)
true, and disables it
otherwise.enabled - the new enabled statepublic void setMoveAfterProxyDrag(boolean moveAfterProxyDrag)
moveAfterProxyDrag - true to move after a proxy dragpublic void setProxy(XElement element)
element - the proxy elementpublic void setProxyStyle(String proxyClass)
public void setSizeProxyToSource(boolean sizeProxyToSource)
sizeProxyToSource - true to update proxy sizepublic void setStartDragDistance(int startDragDistance)
startDragDistance - the start distance in pixelspublic void setUpdateZIndex(boolean updateZIndex)
true will ensure that the dragged
element is always displayed over all other widgets (defaults to true).updateZIndex - true update the z-indexpublic void setUseProxy(boolean useProxy)
useProxy - true use a proxypublic void setXConstraint(int left,
int right)
left - the number of pixels the element can move to the leftright - the number of pixels the element can move to the rightpublic void setYConstraint(int top,
int bottom)
top - the number of pixels the element can move to the upbottom - the number of pixels the element can move to the downCopyright © 2015. All rights reserved.