public class Draggable
extends com.extjs.gxt.ui.client.event.BaseObservable
Modifier and Type | Field and Description |
---|---|
protected int |
conHeight |
protected int |
conWidth |
protected int |
conX |
protected int |
conY |
protected int |
dragStartX |
protected int |
dragStartY |
protected int |
lastX |
protected int |
lastY |
protected El |
proxyEl |
protected com.extjs.gxt.ui.client.util.Rectangle |
startBounds |
Constructor and Description |
---|
Draggable(com.extjs.gxt.ui.client.widget.Component dragComponent)
Creates a new draggable instance.
|
Draggable(com.extjs.gxt.ui.client.widget.Component dragComponent,
com.extjs.gxt.ui.client.widget.Component handle)
Create a new draggable instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addDragListener(com.extjs.gxt.ui.client.event.DragListener listener)
Adds a listener to receive drag events.
|
protected void |
afterDrag() |
void |
cancelDrag()
Cancels the drag if running.
|
protected El |
createProxy() |
com.extjs.gxt.ui.client.widget.Component |
getContainer()
Returns the drag container.
|
com.extjs.gxt.ui.client.widget.Component |
getDragHandle()
Returns the drag handle.
|
com.extjs.gxt.ui.client.widget.Component |
getDragWidget()
Returns the widget being dragged.
|
String |
getProxyStyle()
Returns the proxy style.
|
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.
|
protected void |
onMouseDown(com.extjs.gxt.ui.client.event.ComponentEvent ce) |
protected void |
onMouseMove(com.google.gwt.user.client.Event event) |
void |
release()
Removes the drag handles.
|
void |
removeDragListener(com.extjs.gxt.ui.client.event.DragListener listener)
Removes a previously added listener.
|
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(com.extjs.gxt.ui.client.widget.Component 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(El element)
Sets the proxy element.
|
void |
setProxyStyle(String proxyStyle)
Sets the style name used for proxy drags (defaults to 'my-drag-proxy').
|
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.
|
protected void |
startDrag(com.google.gwt.user.client.Event event) |
protected void |
stopDrag(com.google.gwt.user.client.Event event) |
protected int conX
protected int conY
protected int conWidth
protected int conHeight
protected int dragStartX
protected int dragStartY
protected int lastX
protected int lastY
protected El proxyEl
protected com.extjs.gxt.ui.client.util.Rectangle startBounds
public Draggable(com.extjs.gxt.ui.client.widget.Component dragComponent)
dragComponent
- the component to be draggedpublic Draggable(com.extjs.gxt.ui.client.widget.Component dragComponent, com.extjs.gxt.ui.client.widget.Component handle)
dragComponent
- the component to be draggedhandle
- the component drags will be initiated frompublic void addDragListener(com.extjs.gxt.ui.client.event.DragListener listener)
listener
- the drag listener to be addedpublic void cancelDrag()
public com.extjs.gxt.ui.client.widget.Component getContainer()
public com.extjs.gxt.ui.client.widget.Component getDragHandle()
public com.extjs.gxt.ui.client.widget.Component getDragWidget()
public String getProxyStyle()
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 removeDragListener(com.extjs.gxt.ui.client.event.DragListener listener)
listener
- the listener to be removedpublic 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(com.extjs.gxt.ui.client.widget.Component 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(El element)
element
- the proxy elementpublic void setProxyStyle(String proxyStyle)
proxyStyle
- the proxy stylepublic 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 downprotected void afterDrag()
protected El createProxy()
protected void onMouseDown(com.extjs.gxt.ui.client.event.ComponentEvent ce)
protected void onMouseMove(com.google.gwt.user.client.Event event)
protected void startDrag(com.google.gwt.user.client.Event event)
protected void stopDrag(com.google.gwt.user.client.Event event)
Copyright © 2018. All Rights Reserved.