summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2009-05-25 11:54:36 +0000
committerMarc Englund <marc.englund@itmill.com>2009-05-25 11:54:36 +0000
commit2a7a2f0a80f59c16ab2acaa0089e66f5cd26bbf9 (patch)
treead55eadc5e24d8b12c122114feb91eebe9845c18
parent1a4d5570ddcd0e688ff91f13d859b645ecfea22a (diff)
downloadvaadin-framework-2a7a2f0a80f59c16ab2acaa0089e66f5cd26bbf9.tar.gz
vaadin-framework-2a7a2f0a80f59c16ab2acaa0089e66f5cd26bbf9.zip
Select and AbstractSelect now check isNewItemsAllowed() before adding new items, fixes #3008
svn changeset:7990/svn branch:6.0
-rw-r--r--src/com/vaadin/ui/AbstractSelect.java18
-rw-r--r--src/com/vaadin/ui/Select.java14
2 files changed, 17 insertions, 15 deletions
diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java
index 4719a98371..b2e52254f6 100644
--- a/src/com/vaadin/ui/AbstractSelect.java
+++ b/src/com/vaadin/ui/AbstractSelect.java
@@ -27,8 +27,8 @@ import com.vaadin.terminal.Resource;
/**
* <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}.
+ * set of choices is presented as a set of {@link com.vaadin.data.Item}s in a
+ * {@link com.vaadin.data.Container}.
* </p>
*
* <p>
@@ -362,9 +362,11 @@ public abstract class AbstractSelect extends AbstractField implements
super.changeVariables(source, variables);
// New option entered (and it is allowed)
- final String newitem = (String) variables.get("newitem");
- if (newitem != null && newitem.length() > 0) {
- getNewItemHandler().addNewItem(newitem);
+ if (isNewItemsAllowed()) {
+ final String newitem = (String) variables.get("newitem");
+ if (newitem != null && newitem.length() > 0) {
+ getNewItemHandler().addNewItem(newitem);
+ }
}
// Selection change
@@ -709,8 +711,7 @@ public abstract class AbstractSelect extends AbstractField implements
* Gets the Property identified by the given itemId and propertyId from the
* Container
*
- * @see com.vaadin.data.Container#getContainerProperty(Object,
- * Object)
+ * @see com.vaadin.data.Container#getContainerProperty(Object, Object)
*/
public Property getContainerProperty(Object itemId, Object propertyId) {
return items.getContainerProperty(itemId, propertyId);
@@ -1664,8 +1665,7 @@ public abstract class AbstractSelect extends AbstractField implements
}
}
- public void valueChange(
- com.vaadin.data.Property.ValueChangeEvent event) {
+ public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
requestRepaint();
}
diff --git a/src/com/vaadin/ui/Select.java b/src/com/vaadin/ui/Select.java
index e18a7eaebe..9b16830a31 100644
--- a/src/com/vaadin/ui/Select.java
+++ b/src/com/vaadin/ui/Select.java
@@ -397,12 +397,14 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering {
}
// New option entered (and it is allowed)
- final String newitem = (String) variables.get("newitem");
- if (newitem != null && newitem.length() > 0) {
- getNewItemHandler().addNewItem(newitem);
- // rebuild list
- filterstring = null;
- prevfilterstring = null;
+ if (isNewItemsAllowed()) {
+ final String newitem = (String) variables.get("newitem");
+ if (newitem != null && newitem.length() > 0) {
+ getNewItemHandler().addNewItem(newitem);
+ // rebuild list
+ filterstring = null;
+ prevfilterstring = null;
+ }
}
}