public class CmsDNDHandler
extends java.lang.Object
implements com.google.gwt.event.dom.client.MouseDownHandler
限定符和类型 | 类和说明 |
---|---|
protected class |
CmsDNDHandler.CmsScrollTimer
Timer to schedule automated scrolling.
|
protected static class |
CmsDNDHandler.Direction
Scroll direction enumeration.
|
protected class |
CmsDNDHandler.DNDEventPreviewHandler
Drag and drop event preview handler.
|
static class |
CmsDNDHandler.Orientation
The allowed drag and drop orientation.
|
构造器和说明 |
---|
CmsDNDHandler(I_CmsDNDController controller)
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addTarget(I_CmsDropTarget target)
Adds a drop target.
|
protected void |
animateCancel(I_CmsDraggable draggable,
I_CmsDNDController controller)
Clears the drag process with a move animation of the drag element to it's original position.
|
protected void |
animateDrop(I_CmsDraggable draggable,
I_CmsDropTarget target,
I_CmsDNDController controller)
Clears the drag process with a move animation of the drag element to the place-holder position.
|
void |
cancel()
Cancels the dragging process.
|
protected void |
clear()
Clears all references used within the current drag process.
|
protected void |
clearScrollTimer()
Cancels the scroll timer and removes the timer reference.
|
void |
clearTargets()
Clears the drop target register.
|
void |
drop()
Drops the draggable.
|
I_CmsDNDController |
getController()
Returns the drag and drop controller.
|
I_CmsDropTarget |
getCurrentTarget()
Returns the current drop target.
|
int |
getCursorOffsetX()
Returns the cursor offset x.
|
int |
getCursorOffsetY()
Returns the cursor offset y.
|
I_CmsDraggable |
getDraggable()
Returns the current draggable.
|
com.google.gwt.dom.client.Element |
getDragHelper()
Returns the drag helper element.
|
CmsDNDHandler.Orientation |
getOrientation()
Returns the allowed drag and drop orientation.
|
com.google.gwt.dom.client.Element |
getPlaceholder()
Returns the place holder element.
|
boolean |
isAnimationEnabled()
Returns if the animation is enabled.
|
boolean |
isDragging()
Returns if a dragging process is taking place.
|
boolean |
isScrollEnabled()
Returns if automated scrolling is enabled.
|
void |
onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event) |
protected void |
onMouseWheelScroll(com.google.gwt.user.client.Event event)
Execute on mouse wheel event.
|
protected void |
onMove(com.google.gwt.user.client.Event event)
Executed on mouse move while dragging.
|
protected void |
onUp(com.google.gwt.user.client.Event event)
Executed on mouse up while dragging.
|
protected void |
positionHelper()
Positions an element depending on the current events client position and the cursor offset.
|
void |
removeTarget(I_CmsDropTarget target)
Removes a drop target from the register.
|
void |
setAnimationEnabled(boolean animationEnabled)
Sets the animation enabled.
|
void |
setController(I_CmsDNDController controller)
Sets the drag and drop controller.
|
void |
setCursorOffsetX(int cursorOffsetX)
Sets the cursor offset x.
|
void |
setCursorOffsetY(int cursorOffsetY)
Sets the cursor offset y.
|
void |
setDraggable(I_CmsDraggable draggable)
Sets the draggable.
|
void |
setDragHelper(com.google.gwt.dom.client.Element dragHelper)
Sets the drag helper element.
|
void |
setOrientation(CmsDNDHandler.Orientation orientation)
Sets the allowed drag and drop orientation.
|
void |
setPlaceholder(com.google.gwt.dom.client.Element placeholder)
Sets the placeholder element.
|
void |
setScrollElement(com.google.gwt.dom.client.Element scrollElement)
Sets the scroll element in case not the window but another element needs scrolling.
|
void |
setScrollEnabled(boolean scrollEnabled)
Sets the scrolling enabled.
|
void |
setStartPosition(int left,
int top)
Sets the start position.
|
protected void |
stopDragging()
Sets dragging to false and removes the event preview handler.
|
public CmsDNDHandler(I_CmsDNDController controller)
controller
- the drag and drop controllerpublic void addTarget(I_CmsDropTarget target)
target
- the target to addpublic void cancel()
public void clearTargets()
public void drop()
public I_CmsDNDController getController()
public I_CmsDropTarget getCurrentTarget()
public int getCursorOffsetX()
public int getCursorOffsetY()
public I_CmsDraggable getDraggable()
public com.google.gwt.dom.client.Element getDragHelper()
public CmsDNDHandler.Orientation getOrientation()
public com.google.gwt.dom.client.Element getPlaceholder()
public boolean isAnimationEnabled()
true
if the animation is enabledpublic boolean isDragging()
true
if the handler is currently draggingpublic boolean isScrollEnabled()
public void onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event)
onMouseDown
在接口中 com.google.gwt.event.dom.client.MouseDownHandler
MouseDownHandler.onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent)
public void removeTarget(I_CmsDropTarget target)
target
- the target to removepublic void setAnimationEnabled(boolean animationEnabled)
animationEnabled
- true
to enable the animationpublic void setController(I_CmsDNDController controller)
controller
- the drag and drop controller to setpublic void setCursorOffsetX(int cursorOffsetX)
cursorOffsetX
- the cursor offset x to setpublic void setCursorOffsetY(int cursorOffsetY)
cursorOffsetY
- the cursor offset y to setpublic void setDraggable(I_CmsDraggable draggable)
draggable
- the draggablepublic void setDragHelper(com.google.gwt.dom.client.Element dragHelper)
dragHelper
- the drag helper elementpublic void setOrientation(CmsDNDHandler.Orientation orientation)
orientation
- the drag and drop orientation to setpublic void setPlaceholder(com.google.gwt.dom.client.Element placeholder)
placeholder
- the placeholder elementpublic void setScrollEnabled(boolean scrollEnabled)
scrollEnabled
- true
to enable scrollingpublic void setScrollElement(com.google.gwt.dom.client.Element scrollElement)
scrollElement
- the scroll elementpublic void setStartPosition(int left, int top)
In case of a canceled drag and drop and enabled animation, the draggable helper element will be reverted to the start position.
Values <0
will be ignored.
left
- the left positiontop
- the top positionprotected void animateCancel(I_CmsDraggable draggable, I_CmsDNDController controller)
draggable
- the draggablecontroller
- the drag and drop controllerprotected void animateDrop(I_CmsDraggable draggable, I_CmsDropTarget target, I_CmsDNDController controller)
draggable
- the draggabletarget
- the drop targetcontroller
- the drag and drop controllerprotected void clear()
protected void clearScrollTimer()
protected void onMouseWheelScroll(com.google.gwt.user.client.Event event)
event
- the native eventprotected void onMove(com.google.gwt.user.client.Event event)
event
- the eventprotected void onUp(com.google.gwt.user.client.Event event)
event
- the eventprotected void positionHelper()
protected void stopDragging()