summaryrefslogtreecommitdiffstats
path: root/compatibility-server/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-18 21:51:13 +0300
committerArtur Signell <artur@vaadin.com>2016-08-20 00:08:46 +0300
commit34852cdb88c6c27b1341684204d78db0fdd061a6 (patch)
treef55c6f9d900167a57c7eb2c96c25e1dfe0451dd8 /compatibility-server/src
parent6e0f2efe996cfd3b38c960e04cbced0a91215cf0 (diff)
downloadvaadin-framework-34852cdb88c6c27b1341684204d78db0fdd061a6.tar.gz
vaadin-framework-34852cdb88c6c27b1341684204d78db0fdd061a6.zip
Move selects to compatibility package
Change-Id: I7ee02d34b230e8752174a7f19824f81cbb616c33
Diffstat (limited to 'compatibility-server/src')
-rw-r--r--compatibility-server/src/main/java/com/vaadin/ui/ListSelect.java80
-rw-r--r--compatibility-server/src/main/java/com/vaadin/ui/NativeSelect.java108
-rw-r--r--compatibility-server/src/main/java/com/vaadin/ui/OptionGroup.java253
-rw-r--r--compatibility-server/src/main/java/com/vaadin/ui/Select.java60
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/design/ParseAllSupportedComponentsTest.java45
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/design/ParseLegacyPrefixTest.java44
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java306
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectListenersTest.java26
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java60
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTest.java160
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupTest.java32
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectDeclarativeTest.java71
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java45
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java69
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupListenersTest.java25
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java60
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/select/SelectListenersTest.java25
-rw-r--r--compatibility-server/src/test/java/com/vaadin/ui/AbsSelectTest.java147
-rw-r--r--compatibility-server/src/test/java/com/vaadin/ui/NativeSelectTest.java70
-rw-r--r--compatibility-server/src/test/resources/com/vaadin/tests/design/all-components-legacy.html122
-rw-r--r--compatibility-server/src/test/resources/com/vaadin/tests/design/all-components.html122
21 files changed, 1930 insertions, 0 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/ui/ListSelect.java b/compatibility-server/src/main/java/com/vaadin/ui/ListSelect.java
new file mode 100644
index 0000000000..9a720d1895
--- /dev/null
+++ b/compatibility-server/src/main/java/com/vaadin/ui/ListSelect.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2000-2016 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.ui;
+
+import java.util.Collection;
+
+import com.vaadin.data.Container;
+import com.vaadin.server.PaintException;
+import com.vaadin.server.PaintTarget;
+
+/**
+ * This is a simple list select without, for instance, support for new items,
+ * lazyloading, and other advanced features.
+ */
+@SuppressWarnings("serial")
+public class ListSelect extends AbstractSelect {
+
+ private int rows = 0;
+
+ public ListSelect() {
+ super();
+ }
+
+ public ListSelect(String caption, Collection<?> options) {
+ super(caption, options);
+ }
+
+ public ListSelect(String caption, Container dataSource) {
+ super(caption, dataSource);
+ }
+
+ public ListSelect(String caption) {
+ super(caption);
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ /**
+ * Sets the number of rows in the editor. If the number of rows is set 0,
+ * the actual number of displayed rows is determined implicitly by the
+ * adapter.
+ *
+ * @param rows
+ * the number of rows to set.
+ */
+ public void setRows(int rows) {
+ if (rows < 0) {
+ rows = 0;
+ }
+ if (this.rows != rows) {
+ this.rows = rows;
+ markAsDirty();
+ }
+ }
+
+ @Override
+ public void paintContent(PaintTarget target) throws PaintException {
+ // Adds the number of rows
+ if (rows != 0) {
+ target.addAttribute("rows", rows);
+ }
+ super.paintContent(target);
+ }
+}
diff --git a/compatibility-server/src/main/java/com/vaadin/ui/NativeSelect.java b/compatibility-server/src/main/java/com/vaadin/ui/NativeSelect.java
new file mode 100644
index 0000000000..13556a0387
--- /dev/null
+++ b/compatibility-server/src/main/java/com/vaadin/ui/NativeSelect.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2000-2016 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.ui;
+
+import java.util.Collection;
+
+import com.vaadin.data.Container;
+import com.vaadin.event.FieldEvents;
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcImpl;
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.event.FieldEvents.FocusListener;
+
+/**
+ * This is a simple drop-down select without, for instance, support for
+ * multiselect, new items, lazyloading, and other advanced features. Sometimes
+ * "native" select without all the bells-and-whistles of the ComboBox is a
+ * better choice.
+ */
+@SuppressWarnings("serial")
+public class NativeSelect extends AbstractSelect
+ implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
+
+ FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(
+ this) {
+
+ @Override
+ protected void fireEvent(Event event) {
+ NativeSelect.this.fireEvent(event);
+ }
+ };
+
+ public NativeSelect() {
+ super();
+ registerRpc(focusBlurRpc);
+ }
+
+ public NativeSelect(String caption, Collection<?> options) {
+ super(caption, options);
+ registerRpc(focusBlurRpc);
+ }
+
+ public NativeSelect(String caption, Container dataSource) {
+ super(caption, dataSource);
+ registerRpc(focusBlurRpc);
+ }
+
+ public NativeSelect(String caption) {
+ super(caption);
+ registerRpc(focusBlurRpc);
+ }
+
+ @Override
+ public void setMultiSelect(boolean multiSelect)
+ throws UnsupportedOperationException {
+ if (multiSelect == true) {
+ throw new UnsupportedOperationException(
+ "Multiselect not supported");
+ }
+ }
+
+ @Override
+ public void setNewItemsAllowed(boolean allowNewOptions)
+ throws UnsupportedOperationException {
+ if (allowNewOptions == true) {
+ throw new UnsupportedOperationException(
+ "newItemsAllowed not supported");
+ }
+ }
+
+ @Override
+ public void addFocusListener(FocusListener listener) {
+ addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener,
+ FocusListener.focusMethod);
+ }
+
+ @Override
+ public void removeFocusListener(FocusListener listener) {
+ removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener);
+ }
+
+ @Override
+ public void addBlurListener(BlurListener listener) {
+ addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener,
+ BlurListener.blurMethod);
+ }
+
+ @Override
+ public void removeBlurListener(BlurListener listener) {
+ removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener);
+ }
+
+}
diff --git a/compatibility-server/src/main/java/com/vaadin/ui/OptionGroup.java b/compatibility-server/src/main/java/com/vaadin/ui/OptionGroup.java
new file mode 100644
index 0000000000..3e491906d5
--- /dev/null
+++ b/compatibility-server/src/main/java/com/vaadin/ui/OptionGroup.java
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2000-2016 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.ui;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jsoup.nodes.Element;
+
+import com.vaadin.data.Container;
+import com.vaadin.event.FieldEvents;
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusEvent;
+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;
+
+/**
+ * Configures select to be used as an option group.
+ */
+@SuppressWarnings("serial")
+public class OptionGroup extends AbstractSelect
+ implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier {
+
+ private Set<Object> disabledItemIds = new HashSet<Object>();
+
+ public OptionGroup() {
+ super();
+ }
+
+ public OptionGroup(String caption, Collection<?> options) {
+ super(caption, options);
+ }
+
+ public OptionGroup(String caption, Container dataSource) {
+ super(caption, dataSource);
+ }
+
+ public OptionGroup(String caption) {
+ super(caption);
+ }
+
+ @Override
+ protected void paintItem(PaintTarget target, Object itemId)
+ throws PaintException {
+ super.paintItem(target, itemId);
+ if (!isItemEnabled(itemId)) {
+ target.addAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED,
+ true);
+ }
+ }
+
+ @Override
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ super.changeVariables(source, variables);
+
+ if (variables.containsKey(FocusEvent.EVENT_ID)) {
+ fireEvent(new FocusEvent(this));
+ }
+ if (variables.containsKey(BlurEvent.EVENT_ID)) {
+ fireEvent(new BlurEvent(this));
+ }
+ }
+
+ @Override
+ public void addBlurListener(BlurListener listener) {
+ addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener,
+ BlurListener.blurMethod);
+ }
+
+ @Override
+ public void removeBlurListener(BlurListener listener) {
+ removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener);
+ }
+
+ @Override
+ public void addFocusListener(FocusListener listener) {
+ addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener,
+ FocusListener.focusMethod);
+ }
+
+ @Override
+ public void removeFocusListener(FocusListener listener) {
+ removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener);
+
+ }
+
+ @Override
+ protected void setValue(Object newValue, boolean repaintIsNotNeeded) {
+ if (repaintIsNotNeeded) {
+ /*
+ * Check that value from changeVariables() doesn't contain unallowed
+ * selections: In the multi select mode, the user has selected or
+ * deselected a disabled item. In the single select mode, the user
+ * has selected a disabled item.
+ */
+ if (isMultiSelect()) {
+ Set<?> currentValueSet = (Set<?>) getValue();
+ Set<?> newValueSet = (Set<?>) newValue;
+ for (Object itemId : currentValueSet) {
+ if (!isItemEnabled(itemId)
+ && !newValueSet.contains(itemId)) {
+ markAsDirty();
+ return;
+ }
+ }
+ for (Object itemId : newValueSet) {
+ if (!isItemEnabled(itemId)
+ && !currentValueSet.contains(itemId)) {
+ markAsDirty();
+ return;
+ }
+ }
+ } else {
+ if (newValue == null) {
+ newValue = getNullSelectionItemId();
+ }
+ if (!isItemEnabled(newValue)) {
+ markAsDirty();
+ return;
+ }
+ }
+ }
+ super.setValue(newValue, repaintIsNotNeeded);
+ }
+
+ /**
+ * Sets an item disabled or enabled. In the multiselect mode, a disabled
+ * item cannot be selected or deselected by the user. In the single
+ * selection mode, a disable item cannot be selected.
+ *
+ * However, programmatical selection or deselection of an disable item is
+ * possible. By default, items are enabled.
+ *
+ * @param itemId
+ * the id of the item to be disabled or enabled
+ * @param enabled
+ * if true the item is enabled, otherwise the item is disabled
+ */
+ public void setItemEnabled(Object itemId, boolean enabled) {
+ if (itemId != null) {
+ if (enabled) {
+ disabledItemIds.remove(itemId);
+ } else {
+ disabledItemIds.add(itemId);
+ }
+ markAsDirty();
+ }
+ }
+
+ /**
+ * Returns true if the item is enabled.
+ *
+ * @param itemId
+ * the id of the item to be checked
+ * @return true if the item is enabled, false otherwise
+ * @see #setItemEnabled(Object, boolean)
+ */
+ public boolean isItemEnabled(Object itemId) {
+ if (itemId != null) {
+ return !disabledItemIds.contains(itemId);
+ }
+ return true;
+ }
+
+ /**
+ * Sets whether html is allowed in the item captions. If set to true, the
+ * captions are passed to the browser as html and the developer is
+ * responsible for ensuring no harmful html is used. If set to false, the
+ * content is passed to the browser as plain text.
+ *
+ * @param htmlContentAllowed
+ * true if the captions are used as html, false if used as plain
+ * text
+ */
+ public void setHtmlContentAllowed(boolean htmlContentAllowed) {
+ getState().htmlContentAllowed = htmlContentAllowed;
+ }
+
+ /**
+ * Checks whether captions are interpreted as html or plain text.
+ *
+ * @return true if the captions are used as html, false if used as plain
+ * text
+ * @see #setHtmlContentAllowed(boolean)
+ */
+ public boolean isHtmlContentAllowed() {
+ return getState(false).htmlContentAllowed;
+ }
+
+ @Override
+ protected Object readItem(Element child, Set<String> selected,
+ DesignContext context) {
+ Object itemId = super.readItem(child, selected, context);
+
+ if (child.hasAttr("disabled")) {
+ setItemEnabled(itemId, false);
+ }
+
+ return itemId;
+ }
+
+ @Override
+ protected Element writeItem(Element design, Object itemId,
+ DesignContext context) {
+ Element elem = super.writeItem(design, itemId, context);
+
+ if (!isItemEnabled(itemId)) {
+ elem.attr("disabled", "");
+ }
+ if (isHtmlContentAllowed()) {
+ // need to unencode HTML entities. AbstractSelect.writeDesign can't
+ // check if HTML content is allowed, so it always encodes entities
+ // like '>', '<' and '&'; in case HTML content is allowed this is
+ // undesirable so we need to unencode entities. Entities other than
+ // '<' and '>' will be taken care by Jsoup.
+ elem.html(DesignFormatter.decodeFromTextNode(elem.html()));
+ }
+
+ return elem;
+ }
+
+ @Override
+ protected OptionGroupState getState() {
+ return (OptionGroupState) super.getState();
+ }
+
+ @Override
+ protected OptionGroupState getState(boolean markAsDirty) {
+ return (OptionGroupState) super.getState(markAsDirty);
+ }
+}
diff --git a/compatibility-server/src/main/java/com/vaadin/ui/Select.java b/compatibility-server/src/main/java/com/vaadin/ui/Select.java
new file mode 100644
index 0000000000..66b36f8ac2
--- /dev/null
+++ b/compatibility-server/src/main/java/com/vaadin/ui/Select.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2016 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.ui;
+
+import java.util.Collection;
+
+import com.vaadin.data.Container;
+
+/**
+ * <p>
+ * A class representing a selection of items the user has selected in a UI. The
+ * set of choices is presented as a set of {@link com.vaadin.data.Item}s in a
+ * {@link com.vaadin.data.Container}.
+ * </p>
+ *
+ * <p>
+ * A <code>Select</code> component may be in single- or multiselect mode.
+ * Multiselect mode means that more than one item can be selected
+ * simultaneously.
+ * </p>
+ *
+ * @author Vaadin Ltd.
+ * @since 3.0
+ * @deprecated As of 7.0. Use {@link ComboBox} instead.
+ */
+@Deprecated
+public class Select extends ComboBox {
+ /* Component methods */
+
+ public Select() {
+ super();
+ }
+
+ public Select(String caption, Collection<?> options) {
+ super(caption, options);
+ }
+
+ public Select(String caption, Container dataSource) {
+ super(caption, dataSource);
+ }
+
+ public Select(String caption) {
+ super(caption);
+ }
+
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/design/ParseAllSupportedComponentsTest.java b/compatibility-server/src/test/java/com/vaadin/tests/design/ParseAllSupportedComponentsTest.java
new file mode 100644
index 0000000000..6694372539
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/design/ParseAllSupportedComponentsTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2000-2016 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.design;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.FileNotFoundException;
+
+import org.junit.Test;
+
+import com.vaadin.ui.declarative.Design;
+import com.vaadin.ui.declarative.DesignContext;
+
+/**
+ * Just top level test case that contains all synchronizable components
+ *
+ * @author Vaadin Ltd
+ */
+public class ParseAllSupportedComponentsTest {
+
+ @Test
+ public void allComponentsAreParsed() throws FileNotFoundException {
+ DesignContext ctx = Design.read(
+ getClass().getResourceAsStream("all-components.html"), null);
+
+ assertThat(ctx, is(not(nullValue())));
+ assertThat(ctx.getRootComponent(), is(not(nullValue())));
+ }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/design/ParseLegacyPrefixTest.java b/compatibility-server/src/test/java/com/vaadin/tests/design/ParseLegacyPrefixTest.java
new file mode 100644
index 0000000000..5dd21b35f8
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/design/ParseLegacyPrefixTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2000-2016 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.design;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.FileNotFoundException;
+
+import org.junit.Test;
+
+import com.vaadin.ui.declarative.Design;
+import com.vaadin.ui.declarative.DesignContext;
+
+/**
+ * Test reading a design with all components using the legacy prefix.
+ */
+public class ParseLegacyPrefixTest {
+
+ @Test
+ public void allComponentsAreParsed() throws FileNotFoundException {
+ DesignContext ctx = Design.read(
+ getClass().getResourceAsStream("all-components-legacy.html"),
+ null);
+
+ assertThat(ctx, is(not(nullValue())));
+ assertThat(ctx.getRootComponent(), is(not(nullValue())));
+ }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java
new file mode 100644
index 0000000000..9a8777909f
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2000-2016 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.jsoup.nodes.Attributes;
+import org.jsoup.nodes.Element;
+import org.jsoup.parser.Tag;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.server.ExternalResource;
+import com.vaadin.server.Resource;
+import com.vaadin.tests.design.DeclarativeTestBase;
+import com.vaadin.tests.design.DeclarativeTestBaseBase;
+import com.vaadin.ui.AbstractSelect;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.declarative.DesignContext;
+import com.vaadin.ui.declarative.DesignException;
+
+/**
+ * Test cases for reading the properties of selection components.
+ *
+ * @author Vaadin Ltd
+ */
+public class AbstractSelectDeclarativeTest
+ extends DeclarativeTestBase<AbstractSelect> {
+
+ public String getDesignSingleSelectNewItemsAllowed() {
+ return "<vaadin-combo-box new-items-allowed item-caption-mode='icon_only'"
+ + " null-selection-item-id='nullIid'/>";
+
+ }
+
+ public AbstractSelect getExpectedSingleSelectNewItemsAllowed() {
+ ComboBox c = new ComboBox();
+ c.setNewItemsAllowed(true);
+ c.setItemCaptionMode(ItemCaptionMode.ICON_ONLY);
+ c.setNullSelectionAllowed(true);// Default
+ c.setNullSelectionItemId("nullIid");
+ return c;
+ }
+
+ public String getDesignMultiSelect() {
+ return "<vaadin-list-select multi-select null-selection-allowed='false' new-items-allowed item-caption-mode='property' />";
+ }
+
+ public AbstractSelect getExpectedMultiSelect() {
+ ListSelect c = new ListSelect();
+ c.setNewItemsAllowed(true);
+ c.setNullSelectionAllowed(false);
+ c.setItemCaptionMode(ItemCaptionMode.PROPERTY);
+ c.setMultiSelect(true);
+ return c;
+ }
+
+ @Test
+ public void testReadSingleSelectNewItemsAllowed() {
+ testRead(getDesignSingleSelectNewItemsAllowed(),
+ getExpectedSingleSelectNewItemsAllowed());
+ }
+
+ @Test
+ public void testWriteSingleSelectNewItemsAllowed() {
+ testWrite(getDesignSingleSelectNewItemsAllowed(),
+ getExpectedSingleSelectNewItemsAllowed());
+ }
+
+ @Test
+ public void testReadMultiSelect() {
+ testRead(getDesignMultiSelect(), getExpectedMultiSelect());
+ }
+
+ @Test
+ public void testWriteMultiSelect() {
+ testWrite(getDesignMultiSelect(), getExpectedMultiSelect());
+ }
+
+ @Test
+ public void testReadInlineData() {
+ testRead(getDesignForInlineData(), getExpectedComponentForInlineData());
+ }
+
+ @Test(expected = DesignException.class)
+ public void testReadMultipleValuesForSingleSelect() {
+ testRead("<vaadin-list-select>" + "<option selected>1</option>"
+ + "<option selected>2</option>" + "</vaadin-list-select>",
+ null);
+ }
+
+ @Test
+ public void testReadMultipleValuesForMultiSelect() {
+ ListSelect ls = new ListSelect();
+ ls.setMultiSelect(true);
+ ls.addItem("1");
+ ls.addItem("2");
+ ls.select("1");
+ ls.select("2");
+ testRead("<vaadin-list-select multi-select>"
+ + "<option selected>1</option>" + "<option selected>2</option>"
+ + "</vaadin-list-select>", ls);
+ }
+
+ @Test
+ public void testReadSingleValueForMultiSelect() {
+ ListSelect ls = new ListSelect();
+ ls.setMultiSelect(true);
+ ls.addItem("1");
+ ls.addItem("2");
+ ls.select("1");
+ testRead("<vaadin-list-select multi-select>"
+ + "<option selected>1</option>" + "<option>2</option>"
+ + "</vaadin-list-select>", ls);
+ }
+
+ @Test
+ public void testReadSingleValueForSingleSelect() {
+ ListSelect ls = new ListSelect();
+ ls.setMultiSelect(false);
+ ls.addItem("1");
+ ls.addItem("2");
+ ls.select("1");
+ testRead("<vaadin-list-select>" + "<option selected>1</option>"
+ + "<option>2</option>" + "</vaadin-list-select>", ls);
+ }
+
+ @Test
+ public void testWriteInlineDataIgnored() {
+ // No data is written by default
+ testWrite(stripOptionTags(getDesignForInlineData()),
+ getExpectedComponentForInlineData());
+ }
+
+ @Test
+ public void testWriteInlineData() {
+ testWrite(getDesignForInlineData(), getExpectedComponentForInlineData(),
+ true);
+ }
+
+ private String getDesignForInlineData() {
+ return "<vaadin-list-select>\n"
+ + " <option icon='http://some.url/icon.png'>Value 1</option>\n" //
+ + " <option selected>Value 2</option>\n"//
+ + "</vaadin-list-select>";
+ }
+
+ private AbstractSelect getExpectedComponentForInlineData() {
+ AbstractSelect as = new ListSelect();
+ as.addItem("Value 1");
+ as.setItemIcon("Value 1",
+ new ExternalResource("http://some.url/icon.png"));
+ as.addItem("Value 2");
+ as.setValue("Value 2");
+ return as;
+ }
+
+ @Test
+ public void testReadAttributesSingleSelect() {
+ Element design = createDesignWithAttributesSingleSelect();
+ ComboBox cb = new ComboBox();
+ IndexedContainer container = new IndexedContainer();
+ container.addContainerProperty("icon", Resource.class, null);
+ container.addContainerProperty("name", String.class, null);
+ cb.setContainerDataSource(container);
+ cb.readDesign(design, new DesignContext());
+ Assert.assertTrue("Adding new items should be allowed.",
+ cb.isNewItemsAllowed());
+ assertEquals("Wrong item caption mode.",
+ AbstractSelect.ItemCaptionMode.PROPERTY,
+ cb.getItemCaptionMode());
+ assertEquals("Wrong item caption property id.", "name",
+ cb.getItemCaptionPropertyId());
+ assertEquals("Wrong item icon property id.", "icon",
+ cb.getItemIconPropertyId());
+ Assert.assertTrue("Null selection should be allowed.",
+ cb.isNullSelectionAllowed());
+ assertEquals("Wrong null selection item id.", "No items selected",
+ cb.getNullSelectionItemId());
+ }
+
+ @Test
+ public void testReadAttributesMultiSelect() {
+ Element design = createDesignWithAttributesMultiSelect();
+ ListSelect ls = new ListSelect();
+ ls.readDesign(design, new DesignContext());
+ Assert.assertTrue("Multi select should be allowed.",
+ ls.isMultiSelect());
+ assertEquals("Wrong caption mode.",
+ AbstractSelect.ItemCaptionMode.EXPLICIT,
+ ls.getItemCaptionMode());
+ Assert.assertFalse("Null selection should not be allowed.",
+ ls.isNullSelectionAllowed());
+ }
+
+ private Element createDesignWithAttributesSingleSelect() {
+ Attributes attributes = new Attributes();
+ attributes.put("new-items-allowed", true);
+ attributes.put("multi-select", "false");
+ attributes.put("item-caption-mode", "property");
+ attributes.put("item-caption-property-id", "name");
+ attributes.put("item-icon-property-id", "icon");
+ attributes.put("null-selection-allowed", true);
+ attributes.put("null-selection-item-id", "No items selected");
+ return new Element(Tag.valueOf("vaadin-combo-box"), "", attributes);
+ }
+
+ private Element createDesignWithAttributesMultiSelect() {
+ Attributes attributes = new Attributes();
+ attributes.put("multi-select", true);
+ attributes.put("item-caption-mode", "EXPLICIT");
+ attributes.put("null-selection-allowed", "false");
+ return new Element(Tag.valueOf("vaadin-list-select"), "", attributes);
+ }
+
+ @Test
+ public void testWriteAttributesSingleSelect() {
+ ComboBox cb = createSingleSelectWithOnlyAttributes();
+ Element e = new Element(Tag.valueOf("vaadin-combo-box"), "");
+ cb.writeDesign(e, new DesignContext());
+ assertEquals("Wrong caption for the combo box.", "A combo box",
+ e.attr("caption"));
+ Assert.assertTrue("Adding new items should be allowed.",
+ "".equals(e.attr("new-items-allowed")));
+ assertEquals("Wrong item caption mode.", "icon_only",
+ e.attr("item-caption-mode"));
+ assertEquals("Wrong item icon property id.", "icon",
+ e.attr("item-icon-property-id"));
+ Assert.assertTrue("Null selection should be allowed.",
+ "".equals(e.attr("null-selection-allowed"))
+ || "true".equals(e.attr("null-selection-allowed")));
+ assertEquals("Wrong null selection item id.", "No item selected",
+ e.attr("null-selection-item-id"));
+ }
+
+ @Test
+ public void testWriteMultiListSelect() {
+ ListSelect ls = createMultiSelect();
+ Element e = new Element(Tag.valueOf("vaadin-list-select"), "");
+ ls.writeDesign(e, new DesignContext());
+ assertEquals("Null selection should not be allowed.", "false",
+ e.attr("null-selection-allowed"));
+ Assert.assertTrue("Multi select should be allowed.",
+ "".equals(e.attr("multi-select"))
+ || "true".equals(e.attr("multi-select")));
+ }
+
+ @Test
+ public void testHtmlEntities() {
+ String design = "<vaadin-combo-box>"
+ + " <option item-id=\"one\">&gt; One</option>"
+ + " <option>&gt; Two</option>" + "</vaadin-combo-box>";
+ AbstractSelect read = read(design);
+
+ Assert.assertEquals("> One", read.getItemCaption("one"));
+
+ AbstractSelect underTest = new ComboBox();
+ underTest.addItem("> One");
+
+ Element root = new Element(Tag.valueOf("vaadin-combo-box"), "");
+ DesignContext dc = new DesignContext();
+ dc.setShouldWriteDataDelegate(
+ DeclarativeTestBaseBase.ALWAYS_WRITE_DATA);
+ underTest.writeDesign(root, dc);
+
+ Assert.assertEquals("&gt; One",
+ root.getElementsByTag("option").first().html());
+ }
+
+ public ComboBox createSingleSelectWithOnlyAttributes() {
+ ComboBox cb = new ComboBox();
+ Container dataSource = new IndexedContainer();
+ dataSource.addContainerProperty("icon", Resource.class, null);
+ cb.setContainerDataSource(dataSource);
+ cb.setCaption("A combo box");
+ cb.setNewItemsAllowed(true);
+ cb.setItemCaptionMode(ItemCaptionMode.ICON_ONLY);
+ cb.setItemIconPropertyId("icon");
+ cb.setNullSelectionAllowed(true);
+ cb.setNullSelectionItemId("No item selected");
+ return cb;
+ }
+
+ public ListSelect createMultiSelect() {
+ ListSelect ls = new ListSelect();
+ ls.setNullSelectionAllowed(false);
+ ls.setMultiSelect(true);
+ return ls;
+ }
+
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectListenersTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectListenersTest.java
new file mode 100644
index 0000000000..7fc584e3d5
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectListenersTest.java
@@ -0,0 +1,26 @@
+package com.vaadin.tests.server.component.abstractselect;
+
+import org.junit.Test;
+
+import com.vaadin.data.Container.ItemSetChangeEvent;
+import com.vaadin.data.Container.ItemSetChangeListener;
+import com.vaadin.data.Container.PropertySetChangeEvent;
+import com.vaadin.data.Container.PropertySetChangeListener;
+import com.vaadin.tests.server.component.AbstractListenerMethodsTestBase;
+import com.vaadin.ui.ComboBox;
+
+public class AbstractSelectListenersTest
+ extends AbstractListenerMethodsTestBase {
+
+ @Test
+ public void testItemSetChangeListenerAddGetRemove() throws Exception {
+ testListenerAddGetRemove(ComboBox.class, ItemSetChangeEvent.class,
+ ItemSetChangeListener.class);
+ }
+
+ @Test
+ public void testPropertySetChangeListenerAddGetRemove() throws Exception {
+ testListenerAddGetRemove(ComboBox.class, PropertySetChangeEvent.class,
+ PropertySetChangeListener.class);
+ }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java
new file mode 100644
index 0000000000..c5ff297d7b
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/AbstractSelectStateTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2016 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/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTest.java
new file mode 100644
index 0000000000..8bd253ab64
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTest.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2000-2016 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.Before;
+import org.junit.Test;
+
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.design.DeclarativeTestBase;
+import com.vaadin.ui.OptionGroup;
+
+public class OptionGroupDeclarativeTest
+ extends DeclarativeTestBase<OptionGroup> {
+
+ private OptionGroup og;
+
+ @Before
+ public void init() {
+ og = new OptionGroup();
+ }
+
+ @Test
+ public void testBasicSyntax() {
+
+ String expected = "<vaadin-option-group />";
+ testReadWrite(expected);
+
+ }
+
+ @Test
+ public void testOptionSyntax() {
+
+ og.addItems("foo", "bar", "baz", "bang");
+
+ //@formatter:off
+ String expected =
+ "<vaadin-option-group>"
+ + "<option>foo</option>"
+ + "<option>bar</option>"
+ + "<option>baz</option>"
+ + "<option>bang</option>"
+ + "</vaadin-option-group>";
+ //@formatter:on
+
+ testReadWrite(expected);
+
+ }
+
+ @Test
+ public void testDisabledOptionSyntax() {
+
+ og.addItems("foo", "bar", "baz", "bang");
+ og.setItemEnabled("baz", false);
+
+ //@formatter:off
+ String expected =
+ "<vaadin-option-group>"
+ + "<option>foo</option>"
+ + "<option>bar</option>"
+ + "<option disabled>baz</option>"
+ + "<option>bang</option>"
+ + "</vaadin-option-group>";
+ //@formatter:on
+
+ testReadWrite(expected);
+
+ }
+
+ @Test
+ public void testIconSyntax() {
+
+ og.addItems("foo", "bar", "baz", "bang");
+ og.setItemIcon("bar", new ThemeResource("foobar.png"));
+
+ //@formatter:off
+ String expected =
+ "<vaadin-option-group>"
+ + "<option>foo</option>"
+ + "<option icon='theme://foobar.png'>bar</option>"
+ + "<option>baz</option>"
+ + "<option>bang</option>"
+ + "</vaadin-option-group>";
+ //@formatter:on
+
+ testReadWrite(expected);
+
+ }
+
+ @Test
+ public void testHTMLCaption() {
+
+ og.addItems("foo", "bar", "baz", "bang");
+
+ og.setHtmlContentAllowed(true);
+
+ og.setItemCaption("foo", "<b>True</b>");
+ og.setItemCaption("bar", "<font color='red'>False</font>");
+
+ //@formatter:off
+ String expected =
+ "<vaadin-option-group html-content-allowed>"
+ + "<option item-id=\"foo\"><b>True</b></option>"
+ + "<option item-id=\"bar\"><font color='red'>False</font></option>"
+ + "<option>baz</option>"
+ + "<option>bang</option>"
+ + "</vaadin-option-group>";
+ //@formatter:on
+
+ testReadWrite(expected);
+ }
+
+ @Test
+ public void testPlaintextCaption() {
+
+ og.addItems("foo", "bar", "baz", "bang");
+
+ og.setItemCaption("foo", "<b>True</b>");
+ og.setItemCaption("bar", "<font color=\"red\">False</font>");
+
+ //@formatter:off
+ String expected =
+ "<vaadin-option-group>"
+ + "<option item-id=\"foo\">&lt;b&gt;True&lt;/b&gt;</option>"
+ + "<option item-id=\"bar\">&lt;font color=\"red\"&gt;False&lt;/font&gt;</option>"
+ + "<option>baz</option>"
+ + "<option>bang</option>"
+ + "</vaadin-option-group>";
+ //@formatter:on
+
+ testReadWrite(expected);
+ }
+
+ private void testReadWrite(String design) {
+ testWrite(design, og, true);
+ testRead(design, og);
+ }
+
+ @Override
+ public OptionGroup testRead(String design, OptionGroup expected) {
+
+ OptionGroup read = super.testRead(design, expected);
+ testWrite(design, read, true);
+
+ return read;
+ }
+
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupTest.java
new file mode 100644
index 0000000000..9a20d2fd79
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/abstractselect/OptionGroupTest.java
@@ -0,0 +1,32 @@
+package com.vaadin.tests.server.component.abstractselect;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.vaadin.ui.OptionGroup;
+
+public class OptionGroupTest {
+
+ private OptionGroup optionGroup;
+
+ @Before
+ public void setup() {
+ optionGroup = new OptionGroup();
+ }
+
+ @Test
+ public void itemsAreAdded() {
+ optionGroup.addItems("foo", "bar");
+
+ Collection<?> itemIds = optionGroup.getItemIds();
+
+ assertEquals(2, itemIds.size());
+ assertTrue(itemIds.contains("foo"));
+ assertTrue(itemIds.contains("bar"));
+ }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectDeclarativeTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectDeclarativeTest.java
new file mode 100644
index 0000000000..f0fa4aad55
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectDeclarativeTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2000-2016 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.Test;
+
+import com.vaadin.tests.design.DeclarativeTestBase;
+import com.vaadin.ui.ListSelect;
+
+public class ListSelectDeclarativeTest extends DeclarativeTestBase<ListSelect> {
+
+ private ListSelect getWithOptionsExpected() {
+ ListSelect ls = new ListSelect();
+ ls.setRows(10);
+ ls.addItem("Male");
+ ls.addItem("Female");
+ return ls;
+ }
+
+ private String getWithOptionsDesign() {
+ return "<vaadin-list-select rows=10>\n"
+ + " <option>Male</option>\n"
+ + " <option>Female</option>\n"
+ + "</vaadin-list-select>\n" + "";
+ }
+
+ @Test
+ public void testReadWithOptions() {
+ testRead(getWithOptionsDesign(), getWithOptionsExpected());
+ }
+
+ @Test
+ public void testWriteWithOptions() {
+ testWrite(stripOptionTags(getWithOptionsDesign()),
+ getWithOptionsExpected());
+ }
+
+ private ListSelect getBasicExpected() {
+ ListSelect ls = new ListSelect();
+ ls.setCaption("Hello");
+ return ls;
+ }
+
+ private String getBasicDesign() {
+ return "<vaadin-list-select caption='Hello' />";
+ }
+
+ @Test
+ public void testReadBasic() {
+ testRead(getBasicDesign(), getBasicExpected());
+ }
+
+ @Test
+ public void testWriteBasic() {
+ testWrite(getBasicDesign(), getBasicExpected());
+ }
+
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java
new file mode 100644
index 0000000000..595909aa69
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/listselect/ListSelectStateTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2000-2016 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/compatibility-server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java
new file mode 100644
index 0000000000..853f38c7d3
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/nativeselect/NativeSelectDeclarativeTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2000-2016 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.nativeselect;
+
+import org.junit.Test;
+
+import com.vaadin.tests.design.DeclarativeTestBase;
+import com.vaadin.ui.NativeSelect;
+
+/**
+ * Test cases for reading the properties of selection components.
+ *
+ * @author Vaadin Ltd
+ */
+public class NativeSelectDeclarativeTest
+ extends DeclarativeTestBase<NativeSelect> {
+
+ public String getBasicDesign() {
+ return "<vaadin-native-select><option>foo</option><option>bar</option></vaadin-native-select>";
+
+ }
+
+ public NativeSelect getBasicExpected() {
+ NativeSelect ns = new NativeSelect();
+ ns.addItem("foo");
+ ns.addItem("bar");
+ return ns;
+ }
+
+ @Test
+ public void testReadBasic() {
+ testRead(getBasicDesign(), getBasicExpected());
+ }
+
+ @Test
+ public void testWriteBasic() {
+ testWrite(stripOptionTags(getBasicDesign()), getBasicExpected());
+ }
+
+ @Test
+ public void testReadOnlyValue() {
+ String design = "<vaadin-native-select readonly><option selected>foo</option><option>bar</option></vaadin-native-select>";
+
+ NativeSelect ns = new NativeSelect();
+ ns.addItems("foo", "bar");
+ ns.setValue("foo");
+ ns.setReadOnly(true);
+
+ testRead(design, ns);
+
+ // Selects items are not written out by default
+ String design2 = "<vaadin-native-select readonly></vaadin-native-select>";
+ testWrite(design2, ns);
+ }
+
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupListenersTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupListenersTest.java
new file mode 100644
index 0000000000..2c2a8a81fb
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupListenersTest.java
@@ -0,0 +1,25 @@
+package com.vaadin.tests.server.component.optiongroup;
+
+import org.junit.Test;
+
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.event.FieldEvents.FocusListener;
+import com.vaadin.tests.server.component.AbstractListenerMethodsTestBase;
+import com.vaadin.ui.OptionGroup;
+
+public class OptionGroupListenersTest extends AbstractListenerMethodsTestBase {
+
+ @Test
+ public void testFocusListenerAddGetRemove() throws Exception {
+ testListenerAddGetRemove(OptionGroup.class, FocusEvent.class,
+ FocusListener.class);
+ }
+
+ @Test
+ public void testBlurListenerAddGetRemove() throws Exception {
+ testListenerAddGetRemove(OptionGroup.class, BlurEvent.class,
+ BlurListener.class);
+ }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java
new file mode 100644
index 0000000000..a6d04576bc
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/optiongroup/OptionGroupStateTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2016 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/compatibility-server/src/test/java/com/vaadin/tests/server/component/select/SelectListenersTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/select/SelectListenersTest.java
new file mode 100644
index 0000000000..1b0ff1caff
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/select/SelectListenersTest.java
@@ -0,0 +1,25 @@
+package com.vaadin.tests.server.component.select;
+
+import org.junit.Test;
+
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.event.FieldEvents.FocusListener;
+import com.vaadin.tests.server.component.AbstractListenerMethodsTestBase;
+import com.vaadin.ui.Select;
+
+public class SelectListenersTest extends AbstractListenerMethodsTestBase {
+
+ @Test
+ public void testFocusListenerAddGetRemove() throws Exception {
+ testListenerAddGetRemove(Select.class, FocusEvent.class,
+ FocusListener.class);
+ }
+
+ @Test
+ public void testBlurListenerAddGetRemove() throws Exception {
+ testListenerAddGetRemove(Select.class, BlurEvent.class,
+ BlurListener.class);
+ }
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/ui/AbsSelectTest.java b/compatibility-server/src/test/java/com/vaadin/ui/AbsSelectTest.java
new file mode 100644
index 0000000000..51556f9e1a
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/ui/AbsSelectTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2000-2016 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.ui;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.data.util.ObjectProperty;
+
+public class AbsSelectTest {
+
+ @Test
+ public void addItemsStrings() {
+ NativeSelect ns = new NativeSelect();
+ ns.addItems("Foo", "bar", "baz");
+ Assert.assertEquals(3, ns.size());
+ Assert.assertArrayEquals(new Object[] { "Foo", "bar", "baz" },
+ ns.getItemIds().toArray());
+ }
+
+ @Test
+ public void addItemsObjects() {
+ Object o1 = new Object();
+ Object o2 = new Object();
+ Object o3 = new Object();
+
+ NativeSelect ns = new NativeSelect();
+ ns.addItems(o1, o2, o3);
+ Assert.assertEquals(3, ns.size());
+ Assert.assertArrayEquals(new Object[] { o1, o2, o3 },
+ ns.getItemIds().toArray());
+ }
+
+ @Test
+ public void addItemsStringList() {
+ ArrayList<String> itemIds = new ArrayList<String>();
+ itemIds.add("foo");
+ itemIds.add("bar");
+ itemIds.add("baz");
+ NativeSelect ns = new NativeSelect();
+ ns.addItems(itemIds);
+ Assert.assertEquals(3, ns.size());
+ Assert.assertArrayEquals(new Object[] { "foo", "bar", "baz" },
+ ns.getItemIds().toArray());
+ }
+
+ @Test
+ public void addItemsObjectList() {
+ Object o1 = new Object();
+ Object o2 = new Object();
+ Object o3 = new Object();
+ ArrayList<Object> itemIds = new ArrayList<Object>();
+ itemIds.add(o1);
+ itemIds.add(o2);
+ itemIds.add(o3);
+ NativeSelect ns = new NativeSelect();
+ ns.addItems(itemIds);
+ Assert.assertEquals(3, ns.size());
+ Assert.assertArrayEquals(new Object[] { o1, o2, o3 },
+ ns.getItemIds().toArray());
+
+ }
+
+ @Test
+ public void singleSelectInitiallyEmpty() {
+ AbstractSelect s = new ListSelect();
+ Assert.assertTrue(s.isEmpty());
+ }
+
+ @Test
+ public void singleSelectEmptyAfterClearUsingPDS() {
+ AbstractSelect s = new ListSelect();
+ s.addItem("foo");
+ s.addItem("bar");
+ s.setPropertyDataSource(new ObjectProperty<String>("foo"));
+
+ Assert.assertFalse(s.isEmpty());
+ s.clear();
+ Assert.assertTrue(s.isEmpty());
+ }
+
+ @Test
+ public void singleSelectEmptyAfterClear() {
+ AbstractSelect s = new ListSelect();
+ s.addItem("foo");
+ s.addItem("bar");
+ s.setValue("bar");
+
+ Assert.assertFalse(s.isEmpty());
+ s.clear();
+ Assert.assertTrue(s.isEmpty());
+ }
+
+ @Test
+ public void multiSelectInitiallyEmpty() {
+ AbstractSelect s = new ListSelect();
+ s.setMultiSelect(true);
+ Assert.assertTrue(s.isEmpty());
+ }
+
+ @Test
+ public void multiSelectEmptyAfterClearUsingPDS() {
+ AbstractSelect s = new ListSelect();
+ s.setMultiSelect(true);
+ s.addItem("foo");
+ s.addItem("bar");
+ HashSet<String> sel = new HashSet<String>();
+ sel.add("foo");
+ sel.add("bar");
+ s.setPropertyDataSource(new ObjectProperty<HashSet>(sel));
+
+ Assert.assertFalse(s.isEmpty());
+ s.clear();
+ Assert.assertTrue(s.isEmpty());
+ }
+
+ @Test
+ public void multiSelectEmptyAfterClear() {
+ AbstractSelect s = new ListSelect();
+ s.setMultiSelect(true);
+ s.addItem("foo");
+ s.addItem("bar");
+ s.select("foo");
+ s.select("bar");
+
+ Assert.assertFalse(s.isEmpty());
+ s.clear();
+ Assert.assertTrue(s.isEmpty());
+ }
+
+}
diff --git a/compatibility-server/src/test/java/com/vaadin/ui/NativeSelectTest.java b/compatibility-server/src/test/java/com/vaadin/ui/NativeSelectTest.java
new file mode 100644
index 0000000000..1a41fc1097
--- /dev/null
+++ b/compatibility-server/src/test/java/com/vaadin/ui/NativeSelectTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2000-2016 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.ui;
+
+import java.util.Collections;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.shared.ui.select.AbstractSelectState;
+
+public class NativeSelectTest {
+
+ @Test
+ public void rpcRegisteredConstructorNoArg() {
+ assertFocusRpcRegistered(new NativeSelect());
+ }
+
+ @Test
+ public void rpcRegisteredConstructorString() {
+ assertFocusRpcRegistered(new NativeSelect("foo"));
+ }
+
+ @Test
+ public void rpcRegisteredConstructorStringCollection() {
+ assertFocusRpcRegistered(
+ new NativeSelect("foo", Collections.singleton("Hello")));
+ }
+
+ @Test
+ public void rpcRegisteredConstructorStringContainer() {
+ 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", s.getRpcManager(
+ "com.vaadin.shared.communication.FieldRpc$FocusAndBlurServerRpc"));
+ }
+
+}
diff --git a/compatibility-server/src/test/resources/com/vaadin/tests/design/all-components-legacy.html b/compatibility-server/src/test/resources/com/vaadin/tests/design/all-components-legacy.html
new file mode 100644
index 0000000000..39aecb6db1
--- /dev/null
+++ b/compatibility-server/src/test/resources/com/vaadin/tests/design/all-components-legacy.html
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="package-mapping" content="my:com.addon.mypackage"/>
+ </head>
+ <body>
+ <v-vertical-layout>
+ <!-- abstract component -->
+ <v-button primary-style-name="button" id="foo" style-name="red" caption="Some caption" icon="vaadin://themes/runo/icons/16/ok.png" description="My tooltip" error="Something went wrong" locale="en_US"></v-button>
+
+ <!-- absolute layout -->
+ <v-absolute-layout>
+ <v-button :top="100px" :left="0px" :z-index=21>OK</v-button>
+ <v-button :bottom="0px" :right="0px">Cancel</v-button>
+ </v-absolute-layout>
+
+ <!-- vertical layout -->
+ <v-vertical-layout spacing margin>
+ <v-button :top>OK</v-button>
+ <v-table size-full :expand=1 />
+ </v-vertical-layout>
+
+ <!-- horizontal layout -->
+ <v-horizontal-layout spacing margin>
+ <v-button :top>OK</v-button>
+ <v-table size-full :expand=1 />
+ </v-horizontal-layout>
+
+ <!-- form layout -->
+ <v-form-layout spacing margin>
+ <v-button :top>OK</v-button>
+ <v-table size-full :expand=1 />
+ </v-form-layout>
+
+ <!-- css layout -->
+ <v-css-layout>
+ <v-button>OK</v-button>
+ <v-table size-full />
+ </v-css-layout>
+
+ <!-- panel -->
+ <v-panel caption="Hello world" tabindex=2 scroll-left="10" scroll-top="10">
+ <v-table size-full />
+ </v-panel>
+
+ <!-- abstract field -->
+ <v-text-field buffered validation-visible=false invalid-committed invalid-allowed=false required required-error="This is a required field" conversion-error="Input {0} cannot be parsed" tabindex=3 readonly />
+ <!-- abstract text field, text field -->
+ <v-text-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" />
+ <!-- password field -->
+ <v-password-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" />
+ <!-- text area -->
+ <v-text-area rows=5 wordwrap=false >test value</v-text-area>
+ <!-- button -->
+ <v-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</v-button>
+ <!-- native button -->
+ <v-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</v-button>
+
+ <!-- tabsheet -->
+ <v-tab-sheet tabindex=5>
+ <tab visible=false closable caption="My first tab">
+ <v-vertical-layout>
+ <v-text-field/>
+ </v-vertical-layout>
+ </tab>
+ <tab enabled=false caption="Disabled second tab">
+ <v-button>In disabled tab - can’t be shown by default</v-button>
+ </tab>
+ <tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId">
+ <v-text-field input-prompt="Icon only in tab" />
+ </tab>
+ </v-tab-sheet>
+
+ <!-- accordion -->
+ <v-accordion tabindex=5>
+ <tab visible=false closable caption="My first tab">
+ <v-vertical-layout>
+ <v-text-field/>
+ </v-vertical-layout>
+ </tab>
+ <tab enabled=false caption="Disabled second tab">
+ <v-button>In disabled tab - can’t be shown by default</v-button>
+ </tab>
+ <tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId">
+ <v-text-field input-prompt="Icon only in tab" />
+ </tab>
+ </v-accordion>
+
+ <!-- abstract split panel -->
+ <v-horizontal-split-panel split-position="20px" min-split-position="0px" max-split-position="50px" locked>
+ <v-button>First slot</v-button>
+ </v-horizontal-split-panel>
+ <v-vertical-split-panel split-position="25%" reversed>
+ <v-button :second>Second slot</v-button>
+ </v-vertical-split-panel>
+ <v-horizontal-split-panel split-position="25%" reversed>
+ <v-button>First slot</v-button>
+ <v-button>Second slot</v-button>
+ </v-horizontal-split-panel>
+
+ <!-- label -->
+ <v-label>Hello world!</v-label>
+ <v-label>This is <b><u>Rich</u></b> content!</v-label>
+ <v-label plain-text>This is only <b>text</b> and will contain visible tags</v-label>
+
+ <!-- checkbox -->
+ <v-check-box checked/>
+
+ <!-- abstract select -->
+ <v-list-select new-items-allowed multi-select
+ item-caption-mode="index"
+ null-selection-allowed=false>
+ </v-list-select>
+
+ <v-combo-box>
+ <option icon="http://something/my-icon.png">First value</option>
+ <option>Second value</option>
+ </v-combo-box>
+
+ </v-vertical-layout>
+ </body>
+</html>
diff --git a/compatibility-server/src/test/resources/com/vaadin/tests/design/all-components.html b/compatibility-server/src/test/resources/com/vaadin/tests/design/all-components.html
new file mode 100644
index 0000000000..6507188cd7
--- /dev/null
+++ b/compatibility-server/src/test/resources/com/vaadin/tests/design/all-components.html
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="package-mapping" content="my:com.addon.mypackage"/>
+ </head>
+ <body>
+ <vaadin-vertical-layout>
+ <!-- abstract component -->
+ <vaadin-button primary-style-name="button" id="foo" style-name="red" caption="Some caption" icon="vaadin://themes/runo/icons/16/ok.png" description="My tooltip" error="Something went wrong" locale="en_US"></vaadin-button>
+
+ <!-- absolute layout -->
+ <vaadin-absolute-layout>
+ <vaadin-button :top="100px" :left="0px" :z-index=21>OK</vaadin-button>
+ <vaadin-button :bottom="0px" :right="0px">Cancel</vaadin-button>
+ </vaadin-absolute-layout>
+
+ <!-- vertical layout -->
+ <vaadin-vertical-layout spacing margin>
+ <vaadin-button :top>OK</vaadin-button>
+ <vaadin-table size-full :expand=1 />
+ </vaadin-vertical-layout>
+
+ <!-- horizontal layout -->
+ <vaadin-horizontal-layout spacing margin>
+ <vaadin-button :top>OK</vaadin-button>
+ <vaadin-table size-full :expand=1 />
+ </vaadin-horizontal-layout>
+
+ <!-- form layout -->
+ <vaadin-form-layout spacing margin>
+ <vaadin-button :top>OK</vaadin-button>
+ <vaadin-table size-full :expand=1 />
+ </vaadin-form-layout>
+
+ <!-- css layout -->
+ <vaadin-css-layout>
+ <vaadin-button>OK</vaadin-button>
+ <vaadin-table size-full />
+ </vaadin-css-layout>
+
+ <!-- panel -->
+ <vaadin-panel caption="Hello world" tabindex=2 scroll-left="10" scroll-top="10">
+ <vaadin-table size-full />
+ </vaadin-panel>
+
+ <!-- abstract field -->
+ <vaadin-text-field buffered validation-visible=false invalid-committed invalid-allowed=false required required-error="This is a required field" conversion-error="Input {0} cannot be parsed" tabindex=3 readonly />
+ <!-- abstract text field, text field -->
+ <vaadin-text-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" />
+ <!-- password field -->
+ <vaadin-password-field null-representation="" null-setting-allowed maxlength=10 columns=5 input-prompt="Please enter a value" text-change-event-mode="eager" text-change-timeout=2 value="foo" />
+ <!-- text area -->
+ <vaadin-text-area rows=5 wordwrap=false >test value</vaadin-text-area>
+ <!-- button -->
+ <vaadin-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</vaadin-button>
+ <!-- native button -->
+ <vaadin-button click-shortcut="ctrl-shift-o" disable-on-click tabindex=1 icon="http://vaadin.com/image.png" icon-alt="ok" plain-text>OK</vaadin-button>
+
+ <!-- tabsheet -->
+ <vaadin-tab-sheet tabindex=5>
+ <tab visible=false closable caption="My first tab">
+ <vaadin-vertical-layout>
+ <vaadin-text-field/>
+ </vaadin-vertical-layout>
+ </tab>
+ <tab enabled=false caption="Disabled second tab">
+ <vaadin-button>In disabled tab - can’t be shown by default</vaadin-button>
+ </tab>
+ <tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId">
+ <vaadin-text-field input-prompt="Icon only in tab" />
+ </tab>
+ </vaadin-tab-sheet>
+
+ <!-- accordion -->
+ <vaadin-accordion tabindex=5>
+ <tab visible=false closable caption="My first tab">
+ <vaadin-vertical-layout>
+ <vaadin-text-field/>
+ </vaadin-vertical-layout>
+ </tab>
+ <tab enabled=false caption="Disabled second tab">
+ <vaadin-button>In disabled tab - can’t be shown by default</vaadin-button>
+ </tab>
+ <tab icon="theme://../runo/icons/16/ok.png" icon-alt="Ok png from Runo - very helpful" description="Click to show a text field" style-name="red" id="uniqueDomId">
+ <vaadin-text-field input-prompt="Icon only in tab" />
+ </tab>
+ </vaadin-accordion>
+
+ <!-- abstract split panel -->
+ <vaadin-horizontal-split-panel split-position="20px" min-split-position="0px" max-split-position="50px" locked>
+ <vaadin-button>First slot</vaadin-button>
+ </vaadin-horizontal-split-panel>
+ <vaadin-vertical-split-panel split-position="25%" reversed>
+ <vaadin-button :second>Second slot</vaadin-button>
+ </vaadin-vertical-split-panel>
+ <vaadin-horizontal-split-panel split-position="25%" reversed>
+ <vaadin-button>First slot</vaadin-button>
+ <vaadin-button>Second slot</vaadin-button>
+ </vaadin-horizontal-split-panel>
+
+ <!-- label -->
+ <vaadin-label>Hello world!</vaadin-label>
+ <vaadin-label>This is <b><u>Rich</u></b> content!</vaadin-label>
+ <vaadin-label plain-text>This is only <b>text</b> and will contain visible tags</vaadin-label>
+
+ <!-- checkbox -->
+ <vaadin-check-box checked/>
+
+ <!-- abstract select -->
+ <vaadin-list-select new-items-allowed multi-select
+ item-caption-mode="index"
+ null-selection-allowed=false>
+ </vaadin-list-select>
+
+ <vaadin-combo-box>
+ <option icon="http://something/my-icon.png">First value</option>
+ <option>Second value</option>
+ </vaadin-combo-box>
+
+ </vaadin-vertical-layout>
+ </body>
+</html>