diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-03-18 09:22:35 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-03-18 09:22:35 +0000 |
commit | 7588a1708218dc9a419a2c43a5efbbf627663338 (patch) | |
tree | be3c44482edb2009c260c4cd8ab200097a810b33 /src/com/vaadin/event | |
parent | b8b6a3fa51cc78b5df2f6b7af459a589fcf81e5c (diff) | |
download | vaadin-framework-7588a1708218dc9a419a2c43a5efbbf627663338.tar.gz vaadin-framework-7588a1708218dc9a419a2c43a5efbbf627663338.zip |
DD related refactorings and javadocs
svn changeset:11952/svn branch:6.3
Diffstat (limited to 'src/com/vaadin/event')
-rw-r--r-- | src/com/vaadin/event/dd/acceptCriteria/And.java | 13 | ||||
-rw-r--r-- | src/com/vaadin/event/dd/acceptCriteria/DropTargetDetailEquals.java | 23 |
2 files changed, 27 insertions, 9 deletions
diff --git a/src/com/vaadin/event/dd/acceptCriteria/And.java b/src/com/vaadin/event/dd/acceptCriteria/And.java index 52bf2f7c1d..4bab63386c 100644 --- a/src/com/vaadin/event/dd/acceptCriteria/And.java +++ b/src/com/vaadin/event/dd/acceptCriteria/And.java @@ -22,27 +22,28 @@ import com.vaadin.terminal.PaintTarget; @ClientCriterion(com.vaadin.terminal.gwt.client.ui.dd.VAnd.class) public class And extends ClientSideCriterion { - private ClientSideCriterion[] f1; + private static final long serialVersionUID = -5242574480825471748L; + protected ClientSideCriterion[] criteria; /** * - * @param f1 + * @param criteria * criteria of which the And criterion will be composed */ - public And(ClientSideCriterion... f1) { - this.f1 = f1; + public And(ClientSideCriterion... criteria) { + this.criteria = criteria; } @Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); - for (ClientSideCriterion crit : f1) { + for (ClientSideCriterion crit : criteria) { crit.paint(target); } } public boolean accepts(DragAndDropEvent dragEvent) { - for (ClientSideCriterion crit : f1) { + for (ClientSideCriterion crit : criteria) { if (!crit.accepts(dragEvent)) { return false; } diff --git a/src/com/vaadin/event/dd/acceptCriteria/DropTargetDetailEquals.java b/src/com/vaadin/event/dd/acceptCriteria/DropTargetDetailEquals.java index b97f0159bb..c18cbc8f7a 100644 --- a/src/com/vaadin/event/dd/acceptCriteria/DropTargetDetailEquals.java +++ b/src/com/vaadin/event/dd/acceptCriteria/DropTargetDetailEquals.java @@ -22,10 +22,11 @@ import com.vaadin.terminal.gwt.client.ui.dd.VDropDetailEquals; * */ @ClientCriterion(VDropDetailEquals.class) -public final class DropTargetDetailEquals extends ClientSideCriterion { +public class DropTargetDetailEquals extends ClientSideCriterion { + private static final long serialVersionUID = 763165450054331246L; private String propertyName; - private String value; + private Object value; /** * Constructs a criterion which ensures that the value there is a value in @@ -42,15 +43,31 @@ public final class DropTargetDetailEquals extends ClientSideCriterion { this.value = value; } + public DropTargetDetailEquals(String dataFlavor, Boolean true1) { + propertyName = dataFlavor; + value = true1; + } + @Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); target.addAttribute("p", propertyName); - target.addAttribute("v", value); + if (value instanceof Boolean) { + target.addAttribute("v", ((Boolean) value).booleanValue()); + target.addAttribute("t", "b"); + } else if (value instanceof String) { + target.addAttribute("v", (String) value); + } } public boolean accepts(DragAndDropEvent dragEvent) { Object data = dragEvent.getDropTargetDetails().getData(propertyName); return value.equals(data); } + + @Override + protected String getIdentifier() { + // sub classes by default use VDropDetailEquals a client implementation + return DropTargetDetailEquals.class.getCanonicalName(); + } }
\ No newline at end of file |