com.vaadin.event.dd.acceptcriteria
Interface AcceptCriterion

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractSelect.AcceptItem, AbstractSelect.TargetItemIs, AbstractSelect.VerticalLocationIs, AcceptAll, And, ClientSideCriterion, ContainsDataFlavor, Not, Or, ServerSideCriterion, SourceIs, SourceIsTarget, Table.TableDropCriterion, TargetDetailIs, Tree.TargetInSubtree, Tree.TargetItemAllowsChildren, Tree.TreeDropCriterion

public interface AcceptCriterion
extends Serializable

Criterion that can be used create policy to accept/discard dragged content (presented by Transferable). The drag and drop mechanism will verify the criteria returned by DropHandler.getAcceptCriterion() before calling DropHandler.drop(DragAndDropEvent). The criteria can be evaluated either on the client (browser - see ClientSideCriterion) or on the server (see ServerSideCriterion). If no constraints are needed, an AcceptAll can be used. In addition to accepting or rejecting a possible drop, criteria can provide additional hints for client side painting.

Since:
6.3
See Also:
DropHandler, ClientSideCriterion, ServerSideCriterion

Method Summary
 boolean accept(DragAndDropEvent dragEvent)
          Validates the data in event to be appropriate for the DropHandler.drop(DragAndDropEvent) method.
 boolean isClientSideVerifiable()
          Returns whether the criteria can be checked on the client or whether a server request is needed to check the criteria.
 void paint(PaintTarget target)
           
 void paintResponse(PaintTarget target)
          This needs to be implemented iff criterion does some lazy server side initialization.
 

Method Detail

isClientSideVerifiable

boolean isClientSideVerifiable()
Returns whether the criteria can be checked on the client or whether a server request is needed to check the criteria. This requirement may depend on the state of the criterion (e.g. logical operations between criteria), so this cannot be based on a marker interface.


paint

void paint(PaintTarget target)
           throws PaintException
Throws:
PaintException

paintResponse

void paintResponse(PaintTarget target)
                   throws PaintException
This needs to be implemented iff criterion does some lazy server side initialization. The UIDL painted in this method will be passed to client side drop handler implementation. Implementation can assume that accept(DragAndDropEvent) is called before this method.

Parameters:
target -
Throws:
PaintException

accept

boolean accept(DragAndDropEvent dragEvent)
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.

Parameters:
dragEvent -
Returns:


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