aboutsummaryrefslogtreecommitdiffstats
path: root/shared/src
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-08-22 17:12:54 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-08-22 17:12:54 +0300
commit7e3d95735858ba8726a7dc472a054ba279d7af21 (patch)
treebbc3556e8b0b20d03e1ccd1678d831010bdc96ef /shared/src
parent3f36eee94aa400b85a4b322d3247b72a9eee25d0 (diff)
parent88776600733901f3f9891aa90a11a5aeb2b97ef4 (diff)
downloadvaadin-framework-7e3d95735858ba8726a7dc472a054ba279d7af21.tar.gz
vaadin-framework-7e3d95735858ba8726a7dc472a054ba279d7af21.zip
Merge branch 'master' into root-cleanup
Conflicts: client/src/com/vaadin/terminal/gwt/client/ui/root/RootConnector.java
Diffstat (limited to 'shared/src')
-rw-r--r--shared/src/com/vaadin/shared/annotations/Delayed.java54
-rw-r--r--shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java57
-rw-r--r--shared/src/com/vaadin/shared/communication/MethodInvocation.java14
-rw-r--r--shared/src/com/vaadin/shared/ui/AbstractLayoutState.java9
-rwxr-xr-xshared/src/com/vaadin/shared/ui/BorderStyle.java20
-rw-r--r--shared/src/com/vaadin/shared/ui/MarginInfo.java (renamed from shared/src/com/vaadin/shared/ui/VMarginInfo.java)17
-rw-r--r--shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java9
-rw-r--r--shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java10
-rw-r--r--shared/src/com/vaadin/shared/ui/root/RootConstants.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/root/RootServerRpc.java5
-rw-r--r--shared/src/com/vaadin/shared/ui/root/RootState.java8
11 files changed, 178 insertions, 29 deletions
diff --git a/shared/src/com/vaadin/shared/annotations/Delayed.java b/shared/src/com/vaadin/shared/annotations/Delayed.java
new file mode 100644
index 0000000000..706ffc1c53
--- /dev/null
+++ b/shared/src/com/vaadin/shared/annotations/Delayed.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.shared.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+/**
+ * Invoking a method in a {@link ServerRpc} interface marked with this
+ * annotation will only add the invocation to a queue of outgoing RPC
+ * invocations, but it will not cause the queue to be purged and sent to the
+ * server. The queue will instead be sent when any RPC method not marked as @Delayed
+ * has been invoked.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0.0
+ */
+@Target(ElementType.METHOD)
+@Documented
+public @interface Delayed {
+ /**
+ * By setting lastonly to <code>true</code>, any previous invocations of the
+ * same method will be removed from the queue when a new invocation is
+ * added. This can be used in cases where only the last value is of
+ * interest.
+ * <p>
+ * The default value is <code>false</code> which means that invoking the
+ * method multiple times will cause multiple invocations to be enqueued and
+ * eventually sent to the server.
+ *
+ * @return <code>true</code> if only the last invocation of the annotated
+ * method should be sent to the server, <code>false</code> if all
+ * enqueued invocations should be sent.
+ */
+ public boolean lastonly() default false;
+}
diff --git a/shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java b/shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java
new file mode 100644
index 0000000000..2ffc56dd71
--- /dev/null
+++ b/shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.communication;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.vaadin.shared.ApplicationConstants;
+
+public class LegacyChangeVariablesInvocation extends MethodInvocation {
+ private Map<String, Object> variableChanges = new HashMap<String, Object>();
+
+ public LegacyChangeVariablesInvocation(String connectorId,
+ String variableName, Object value) {
+ super(connectorId, ApplicationConstants.UPDATE_VARIABLE_INTERFACE,
+ ApplicationConstants.UPDATE_VARIABLE_METHOD, new Object[] {
+ variableName, new UidlValue(value) });
+ setVariableChange(variableName, value);
+ }
+
+ public static boolean isLegacyVariableChange(String interfaceName,
+ String methodName) {
+ return ApplicationConstants.UPDATE_VARIABLE_METHOD
+ .equals(interfaceName)
+ && ApplicationConstants.UPDATE_VARIABLE_METHOD
+ .equals(methodName);
+ }
+
+ public void setVariableChange(String name, Object value) {
+ variableChanges.put(name, value);
+ }
+
+ public Map<String, Object> getVariableChanges() {
+ return variableChanges;
+ }
+
+ @Override
+ public String getLastonlyTag() {
+ assert variableChanges.size() == 1;
+ return super.getLastonlyTag()
+ + variableChanges.keySet().iterator().next();
+ }
+
+}
diff --git a/shared/src/com/vaadin/shared/communication/MethodInvocation.java b/shared/src/com/vaadin/shared/communication/MethodInvocation.java
index 720ce09fcb..c4da937c27 100644
--- a/shared/src/com/vaadin/shared/communication/MethodInvocation.java
+++ b/shared/src/com/vaadin/shared/communication/MethodInvocation.java
@@ -71,4 +71,18 @@ public class MethodInvocation implements Serializable {
+ Arrays.toString(parameters) + ")";
}
+ /**
+ * Gets a String tag that is used to uniquely identify previous method
+ * invocations that should be purged from the queue if
+ * <code>{@literal @}Delay(lastonly = true)</code> is used.
+ * <p>
+ * The returned string should contain at least one non-number char to ensure
+ * it doesn't collide with the keys used for invocations without lastonly.
+ *
+ * @return a string identifying this method invocation
+ */
+ public String getLastonlyTag() {
+ return connectorId + "-" + getInterfaceName() + "-" + getMethodName();
+ }
+
} \ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java
index 675d11d0b7..4fc865626c 100644
--- a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java
+++ b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java
@@ -18,14 +18,5 @@ package com.vaadin.shared.ui;
import com.vaadin.shared.ComponentState;
public class AbstractLayoutState extends ComponentState {
- private int marginsBitmask;
-
- public int getMarginsBitmask() {
- return marginsBitmask;
- }
-
- public void setMarginsBitmask(int marginsBitmask) {
- this.marginsBitmask = marginsBitmask;
- }
} \ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/BorderStyle.java b/shared/src/com/vaadin/shared/ui/BorderStyle.java
new file mode 100755
index 0000000000..786d340f1c
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/BorderStyle.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui;
+
+public enum BorderStyle {
+ NONE, MINIMAL, DEFAULT;
+}
diff --git a/shared/src/com/vaadin/shared/ui/VMarginInfo.java b/shared/src/com/vaadin/shared/ui/MarginInfo.java
index 9e9e0a4bb4..21e52f258a 100644
--- a/shared/src/com/vaadin/shared/ui/VMarginInfo.java
+++ b/shared/src/com/vaadin/shared/ui/MarginInfo.java
@@ -18,8 +18,7 @@ package com.vaadin.shared.ui;
import java.io.Serializable;
-@SuppressWarnings("serial")
-public class VMarginInfo implements Serializable {
+public class MarginInfo implements Serializable {
private static final int TOP = 1;
private static final int RIGHT = 2;
@@ -28,11 +27,15 @@ public class VMarginInfo implements Serializable {
private int bitMask;
- public VMarginInfo(int bitMask) {
+ public MarginInfo(boolean enabled) {
+ this(enabled, enabled, enabled, enabled);
+ }
+
+ public MarginInfo(int bitMask) {
this.bitMask = bitMask;
}
- public VMarginInfo(boolean top, boolean right, boolean bottom, boolean left) {
+ public MarginInfo(boolean top, boolean right, boolean bottom, boolean left) {
setMargins(top, right, bottom, left);
}
@@ -44,7 +47,7 @@ public class VMarginInfo implements Serializable {
bitMask += left ? LEFT : 0;
}
- public void setMargins(VMarginInfo marginInfo) {
+ public void setMargins(MarginInfo marginInfo) {
bitMask = marginInfo.bitMask;
}
@@ -78,11 +81,11 @@ public class VMarginInfo implements Serializable {
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof VMarginInfo)) {
+ if (!(obj instanceof MarginInfo)) {
return false;
}
- return ((VMarginInfo) obj).bitMask == bitMask;
+ return ((MarginInfo) obj).bitMask == bitMask;
}
@Override
diff --git a/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java
index d2e685d8cb..381a6a7f85 100644
--- a/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java
+++ b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java
@@ -21,6 +21,7 @@ public class GridLayoutState extends AbstractLayoutState {
private boolean spacing = false;
private int rows = 0;
private int columns = 0;
+ private int marginsBitmask = 0;
public boolean isSpacing() {
return spacing;
@@ -30,6 +31,14 @@ public class GridLayoutState extends AbstractLayoutState {
this.spacing = spacing;
}
+ public int getMarginsBitmask() {
+ return marginsBitmask;
+ }
+
+ public void setMarginsBitmask(int marginsBitmask) {
+ this.marginsBitmask = marginsBitmask;
+ }
+
public int getRows() {
return rows;
}
diff --git a/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java
index 235c9eab13..3fa2ad771c 100644
--- a/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java
+++ b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java
@@ -27,6 +27,8 @@ public class AbstractOrderedLayoutState extends AbstractLayoutState {
public HashMap<Connector, ChildComponentData> childData = new HashMap<Connector, ChildComponentData>();
+ private int marginsBitmask = 0;
+
public static class ChildComponentData implements Serializable {
private int alignmentBitmask = AlignmentInfo.TOP_LEFT.getBitMask();
private float expandRatio = 0.0f;
@@ -65,4 +67,12 @@ public class AbstractOrderedLayoutState extends AbstractLayoutState {
this.spacing = spacing;
}
+ public int getMarginsBitmask() {
+ return marginsBitmask;
+ }
+
+ public void setMarginsBitmask(int marginsBitmask) {
+ this.marginsBitmask = marginsBitmask;
+ }
+
} \ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/root/RootConstants.java b/shared/src/com/vaadin/shared/ui/root/RootConstants.java
index bc4f6017f6..34c17ac71f 100644
--- a/shared/src/com/vaadin/shared/ui/root/RootConstants.java
+++ b/shared/src/com/vaadin/shared/ui/root/RootConstants.java
@@ -21,12 +21,8 @@ public class RootConstants {
*/
@Deprecated
public static final String RESIZE_LAZY = "rL";
- @Deprecated
- public static final String BROWSER_HEIGHT_VAR = "browserHeight";
@Deprecated
- public static final String BROWSER_WIDTH_VAR = "browserWidth";
- @Deprecated
public static final String NOTIFICATION_HTML_CONTENT_NOT_ALLOWED = "useplain";
@Deprecated
diff --git a/shared/src/com/vaadin/shared/ui/root/RootServerRpc.java b/shared/src/com/vaadin/shared/ui/root/RootServerRpc.java
index f074a8d3cc..df2031f7d5 100644
--- a/shared/src/com/vaadin/shared/ui/root/RootServerRpc.java
+++ b/shared/src/com/vaadin/shared/ui/root/RootServerRpc.java
@@ -15,9 +15,12 @@
*/
package com.vaadin.shared.ui.root;
+import com.vaadin.shared.annotations.Delayed;
import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.shared.ui.ClickRpc;
public interface RootServerRpc extends ClickRpc, ServerRpc {
-
+ @Delayed(lastonly = true)
+ public void resize(int viewWidth, int viewHeight, int windowWidth,
+ int windowHeight);
} \ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/root/RootState.java b/shared/src/com/vaadin/shared/ui/root/RootState.java
index 07c71c8167..b7c2c88ce5 100644
--- a/shared/src/com/vaadin/shared/ui/root/RootState.java
+++ b/shared/src/com/vaadin/shared/ui/root/RootState.java
@@ -20,7 +20,6 @@ import com.vaadin.shared.Connector;
public class RootState extends ComponentState {
private Connector content;
- private int heartbeatInterval;
public Connector getContent() {
return content;
@@ -30,11 +29,4 @@ public class RootState extends ComponentState {
this.content = content;
}
- public int getHeartbeatInterval() {
- return heartbeatInterval;
- }
-
- public void setHeartbeatInterval(int heartbeatInterval) {
- this.heartbeatInterval = heartbeatInterval;
- }
} \ No newline at end of file