public interface AcceptCriterion extends Serializable
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.DropHandler
,
ClientSideCriterion
,
ServerSideCriterion
Modifier and Type | Method and Description |
---|---|
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 if and only if a criterion does some lazy
server side initialization.
|
boolean isClientSideVerifiable()
void paint(PaintTarget target) throws PaintException
PaintException
void paintResponse(PaintTarget target) throws PaintException
accept(DragAndDropEvent)
is called before this
method.target
- PaintException
boolean accept(DragAndDropEvent dragEvent)
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.
dragEvent
- Copyright © 2020 Vaadin Ltd. All rights reserved.