diff options
Diffstat (limited to 'client-compiler')
3 files changed, 46 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 7c3bb1eb77..13bd7051f6 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java @@ -68,6 +68,7 @@ import com.vaadin.server.widgetsetutils.metadata.TypeVisitor; import com.vaadin.server.widgetsetutils.metadata.WidgetInitVisitor; import com.vaadin.shared.annotations.Delayed; import com.vaadin.shared.annotations.DelegateToWidget; +import com.vaadin.shared.annotations.NoLayout; import com.vaadin.shared.communication.ClientRpc; import com.vaadin.shared.communication.ServerRpc; import com.vaadin.shared.ui.Connect; @@ -454,6 +455,10 @@ public class ConnectorBundleLoaderFactory extends Generator { writer.println("var data = {"); writer.indent(); + if (property.getAnnotation(NoLayout.class) != null) { + writer.println("noLayout: 1, "); + } + writer.println("setter: function(bean, value) {"); writer.indent(); property.writeSetterBody(logger, writer, "bean", "value"); @@ -497,6 +502,7 @@ public class ConnectorBundleLoaderFactory extends Generator { writeParamTypes(w, bundle); writeProxys(w, bundle); writeDelayedInfo(w, bundle); + writeNoLayoutRpcMethods(w, bundle); w.println("%s(store);", loadNativeJsMethodName); @@ -509,6 +515,22 @@ public class ConnectorBundleLoaderFactory extends Generator { writeOnStateChangeHandlers(logger, w, bundle); } + private void writeNoLayoutRpcMethods(SplittingSourceWriter w, + ConnectorBundle bundle) { + Map<JClassType, Set<JMethod>> needsNoLayout = bundle + .getNeedsNoLayoutRpcMethods(); + for (Entry<JClassType, Set<JMethod>> entry : needsNoLayout.entrySet()) { + JClassType type = entry.getKey(); + + for (JMethod method : entry.getValue()) { + w.println("store.setNoLayoutRpcMethod(%s, \"%s\");", + getClassLiteralString(type), method.getName()); + } + + w.splitIfNeeded(); + } + } + private void writeOnStateChangeHandlers(TreeLogger logger, SplittingSourceWriter w, ConnectorBundle bundle) throws UnableToCompleteException { diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java index 856f67657f..1df3d78588 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java @@ -24,6 +24,7 @@ import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; import com.google.gwt.core.ext.typeinfo.JType; +import com.vaadin.shared.annotations.NoLayout; public class ClientRpcVisitor extends TypeVisitor { @Override @@ -39,6 +40,9 @@ public class ClientRpcVisitor extends TypeVisitor { bundle.setNeedsInvoker(type, method); bundle.setNeedsParamTypes(type, method); + if (method.getAnnotation(NoLayout.class) != null) { + bundle.setNeedsNoLayoutRpcMethod(type, method); + } JType[] parameterTypes = method.getParameterTypes(); for (JType paramType : parameterTypes) { 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 4a079c38b0..2c2d091d5e 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java @@ -73,6 +73,7 @@ public class ConnectorBundle { private final Map<JClassType, Set<JMethod>> needsParamTypes = new HashMap<JClassType, Set<JMethod>>(); private final Map<JClassType, Set<JMethod>> needsDelayedInfo = new HashMap<JClassType, Set<JMethod>>(); private final Map<JClassType, Set<JMethod>> needsOnStateChange = new HashMap<JClassType, Set<JMethod>>(); + private final Map<JClassType, Set<JMethod>> needsNoLayoutRpcMethods = new HashMap<JClassType, Set<JMethod>>(); private final Set<Property> needsProperty = new HashSet<Property>(); private final Map<JClassType, Set<Property>> needsDelegateToWidget = new HashMap<JClassType, Set<Property>>(); @@ -634,6 +635,25 @@ public class ConnectorBundle { return Collections.unmodifiableMap(needsOnStateChange); } + public void setNeedsNoLayoutRpcMethod(JClassType type, JMethod method) { + if (!isNeedsNoLayoutRpcMethod(type, method)) { + addMapping(needsNoLayoutRpcMethods, type, method); + } + } + + private boolean isNeedsNoLayoutRpcMethod(JClassType type, JMethod method) { + if (hasMapping(needsNoLayoutRpcMethods, type, method)) { + return true; + } else { + return previousBundle != null + && previousBundle.isNeedsNoLayoutRpcMethod(type, method); + } + } + + public Map<JClassType, Set<JMethod>> getNeedsNoLayoutRpcMethods() { + return Collections.unmodifiableMap(needsNoLayoutRpcMethods); + } + public static JMethod findInheritedMethod(JClassType type, String methodName, JType... params) { |