summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2014-07-02 15:02:02 +0300
committerLeif Åstrand <leif@vaadin.com>2014-11-25 08:12:08 +0000
commitec1d9a12ca0e1e7e6ae13d58d9b361c19986cdd3 (patch)
tree1eb42c436d9b75ec9471abd5bc9c81a77e8506d3 /shared
parent759ec0e19569ba6b0d0e43f68cdd25e26ecf55d6 (diff)
downloadvaadin-framework-ec1d9a12ca0e1e7e6ae13d58d9b361c19986cdd3.tar.gz
vaadin-framework-ec1d9a12ca0e1e7e6ae13d58d9b361c19986cdd3.zip
Add @NoLayout annotation (#12936)
This commit adds support for @NoLayout and updates most framework components to use the annotation where it makes sense Change-Id: I99320a6aa6de717da5f2463dd8acfcd412165767
Diffstat (limited to 'shared')
-rw-r--r--shared/src/com/vaadin/shared/AbstractComponentState.java3
-rw-r--r--shared/src/com/vaadin/shared/annotations/NoLayout.java43
-rw-r--r--shared/src/com/vaadin/shared/communication/SharedState.java2
-rw-r--r--shared/src/com/vaadin/shared/data/DataProviderRpc.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/AbstractMediaState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/MediaControl.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/TabIndexState.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/button/ButtonState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/panel/PanelState.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/slider/SliderState.java5
-rw-r--r--shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/ui/ScrollClientRpc.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/window/WindowState.java15
21 files changed, 114 insertions, 0 deletions
diff --git a/shared/src/com/vaadin/shared/AbstractComponentState.java b/shared/src/com/vaadin/shared/AbstractComponentState.java
index 816af978cf..f144f9e48b 100644
--- a/shared/src/com/vaadin/shared/AbstractComponentState.java
+++ b/shared/src/com/vaadin/shared/AbstractComponentState.java
@@ -18,6 +18,7 @@ package com.vaadin.shared;
import java.util.List;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.communication.SharedState;
/**
@@ -31,7 +32,9 @@ public class AbstractComponentState extends SharedState {
public String height = "";
public String width = "";
public boolean readOnly = false;
+ @NoLayout
public boolean immediate = false;
+ @NoLayout
public String description = "";
// Note: for the caption, there is a difference between null and an empty
// string!
diff --git a/shared/src/com/vaadin/shared/annotations/NoLayout.java b/shared/src/com/vaadin/shared/annotations/NoLayout.java
new file mode 100644
index 0000000000..78ff1e2984
--- /dev/null
+++ b/shared/src/com/vaadin/shared/annotations/NoLayout.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 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;
+
+/**
+ * Annotation used to mark client RPC methods, state fields, or state setter
+ * methods that should not trigger an layout phase after changes have been
+ * processed. Whenever there's at least one change that is not marked with this
+ * annotation, the framework will assume some sizes might have changed an will
+ * therefore start a layout phase after applying the changes.
+ * <p>
+ * This annotation can be used for any RPC method or state property that does
+ * not cause the size of the component or its children to change. Please note
+ * that almost anything related to CSS (e.g. adding or removing a stylename) has
+ * the potential of causing sizes to change with appropriate style definitions
+ * in the application theme.
+ *
+ * @since
+ *
+ * @author Vaadin Ltd
+ */
+@Documented
+@Target({ ElementType.METHOD, ElementType.FIELD })
+public @interface NoLayout {
+ // Just an empty marker annotation
+}
diff --git a/shared/src/com/vaadin/shared/communication/SharedState.java b/shared/src/com/vaadin/shared/communication/SharedState.java
index e16fc51fae..b21a675a4a 100644
--- a/shared/src/com/vaadin/shared/communication/SharedState.java
+++ b/shared/src/com/vaadin/shared/communication/SharedState.java
@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.Set;
import com.vaadin.shared.Connector;
+import com.vaadin.shared.annotations.NoLayout;
/**
* Interface to be implemented by all shared state classes used to communicate
@@ -64,6 +65,7 @@ public class SharedState implements Serializable {
/**
* A set of event identifiers with registered listeners.
*/
+ @NoLayout
public Set<String> registeredEventListeners = null;
}
diff --git a/shared/src/com/vaadin/shared/data/DataProviderRpc.java b/shared/src/com/vaadin/shared/data/DataProviderRpc.java
index 043818d573..3e5dd9a332 100644
--- a/shared/src/com/vaadin/shared/data/DataProviderRpc.java
+++ b/shared/src/com/vaadin/shared/data/DataProviderRpc.java
@@ -16,6 +16,7 @@
package com.vaadin.shared.data;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.communication.ClientRpc;
/**
@@ -51,6 +52,7 @@ public interface DataProviderRpc extends ClientRpc {
* @see com.vaadin.shared.ui.grid.GridState#JSONKEY_DATA
* @see com.vaadin.ui.components.grid.Renderer#encode(Object)
*/
+ @NoLayout
public void setRowData(int firstRowIndex, String rowDataJson);
/**
@@ -62,6 +64,7 @@ public interface DataProviderRpc extends ClientRpc {
* the number of rows removed from <code>firstRowIndex</code> and
* onwards
*/
+ @NoLayout
public void removeRowData(int firstRowIndex, int count);
/**
@@ -72,6 +75,7 @@ public interface DataProviderRpc extends ClientRpc {
* @param count
* the number of rows inserted at <code>firstRowIndex</code>
*/
+ @NoLayout
public void insertRowData(int firstRowIndex, int count);
/**
diff --git a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
index f5779de43d..0cb9be8702 100644
--- a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
+++ b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
@@ -16,10 +16,12 @@
package com.vaadin.shared.ui;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.annotations.NoLayout;
public class AbstractEmbeddedState extends AbstractComponentState {
public static final String SOURCE_RESOURCE = "source";
+ @NoLayout
public String alternateText;
}
diff --git a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java
index d2ef09810b..3029bedca7 100644
--- a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java
+++ b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java
@@ -19,17 +19,21 @@ import java.util.ArrayList;
import java.util.List;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.communication.URLReference;
public class AbstractMediaState extends AbstractComponentState {
public boolean showControls;
+ @NoLayout
public String altText;
public boolean htmlContentAllowed;
+ @NoLayout
public boolean autoplay;
+ @NoLayout
public boolean muted;
public List<URLReference> sources = new ArrayList<URLReference>();
diff --git a/shared/src/com/vaadin/shared/ui/MediaControl.java b/shared/src/com/vaadin/shared/ui/MediaControl.java
index 2311d57b16..ab31d6f95f 100644
--- a/shared/src/com/vaadin/shared/ui/MediaControl.java
+++ b/shared/src/com/vaadin/shared/ui/MediaControl.java
@@ -16,6 +16,7 @@
package com.vaadin.shared.ui;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.communication.ClientRpc;
/**
@@ -27,10 +28,12 @@ public interface MediaControl extends ClientRpc {
/**
* Start playing the media.
*/
+ @NoLayout
public void play();
/**
* Pause playback of the media.
*/
+ @NoLayout
public void pause();
}
diff --git a/shared/src/com/vaadin/shared/ui/TabIndexState.java b/shared/src/com/vaadin/shared/ui/TabIndexState.java
index eec61a0595..1afe982546 100644
--- a/shared/src/com/vaadin/shared/ui/TabIndexState.java
+++ b/shared/src/com/vaadin/shared/ui/TabIndexState.java
@@ -16,6 +16,7 @@
package com.vaadin.shared.ui;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.annotations.NoLayout;
/**
* Interface implemented by state classes that support tab indexes.
@@ -29,6 +30,7 @@ public class TabIndexState extends AbstractComponentState {
/**
* The <i>tabulator index</i> of the field.
*/
+ @NoLayout
public int tabIndex = 0;
}
diff --git a/shared/src/com/vaadin/shared/ui/button/ButtonState.java b/shared/src/com/vaadin/shared/ui/button/ButtonState.java
index a12136870c..e5b94d95c4 100644
--- a/shared/src/com/vaadin/shared/ui/button/ButtonState.java
+++ b/shared/src/com/vaadin/shared/ui/button/ButtonState.java
@@ -17,6 +17,7 @@
package com.vaadin.shared.ui.button;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.ui.TabIndexState;
/**
@@ -31,11 +32,14 @@ public class ButtonState extends TabIndexState {
{
primaryStyleName = "v-button";
}
+ @NoLayout
public boolean disableOnClick = false;
+ @NoLayout
public int clickShortcutKeyCode = 0;
/**
* If caption should be rendered in HTML
*/
public boolean htmlContentAllowed = false;
+ @NoLayout
public String iconAltText = "";
}
diff --git a/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java b/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java
index 07726f8af0..6f10af4314 100644
--- a/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.shared.ui.datefield;
+import com.vaadin.shared.annotations.NoLayout;
+
public class PopupDateFieldState extends TextualDateFieldState {
public static final String DESCRIPTION_FOR_ASSISTIVE_DEVICES = "Arrow down key opens calendar element for choosing the date";
@@ -23,5 +25,6 @@ public class PopupDateFieldState extends TextualDateFieldState {
}
public boolean textFieldEnabled = true;
+ @NoLayout
public String descriptionForAssistiveDevices = DESCRIPTION_FOR_ASSISTIVE_DEVICES;
}
diff --git a/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java b/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java
index 09bfb9c1a1..bf38ee04a9 100644
--- a/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java
@@ -18,6 +18,7 @@ package com.vaadin.shared.ui.datefield;
import java.util.Date;
import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.annotations.NoLayout;
public class TextualDateFieldState extends AbstractFieldState {
{
@@ -28,11 +29,13 @@ public class TextualDateFieldState extends AbstractFieldState {
* Start range that has been cleared, depending on the resolution of the
* date field
*/
+ @NoLayout
public Date rangeStart = null;
/*
* End range that has been cleared, depending on the resolution of the date
* field
*/
+ @NoLayout
public Date rangeEnd = null;
}
diff --git a/shared/src/com/vaadin/shared/ui/panel/PanelState.java b/shared/src/com/vaadin/shared/ui/panel/PanelState.java
index 6c0fcb683c..8f48fad921 100644
--- a/shared/src/com/vaadin/shared/ui/panel/PanelState.java
+++ b/shared/src/com/vaadin/shared/ui/panel/PanelState.java
@@ -16,11 +16,14 @@
package com.vaadin.shared.ui.panel;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.annotations.NoLayout;
public class PanelState extends AbstractComponentState {
{
primaryStyleName = "v-panel";
}
+ @NoLayout
public int tabIndex;
+ @NoLayout
public int scrollLeft, scrollTop;
}
diff --git a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java
index da49e47ae8..86fda428a1 100644
--- a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java
+++ b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java
@@ -16,10 +16,12 @@
package com.vaadin.shared.ui.popupview;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.annotations.NoLayout;
public class PopupViewState extends AbstractComponentState {
public String html;
+ @NoLayout
public boolean hideOnMouseOut;
}
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
index 79ef766951..6f557489dd 100644
--- a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
@@ -17,6 +17,7 @@
package com.vaadin.shared.ui.progressindicator;
import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.communication.SharedState;
/**
@@ -32,6 +33,7 @@ public class ProgressBarState extends AbstractFieldState {
primaryStyleName = PRIMARY_STYLE_NAME;
}
public boolean indeterminate = false;
+ @NoLayout
public Float state = 0.0f;
}
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
index 15d0a947d7..9b3cf94d4a 100644
--- a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.shared.ui.progressindicator;
+import com.vaadin.shared.annotations.NoLayout;
+
@Deprecated
public class ProgressIndicatorState extends ProgressBarState {
public static final String PRIMARY_STYLE_NAME = "v-progressindicator";
@@ -23,5 +25,6 @@ public class ProgressIndicatorState extends ProgressBarState {
primaryStyleName = PRIMARY_STYLE_NAME;
}
+ @NoLayout
public int pollingInterval = 1000;
}
diff --git a/shared/src/com/vaadin/shared/ui/slider/SliderState.java b/shared/src/com/vaadin/shared/ui/slider/SliderState.java
index 0e48a0c4e2..a96d35bc13 100644
--- a/shared/src/com/vaadin/shared/ui/slider/SliderState.java
+++ b/shared/src/com/vaadin/shared/ui/slider/SliderState.java
@@ -16,21 +16,26 @@
package com.vaadin.shared.ui.slider;
import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.annotations.NoLayout;
public class SliderState extends AbstractFieldState {
{
primaryStyleName = "v-slider";
}
+ @NoLayout
public double value;
+ @NoLayout
public double maxValue = 100;
+ @NoLayout
public double minValue = 0;
/**
* The number of fractional digits that are considered significant. Must be
* non-negative.
*/
+ @NoLayout
public int resolution = 0;
public SliderOrientation orientation = SliderOrientation.HORIZONTAL;
diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java
index 98a1d2b87f..69a3330f64 100644
--- a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java
+++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java
@@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.List;
import com.vaadin.shared.AbstractComponentState;
+import com.vaadin.shared.annotations.NoLayout;
public class TabsheetState extends AbstractComponentState {
public static final String PRIMARY_STYLE_NAME = "v-tabsheet";
@@ -31,6 +32,7 @@ public class TabsheetState extends AbstractComponentState {
* Index of the component when switching focus - not related to Tabsheet
* tabs.
*/
+ @NoLayout
public int tabIndex;
public List<TabState> tabs = new ArrayList<TabState>();
diff --git a/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java b/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java
index 380ee4c7fb..c1f9536278 100644
--- a/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java
+++ b/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java
@@ -16,6 +16,7 @@
package com.vaadin.shared.ui.textarea;
import com.vaadin.shared.annotations.DelegateToWidget;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.ui.textfield.AbstractTextFieldState;
public class TextAreaState extends AbstractTextFieldState {
@@ -33,6 +34,7 @@ public class TextAreaState extends AbstractTextFieldState {
* Tells if word-wrapping should be used in the text area.
*/
@DelegateToWidget
+ @NoLayout
public boolean wordwrap = true;
}
diff --git a/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java b/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java
index 084d02cd7b..9d4272c22f 100644
--- a/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java
@@ -16,6 +16,7 @@
package com.vaadin.shared.ui.textfield;
import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.annotations.NoLayout;
public class AbstractTextFieldState extends AbstractFieldState {
{
@@ -25,6 +26,7 @@ public class AbstractTextFieldState extends AbstractFieldState {
/**
* Maximum character count in text field.
*/
+ @NoLayout
public int maxLength = -1;
/**
@@ -35,10 +37,12 @@ public class AbstractTextFieldState extends AbstractFieldState {
/**
* The prompt to display in an empty field. Null when disabled.
*/
+ @NoLayout
public String inputPrompt = null;
/**
* The text in the field
*/
+ @NoLayout
public String text = null;
}
diff --git a/shared/src/com/vaadin/shared/ui/ui/ScrollClientRpc.java b/shared/src/com/vaadin/shared/ui/ui/ScrollClientRpc.java
index e32a27830d..fb052a25e9 100644
--- a/shared/src/com/vaadin/shared/ui/ui/ScrollClientRpc.java
+++ b/shared/src/com/vaadin/shared/ui/ui/ScrollClientRpc.java
@@ -16,11 +16,14 @@
package com.vaadin.shared.ui.ui;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.communication.ClientRpc;
public interface ScrollClientRpc extends ClientRpc {
+ @NoLayout
public void setScrollTop(int scrollTop);
+ @NoLayout
public void setScrollLeft(int scrollLeft);
}
diff --git a/shared/src/com/vaadin/shared/ui/window/WindowState.java b/shared/src/com/vaadin/shared/ui/window/WindowState.java
index fa73bea391..7dafba57ff 100644
--- a/shared/src/com/vaadin/shared/ui/window/WindowState.java
+++ b/shared/src/com/vaadin/shared/ui/window/WindowState.java
@@ -16,6 +16,7 @@
package com.vaadin.shared.ui.window;
import com.vaadin.shared.Connector;
+import com.vaadin.shared.annotations.NoLayout;
import com.vaadin.shared.ui.panel.PanelState;
public class WindowState extends PanelState {
@@ -23,20 +24,34 @@ public class WindowState extends PanelState {
primaryStyleName = "v-window";
}
+ @NoLayout
public boolean modal = false;
+ @NoLayout
public boolean resizable = true;
+ @NoLayout
public boolean resizeLazy = false;
+ @NoLayout
public boolean draggable = true;
+ @NoLayout
public boolean centered = false;
+ @NoLayout
public int positionX = -1;
+ @NoLayout
public int positionY = -1;
public WindowMode windowMode = WindowMode.NORMAL;
+ @NoLayout
public String assistivePrefix = "";
+ @NoLayout
public String assistivePostfix = "";
+ @NoLayout
public Connector[] contentDescription = new Connector[0];
+ @NoLayout
public WindowRole role = WindowRole.DIALOG;
+ @NoLayout
public boolean assistiveTabStop = false;
+ @NoLayout
public String assistiveTabStopTopText = "Top of dialog";
+ @NoLayout
public String assistiveTabStopBottomText = "Bottom of Dialog";
}