diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2017-03-07 10:41:38 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-03-07 12:36:54 +0200 |
commit | 6e8e010356206559c58e2eff2330d5bdd05a3b3d (patch) | |
tree | 4f59864fda4d60f3341ff4d865f87d511cb4586a | |
parent | 14c160e720d0c3b2ded071d8996fd3fed00ca0be (diff) | |
download | vaadin-framework-6e8e010356206559c58e2eff2330d5bdd05a3b3d.tar.gz vaadin-framework-6e8e010356206559c58e2eff2330d5bdd05a3b3d.zip |
Revert multi select using state change
3 files changed, 14 insertions, 14 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/optiongroup/OptionGroupBaseConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/optiongroup/OptionGroupBaseConnector.java index 1de28c832a..fba8593766 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/optiongroup/OptionGroupBaseConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/optiongroup/OptionGroupBaseConnector.java @@ -43,8 +43,8 @@ public abstract class OptionGroupBaseConnector extends AbstractFieldConnector getWidget().selectedKeys = uidl.getStringArrayVariableAsSet("selected"); getWidget().setReadonly(isReadOnly()); - // Intentional change to use state over UIDL in compatibility package - getWidget().multiselect = getState().multiSelect; + getWidget().multiselect = "multi" + .equals(uidl.getStringAttribute("selectmode")); getWidget().immediate = getState().immediate; getWidget().nullSelectionAllowed = uidl .getBooleanAttribute("nullselect"); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java index 0aeef24c68..b401c1b81b 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java @@ -221,6 +221,11 @@ public abstract class AbstractSelect extends AbstractField<Object> implements } /** + * Is the select in multiselect mode? + */ + private boolean multiSelect = false; + + /** * Select options. */ protected Container items; @@ -354,6 +359,9 @@ public abstract class AbstractSelect extends AbstractField<Object> implements public void paintContent(PaintTarget target) throws PaintException { // Paints select attributes + if (isMultiSelect()) { + target.addAttribute("selectmode", "multi"); + } if (isNewItemsAllowed()) { target.addAttribute("allownewitem", true); } @@ -1097,7 +1105,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements * @return the Value of property multiSelect. */ public boolean isMultiSelect() { - return getState(false).multiSelect; + return multiSelect; } /** @@ -1116,12 +1124,12 @@ public abstract class AbstractSelect extends AbstractField<Object> implements throw new IllegalStateException( "Multiselect and NullSelectionItemId can not be set at the same time."); } - if (multiSelect != getState(false).multiSelect) { + if (multiSelect != this.multiSelect) { // Selection before mode change final Object oldValue = getValue(); - getState().multiSelect = multiSelect; + this.multiSelect = multiSelect; // Convert the value type if (multiSelect) { @@ -1789,7 +1797,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements */ @Override public boolean isEmpty() { - if (!isMultiSelect()) { + if (!multiSelect) { return super.isEmpty(); } else { Object value = getValue(); diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/select/AbstractSelectState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/select/AbstractSelectState.java index 4d2c69bebc..d94bda748c 100644 --- a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/select/AbstractSelectState.java +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/select/AbstractSelectState.java @@ -27,12 +27,4 @@ public class AbstractSelectState extends AbstractFieldState { { primaryStyleName = "v-select"; } - - /** - * Is the select in multiselect mode? - * - * Note that Table and Tree still use the old communication mechanism for - * multi-mode support. - */ - public boolean multiSelect; } |