From: Henri Sara Date: Thu, 21 Jun 2012 07:33:23 +0000 (+0300) Subject: Use class references instead of class names for AcceptCriterion (#8641) X-Git-Tag: 7.0.0.alpha3~92 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0a35fe732f1c96027e859e2f15fa1909a26b5ae0;p=vaadin-framework.git Use class references instead of class names for AcceptCriterion (#8641) --- diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java b/src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java index 32dac10170..8a026e4d2e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/AcceptCriterion.java @@ -25,9 +25,9 @@ import java.lang.annotation.Target; @Target(ElementType.TYPE) public @interface AcceptCriterion { /** - * @return the fully qualified class name of the server side counterpart for - * the annotated criterion + * @return the class of the server side counterpart for the annotated + * criterion */ - String value(); + Class value(); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java index 07e931fb02..a864a93c2a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java @@ -6,9 +6,10 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.AcceptAll; import com.vaadin.terminal.gwt.client.UIDL; -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.AcceptAll") +@AcceptCriterion(AcceptAll.class) final public class VAcceptAll extends VAcceptCriterion { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java index 727c30075c..19399d7d4a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java @@ -6,9 +6,10 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.And; import com.vaadin.terminal.gwt.client.UIDL; -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.And") +@AcceptCriterion(And.class) final public class VAnd extends VAcceptCriterion implements VAcceptCallback { private boolean b1; diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java index 5786068174..3cd341eefd 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlavor.java @@ -6,9 +6,10 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor; import com.vaadin.terminal.gwt.client.UIDL; -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor") +@AcceptCriterion(ContainsDataFlavor.class) final public class VContainsDataFlavor extends VAcceptCriterion { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java index 58550af918..b6af81085f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragSourceIs.java @@ -3,6 +3,7 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.SourceIs; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.ConnectorMap; import com.vaadin.terminal.gwt.client.UIDL; @@ -12,7 +13,7 @@ import com.vaadin.terminal.gwt.client.UIDL; * * @since 6.3 */ -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.SourceIs") +@AcceptCriterion(SourceIs.class) final public class VDragSourceIs extends VAcceptCriterion { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java index 3fc54e6fd3..5dad4873ea 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java @@ -9,8 +9,9 @@ package com.vaadin.terminal.gwt.client.ui.dd; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.ConnectorMap; import com.vaadin.terminal.gwt.client.UIDL; +import com.vaadin.ui.AbstractSelect; -@AcceptCriterion("com.vaadin.ui.AbstractSelect.TargetItemIs") +@AcceptCriterion(AbstractSelect.TargetItemIs.class) final public class VIsOverId extends VAcceptCriterion { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java index 5f1fe978b5..ca4d0e900d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VItemIdIs.java @@ -8,8 +8,9 @@ package com.vaadin.terminal.gwt.client.ui.dd; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.UIDL; +import com.vaadin.ui.AbstractSelect; -@AcceptCriterion("com.vaadin.ui.AbstractSelect.AcceptItem") +@AcceptCriterion(AbstractSelect.AcceptItem.class) final public class VItemIdIs extends VAcceptCriterion { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java index e972371b9f..e3bed02642 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java @@ -9,6 +9,8 @@ package com.vaadin.terminal.gwt.client.ui.dd; import java.util.HashSet; import com.vaadin.terminal.gwt.client.UIDL; +import com.vaadin.ui.Table; +import com.vaadin.ui.Tree; /** * @@ -18,13 +20,13 @@ public class VLazyInitItemIdentifiers extends VAcceptCriterion { private HashSet hashSet; private VDragEvent lastDragEvent; - @AcceptCriterion("com.vaadin.ui.Table.TableDropCriterion") + @AcceptCriterion(Table.TableDropCriterion.class) final public static class VTableLazyInitItemIdentifiers extends VLazyInitItemIdentifiers { // all logic in superclass } - @AcceptCriterion("com.vaadin.ui.Tree.TreeDropCriterion") + @AcceptCriterion(Tree.TreeDropCriterion.class) final public static class VTreeLazyInitItemIdentifiers extends VLazyInitItemIdentifiers { // all logic in superclass diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java index e91ad6149a..e4d2dff606 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java @@ -6,6 +6,7 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.Not; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.VConsole; @@ -13,7 +14,7 @@ import com.vaadin.terminal.gwt.client.VConsole; * TODO implementation could now be simplified/optimized * */ -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.Not") +@AcceptCriterion(Not.class) final public class VNot extends VAcceptCriterion { private boolean b1; private VAcceptCriterion crit1; diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java index 3664326568..91ba4bf0c4 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java @@ -6,12 +6,13 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.Or; import com.vaadin.terminal.gwt.client.UIDL; /** * */ -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.Or") +@AcceptCriterion(Or.class) final public class VOr extends VAcceptCriterion implements VAcceptCallback { private boolean accepted; diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java index e679b64369..64c2da5320 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java @@ -6,9 +6,10 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion; import com.vaadin.terminal.gwt.client.UIDL; -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.ServerSideCriterion") +@AcceptCriterion(ServerSideCriterion.class) final public class VServerAccept extends VAcceptCriterion { @Override public void accept(final VDragEvent drag, UIDL configuration, diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java index 9bbabe9d29..2365eabe22 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsTarget.java @@ -6,10 +6,11 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.SourceIsTarget; import com.vaadin.terminal.gwt.client.ComponentConnector; import com.vaadin.terminal.gwt.client.UIDL; -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.SourceIsTarget") +@AcceptCriterion(SourceIsTarget.class) final public class VSourceIsTarget extends VAcceptCriterion { @Override 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 7d92359f7d..610d555745 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetDetailIs.java @@ -6,9 +6,10 @@ */ package com.vaadin.terminal.gwt.client.ui.dd; +import com.vaadin.event.dd.acceptcriteria.TargetDetailIs; import com.vaadin.terminal.gwt.client.UIDL; -@AcceptCriterion("com.vaadin.event.dd.acceptcriteria.TargetDetailIs") +@AcceptCriterion(TargetDetailIs.class) final public class VTargetDetailIs extends VAcceptCriterion { @Override diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java index 3db44f3162..56478b2b95 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java +++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VTargetInSubtree.java @@ -10,8 +10,9 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.ui.tree.VTree; import com.vaadin.terminal.gwt.client.ui.tree.VTree.TreeNode; +import com.vaadin.ui.Tree; -@AcceptCriterion("com.vaadin.ui.Tree.TargetInSubtree") +@AcceptCriterion(Tree.TargetInSubtree.class) final public class VTargetInSubtree extends VAcceptCriterion { @Override diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java index 459b6ddd30..6d90a51761 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/AcceptCriteriaFactoryGenerator.java @@ -107,8 +107,9 @@ public class AcceptCriteriaFactoryGenerator extends Generator { .getAnnotation(AcceptCriterion.class); if (annotation != null) { String clientClassName = clientClass.getQualifiedSourceName(); - String serverClassName = clientClass.getAnnotation( + Class serverClass = clientClass.getAnnotation( AcceptCriterion.class).value(); + String serverClassName = serverClass.getCanonicalName(); logger.log(Type.INFO, "creating mapping for " + serverClassName); sourceWriter.print("if (\""); sourceWriter.print(serverClassName); @@ -123,5 +124,4 @@ public class AcceptCriteriaFactoryGenerator extends Generator { sourceWriter.outdent(); sourceWriter.println("}"); } - }