diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-30 16:25:57 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-08-30 16:25:57 +0300 |
commit | 51eb105ee6af55bc8972ab3e860c38a11194b5bd (patch) | |
tree | 89f35e0b71c2dc0117490e44aef0d1f15a304387 /tests | |
parent | 876182aaa34682503338a4dcdd119b3ebc256f97 (diff) | |
download | vaadin-framework-51eb105ee6af55bc8972ab3e860c38a11194b5bd.tar.gz vaadin-framework-51eb105ee6af55bc8972ab3e860c38a11194b5bd.zip |
Merged Select with ComboBox (#2869)
Select now extends ComboBox instead of vice versa
Select is now deprecated in favor of ComboBox
Diffstat (limited to 'tests')
4 files changed, 25 insertions, 27 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxes2.java b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxes2.java index 7b241c9fe1..c72fdd7132 100644 --- a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxes2.java +++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxes2.java @@ -3,29 +3,28 @@ package com.vaadin.tests.components.combobox; import java.util.LinkedHashMap; import com.vaadin.server.Resource; -import com.vaadin.tests.components.select.SelectTest; +import com.vaadin.tests.components.select.AbstractSelectTestCase; import com.vaadin.ui.ComboBox; -import com.vaadin.ui.Select; -public class ComboBoxes2 extends SelectTest<ComboBox> { +public class ComboBoxes2<T extends ComboBox> extends AbstractSelectTestCase<T> { - private Command<ComboBox, String> inputPromptCommand = new Command<ComboBox, String>() { + private Command<T, String> inputPromptCommand = new Command<T, String>() { @Override - public void execute(ComboBox c, String value, Object data) { + public void execute(T c, String value, Object data) { c.setInputPrompt(value); } }; - private Command<ComboBox, Integer> filteringModeCommand = new Command<ComboBox, Integer>() { + private Command<T, Integer> filteringModeCommand = new Command<T, Integer>() { @Override - public void execute(ComboBox c, Integer value, Object data) { + public void execute(T c, Integer value, Object data) { c.setFilteringMode(value); } }; @Override - protected Class<ComboBox> getTestClass() { - return ComboBox.class; + protected Class<T> getTestClass() { + return (Class<T>) ComboBox.class; } @Override @@ -40,9 +39,9 @@ public class ComboBoxes2 extends SelectTest<ComboBox> { private void createTextInputAlowedAction(String category) { createBooleanAction("Text input allowed", category, true, - new Command<ComboBox, Boolean>() { + new Command<T, Boolean>() { @Override - public void execute(ComboBox c, Boolean value, Object data) { + public void execute(T c, Boolean value, Object data) { c.setTextInputAllowed(value.booleanValue()); } }); @@ -50,9 +49,9 @@ public class ComboBoxes2 extends SelectTest<ComboBox> { private void createNewItemsAllowedAction(String category) { createBooleanAction("New items allowed", category, false, - new Command<ComboBox, Boolean>() { + new Command<T, Boolean>() { @Override - public void execute(ComboBox c, Boolean value, Object data) { + public void execute(T c, Boolean value, Object data) { c.setNewItemsAllowed(value.booleanValue()); } }); @@ -60,9 +59,9 @@ public class ComboBoxes2 extends SelectTest<ComboBox> { private void createFilteringModeAction(String category) { LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); - options.put("Off", Select.FILTERINGMODE_OFF); - options.put("Contains", Select.FILTERINGMODE_CONTAINS); - options.put("Starts with", Select.FILTERINGMODE_STARTSWITH); + options.put("Off", ComboBox.FILTERINGMODE_OFF); + options.put("Contains", ComboBox.FILTERINGMODE_CONTAINS); + options.put("Starts with", ComboBox.FILTERINGMODE_STARTSWITH); createSelectAction("Filtering mode", category, options, "Contains", filteringModeCommand); @@ -82,10 +81,10 @@ public class ComboBoxes2 extends SelectTest<ComboBox> { private void createItemIconSelect(String category) { createSelectAction("Icon", category, createIconOptions(false), "-", - new Command<ComboBox, Resource>() { + new Command<T, Resource>() { @Override - public void execute(ComboBox c, Resource value, Object data) { + public void execute(T c, Resource value, Object data) { for (Object id : c.getItemIds()) { if (value == null) { c.setItemIcon(id, null); diff --git a/tests/testbench/com/vaadin/tests/components/combobox/Comboboxes.java b/tests/testbench/com/vaadin/tests/components/combobox/Comboboxes.java index 3e409069d0..5b2608b389 100644 --- a/tests/testbench/com/vaadin/tests/components/combobox/Comboboxes.java +++ b/tests/testbench/com/vaadin/tests/components/combobox/Comboboxes.java @@ -8,7 +8,6 @@ import com.vaadin.server.ThemeResource; import com.vaadin.tests.components.ComponentTestCase; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Component; -import com.vaadin.ui.Select; public class Comboboxes extends ComponentTestCase<ComboBox> { @@ -83,7 +82,7 @@ public class Comboboxes extends ComponentTestCase<ComboBox> { } } - private void populate(Select s, int nr) { + private void populate(ComboBox s, int nr) { String text = " an item "; String caption = ""; @@ -99,7 +98,7 @@ public class Comboboxes extends ComponentTestCase<ComboBox> { } - private void addItem(Select s, String string) { + private void addItem(ComboBox s, String string) { Object id = s.addItem(); s.getItem(id).getItemProperty(CAPTION).setValue(string); diff --git a/tests/testbench/com/vaadin/tests/components/combobox/GridLayoutComboBoxZoomOut.java b/tests/testbench/com/vaadin/tests/components/combobox/GridLayoutComboBoxZoomOut.java index f64fd6f5fa..c93da483ab 100644 --- a/tests/testbench/com/vaadin/tests/components/combobox/GridLayoutComboBoxZoomOut.java +++ b/tests/testbench/com/vaadin/tests/components/combobox/GridLayoutComboBoxZoomOut.java @@ -6,7 +6,6 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.UI; -import com.vaadin.ui.Select; @SuppressWarnings("serial") public class GridLayoutComboBoxZoomOut extends AbstractTestCase { @@ -26,7 +25,7 @@ public class GridLayoutComboBoxZoomOut extends AbstractTestCase { // formLayout.setWidth("100%"); formLayout.setWidth("1000px"); - Select countryField = new ComboBox(); + ComboBox countryField = new ComboBox(); countryField.addItem("Finland"); countryField.addItem("Sweden"); countryField.addItem("Canada"); @@ -35,7 +34,7 @@ public class GridLayoutComboBoxZoomOut extends AbstractTestCase { countryField.setWidth("100%"); formLayout.addComponent(countryField); - Select statusField = new ComboBox(); + ComboBox statusField = new ComboBox(); statusField.addItem("Available"); statusField.addItem("On vacation"); statusField.addItem("Busy"); diff --git a/tests/testbench/com/vaadin/tests/components/select/SelectTest.java b/tests/testbench/com/vaadin/tests/components/select/SelectTest.java index efea508681..f19e7ecad2 100644 --- a/tests/testbench/com/vaadin/tests/components/select/SelectTest.java +++ b/tests/testbench/com/vaadin/tests/components/select/SelectTest.java @@ -1,13 +1,14 @@ package com.vaadin.tests.components.select; +import com.vaadin.tests.components.combobox.ComboBoxes2; import com.vaadin.ui.Select; -public class SelectTest<T extends Select> extends AbstractSelectTestCase<T> { +public class SelectTest extends ComboBoxes2<Select> { @SuppressWarnings("unchecked") @Override - protected Class<T> getTestClass() { - return (Class<T>) Select.class; + protected Class<Select> getTestClass() { + return Select.class; } } |