summaryrefslogtreecommitdiffstats
path: root/client-compiler/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-02-15 16:28:07 +0200
committerVaadin Code Review <review@vaadin.com>2013-02-18 12:20:27 +0000
commitf759408c0fa75cc1610b6a598737bf4eec039104 (patch)
tree981a812ea95c312faa7e3039a3c56b6d872d0bd3 /client-compiler/src
parentd4af8b07d51a1e7b1b4eaa828be596b780afd34f (diff)
downloadvaadin-framework-f759408c0fa75cc1610b6a598737bf4eec039104.tar.gz
vaadin-framework-f759408c0fa75cc1610b6a598737bf4eec039104.zip
Only add tooltip listeners when needed (#11051)
Change-Id: I2b097ed67d59260390cd939b2f2d844548b5fced
Diffstat (limited to 'client-compiler/src')
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java16
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java35
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java19
3 files changed, 70 insertions, 0 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
index f8aa586064..2be3bf5a16 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
@@ -334,6 +334,22 @@ public class ConnectorBundleLoaderFactory extends Generator {
writeGetters(logger, w, bundle);
writeSerializers(logger, w, bundle);
writeDelegateToWidget(logger, w, bundle);
+ writeHasGetTooltip(logger, w, bundle);
+ }
+
+ /**
+ * @deprecated As of 7.0.1. This is just a hack to avoid breaking backwards
+ * compatibility and will be removed in Vaadin 7.1
+ */
+ @Deprecated
+ private void writeHasGetTooltip(TreeLogger logger, SplittingSourceWriter w,
+ ConnectorBundle bundle) {
+ Set<JClassType> types = bundle.getHasGetTooltip();
+ for (JClassType type : types) {
+ w.println("store.setHasGetTooltipInfo(%s);",
+ getClassLiteralString(type));
+ w.splitIfNeeded();
+ }
}
private void writeDelegateToWidget(TreeLogger logger,
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
index ff91e249b7..f6dc982f15 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
@@ -63,6 +63,7 @@ public class ConnectorBundle {
private final Set<JClassType> needsGwtConstructor = new HashSet<JClassType>();
private final Set<JClassType> visitedTypes = new HashSet<JClassType>();
private final Set<JClassType> needsProxySupport = new HashSet<JClassType>();
+ private final Set<JClassType> hasGetTooltip = new HashSet<JClassType>();
private final Map<JClassType, Set<String>> identifiers = new HashMap<JClassType, Set<String>>();
private final Map<JClassType, Set<JMethod>> needsReturnType = new HashMap<JClassType, Set<JMethod>>();
@@ -618,4 +619,38 @@ public class ConnectorBundle {
public Set<Property> getNeedsDelegateToWidget() {
return Collections.unmodifiableSet(needsDelegateToWidget);
}
+
+ /**
+ * @deprecated As of 7.0.1. This is just a hack to avoid breaking backwards
+ * compatibility and will be removed in Vaadin 7.1
+ */
+ @Deprecated
+ public Set<JClassType> getHasGetTooltip() {
+ return Collections.unmodifiableSet(hasGetTooltip);
+ }
+
+ /**
+ * @deprecated As of 7.0.1. This is just a hack to avoid breaking backwards
+ * compatibility and will be removed in Vaadin 7.1
+ */
+ @Deprecated
+ public void setHasGetTooltip(JClassType type) {
+ if (!isHasGetTooltip(type)) {
+ hasGetTooltip.add(type);
+ }
+ }
+
+ /**
+ * @deprecated As of 7.0.1. This is just a hack to avoid breaking backwards
+ * compatibility and will be removed in Vaadin 7.1
+ */
+ @Deprecated
+ private boolean isHasGetTooltip(JClassType type) {
+ if (hasGetTooltip.contains(type)) {
+ return true;
+ } else {
+ return previousBundle != null
+ && previousBundle.isHasGetTooltip(type);
+ }
+ }
} \ No newline at end of file
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
index 4de9d2ae99..662ecf872b 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
@@ -47,6 +47,25 @@ public class WidgetInitVisitor extends TypeVisitor {
bundle.setNeedsReturnType(type, getWidget);
}
+ // Hack to detect when getTooltipInfo has a custom implementation
+ // #11051
+ JClassType getTooltipParamType = type.getOracle().findType(
+ "com.google.gwt.dom.client.Element");
+ JMethod getTooltipInfoMethod = findInheritedMethod(type,
+ "getTooltipInfo", getTooltipParamType);
+ if (getTooltipInfoMethod == null) {
+ logger.log(Type.ERROR, "Could not find getTooltipInfo in "
+ + type.getQualifiedSourceName());
+ throw new UnableToCompleteException();
+ }
+ JClassType enclosingType = getTooltipInfoMethod.getEnclosingType();
+ if (!enclosingType.getQualifiedSourceName().equals(
+ AbstractComponentConnector.class.getCanonicalName())) {
+ logger.log(Type.WARN, type.getQualifiedSourceName()
+ + " has overridden getTooltipInfo");
+ bundle.setHasGetTooltip(type);
+ }
+
// Check state properties for @DelegateToWidget
JMethod getState = findInheritedMethod(type, "getState");
JClassType stateType = getState.getReturnType().isClass();