diff options
author | Henri Sara <hesara@vaadin.com> | 2016-07-14 15:14:18 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-08-11 10:01:04 +0000 |
commit | fd3617bba2d758ad78689116cfe444d6bfbc1664 (patch) | |
tree | 4c7e7c0e7e7f3b8ac2d2f532896e862ff418f50e | |
parent | 5e75657b387a99993ec17b03ab97bc32884fef80 (diff) | |
download | vaadin-framework-fd3617bba2d758ad78689116cfe444d6bfbc1664.tar.gz vaadin-framework-fd3617bba2d758ad78689116cfe444d6bfbc1664.zip |
Remove deprecated column based width support from selects
Change-Id: I233f205d3d0d7c0cf59e55531de09b7807d73548
10 files changed, 1 insertions, 246 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java b/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java index ce75043d89..703c0e3090 100644 --- a/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java +++ b/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java @@ -59,9 +59,6 @@ public abstract class VOptionGroupBase extends Composite implements Field, private boolean readonly; /** 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; /** For internal use only. May be removed or replaced in the future. */ @@ -138,15 +135,6 @@ public abstract class VOptionGroupBase extends Composite implements Field, /** * 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. - * * @return "rows" specified in uidl, 0 if not specified */ public int getRows() { diff --git a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java index 853bd8d456..8495a25f68 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java @@ -363,12 +363,7 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, /** For internal use only. May be removed or replaced in the future. */ public void clearInternalWidths() { - int cols = -1; - if (getColumns() > 0) { - cols = getColumns(); - } else { - cols = DEFAULT_COLUMN_COUNT; - } + int cols = DEFAULT_COLUMN_COUNT; if (cols >= 0) { String colWidth = cols + "em"; diff --git a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java index 0757bc395b..4c5a8b9dea 100644 --- a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java @@ -51,22 +51,12 @@ public abstract class OptionGroupBaseConnector extends AbstractFieldConnector getWidget().nullSelectionItemAvailable = uidl .getBooleanAttribute("nullselectitem"); - if (uidl.hasAttribute("cols")) { - getWidget().cols = uidl.getIntAttribute("cols"); - } if (uidl.hasAttribute("rows")) { getWidget().rows = uidl.getIntAttribute("rows"); } final UIDL ops = uidl.getChildUIDL(0); - if (getWidget().getColumns() > 0) { - getWidget().container.setWidth(getWidget().getColumns() + "em"); - if (getWidget().container != getWidget().optionsContainer) { - getWidget().optionsContainer.setWidth("100%"); - } - } - getWidget().buildOptions(ops); if (uidl.getBooleanAttribute("allownewitem")) { diff --git a/server/src/main/java/com/vaadin/ui/ListSelect.java b/server/src/main/java/com/vaadin/ui/ListSelect.java index c8ed8e5854..b340e701ad 100644 --- a/server/src/main/java/com/vaadin/ui/ListSelect.java +++ b/server/src/main/java/com/vaadin/ui/ListSelect.java @@ -29,7 +29,6 @@ import com.vaadin.server.PaintTarget; @SuppressWarnings("serial") public class ListSelect extends AbstractSelect { - private int columns = 0; private int rows = 0; public ListSelect() { @@ -48,46 +47,6 @@ public class ListSelect extends AbstractSelect { super(caption); } - /** - * Sets the width of the component so that it can display approximately the - * given number of letters. - * <p> - * Calling {@code setColumns(10);} is equivalent to calling - * {@code setWidth("10em");} - * </p> - * - * @deprecated As of 7.0. "Columns" does not reflect the exact number of - * characters that will be displayed. It is better to use - * setWidth together with "em" to control the width of the - * field. - * @param columns - * the number of columns to set. - */ - @Deprecated - public void setColumns(int columns) { - if (columns < 0) { - columns = 0; - } - if (this.columns != columns) { - this.columns = columns; - markAsDirty(); - } - } - - /** - * Gets the number of columns for the component. - * - * @see #setColumns(int) - * @deprecated As of 7.0. "Columns" does not reflect the exact number of - * characters that will be displayed. It is better to use - * setWidth together with "em" to control the width of the - * field. - */ - @Deprecated - public int getColumns() { - return columns; - } - public int getRows() { return rows; } @@ -112,10 +71,6 @@ public class ListSelect extends AbstractSelect { @Override public void paintContent(PaintTarget target) throws PaintException { - // Adds the number of columns - if (columns != 0) { - target.addAttribute("cols", columns); - } // Adds the number of rows if (rows != 0) { target.addAttribute("rows", rows); diff --git a/server/src/main/java/com/vaadin/ui/NativeSelect.java b/server/src/main/java/com/vaadin/ui/NativeSelect.java index 9dbd85e386..c7af478428 100644 --- a/server/src/main/java/com/vaadin/ui/NativeSelect.java +++ b/server/src/main/java/com/vaadin/ui/NativeSelect.java @@ -25,8 +25,6 @@ import com.vaadin.event.FieldEvents.BlurListener; import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcImpl; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; -import com.vaadin.server.PaintException; -import com.vaadin.server.PaintTarget; /** * This is a simple drop-down select without, for instance, support for @@ -38,9 +36,6 @@ import com.vaadin.server.PaintTarget; public class NativeSelect extends AbstractSelect implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { - // width in characters, mimics TextField - private int columns = 0; - FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) { @Override @@ -69,56 +64,6 @@ public class NativeSelect extends AbstractSelect implements registerRpc(focusBlurRpc); } - /** - * Sets the width of the component so that it can display approximately the - * given number of letters. - * <p> - * Calling {@code setColumns(10);} is equivalent to calling - * {@code setWidth("10em");} - * </p> - * - * @deprecated As of 7.0. "Columns" does not reflect the exact number of - * characters that will be displayed. It is better to use - * setWidth together with "em" to control the width of the - * field. - * @param columns - * the number of columns to set. - */ - @Deprecated - public void setColumns(int columns) { - if (columns < 0) { - columns = 0; - } - if (this.columns != columns) { - this.columns = columns; - markAsDirty(); - } - } - - /** - * Gets the number of columns for the component. - * - * @see #setColumns(int) - * @deprecated As of 7.0. "Columns" does not reflect the exact number of - * characters that will be displayed. It is better to use - * setWidth together with "em" to control the width of the - * field. - */ - @Deprecated - public int getColumns() { - return columns; - } - - @Override - public void paintContent(PaintTarget target) throws PaintException { - // Adds the number of columns - if (columns != 0) { - target.addAttribute("cols", columns); - } - - super.paintContent(target); - } - @Override public void setMultiSelect(boolean multiSelect) throws UnsupportedOperationException { diff --git a/server/src/main/java/com/vaadin/ui/TwinColSelect.java b/server/src/main/java/com/vaadin/ui/TwinColSelect.java index 06e06c3396..60ab09b24c 100644 --- a/server/src/main/java/com/vaadin/ui/TwinColSelect.java +++ b/server/src/main/java/com/vaadin/ui/TwinColSelect.java @@ -31,7 +31,6 @@ import com.vaadin.shared.ui.twincolselect.TwinColSelectState; @SuppressWarnings("serial") public class TwinColSelect extends AbstractSelect { - private int columns = 0; private int rows = 0; private String leftColumnCaption; @@ -62,46 +61,6 @@ public class TwinColSelect extends AbstractSelect { setMultiSelect(true); } - /** - * Sets the width of the component so that it displays approximately the - * given number of letters in each of the two selects. - * <p> - * Calling {@code setColumns(10);} is roughly equivalent to calling - * {@code setWidth((10*2+4)+"10em");} - * </p> - * - * @deprecated As of 7.0. "Columns" does not reflect the exact number of - * characters that will be displayed. It is better to use - * setWidth together with "em" to control the width of the - * field. - * @param columns - * the number of columns to set. - */ - @Deprecated - public void setColumns(int columns) { - if (columns < 0) { - columns = 0; - } - if (this.columns != columns) { - this.columns = columns; - markAsDirty(); - } - } - - /** - * Gets the number of columns for the component. - * - * @see #setColumns(int) - * @deprecated As of 7.0. "Columns" does not reflect the exact number of - * characters that will be displayed. It is better to use - * setWidth together with "em" to control the width of the - * field. - */ - @Deprecated - public int getColumns() { - return columns; - } - public int getRows() { return rows; } @@ -142,9 +101,6 @@ public class TwinColSelect extends AbstractSelect { @Override public void paintContent(PaintTarget target) throws PaintException { // Adds the number of columns - if (columns != 0) { - target.addAttribute("cols", columns); - } // Adds the number of rows if (rows != 0) { target.addAttribute("rows", rows); diff --git a/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelects.java b/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelects.java index 8998fd3a3d..fcd38dfc9c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelects.java +++ b/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelects.java @@ -14,13 +14,6 @@ public class ListSelects extends AbstractSelectTestCase<ListSelect> { } }; - private Command<ListSelect, Integer> colsCommand = new Command<ListSelect, Integer>() { - @Override - public void execute(ListSelect c, Integer value, Object data) { - c.setColumns(value); - } - }; - @Override protected Class<ListSelect> getTestClass() { return ListSelect.class; @@ -30,7 +23,6 @@ public class ListSelects extends AbstractSelectTestCase<ListSelect> { protected void createActions() { super.createActions(); createRowsAction(CATEGORY_FEATURES); - createColsAction(CATEGORY_FEATURES); } private void createRowsAction(String category) { @@ -38,9 +30,4 @@ public class ListSelects extends AbstractSelectTestCase<ListSelect> { createSelectAction("Rows", category, options, "0", rowsCommand); } - private void createColsAction(String category) { - LinkedHashMap<String, Integer> options = createIntegerOptions(20); - createSelectAction("Columns", category, options, "0", colsCommand); - } - } diff --git a/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelects.java b/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelects.java index 80b088f03a..5a78010d9b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelects.java +++ b/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelects.java @@ -1,7 +1,5 @@ package com.vaadin.tests.components.nativeselect; -import java.util.LinkedHashMap; - import com.vaadin.tests.components.select.AbstractSelectTestCase; import com.vaadin.ui.NativeSelect; @@ -15,29 +13,6 @@ public class NativeSelects extends AbstractSelectTestCase<NativeSelect> { @Override protected void createActions() { super.createActions(); - createColumnSelectAction(); - } - - private void createColumnSelectAction() { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); - options.put("-", 0); - for (int i = 1; i <= 10; i++) { - options.put(String.valueOf(i), i); - } - options.put("50", 50); - options.put("100", 100); - options.put("1000", 1000); - - super.createSelectAction("Columns", CATEGORY_DATA_SOURCE, options, "-", - columnsAction); - } - private Command<NativeSelect, Integer> columnsAction = new Command<NativeSelect, Integer>() { - - @Override - public void execute(NativeSelect c, Integer value, Object data) { - c.setColumns(value); - } - }; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/select/TwinColSelectTest.java b/uitest/src/main/java/com/vaadin/tests/components/select/TwinColSelectTest.java index b27dfa0ec8..de92ba9e81 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/select/TwinColSelectTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/select/TwinColSelectTest.java @@ -13,13 +13,6 @@ public class TwinColSelectTest extends AbstractSelectTestCase<TwinColSelect> { } }; - private Command<TwinColSelect, Integer> colsCommand = new Command<TwinColSelect, Integer>() { - @Override - public void execute(TwinColSelect c, Integer value, Object data) { - c.setColumns(value); - } - }; - private Command<TwinColSelect, String> leftColumnCaptionCommand = new Command<TwinColSelect, String>() { @Override @@ -45,7 +38,6 @@ public class TwinColSelectTest extends AbstractSelectTestCase<TwinColSelect> { protected void createActions() { super.createActions(); createRowsAction(CATEGORY_FEATURES); - createColsAction(CATEGORY_FEATURES); createCaptionActions(CATEGORY_FEATURES); } @@ -54,11 +46,6 @@ public class TwinColSelectTest extends AbstractSelectTestCase<TwinColSelect> { createSelectAction("Rows", category, options, "0", rowsCommand); } - private void createColsAction(String category) { - LinkedHashMap<String, Integer> options = createIntegerOptions(20); - createSelectAction("Columns", category, options, "0", colsCommand); - } - private void createCaptionActions(String category) { createSelectAction("Left column caption", category, createCaptionOptions(), "-", leftColumnCaptionCommand); diff --git a/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java b/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java index fc1b11bb94..25c2bed741 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java +++ b/uitest/src/main/java/com/vaadin/tests/components/twincolselect/TwinColSelects.java @@ -15,25 +15,9 @@ public class TwinColSelects extends AbstractSelectTestCase<TwinColSelect> { @Override protected void createActions() { super.createActions(); - createColumnSelectAction(); createRowSelectAction(); } - private void createColumnSelectAction() { - LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); - options.put("-", 0); - for (int i = 1; i <= 10; i++) { - options.put(String.valueOf(i), i); - } - options.put("50", 50); - options.put("100", 100); - options.put("1000", 1000); - - super.createSelectAction("Columns", CATEGORY_DATA_SOURCE, options, "-", - columnsAction); - - } - private void createRowSelectAction() { LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>(); options.put("-", 0); @@ -49,13 +33,6 @@ public class TwinColSelects extends AbstractSelectTestCase<TwinColSelect> { } - private Command<TwinColSelect, Integer> columnsAction = new Command<TwinColSelect, Integer>() { - - @Override - public void execute(TwinColSelect c, Integer value, Object data) { - c.setColumns(value); - } - }; private Command<TwinColSelect, Integer> rowsAction = new Command<TwinColSelect, Integer>() { @Override |