diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-02-17 09:10:43 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-02-17 09:10:43 +0000 |
commit | 8d2ace1645c029eafc2de9dd7704980709692819 (patch) | |
tree | 2fc8369656e4522581f915c60f50047673f29d8e /src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java | |
parent | 3b012b40d19c9b9b3acb7b675e82e07aad309cbe (diff) | |
download | vaadin-framework-8d2ace1645c029eafc2de9dd7704980709692819.tar.gz vaadin-framework-8d2ace1645c029eafc2de9dd7704980709692819.zip |
criterion map now generated from annotations from server side counterpart
svn changeset:11350/svn branch:6.3_dd
Diffstat (limited to 'src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java new file mode 100644 index 0000000000..324dc08d6a --- /dev/null +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java @@ -0,0 +1,58 @@ +/** + * + */ +package com.vaadin.terminal.gwt.client.ui.dd; + +import com.vaadin.terminal.gwt.client.ApplicationConnection; +import com.vaadin.terminal.gwt.client.UIDL; + +final public class VOr implements VAcceptCriteria { + private boolean b1; + private boolean b2; + private VAcceptCriteria crit1; + private VAcceptCriteria crit2; + + public void accept(VDragEvent drag, UIDL configuration, + VAcceptCallback callback) { + if (crit1 == null) { + crit1 = getCriteria(drag, configuration, 0); + crit2 = getCriteria(drag, configuration, 1); + if (crit1 == null || crit2 == null) { + ApplicationConnection.getConsole().log( + "Or criteria didn't found a chidl criteria"); + return; + } + } + + b1 = false; + b2 = false; + + VAcceptCallback accept1cb = new VAcceptCallback() { + public void accepted(VDragEvent event) { + b1 = true; + } + }; + VAcceptCallback accept2cb = new VAcceptCallback() { + public void accepted(VDragEvent event) { + b2 = true; + } + }; + + crit1.accept(drag, configuration.getChildUIDL(0), accept1cb); + crit2.accept(drag, configuration.getChildUIDL(1), accept2cb); + if (b1 || b2) { + callback.accepted(drag); + } + } + + private VAcceptCriteria getCriteria(VDragEvent drag, UIDL configuration, + int i) { + UIDL childUIDL = configuration.getChildUIDL(i); + return VAcceptCriterion.get(childUIDL.getStringAttribute("name")); + } + + public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) { + return false; // TODO enforce on server side + } + +}
\ No newline at end of file |