com.extjs.gxt.ui.client.dnd
Class DropTarget

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.dnd.DropTarget
All Implemented Interfaces:
Observable
Direct Known Subclasses:
GridDropTarget, ListViewDropTarget, TreeDropTarget, TreeGridDropTarget, TreePanelDropTarget

public class DropTarget
extends BaseObservable

Identifies components that can receive data from a drag and drop operations.

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 @link 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. The status proxy is accessible via the DNDEvent.

Events:
DragEnter : DNDEvent(target, source, component, event, dragEvent, status)
Fires after the cursor enters the target's boundaries.
DragLeave : DNDEvent(target, source, component, event, dragEvent, status)
Fires after the cursor leaves the target's boundaries.
DragCancel : DNDEvent(target, source, component, event, dragEvent, status)
Fires after the user when a drag operation is cancelled.
DragMove : DNDEvent(target, source, component, event, dragEvent, status)
Fires after the user begins a drag and drop operation.
DragDrop : DNDEvent(target, source, data, component, event, dragEvent, status)
Fires after the user drops data over the target.


Constructor Summary
DropTarget(Component target)
          Creates a new drop target.
 
Method Summary
 void addDNDListener(DNDListener listener)
          Adds the listener to the target.
 void disable()
          Disables the drag source.
 void enable()
          Enables the drag source.
 Component getComponent()
          Returns the target's component.
 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.
 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 removeDNDListener(DNDListener listener)
          Removes the listener.
 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 com.extjs.gxt.ui.client.event.BaseObservable
addListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DropTarget

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

Parameters:
target - the target component
Method Detail

addDNDListener

public void addDNDListener(DNDListener listener)
Adds the listener to the target.

Parameters:
listener - the listener to add

disable

public void disable()
Disables the drag source.


enable

public void enable()
Enables the drag source.


getComponent

public Component getComponent()
Returns the target's component.

Returns:
the component

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

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.


removeDNDListener

public void removeDNDListener(DNDListener listener)
Removes the listener.

Parameters:
listener - the listener to be removed

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 component.

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