From bf030a07b0614c9782dd02669900529175069c15 Mon Sep 17 00:00:00 2001
From: Denis Anisimov audio
element.";
}
+ @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
- * 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. *
* * @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 @@ -76,6 +100,11 @@ public class UploadTest { return super.getStreamVariable(); } + @Override + public UploadState getState() { + return super.getState(); + } + @Override protected void fireNoInputStream(String filename, String MIMEType, long length) { 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"; + } +} -- cgit v1.2.3