com.vaadin.ui
Class Tree.TargetInSubtree

java.lang.Object
  extended by com.vaadin.event.dd.acceptcriteria.ClientSideCriterion
      extended by com.vaadin.ui.Tree.TargetInSubtree
All Implemented Interfaces:
AcceptCriterion, Serializable
Enclosing class:
Tree

public class Tree.TargetInSubtree
extends ClientSideCriterion

An accept criterion that checks the parent node (or parent hierarchy) for the item identifier given in constructor. If the parent is found, content is accepted. Criterion can be used to accepts drags on a specific sub tree only.

The root items is also consider to be valid target.

See Also:
Serialized Form

Constructor Summary
Tree.TargetInSubtree(Object parentItemId)
          Constructs a criteria that accepts the drag if the targeted Item is a descendant of Item identified by given id
Tree.TargetInSubtree(Object rootId, int depthToCheck)
          Constructs a criteria that accepts drops within given level below the subtree root identified by given id.
 
Method Summary
 boolean accept(DragAndDropEvent dragEvent)
          Validates the data in event to be appropriate for the DropHandler.drop(DragAndDropEvent) method.
 void paintContent(PaintTarget target)
           
 
Methods inherited from class com.vaadin.event.dd.acceptcriteria.ClientSideCriterion
getIdentifier, isClientSideVerifiable, paint, paintResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tree.TargetInSubtree

public Tree.TargetInSubtree(Object parentItemId)
Constructs a criteria that accepts the drag if the targeted Item is a descendant of Item identified by given id

Parameters:
parentItemId - the item identifier of the parent node

Tree.TargetInSubtree

public Tree.TargetInSubtree(Object rootId,
                            int depthToCheck)
Constructs a criteria that accepts drops within given level below the subtree root identified by given id.

Parameters:
rootId - the item identifier to be sought for
depthToCheck - the depth that tree is traversed upwards to seek for the parent, -1 means that the whole structure should be checked
Method Detail

accept

public boolean accept(DragAndDropEvent dragEvent)
Description copied from interface: AcceptCriterion
Validates the data in event to be appropriate for the DropHandler.drop(DragAndDropEvent) method.

Note that even if your criterion is validated on client side, you should always validate the data on server side too.

Returns:

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Overrides:
paintContent in class ClientSideCriterion
Throws:
PaintException


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.