summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2015-09-24 11:53:58 +0300
committerDenis Anisimov <denis@vaadin.com>2015-10-16 09:58:35 +0300
commitbf030a07b0614c9782dd02669900529175069c15 (patch)
tree7609ceaac9d81f8994e7fa32f6d263a1e654f7b6
parent5b4906440b4113674b5c7cd88be68c0581bc564e (diff)
downloadvaadin-framework-bf030a07b0614c9782dd02669900529175069c15.tar.gz
vaadin-framework-bf030a07b0614c9782dd02669900529175069c15.zip
Provide own states for a number of components (#18987).
Change-Id: I9fe4a332bb8170a6482610d1b83bad73e049a3a1
-rw-r--r--client/src/com/vaadin/client/ui/audio/AudioConnector.java6
-rw-r--r--client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java6
-rw-r--r--client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java6
-rw-r--r--client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java6
-rw-r--r--client/src/com/vaadin/client/ui/upload/UploadConnector.java6
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java4
-rw-r--r--server/src/com/vaadin/ui/AbstractSelect.java6
-rw-r--r--server/src/com/vaadin/ui/Audio.java6
-rw-r--r--server/src/com/vaadin/ui/ComboBox.java6
-rw-r--r--server/src/com/vaadin/ui/FormLayout.java6
-rw-r--r--server/src/com/vaadin/ui/OptionGroup.java6
-rw-r--r--server/src/com/vaadin/ui/RichTextArea.java6
-rw-r--r--server/src/com/vaadin/ui/Table.java10
-rw-r--r--server/src/com/vaadin/ui/Tree.java5
-rw-r--r--server/src/com/vaadin/ui/TreeTable.java6
-rw-r--r--server/src/com/vaadin/ui/TwinColSelect.java6
-rw-r--r--server/src/com/vaadin/ui/Upload.java6
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java60
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/audio/AudioStateTest.java59
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/combobox/ComboBoxStateTest.java59
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/grid/GridStateTest.java44
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java45
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java60
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaStateTest.java59
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/table/TableStateTest.java60
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java33
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java29
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/twincolselect/TwinColSelectStateTest.java60
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java29
-rw-r--r--server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java33
-rw-r--r--server/tests/src/com/vaadin/ui/NativeSelectTest.java16
-rw-r--r--shared/src/com/vaadin/shared/ui/audio/AudioState.java30
-rw-r--r--shared/src/com/vaadin/shared/ui/combobox/ComboBoxState.java9
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/GridState.java5
-rw-r--r--shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupState.java9
-rw-r--r--shared/src/com/vaadin/shared/ui/orderedlayout/FormLayoutState.java28
-rw-r--r--shared/src/com/vaadin/shared/ui/select/AbstractSelectState.java30
-rw-r--r--shared/src/com/vaadin/shared/ui/table/TableState.java9
-rw-r--r--shared/src/com/vaadin/shared/ui/textarea/RichTextAreaState.java31
-rw-r--r--shared/src/com/vaadin/shared/ui/tree/TreeState.java9
-rw-r--r--shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java9
-rw-r--r--shared/src/com/vaadin/shared/ui/upload/UploadState.java30
42 files changed, 932 insertions, 16 deletions
diff --git a/client/src/com/vaadin/client/ui/audio/AudioConnector.java b/client/src/com/vaadin/client/ui/audio/AudioConnector.java
index f238ecc08c..a451d117f2 100644
--- a/client/src/com/vaadin/client/ui/audio/AudioConnector.java
+++ b/client/src/com/vaadin/client/ui/audio/AudioConnector.java
@@ -24,6 +24,7 @@ import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.MediaBaseConnector;
import com.vaadin.client.ui.VAudio;
import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.audio.AudioState;
import com.vaadin.ui.Audio;
@Connect(Audio.class)
@@ -40,6 +41,11 @@ public class AudioConnector extends MediaBaseConnector {
}
@Override
+ public AudioState getState() {
+ return (AudioState) super.getState();
+ }
+
+ @Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
diff --git a/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java b/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java
index 9517619cf3..bab4153649 100644
--- a/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java
+++ b/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java
@@ -30,15 +30,15 @@ import com.vaadin.client.ui.VFormLayout.ErrorFlag;
import com.vaadin.client.ui.VFormLayout.VFormLayoutTable;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.MarginInfo;
-import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState;
+import com.vaadin.shared.ui.orderedlayout.FormLayoutState;
import com.vaadin.ui.FormLayout;
@Connect(FormLayout.class)
public class FormLayoutConnector extends AbstractLayoutConnector {
@Override
- public AbstractOrderedLayoutState getState() {
- return (AbstractOrderedLayoutState) super.getState();
+ public FormLayoutState getState() {
+ return (FormLayoutState) super.getState();
}
@Override
diff --git a/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java b/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java
index a655635edc..0757bc395b 100644
--- a/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java
+++ b/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java
@@ -24,6 +24,7 @@ import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.VNativeButton;
import com.vaadin.client.ui.VOptionGroupBase;
import com.vaadin.client.ui.VTextField;
+import com.vaadin.shared.ui.select.AbstractSelectState;
public abstract class OptionGroupBaseConnector extends AbstractFieldConnector
implements Paintable {
@@ -108,4 +109,9 @@ public abstract class OptionGroupBaseConnector extends AbstractFieldConnector
public VOptionGroupBase getWidget() {
return (VOptionGroupBase) super.getWidget();
}
+
+ @Override
+ public AbstractSelectState getState() {
+ return (AbstractSelectState) super.getState();
+ }
}
diff --git a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
index 5fe637447e..bcf61a9338 100644
--- a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
+++ b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
@@ -27,6 +27,7 @@ import com.vaadin.client.ui.SimpleManagedLayout;
import com.vaadin.client.ui.VRichTextArea;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.textarea.RichTextAreaState;
import com.vaadin.shared.util.SharedUtil;
import com.vaadin.ui.RichTextArea;
@@ -135,4 +136,9 @@ public class RichTextAreaConnector extends AbstractFieldConnector implements
getWidget().rta.setHeight(editorHeight + "px");
}
}
+
+ @Override
+ public RichTextAreaState getState() {
+ return (RichTextAreaState) super.getState();
+ }
}
diff --git a/client/src/com/vaadin/client/ui/upload/UploadConnector.java b/client/src/com/vaadin/client/ui/upload/UploadConnector.java
index ca16b7c513..9e25770a17 100644
--- a/client/src/com/vaadin/client/ui/upload/UploadConnector.java
+++ b/client/src/com/vaadin/client/ui/upload/UploadConnector.java
@@ -28,6 +28,7 @@ import com.vaadin.shared.EventId;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.upload.UploadClientRpc;
import com.vaadin.shared.ui.upload.UploadServerRpc;
+import com.vaadin.shared.ui.upload.UploadState;
import com.vaadin.ui.Upload;
@Connect(Upload.class)
@@ -103,4 +104,9 @@ public class UploadConnector extends AbstractComponentConnector implements
public VUpload getWidget() {
return (VUpload) super.getWidget();
}
+
+ @Override
+ public UploadState getState() {
+ return (UploadState) super.getState();
+ }
}
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index 3242560882..e10da5494a 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -219,6 +219,8 @@ public class Grid<T> extends ResizeComposite implements
HasSelectionHandlers<T>, SubPartAware, DeferredWorker, Focusable,
com.google.gwt.user.client.ui.Focusable, HasWidgets, HasEnabled {
+ private static final String STYLE_NAME = "v-grid";
+
private static final String SELECT_ALL_CHECKBOX_CLASSNAME = "-select-all-checkbox";
/**
@@ -5719,7 +5721,7 @@ public class Grid<T> extends ResizeComposite implements
getElement().setTabIndex(0);
cellFocusHandler = new CellFocusHandler();
- setStylePrimaryName("v-grid");
+ setStylePrimaryName(STYLE_NAME);
escalator.getHeader().setEscalatorUpdater(createHeaderUpdater());
escalator.getBody().setEscalatorUpdater(createBodyUpdater());
diff --git a/server/src/com/vaadin/ui/AbstractSelect.java b/server/src/com/vaadin/ui/AbstractSelect.java
index 69eed32afb..9babf7e876 100644
--- a/server/src/com/vaadin/ui/AbstractSelect.java
+++ b/server/src/com/vaadin/ui/AbstractSelect.java
@@ -54,6 +54,7 @@ import com.vaadin.server.Resource;
import com.vaadin.server.VaadinSession;
import com.vaadin.shared.ui.combobox.FilteringMode;
import com.vaadin.shared.ui.dd.VerticalDropLocation;
+import com.vaadin.shared.ui.select.AbstractSelectState;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.DesignException;
@@ -2329,4 +2330,9 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
return element;
}
+
+ @Override
+ protected AbstractSelectState getState() {
+ return (AbstractSelectState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/Audio.java b/server/src/com/vaadin/ui/Audio.java
index 845bbd13b5..8b9fad2196 100644
--- a/server/src/com/vaadin/ui/Audio.java
+++ b/server/src/com/vaadin/ui/Audio.java
@@ -17,6 +17,7 @@
package com.vaadin.ui;
import com.vaadin.server.Resource;
+import com.vaadin.shared.ui.audio.AudioState;
/**
* The Audio component translates into an HTML5 &lt;audio&gt; element and as
@@ -64,4 +65,9 @@ public class Audio extends AbstractMedia {
setSource(source);
setShowControls(true);
}
+
+ @Override
+ protected AudioState getState() {
+ return (AudioState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java
index 1cf23468bb..b632cb0d8d 100644
--- a/server/src/com/vaadin/ui/ComboBox.java
+++ b/server/src/com/vaadin/ui/ComboBox.java
@@ -35,6 +35,7 @@ import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.server.Resource;
import com.vaadin.shared.ui.combobox.ComboBoxConstants;
+import com.vaadin.shared.ui.combobox.ComboBoxState;
import com.vaadin.shared.ui.combobox.FilteringMode;
/**
@@ -383,6 +384,11 @@ public class ComboBox extends AbstractSelect implements
return textInputAllowed;
}
+ @Override
+ protected ComboBoxState getState() {
+ return (ComboBoxState) super.getState();
+ }
+
/**
* Returns the filtered options for the current page using a container
* filter.
diff --git a/server/src/com/vaadin/ui/FormLayout.java b/server/src/com/vaadin/ui/FormLayout.java
index 1c8b196b31..f6f711d658 100644
--- a/server/src/com/vaadin/ui/FormLayout.java
+++ b/server/src/com/vaadin/ui/FormLayout.java
@@ -17,6 +17,7 @@
package com.vaadin.ui;
import com.vaadin.shared.ui.MarginInfo;
+import com.vaadin.shared.ui.orderedlayout.FormLayoutState;
/**
* FormLayout is used by {@link Form} to layout fields. It may also be used
@@ -71,4 +72,9 @@ public class FormLayout extends AbstractOrderedLayout {
public float getExpandRatio(Component component) {
return super.getExpandRatio(component);
}
+
+ @Override
+ protected FormLayoutState getState() {
+ return (FormLayoutState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/OptionGroup.java b/server/src/com/vaadin/ui/OptionGroup.java
index 37517bd1f2..81e81c9a3a 100644
--- a/server/src/com/vaadin/ui/OptionGroup.java
+++ b/server/src/com/vaadin/ui/OptionGroup.java
@@ -32,6 +32,7 @@ import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.shared.ui.optiongroup.OptionGroupConstants;
+import com.vaadin.shared.ui.optiongroup.OptionGroupState;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.DesignFormatter;
@@ -288,4 +289,9 @@ public class OptionGroup extends AbstractSelect implements
return elem;
}
+
+ @Override
+ protected OptionGroupState getState() {
+ return (OptionGroupState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/RichTextArea.java b/server/src/com/vaadin/ui/RichTextArea.java
index eff669c4c6..2f0ba215b9 100644
--- a/server/src/com/vaadin/ui/RichTextArea.java
+++ b/server/src/com/vaadin/ui/RichTextArea.java
@@ -23,6 +23,7 @@ import org.jsoup.nodes.Element;
import com.vaadin.data.Property;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
+import com.vaadin.shared.ui.textarea.RichTextAreaState;
import com.vaadin.ui.declarative.DesignContext;
/**
@@ -308,4 +309,9 @@ public class RichTextArea extends AbstractField<String> implements
super.writeDesign(design, designContext);
design.html(getValue());
}
+
+ @Override
+ protected RichTextAreaState getState() {
+ return (RichTextAreaState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java
index a6b40ff06b..69874d9947 100644
--- a/server/src/com/vaadin/ui/Table.java
+++ b/server/src/com/vaadin/ui/Table.java
@@ -68,6 +68,7 @@ import com.vaadin.shared.ui.MultiSelectMode;
import com.vaadin.shared.ui.table.TableConstants;
import com.vaadin.shared.ui.table.TableConstants.Section;
import com.vaadin.shared.ui.table.TableServerRpc;
+import com.vaadin.shared.ui.table.TableState;
import com.vaadin.shared.util.SharedUtil;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
@@ -1033,8 +1034,8 @@ public class Table extends AbstractSelect implements Action.Container,
* </p>
*
* <p>
- * If Table has height set ({@link #setHeight(float, Unit)} ) the client side
- * may update the page length automatically the correct value.
+ * If Table has height set ({@link #setHeight(float, Unit)} ) the client
+ * side may update the page length automatically the correct value.
* </p>
*
* @param pageLength
@@ -6455,6 +6456,11 @@ public class Table extends AbstractSelect implements Action.Container,
}
}
+ @Override
+ protected TableState getState() {
+ return (TableState) super.getState();
+ }
+
private final Logger getLogger() {
if (logger == null) {
logger = Logger.getLogger(Table.class.getName());
diff --git a/server/src/com/vaadin/ui/Tree.java b/server/src/com/vaadin/ui/Tree.java
index de8e74bb03..c46f7ca6ee 100644
--- a/server/src/com/vaadin/ui/Tree.java
+++ b/server/src/com/vaadin/ui/Tree.java
@@ -61,6 +61,7 @@ import com.vaadin.shared.ui.MultiSelectMode;
import com.vaadin.shared.ui.dd.VerticalDropLocation;
import com.vaadin.shared.ui.tree.TreeConstants;
import com.vaadin.shared.ui.tree.TreeServerRpc;
+import com.vaadin.shared.ui.tree.TreeState;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.DesignException;
@@ -1973,4 +1974,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
return htmlContentAllowed;
}
+ @Override
+ protected TreeState getState() {
+ return (TreeState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/TreeTable.java b/server/src/com/vaadin/ui/TreeTable.java
index 254d8774a9..bf38148aa9 100644
--- a/server/src/com/vaadin/ui/TreeTable.java
+++ b/server/src/com/vaadin/ui/TreeTable.java
@@ -41,6 +41,7 @@ import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.server.Resource;
import com.vaadin.shared.ui.treetable.TreeTableConstants;
+import com.vaadin.shared.ui.treetable.TreeTableState;
import com.vaadin.ui.Tree.CollapseEvent;
import com.vaadin.ui.Tree.CollapseListener;
import com.vaadin.ui.Tree.ExpandEvent;
@@ -972,4 +973,9 @@ public class TreeTable extends Table implements Hierarchical {
isCollapsed(itemId), true, boolean.class);
return tr;
}
+
+ @Override
+ protected TreeTableState getState() {
+ return (TreeTableState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/TwinColSelect.java b/server/src/com/vaadin/ui/TwinColSelect.java
index 37e3b7ccb9..8086220c94 100644
--- a/server/src/com/vaadin/ui/TwinColSelect.java
+++ b/server/src/com/vaadin/ui/TwinColSelect.java
@@ -22,6 +22,7 @@ import com.vaadin.data.Container;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.shared.ui.twincolselect.TwinColSelectConstants;
+import com.vaadin.shared.ui.twincolselect.TwinColSelectState;
/**
* Multiselect component with two lists: left side for available items and right
@@ -205,4 +206,9 @@ public class TwinColSelect extends AbstractSelect {
return leftColumnCaption;
}
+ @Override
+ protected TwinColSelectState getState() {
+ return (TwinColSelectState) super.getState();
+ }
+
}
diff --git a/server/src/com/vaadin/ui/Upload.java b/server/src/com/vaadin/ui/Upload.java
index 2da7db53b5..a61bcf1bd9 100644
--- a/server/src/com/vaadin/ui/Upload.java
+++ b/server/src/com/vaadin/ui/Upload.java
@@ -31,6 +31,7 @@ import com.vaadin.server.StreamVariable.StreamingProgressEvent;
import com.vaadin.shared.EventId;
import com.vaadin.shared.ui.upload.UploadClientRpc;
import com.vaadin.shared.ui.upload.UploadServerRpc;
+import com.vaadin.shared.ui.upload.UploadState;
import com.vaadin.util.ReflectTools;
/**
@@ -1192,4 +1193,9 @@ public class Upload extends AbstractComponent implements Component.Focusable,
}
return super.getListeners(eventType);
}
+
+ @Override
+ protected UploadState getState() {
+ return (UploadState) super.getState();
+ }
}
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java
new file mode 100644
index 0000000000..52b215f4c8
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.tests.server.component.abstractselect;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.select.AbstractSelectState;
+import com.vaadin.ui.AbstractSelect;
+
+/**
+ * Tests for AbstractSelect state
+ *
+ */
+public class AbstractSelectStateTest {
+
+ @Test
+ public void getState_selectHasCustomState() {
+ TestSelect select = new TestSelect();
+ AbstractSelectState state = select.getState();
+ Assert.assertEquals("Unexpected state class",
+ AbstractSelectState.class, state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_selectHasCustomPrimaryStyleName() {
+ TestSelect combobox = new TestSelect();
+ AbstractSelectState state = new AbstractSelectState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, combobox.getPrimaryStyleName());
+ }
+
+ @Test
+ public void selectStateHasCustomPrimaryStyleName() {
+ AbstractSelectState state = new AbstractSelectState();
+ Assert.assertEquals("Unexpected primary style name", "v-select",
+ state.primaryStyleName);
+ }
+
+ private static class TestSelect extends AbstractSelect {
+
+ @Override
+ public AbstractSelectState getState() {
+ return super.getState();
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/audio/AudioStateTest.java b/server/tests/src/com/vaadin/tests/server/component/audio/AudioStateTest.java
new file mode 100644
index 0000000000..d18127791e
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/audio/AudioStateTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tests.server.component.audio;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.audio.AudioState;
+import com.vaadin.ui.Audio;
+
+/**
+ * Tests for Audio state.
+ *
+ */
+public class AudioStateTest {
+ @Test
+ public void getState_audioHasCustomState() {
+ TestAudio audio = new TestAudio();
+ AudioState state = audio.getState();
+ Assert.assertEquals("Unexpected state class", AudioState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_audioHasCustomPrimaryStyleName() {
+ Audio audio = new Audio();
+ AudioState state = new AudioState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, audio.getPrimaryStyleName());
+ }
+
+ @Test
+ public void audioStateHasCustomPrimaryStyleName() {
+ AudioState state = new AudioState();
+ Assert.assertEquals("Unexpected primary style name", "v-audio",
+ state.primaryStyleName);
+ }
+
+ private static class TestAudio extends Audio {
+
+ @Override
+ public AudioState getState() {
+ return super.getState();
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/combobox/ComboBoxStateTest.java b/server/tests/src/com/vaadin/tests/server/component/combobox/ComboBoxStateTest.java
new file mode 100644
index 0000000000..0908a355de
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/combobox/ComboBoxStateTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tests.server.component.combobox;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.combobox.ComboBoxState;
+import com.vaadin.ui.ComboBox;
+
+/**
+ * Tests for ComboBox state.
+ *
+ */
+public class ComboBoxStateTest {
+ @Test
+ public void getState_comboboxHasCustomState() {
+ TestComboBox combobox = new TestComboBox();
+ ComboBoxState state = combobox.getState();
+ Assert.assertEquals("Unexpected state class", ComboBoxState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_comboboxHasCustomPrimaryStyleName() {
+ ComboBox combobox = new ComboBox();
+ ComboBoxState state = new ComboBoxState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, combobox.getPrimaryStyleName());
+ }
+
+ @Test
+ public void comboboxStateHasCustomPrimaryStyleName() {
+ ComboBoxState state = new ComboBoxState();
+ Assert.assertEquals("Unexpected primary style name", "v-filterselect",
+ state.primaryStyleName);
+ }
+
+ private static class TestComboBox extends ComboBox {
+
+ @Override
+ public ComboBoxState getState() {
+ return super.getState();
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/grid/GridStateTest.java b/server/tests/src/com/vaadin/tests/server/component/grid/GridStateTest.java
new file mode 100644
index 0000000000..567fad52af
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/grid/GridStateTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.tests.server.component.grid;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.grid.GridState;
+import com.vaadin.ui.Grid;
+
+/**
+ * Tests for Grid State.
+ *
+ */
+public class GridStateTest {
+
+ @Test
+ public void getPrimaryStyleName_gridHasCustomPrimaryStyleName() {
+ Grid grid = new Grid();
+ GridState state = new GridState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, grid.getPrimaryStyleName());
+ }
+
+ @Test
+ public void gridStateHasCustomPrimaryStyleName() {
+ GridState state = new GridState();
+ Assert.assertEquals("Unexpected primary style name", "v-grid",
+ state.primaryStyleName);
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java b/server/tests/src/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java
new file mode 100644
index 0000000000..01dc71d96a
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.tests.server.component.listselect;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.select.AbstractSelectState;
+import com.vaadin.ui.ListSelect;
+
+/**
+ * Tests for ListSelect State.
+ *
+ */
+public class ListSelectStateTest {
+
+ @Test
+ public void getState_listSelectHasCustomState() {
+ TestListSelect select = new TestListSelect();
+ AbstractSelectState state = select.getState();
+ Assert.assertEquals("Unexpected state class",
+ AbstractSelectState.class, state.getClass());
+ }
+
+ private static class TestListSelect extends ListSelect {
+ @Override
+ public AbstractSelectState getState() {
+ return super.getState();
+ }
+ }
+
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java b/server/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java
new file mode 100644
index 0000000000..59ff432cad
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.tests.server.component.optiongroup;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.optiongroup.OptionGroupState;
+import com.vaadin.ui.OptionGroup;
+
+/**
+ * Tests for OptionGroup state.
+ *
+ */
+public class OptionGroupStateTest {
+
+ @Test
+ public void getState_optionGroupHasCustomState() {
+ TestOptionGroup group = new TestOptionGroup();
+ OptionGroupState state = group.getState();
+ Assert.assertEquals("Unexpected state class", OptionGroupState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_optionGroupHasCustomPrimaryStyleName() {
+ OptionGroup layout = new OptionGroup();
+ OptionGroupState state = new OptionGroupState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, layout.getPrimaryStyleName());
+ }
+
+ @Test
+ public void optionGroupStateHasCustomPrimaryStyleName() {
+ OptionGroupState state = new OptionGroupState();
+ Assert.assertEquals("Unexpected primary style name",
+ "v-select-optiongroup", state.primaryStyleName);
+ }
+
+ private static class TestOptionGroup extends OptionGroup {
+
+ @Override
+ public OptionGroupState getState() {
+ return super.getState();
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaStateTest.java b/server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaStateTest.java
new file mode 100644
index 0000000000..d1c0f8fa1e
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/richtextarea/RichTextAreaStateTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tests.server.component.richtextarea;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.textarea.RichTextAreaState;
+import com.vaadin.ui.RichTextArea;
+
+/**
+ * Tests for RichTextArea State.
+ *
+ */
+public class RichTextAreaStateTest {
+ @Test
+ public void getState_areaHasCustomState() {
+ TestRichTextArea area = new TestRichTextArea();
+ RichTextAreaState state = area.getState();
+ Assert.assertEquals("Unexpected state class", RichTextAreaState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_areaHasCustomPrimaryStyleName() {
+ RichTextArea area = new RichTextArea();
+ RichTextAreaState state = new RichTextAreaState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, area.getPrimaryStyleName());
+ }
+
+ @Test
+ public void areaStateHasCustomPrimaryStyleName() {
+ RichTextAreaState state = new RichTextAreaState();
+ Assert.assertEquals("Unexpected primary style name", "v-richtextarea",
+ state.primaryStyleName);
+ }
+
+ private static class TestRichTextArea extends RichTextArea {
+
+ @Override
+ public RichTextAreaState getState() {
+ return super.getState();
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/table/TableStateTest.java b/server/tests/src/com/vaadin/tests/server/component/table/TableStateTest.java
new file mode 100644
index 0000000000..7f951e0835
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/table/TableStateTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.tests.server.component.table;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.table.TableState;
+import com.vaadin.ui.Table;
+
+/**
+ * Tests for Table State.
+ *
+ */
+public class TableStateTest {
+
+ @Test
+ public void getState_tableHasCustomState() {
+ TestTable table = new TestTable();
+ TableState state = table.getState();
+ Assert.assertEquals("Unexpected state class", TableState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_tableHasCustomPrimaryStyleName() {
+ Table table = new Table();
+ TableState state = new TableState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, table.getPrimaryStyleName());
+ }
+
+ @Test
+ public void tableStateHasCustomPrimaryStyleName() {
+ TableState state = new TableState();
+ Assert.assertEquals("Unexpected primary style name", "v-table",
+ state.primaryStyleName);
+ }
+
+ private static class TestTable extends Table {
+
+ @Override
+ public TableState getState() {
+ return super.getState();
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java
index 3c9fc4c0cd..3e5425a875 100644
--- a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java
+++ b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java
@@ -8,12 +8,14 @@ import static org.junit.Assert.assertTrue;
import java.lang.reflect.Field;
import java.util.HashSet;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.vaadin.data.Container;
import com.vaadin.data.util.HierarchicalContainer;
import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.shared.ui.tree.TreeState;
import com.vaadin.ui.Tree;
public class TreeTest {
@@ -142,4 +144,35 @@ public class TreeTest {
assertNull(expandedItemId);
}
+ @Test
+ public void getState_treeHasCustomState() {
+ TestTree table = new TestTree();
+ TreeState state = table.getState();
+ Assert.assertEquals("Unexpected state class", TreeState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_treeHasCustomPrimaryStyleName() {
+ Tree table = new Tree();
+ TreeState state = new TreeState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, table.getPrimaryStyleName());
+ }
+
+ @Test
+ public void treeStateHasCustomPrimaryStyleName() {
+ TreeState state = new TreeState();
+ Assert.assertEquals("Unexpected primary style name", "v-tree",
+ state.primaryStyleName);
+ }
+
+ private static class TestTree extends Tree {
+
+ @Override
+ public TreeState getState() {
+ return super.getState();
+ }
+ }
+
}
diff --git a/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java b/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java
index 60f4ac5f99..33f41d84ea 100644
--- a/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java
+++ b/server/tests/src/com/vaadin/tests/server/component/treetable/TreeTableTest.java
@@ -20,6 +20,7 @@ import java.util.EnumSet;
import org.junit.Assert;
import org.junit.Test;
+import com.vaadin.shared.ui.treetable.TreeTableState;
import com.vaadin.ui.Table.RowHeaderMode;
import com.vaadin.ui.TreeTable;
@@ -62,11 +63,39 @@ public class TreeTableTest {
}
}
+ @Test
+ public void getState_treeTableHasCustomState() {
+ TestTreeTable table = new TestTreeTable();
+ TreeTableState state = table.getState();
+ Assert.assertEquals("Unexpected state class", TreeTableState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_treeTableHasCustomPrimaryStyleName() {
+ TreeTable table = new TreeTable();
+ TreeTableState state = new TreeTableState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, table.getPrimaryStyleName());
+ }
+
+ @Test
+ public void treeTableStateHasCustomPrimaryStyleName() {
+ TreeTableState state = new TreeTableState();
+ Assert.assertEquals("Unexpected primary style name", "v-table",
+ state.primaryStyleName);
+ }
+
private static class TestTreeTable extends TreeTable {
@Override
protected boolean rowHeadersAreEnabled() {
return super.rowHeadersAreEnabled();
}
+
+ @Override
+ public TreeTableState getState() {
+ return super.getState();
+ }
}
}
diff --git a/server/tests/src/com/vaadin/tests/server/component/twincolselect/TwinColSelectStateTest.java b/server/tests/src/com/vaadin/tests/server/component/twincolselect/TwinColSelectStateTest.java
new file mode 100644
index 0000000000..b2e2c0a65b
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/twincolselect/TwinColSelectStateTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.tests.server.component.twincolselect;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.shared.ui.twincolselect.TwinColSelectState;
+import com.vaadin.ui.TwinColSelect;
+
+/**
+ * Tests for TwinColSelectState.
+ *
+ */
+public class TwinColSelectStateTest {
+
+ @Test
+ public void getState_selectHasCustomState() {
+ TestTwinColSelect select = new TestTwinColSelect();
+ TwinColSelectState state = select.getState();
+ Assert.assertEquals("Unexpected state class", TwinColSelectState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_selectHasCustomPrimaryStyleName() {
+ TwinColSelect table = new TwinColSelect();
+ TwinColSelectState state = new TwinColSelectState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, table.getPrimaryStyleName());
+ }
+
+ @Test
+ public void selectStateHasCustomPrimaryStyleName() {
+ TwinColSelectState state = new TwinColSelectState();
+ Assert.assertEquals("Unexpected primary style name",
+ "v-select-twincol", state.primaryStyleName);
+ }
+
+ private static class TestTwinColSelect extends TwinColSelect {
+
+ @Override
+ public TwinColSelectState getState() {
+ return super.getState();
+ }
+ }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java b/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java
index 2132829c0a..358e4db9cd 100644
--- a/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java
+++ b/server/tests/src/com/vaadin/tests/server/component/upload/UploadTest.java
@@ -20,6 +20,7 @@ import org.junit.Test;
import com.vaadin.server.StreamVariable;
import com.vaadin.server.StreamVariable.StreamingErrorEvent;
+import com.vaadin.shared.ui.upload.UploadState;
import com.vaadin.ui.Upload;
/**
@@ -40,6 +41,29 @@ public class UploadTest {
Assert.assertFalse(upload.isUploading());
}
+ @Test
+ public void getState_uploadHasCustomState() {
+ TestUpload upload = new TestUpload();
+ UploadState state = upload.getState();
+ Assert.assertEquals("Unexpected state class", UploadState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_uploadHasCustomPrimaryStyleName() {
+ Upload upload = new Upload();
+ UploadState state = new UploadState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, upload.getPrimaryStyleName());
+ }
+
+ @Test
+ public void uploadStateHasCustomPrimaryStyleName() {
+ UploadState state = new UploadState();
+ Assert.assertEquals("Unexpected primary style name", "v-upload",
+ state.primaryStyleName);
+ }
+
private static class TestStreamingErrorEvent implements StreamingErrorEvent {
@Override
@@ -77,6 +101,11 @@ public class UploadTest {
}
@Override
+ public UploadState getState() {
+ return super.getState();
+ }
+
+ @Override
protected void fireNoInputStream(String filename, String MIMEType,
long length) {
fireEvent();
diff --git a/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java b/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
index c689e7fe06..f55798007f 100644
--- a/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
+++ b/server/tests/src/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
@@ -3,8 +3,10 @@ package com.vaadin.tests.server.componentcontainer;
import java.util.Iterator;
import java.util.NoSuchElementException;
+import org.junit.Assert;
import org.junit.Test;
+import com.vaadin.shared.ui.orderedlayout.FormLayoutState;
import com.vaadin.ui.Component;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
@@ -53,6 +55,29 @@ public class FormLayoutTest extends AbstractIndexedLayoutTestBase {
assertOrder(l, new int[] { 0, 1, 2, 3 });
}
+ @Test
+ public void getState_formLayoutHasCustomState() {
+ TestFormLayout layout = new TestFormLayout();
+ FormLayoutState state = layout.getState();
+ Assert.assertEquals("Unexpected state class", FormLayoutState.class,
+ state.getClass());
+ }
+
+ @Test
+ public void getPrimaryStyleName_formLayoutHasCustomPrimaryStyleName() {
+ FormLayout layout = new FormLayout();
+ FormLayoutState state = new FormLayoutState();
+ Assert.assertEquals("Unexpected primary style name",
+ state.primaryStyleName, layout.getPrimaryStyleName());
+ }
+
+ @Test
+ public void formLayoutStateHasCustomPrimaryStyleName() {
+ FormLayoutState state = new FormLayoutState();
+ Assert.assertEquals("Unexpected primary style name", "v-formlayout",
+ state.primaryStyleName);
+ }
+
private void assertOrder(Layout layout, int[] indices) {
Iterator<?> i = layout.iterator();
try {
@@ -69,4 +94,12 @@ public class FormLayoutTest extends AbstractIndexedLayoutTestBase {
}
}
+ private static class TestFormLayout extends FormLayout {
+
+ @Override
+ public FormLayoutState getState() {
+ return super.getState();
+ }
+ }
+
}
diff --git a/server/tests/src/com/vaadin/ui/NativeSelectTest.java b/server/tests/src/com/vaadin/ui/NativeSelectTest.java
index 7e2a04ef1c..78e4715f9b 100644
--- a/server/tests/src/com/vaadin/ui/NativeSelectTest.java
+++ b/server/tests/src/com/vaadin/ui/NativeSelectTest.java
@@ -21,6 +21,7 @@ import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.shared.ui.select.AbstractSelectState;
public class NativeSelectTest {
@@ -45,6 +46,21 @@ public class NativeSelectTest {
assertFocusRpcRegistered(new NativeSelect("foo", new IndexedContainer()));
}
+ @Test
+ public void getState_listSelectHasCustomState() {
+ TestNativeSelect select = new TestNativeSelect();
+ AbstractSelectState state = select.getState();
+ Assert.assertEquals("Unexpected state class",
+ AbstractSelectState.class, state.getClass());
+ }
+
+ private static class TestNativeSelect extends NativeSelect {
+ @Override
+ public AbstractSelectState getState() {
+ return super.getState();
+ }
+ }
+
private void assertFocusRpcRegistered(NativeSelect s) {
Assert.assertNotNull(
"RPC is not correctly registered",
diff --git a/shared/src/com/vaadin/shared/ui/audio/AudioState.java b/shared/src/com/vaadin/shared/ui/audio/AudioState.java
new file mode 100644
index 0000000000..1fedc6ab53
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/audio/AudioState.java
@@ -0,0 +1,30 @@
+/*
+ * 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.ui.audio;
+
+import com.vaadin.shared.ui.AbstractMediaState;
+
+/**
+ * Shared state for the Audio component.
+ *
+ * @since
+ */
+public class AudioState extends AbstractMediaState {
+
+ {
+ primaryStyleName = "v-audio";
+ }
+}
diff --git a/shared/src/com/vaadin/shared/ui/combobox/ComboBoxState.java b/shared/src/com/vaadin/shared/ui/combobox/ComboBoxState.java
index 4925f98b4d..69b8a47ba6 100644
--- a/shared/src/com/vaadin/shared/ui/combobox/ComboBoxState.java
+++ b/shared/src/com/vaadin/shared/ui/combobox/ComboBoxState.java
@@ -15,9 +15,14 @@
*/
package com.vaadin.shared.ui.combobox;
-import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.select.AbstractSelectState;
-public class ComboBoxState extends AbstractFieldState {
+/**
+ * Shared state for the ComboBox component.
+ *
+ * @since
+ */
+public class ComboBoxState extends AbstractSelectState {
{
primaryStyleName = "v-filterselect";
}
diff --git a/shared/src/com/vaadin/shared/ui/grid/GridState.java b/shared/src/com/vaadin/shared/ui/grid/GridState.java
index 4ed878f1cb..54ccc78daa 100644
--- a/shared/src/com/vaadin/shared/ui/grid/GridState.java
+++ b/shared/src/com/vaadin/shared/ui/grid/GridState.java
@@ -137,6 +137,10 @@ public class GridState extends TabIndexState {
*/
public static final String JSONKEY_SELECTED = "s";
+ {
+ primaryStyleName = "v-grid";
+ }
+
/**
* Columns in grid.
*/
@@ -197,4 +201,5 @@ public class GridState extends TabIndexState {
/** Whether the columns can be reordered */
@DelegateToWidget
public boolean columnReorderingAllowed;
+
}
diff --git a/shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupState.java b/shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupState.java
index 504e3dcdc8..7ad5045f94 100644
--- a/shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupState.java
+++ b/shared/src/com/vaadin/shared/ui/optiongroup/OptionGroupState.java
@@ -15,9 +15,14 @@
*/
package com.vaadin.shared.ui.optiongroup;
-import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.select.AbstractSelectState;
-public class OptionGroupState extends AbstractFieldState {
+/**
+ * Shared state for the OptionGroup component.
+ *
+ * @since
+ */
+public class OptionGroupState extends AbstractSelectState {
{
primaryStyleName = "v-select-optiongroup";
}
diff --git a/shared/src/com/vaadin/shared/ui/orderedlayout/FormLayoutState.java b/shared/src/com/vaadin/shared/ui/orderedlayout/FormLayoutState.java
new file mode 100644
index 0000000000..0f75ec0501
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/orderedlayout/FormLayoutState.java
@@ -0,0 +1,28 @@
+/*
+ * 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.ui.orderedlayout;
+
+/**
+ * Shared state for the FormLayout component.
+ *
+ * @since
+ */
+public class FormLayoutState extends AbstractOrderedLayoutState {
+
+ {
+ primaryStyleName = "v-formlayout";
+ }
+}
diff --git a/shared/src/com/vaadin/shared/ui/select/AbstractSelectState.java b/shared/src/com/vaadin/shared/ui/select/AbstractSelectState.java
new file mode 100644
index 0000000000..9dc21ced1b
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/select/AbstractSelectState.java
@@ -0,0 +1,30 @@
+/*
+ * 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.ui.select;
+
+import com.vaadin.shared.AbstractFieldState;
+
+/**
+ * Shared state for the AbstractSelect component.
+ *
+ * @since
+ */
+public class AbstractSelectState extends AbstractFieldState {
+
+ {
+ primaryStyleName = "v-select";
+ }
+}
diff --git a/shared/src/com/vaadin/shared/ui/table/TableState.java b/shared/src/com/vaadin/shared/ui/table/TableState.java
index 4a89a99685..19a775323c 100644
--- a/shared/src/com/vaadin/shared/ui/table/TableState.java
+++ b/shared/src/com/vaadin/shared/ui/table/TableState.java
@@ -15,9 +15,14 @@
*/
package com.vaadin.shared.ui.table;
-import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.select.AbstractSelectState;
-public class TableState extends AbstractFieldState {
+/**
+ * Shared state for the Table component.
+ *
+ * @since
+ */
+public class TableState extends AbstractSelectState {
{
primaryStyleName = "v-table";
}
diff --git a/shared/src/com/vaadin/shared/ui/textarea/RichTextAreaState.java b/shared/src/com/vaadin/shared/ui/textarea/RichTextAreaState.java
new file mode 100644
index 0000000000..b4679d5a9d
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/textarea/RichTextAreaState.java
@@ -0,0 +1,31 @@
+/*
+ * 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.ui.textarea;
+
+import com.vaadin.shared.ui.textfield.AbstractTextFieldState;
+
+/**
+ *
+ * Shared state for the RichTextArea component.
+ *
+ * @since
+ */
+public class RichTextAreaState extends AbstractTextFieldState {
+
+ {
+ primaryStyleName = "v-richtextarea";
+ }
+}
diff --git a/shared/src/com/vaadin/shared/ui/tree/TreeState.java b/shared/src/com/vaadin/shared/ui/tree/TreeState.java
index 9f237ce037..14e544120d 100644
--- a/shared/src/com/vaadin/shared/ui/tree/TreeState.java
+++ b/shared/src/com/vaadin/shared/ui/tree/TreeState.java
@@ -15,9 +15,14 @@
*/
package com.vaadin.shared.ui.tree;
-import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.select.AbstractSelectState;
-public class TreeState extends AbstractFieldState {
+/**
+ * Shared state for the Table component.
+ *
+ * @since
+ */
+public class TreeState extends AbstractSelectState {
{
primaryStyleName = "v-tree";
}
diff --git a/shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java b/shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java
index cccc2fb6ae..6f0a14f17f 100644
--- a/shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java
+++ b/shared/src/com/vaadin/shared/ui/twincolselect/TwinColSelectState.java
@@ -15,9 +15,14 @@
*/
package com.vaadin.shared.ui.twincolselect;
-import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.ui.select.AbstractSelectState;
-public class TwinColSelectState extends AbstractFieldState {
+/**
+ * Shared state for the TwinColSelect component.
+ *
+ * @since
+ */
+public class TwinColSelectState extends AbstractSelectState {
{
primaryStyleName = "v-select-twincol";
}
diff --git a/shared/src/com/vaadin/shared/ui/upload/UploadState.java b/shared/src/com/vaadin/shared/ui/upload/UploadState.java
new file mode 100644
index 0000000000..79ed88e5b3
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/upload/UploadState.java
@@ -0,0 +1,30 @@
+/*
+ * 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.ui.upload;
+
+import com.vaadin.shared.AbstractComponentState;
+
+/**
+ * Shared state for the Upload component.
+ *
+ * @since
+ */
+public class UploadState extends AbstractComponentState {
+
+ {
+ primaryStyleName = "v-upload";
+ }
+}