diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-13 18:34:33 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-08-13 19:18:33 +0300 |
commit | e85d933b25cc3c5cc85eb7eb4b13b950fd8e1569 (patch) | |
tree | 9ab6f13f7188cab44bbd979b1cf620f15328a03f /server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java | |
parent | 14dd4d0b28c76eb994b181a4570f3adec53342e6 (diff) | |
download | vaadin-framework-e85d933b25cc3c5cc85eb7eb4b13b950fd8e1569.tar.gz vaadin-framework-e85d933b25cc3c5cc85eb7eb4b13b950fd8e1569.zip |
Moved server files to a server src folder (#9299)
Diffstat (limited to 'server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java')
-rw-r--r-- | server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java b/server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java new file mode 100644 index 0000000000..c0f04d362f --- /dev/null +++ b/server/src/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java @@ -0,0 +1,75 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ +/** + * + */ +package com.vaadin.event.dd.acceptcriteria; + +import java.io.Serializable; + +import com.vaadin.event.Transferable; +import com.vaadin.event.dd.DragAndDropEvent; +import com.vaadin.event.dd.DropHandler; +import com.vaadin.terminal.PaintException; +import com.vaadin.terminal.PaintTarget; + +/** + * Criterion that can be used create policy to accept/discard dragged content + * (presented by {@link Transferable}). + * + * The drag and drop mechanism will verify the criteria returned by + * {@link DropHandler#getAcceptCriterion()} before calling + * {@link DropHandler#drop(DragAndDropEvent)}. + * + * The criteria can be evaluated either on the client (browser - see + * {@link ClientSideCriterion}) or on the server (see + * {@link ServerSideCriterion}). If no constraints are needed, an + * {@link AcceptAll} can be used. + * + * In addition to accepting or rejecting a possible drop, criteria can provide + * additional hints for client side painting. + * + * @see DropHandler + * @see ClientSideCriterion + * @see ServerSideCriterion + * + * @since 6.3 + */ +public interface AcceptCriterion extends Serializable { + + /** + * 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. + */ + public boolean isClientSideVerifiable(); + + public void paint(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 + * {@link #accept(DragAndDropEvent)} is called before this method. + * + * @param target + * @throws PaintException + */ + public void paintResponse(PaintTarget target) throws PaintException; + + /** + * Validates the data in event to be appropriate for the + * {@link DropHandler#drop(DragAndDropEvent)} method. + * <p> + * Note that even if your criterion is validated on client side, you should + * always validate the data on server side too. + * + * @param dragEvent + * @return + */ + public boolean accept(DragAndDropEvent dragEvent); +}
\ No newline at end of file |