diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2017-03-06 16:19:51 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-03-07 12:36:54 +0200 |
commit | 14c160e720d0c3b2ded071d8996fd3fed00ca0be (patch) | |
tree | c39ad1b6676d1a5cbe075f8d6444ff29ae93c059 /compatibility-client | |
parent | c9436d8a25ceacc2850ea63732ed4aa57e17f901 (diff) | |
download | vaadin-framework-14c160e720d0c3b2ded071d8996fd3fed00ca0be.tar.gz vaadin-framework-14c160e720d0c3b2ded071d8996fd3fed00ca0be.zip |
Restore column based width for compatibility selects
Diffstat (limited to 'compatibility-client')
3 files changed, 25 insertions, 7 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroupBase.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroupBase.java index 239e6ff53a..2e5ed2319f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroupBase.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroupBase.java @@ -60,7 +60,8 @@ public abstract class VOptionGroupBase extends Composite implements Field, private boolean readonly; - // Intentional removal of cols in compatibility package + /** For internal use only. May be removed or replaced in the future. */ + public int cols = 0; /** For internal use only. May be removed or replaced in the future. */ public int rows = 0; @@ -136,7 +137,14 @@ public abstract class VOptionGroupBase extends Composite implements Field, return nullSelectionItemAvailable; } - // Intentional removal of getColumns in compatibility package + /** + * For internal use only. May be removed or replaced in the future. + * + * @return "cols" specified in uidl, 0 if not specified + */ + public int getColumns() { + return cols; + } /** * For internal use only. May be removed or replaced in the future. diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java index 2403750b03..70e8d1892f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java @@ -367,8 +367,12 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, /** For internal use only. May be removed or replaced in the future. */ public void clearInternalWidths() { - // Intentional removal of cols in compatibility package - int cols = DEFAULT_COLUMN_COUNT; + int cols = -1; + if (getColumns() > 0) { + cols = getColumns(); + } else { + cols = DEFAULT_COLUMN_COUNT; + } if (cols >= 0) { String colWidth = cols + "em"; 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 6fe94fa5a5..1de28c832a 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 @@ -51,15 +51,21 @@ public abstract class OptionGroupBaseConnector extends AbstractFieldConnector getWidget().nullSelectionItemAvailable = uidl .getBooleanAttribute("nullselectitem"); - // Support for cols has been dropped. - + if (uidl.hasAttribute("cols")) { + getWidget().cols = uidl.getIntAttribute("cols"); + } if (uidl.hasAttribute("rows")) { getWidget().rows = uidl.getIntAttribute("rows"); } final UIDL ops = uidl.getChildUIDL(0); - // Method getColumns has been removed + if (getWidget().getColumns() > 0) { + getWidget().container.setWidth(getWidget().getColumns() + "em"); + if (getWidget().container != getWidget().optionsContainer) { + getWidget().optionsContainer.setWidth("100%"); + } + } getWidget().buildOptions(ops); |