com.sencha.gxt.dnd.core.client
Class DropTarget

java.lang.Object
  extended by com.sencha.gxt.dnd.core.client.DropTarget
All Implemented Interfaces:
DndDragCancelEvent.HasDndDragCancelHandlers, DndDragEnterEvent.HasDndDragEnterHandlers, DndDragLeaveEvent.HasDndDragLeaveHandlers, DndDragMoveEvent.HasDndDragMoveHandlers, DndDropEvent.HasDndDropHandlers
Direct Known Subclasses:
GridDropTarget, ListViewDropTarget, TreeDropTarget, TreeGridDropTarget

public class DropTarget
extends java.lang.Object
implements DndDragEnterEvent.HasDndDragEnterHandlers, DndDragLeaveEvent.HasDndDragLeaveHandlers, DndDragCancelEvent.HasDndDragCancelHandlers, DndDragMoveEvent.HasDndDragMoveHandlers, DndDropEvent.HasDndDropHandlers

Enables a component to act as the target of a drag and drop operation (i.e. a user can drop data on the component).

While the cursor is over a target, the target is responsible for determining if the drop is valid and showing any visual indicators for the drop. The StatusProxy object should be used to specify if the drop is valid, and can also be used to change the values of the proxy object displayed by the cursor.


Constructor Summary
DropTarget(Widget target)
          Creates a new drop target.
 
Method Summary
 HandlerRegistration addDragCancelHandler(DndDragCancelEvent.DndDragCancelHandler handler)
          Adds a DndDragCancelEvent.DndDragCancelHandler handler for DndDragCancelEvent events.
 HandlerRegistration addDragEnterHandler(DndDragEnterEvent.DndDragEnterHandler handler)
          Adds a DndDragEnterEvent.DndDragEnterHandler handler for DndDragEnterEvent events.
 HandlerRegistration addDragLeaveHandler(DndDragLeaveEvent.DndDragLeaveHandler handler)
          Adds a DndDragLeaveEvent.DndDragLeaveHandler handler for DndDragLeaveEvent events.
 HandlerRegistration addDragMoveHandler(DndDragMoveEvent.DndDragMoveHandler handler)
          Adds a DndDragMoveEvent.DndDragMoveHandler handler for DndDragMoveEvent events.
 HandlerRegistration addDropHandler(DndDropEvent.DndDropHandler handler)
          Adds a DndDropEvent.DndDropHandler handler for DndDropEvent events.
 void disable()
          Disables the drag source.
 void enable()
          Enables the drag source.
 DND.Feedback getFeedback()
          Returns the target's feedback setting.
 java.lang.String getGroup()
          Returns the target's group name.
 DND.Operation getOperation()
          Returns the target's operation.
 java.lang.String getOverStyle()
          Returns the target's over style.
 Widget getWidget()
          Returns the target's widget.
 boolean isAllowSelfAsSource()
          Returns true if internal drops are allowed.
 boolean isEnabled()
          Returns true if the drag source is enabled.
 void release()
          Unregisters the target as a drop target.
 void setAllowSelfAsSource(boolean allowSelfAsSource)
          Sets whether internal drops are allowed (defaults to false).
 void setFeedback(DND.Feedback feedback)
          Sets the target's feedback.
 void setGroup(java.lang.String group)
          Sets the drag group.
 void setOperation(DND.Operation operation)
          Sets the operation for the drop target which specifies if data should be moved or copied when dropped.
 void setOverStyle(java.lang.String overStyle)
          Sets the style name to be applied when the cursor is over the target (defaults to null).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DropTarget

public DropTarget(Widget target)
Creates a new drop target.

Parameters:
target - the target widget
Method Detail

addDragCancelHandler

public HandlerRegistration addDragCancelHandler(DndDragCancelEvent.DndDragCancelHandler handler)
Description copied from interface: DndDragCancelEvent.HasDndDragCancelHandlers
Adds a DndDragCancelEvent.DndDragCancelHandler handler for DndDragCancelEvent events.

Specified by:
addDragCancelHandler in interface DndDragCancelEvent.HasDndDragCancelHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addDragEnterHandler

public HandlerRegistration addDragEnterHandler(DndDragEnterEvent.DndDragEnterHandler handler)
Description copied from interface: DndDragEnterEvent.HasDndDragEnterHandlers
Adds a DndDragEnterEvent.DndDragEnterHandler handler for DndDragEnterEvent events.

Specified by:
addDragEnterHandler in interface DndDragEnterEvent.HasDndDragEnterHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addDragLeaveHandler

public HandlerRegistration addDragLeaveHandler(DndDragLeaveEvent.DndDragLeaveHandler handler)
Description copied from interface: DndDragLeaveEvent.HasDndDragLeaveHandlers
Adds a DndDragLeaveEvent.DndDragLeaveHandler handler for DndDragLeaveEvent events.

Specified by:
addDragLeaveHandler in interface DndDragLeaveEvent.HasDndDragLeaveHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addDragMoveHandler

public HandlerRegistration addDragMoveHandler(DndDragMoveEvent.DndDragMoveHandler handler)
Description copied from interface: DndDragMoveEvent.HasDndDragMoveHandlers
Adds a DndDragMoveEvent.DndDragMoveHandler handler for DndDragMoveEvent events.

Specified by:
addDragMoveHandler in interface DndDragMoveEvent.HasDndDragMoveHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addDropHandler

public HandlerRegistration addDropHandler(DndDropEvent.DndDropHandler handler)
Description copied from interface: DndDropEvent.HasDndDropHandlers
Adds a DndDropEvent.DndDropHandler handler for DndDropEvent events.

Specified by:
addDropHandler in interface DndDropEvent.HasDndDropHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

disable

public void disable()
Disables the drag source.


enable

public void enable()
Enables the drag source.


getFeedback

public DND.Feedback getFeedback()
Returns the target's feedback setting.

Returns:
the feedback

getGroup

public java.lang.String getGroup()
Returns the target's group name.

Returns:
the group name

getOperation

public DND.Operation getOperation()
Returns the target's operation.

Returns:
the operation

getOverStyle

public java.lang.String getOverStyle()
Returns the target's over style.

Returns:
the over style

getWidget

public Widget getWidget()
Returns the target's widget.

Returns:
the widget

isAllowSelfAsSource

public boolean isAllowSelfAsSource()
Returns true if internal drops are allowed.

Returns:
true for internal drops

isEnabled

public boolean isEnabled()
Returns true if the drag source is enabled.

Returns:
true for enabled

release

public void release()
Unregisters the target as a drop target.


setAllowSelfAsSource

public void setAllowSelfAsSource(boolean allowSelfAsSource)
Sets whether internal drops are allowed (defaults to false).

Parameters:
allowSelfAsSource - true to allow internal drops

setFeedback

public void setFeedback(DND.Feedback feedback)
Sets the target's feedback. Feedback determines the type of visual indicators a drop target supports. Subclasses will determine range of valid values.

Parameters:
feedback - the feedback

setGroup

public void setGroup(java.lang.String group)
Sets the drag group. If specified, only drag sources with the same group value are allowed.

Parameters:
group - the group name

setOperation

public void setOperation(DND.Operation operation)
Sets the operation for the drop target which specifies if data should be moved or copied when dropped. Drag sources use this value to determine if the target data should be removed from the source widget.

Parameters:
operation - the operation

setOverStyle

public void setOverStyle(java.lang.String overStyle)
Sets the style name to be applied when the cursor is over the target (defaults to null).

Parameters:
overStyle - the over style


Copyright © 2012. All Rights Reserved.