summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2012-02-08 14:18:08 +0200
committerHenri Sara <hesara@vaadin.com>2012-02-08 14:18:08 +0200
commita062383b16cc1394baa604a0841416d646e91fba (patch)
treefa7d04736ebde85618c1dd62c91a9de271512aa3 /src/com/vaadin/ui
parent2bb7aae1c0cd44ad1ca260dec70b3225c8a226ac (diff)
downloadvaadin-framework-a062383b16cc1394baa604a0841416d646e91fba.tar.gz
vaadin-framework-a062383b16cc1394baa604a0841416d646e91fba.zip
Remove support for Select in multi-select mode (#8169, #8326).
Also includes some related cleanup as this was the last special case where the widget was selected on the client side based on UIDL fields other than tag.
Diffstat (limited to 'src/com/vaadin/ui')
-rw-r--r--src/com/vaadin/ui/AbstractSelect.java5
-rw-r--r--src/com/vaadin/ui/ComboBox.java12
-rw-r--r--src/com/vaadin/ui/Form.java11
-rw-r--r--src/com/vaadin/ui/Select.java6
4 files changed, 15 insertions, 19 deletions
diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java
index 5e086f0b8d..47f132aa77 100644
--- a/src/com/vaadin/ui/AbstractSelect.java
+++ b/src/com/vaadin/ui/AbstractSelect.java
@@ -976,10 +976,13 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
}
/**
- * Sets the multiselect mode. Setting multiselect mode false may loose
+ * Sets the multiselect mode. Setting multiselect mode false may lose
* selection information: if selected items set contains one or more
* selected items, only one of the selected items is kept as selected.
*
+ * Subclasses of AbstractSelect can choose not to support changing the
+ * multiselect mode, and may throw {@link UnsupportedOperationException}.
+ *
* @param multiSelect
* the New value of property multiSelect.
*/
diff --git a/src/com/vaadin/ui/ComboBox.java b/src/com/vaadin/ui/ComboBox.java
index 013fe6ab85..12db8c18af 100644
--- a/src/com/vaadin/ui/ComboBox.java
+++ b/src/com/vaadin/ui/ComboBox.java
@@ -34,36 +34,24 @@ public class ComboBox extends Select {
private boolean textInputAllowed = true;
public ComboBox() {
- setMultiSelect(false);
setNewItemsAllowed(false);
}
public ComboBox(String caption, Collection<?> options) {
super(caption, options);
- setMultiSelect(false);
setNewItemsAllowed(false);
}
public ComboBox(String caption, Container dataSource) {
super(caption, dataSource);
- setMultiSelect(false);
setNewItemsAllowed(false);
}
public ComboBox(String caption) {
super(caption);
- setMultiSelect(false);
setNewItemsAllowed(false);
}
- @Override
- public void setMultiSelect(boolean multiSelect) {
- if (multiSelect && !isMultiSelect()) {
- throw new UnsupportedOperationException("Multiselect not supported");
- }
- super.setMultiSelect(multiSelect);
- }
-
/**
* Gets the current input prompt.
*
diff --git a/src/com/vaadin/ui/Form.java b/src/com/vaadin/ui/Form.java
index c79804c7e7..dd3710cd2c 100644
--- a/src/com/vaadin/ui/Form.java
+++ b/src/com/vaadin/ui/Form.java
@@ -861,13 +861,16 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* match. Null values are not supported.
* </p>
*
+ * Note: since Vaadin 7.0, returns an {@link AbstractSelect} instead of a
+ * {@link Select}.
+ *
* @param propertyId
* the id of the property.
* @param values
* @param descriptions
* @return the select property generated
*/
- public Select replaceWithSelect(Object propertyId, Object[] values,
+ public AbstractSelect replaceWithSelect(Object propertyId, Object[] values,
Object[] descriptions) {
// Checks the parameters
@@ -927,10 +930,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
}
// Creates the new field matching to old field parameters
- final Select newField = new Select();
- if (isMultiselect) {
- newField.setMultiSelect(true);
- }
+ final AbstractSelect newField = isMultiselect ? new ListSelect()
+ : new Select();
newField.setCaption(oldField.getCaption());
newField.setReadOnly(oldField.isReadOnly());
newField.setReadThrough(oldField.isReadThrough());
diff --git a/src/com/vaadin/ui/Select.java b/src/com/vaadin/ui/Select.java
index 38785f3ab9..c1da88acea 100644
--- a/src/com/vaadin/ui/Select.java
+++ b/src/com/vaadin/ui/Select.java
@@ -754,11 +754,15 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering,
* @deprecated use {@link ListSelect}, {@link OptionGroup} or
* {@link TwinColSelect} instead
* @see com.vaadin.ui.AbstractSelect#setMultiSelect(boolean)
+ * @throws UnsupportedOperationException
+ * if trying to activate multiselect mode
*/
@Deprecated
@Override
public void setMultiSelect(boolean multiSelect) {
- super.setMultiSelect(multiSelect);
+ if (multiSelect) {
+ throw new UnsupportedOperationException("Multiselect not supported");
+ }
}
/**