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

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.dnd.DropTarget
          extended by com.extjs.gxt.ui.client.dnd.TreeGridDropTarget
All Implemented Interfaces:
Observable

public class TreeGridDropTarget
extends DropTarget

DropTarget implementation for TreeGrid.

Supported drag data:


Field Summary
protected  TreeGrid.TreeNode activeItem
           
protected  TreeGrid.TreeNode appendItem
           
protected  int status
           
protected  TreeGrid<ModelData> treeGrid
           
 
Fields inherited from class com.extjs.gxt.ui.client.dnd.DropTarget
component, feedback, operation, overStyle
 
Constructor Summary
TreeGridDropTarget(TreeGrid tree)
           
 
Method Summary
protected  void appendModel(ModelData p, java.util.List<ModelData> models, int index)
           
protected  void bind(TreeGrid tree)
           
protected  void clearStyle(TreeGrid.TreeNode node)
           
 TreeGrid<?> getTreeGrid()
          Returns the target's tree.
protected  void handleAppend(DNDEvent event, TreeGrid.TreeNode item)
           
protected  void handleAppendDrop(DNDEvent event, TreeGrid.TreeNode item)
           
protected  void handleInsert(DNDEvent event, TreeGrid.TreeNode item)
           
protected  void handleInsertDrop(DNDEvent event, TreeGrid.TreeNode item, int index)
           
 boolean isAddChildren()
          Returns true if children are being added when inserting into the TreeStore.
 boolean isAllowDropOnLeaf()
          Returns whether drops are allowed on leaf nodes.
 boolean isAutoExpand()
          Returns true if auto expand is enabled (defaults to true).
 boolean isAutoScroll()
          Returns true if auto scroll is enabled (defaults to true).
protected  void onDragCancelled(DNDEvent event)
          Called if the user cancels the drag operations while the mouse is over the target.
protected  void onDragDrop(DNDEvent event)
          Called when the user releases the mouse over the target component.
protected  void onDragEnter(DNDEvent e)
          Called when the cursor first enters the bounds of the drop target.
protected  void onDragFail(DNDEvent event)
           
protected  void onDragLeave(DNDEvent e)
          Called when the cursor leaves the target.
protected  void onDragMove(DNDEvent event)
          Called when the cursor is moved within the target component.
 void setAddChildren(boolean addChildren)
          True to add children when inserting models into the TreeStore (defaults to false).
 void setAllowDropOnLeaf(boolean allowDropOnLeaf)
          True to allow drops on leaf nodes (defaults to false).
 void setAutoExpand(boolean autoExpand)
          True to automatically expand the active tree item when the user hovers over a collapsed item (defaults to true).
 void setAutoExpandDelay(int autoExpandDelay)
          Sets the delay used to auto expand items (defaults to 800).
 void setAutoScroll(boolean autoScroll)
          True to automatically scroll the tree when the user hovers over the top and bottom of the tree grid (defaults to true).
protected  void showFeedback(DNDEvent event)
          Called as the mouse is moved over the target component.
 
Methods inherited from class com.extjs.gxt.ui.client.dnd.DropTarget
addDNDListener, disable, enable, getComponent, getFeedback, getGroup, getOperation, getOverStyle, isAllowSelfAsSource, isEnabled, onComponentAttach, onComponentDetach, prepareDropData, release, removeDNDListener, setAllowSelfAsSource, setFeedback, setGroup, setOperation, setOverStyle
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

treeGrid

protected TreeGrid<ModelData> treeGrid

activeItem

protected TreeGrid.TreeNode activeItem

appendItem

protected TreeGrid.TreeNode appendItem

status

protected int status
Constructor Detail

TreeGridDropTarget

public TreeGridDropTarget(TreeGrid tree)
Method Detail

getTreeGrid

public TreeGrid<?> getTreeGrid()
Returns the target's tree.

Returns:
the tree

isAddChildren

public boolean isAddChildren()
Returns true if children are being added when inserting into the TreeStore.

Returns:
the add children state

