diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-04-19 13:50:48 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-04-19 13:50:48 +0000 |
commit | 4eb5847f9929fd69f656f415fca454ffd605448f (patch) | |
tree | 3eab4fe82b5541cfdab446e3b6812093e5676cce /src/com | |
parent | e2a5e02e5d19fbc6b810ae768fdd4cbfb85f4230 (diff) | |
download | vaadin-framework-4eb5847f9929fd69f656f415fca454ffd605448f.tar.gz vaadin-framework-4eb5847f9929fd69f656f415fca454ffd605448f.zip |
Merged drag'n'drop enhancements [12493],[12484]
svn changeset:12652/svn branch:6.4
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java | 6 | ||||
-rw-r--r-- | src/com/vaadin/ui/AbstractSelect.java | 21 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java index 4e838fb031..9279cc8bc3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java @@ -23,7 +23,11 @@ final public class VTargetDetailIs extends VAcceptCriterion { } if (value != null) { Object object = drag.getDropDetails().get(name); - return value.equals(object); + if (object instanceof Enum) { + return ((Enum) object).name().equals(value); + } else { + return value.equals(object); + } } else { return false; } diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java index d2b9239963..9667de32d6 100644 --- a/src/com/vaadin/ui/AbstractSelect.java +++ b/src/com/vaadin/ui/AbstractSelect.java @@ -27,6 +27,7 @@ import com.vaadin.event.dd.TargetDetailsImpl; import com.vaadin.event.dd.acceptcriteria.ClientCriterion; import com.vaadin.event.dd.acceptcriteria.ClientSideCriterion; import com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor; +import com.vaadin.event.dd.acceptcriteria.TargetDetailIs; import com.vaadin.terminal.KeyMapper; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; @@ -1849,4 +1850,24 @@ public abstract class AbstractSelect extends AbstractField implements } + /** + * An accept criterion to accept drops only on a specific vertical location + * of an item. + * <p> + * This accept criterion is currently usable in Tree and Table + * implementations. + */ + public static class VerticalLocationIs extends TargetDetailIs { + public static VerticalLocationIs TOP = new VerticalLocationIs( + VerticalDropLocation.TOP); + public static VerticalLocationIs BOTTOM = new VerticalLocationIs( + VerticalDropLocation.BOTTOM); + public static VerticalLocationIs MIDDLE = new VerticalLocationIs( + VerticalDropLocation.MIDDLE); + + private VerticalLocationIs(VerticalDropLocation l) { + super("detail", l.name()); + } + } + } |