isAllowDropOnLeaf

public boolean isAllowDropOnLeaf()
Returns whether drops are allowed on leaf nodes.

Returns:
true of drops on leafs are allowed

isAutoExpand

public boolean isAutoExpand()
Returns true if auto expand is enabled (defaults to true).

Returns:
the auto expand state

isAutoScroll

public boolean isAutoScroll()
Returns true if auto scroll is enabled (defaults to true).

Returns:
true if auto scroll enabled

setAddChildren

public void setAddChildren(boolean addChildren)
True to add children when inserting models into the TreeStore (defaults to false).

Parameters:
addChildren - true to add children

setAllowDropOnLeaf

public void setAllowDropOnLeaf(boolean allowDropOnLeaf)
True to allow drops on leaf nodes (defaults to false).

Parameters:
allowDropOnLeaf - true to enable drops on leaf nodes

setAutoExpand

public void setAutoExpand(boolean autoExpand)
True to automatically expand the active tree item when the user hovers over a collapsed item (defaults to true). Use setAutoExpandDelay(int) to set the delay.

Parameters:
autoExpand - true to auto expand

setAutoExpandDelay

public void setAutoExpandDelay(int autoExpandDelay)
Sets the delay used to auto expand items (defaults to 800).

Parameters:
autoExpandDelay - the delay in milliseconds

setAutoScroll

public void setAutoScroll(boolean autoScroll)
True to automatically scroll the tree when the user hovers over the top and bottom of the tree grid (defaults to true).

Parameters:
autoScroll - true to enable auto scroll
See Also:
ScrollSupport

appendModel

protected void appendModel(ModelData p,
                           java.util.List<ModelData> models,
                           int index)

bind

protected void bind(TreeGrid tree)

clearStyle

protected void clearStyle(TreeGrid.TreeNode node)

handleAppend

protected void handleAppend(DNDEvent event,
                            TreeGrid.TreeNode item)

handleAppendDrop

protected void handleAppendDrop(DNDEvent event,
                                TreeGrid.TreeNode item)

handleInsert

protected void handleInsert(DNDEvent event,
                            TreeGrid.TreeNode item)

handleInsertDrop

protected void handleInsertDrop(DNDEvent event,
                                TreeGrid.TreeNode item,
                                int index)

onDragCancelled

protected void onDragCancelled(DNDEvent event)
Description copied from class: DropTarget
Called if the user cancels the drag operations while the mouse is over the target.

Overrides:
onDragCancelled in class DropTarget
Parameters:
event - the dd event

onDragFail

protected void onDragFail(DNDEvent event)
Overrides:
onDragFail in class DropTarget

onDragDrop

protected void onDragDrop(DNDEvent event)
Description copied from class: DropTarget
Called when the user releases the mouse over the target component.

Overrides:
onDragDrop in class DropTarget
Parameters:
event - the dd event

onDragEnter

protected void onDragEnter(DNDEvent e)
Description copied from class: DropTarget
Called when the cursor first enters the bounds of the drop target. Subclasses or listeners can change the status of status proxy via the passed event.

Overrides:
onDragEnter in class DropTarget
Parameters:
e - the dd event

onDragLeave

protected void onDragLeave(DNDEvent e)
Description copied from class: DropTarget
Called when the cursor leaves the target.

Overrides:
onDragLeave in class DropTarget
Parameters:
e - the dd event

onDragMove

protected void onDragMove(DNDEvent event)
Description copied from class: DropTarget
Called when the cursor is moved within the target component. Subclasses or listeners can change the status of status proxy via the passed event. If either a subclass or listener sets BaseEvent.setCancelled(boolean) to true, DropTarget.showFeedback(DNDEvent) will be called.

Overrides:
onDragMove in class DropTarget
Parameters:
event - the dd event

showFeedback

protected void showFeedback(DNDEvent event)
Description copied from class: DropTarget
Called as the mouse is moved over the target component. The default implementation does nothing.

Overrides:
showFeedback in class DropTarget
Parameters:
event - the dd event