summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Koivisto <markus@vaadin.com>2014-07-31 16:34:08 +0300
committerMarkus Koivisto <markus@vaadin.com>2014-07-31 16:34:08 +0300
commit9c5637fce80329900b993bd7745958e886da10a0 (patch)
treedd4b868fc2a0112f0e187028f87e8a3f878e8770
parentd45e5c2592a3b949d781cdd05532560375fc524e (diff)
downloadvaadin-framework-9c5637fce80329900b993bd7745958e886da10a0.tar.gz
vaadin-framework-9c5637fce80329900b993bd7745958e886da10a0.zip
Revert "Fixed regression with changing widths when stylenames have changed (#13444, #8801):"
This reverts commit d45e5c2592a3b949d781cdd05532560375fc524e. this is not supposed to be picked before 7.3.0
-rw-r--r--client/src/com/vaadin/client/ui/VFilterSelect.java77
-rw-r--r--client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboboxStyleChangeWidthTest.java2
3 files changed, 32 insertions, 53 deletions
diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java
index cb30f377d7..f35d0bdcdd 100644
--- a/client/src/com/vaadin/client/ui/VFilterSelect.java
+++ b/client/src/com/vaadin/client/ui/VFilterSelect.java
@@ -81,7 +81,7 @@ import com.vaadin.shared.ui.combobox.FilteringMode;
/**
* Client side implementation of the Select component.
- *
+ *
* TODO needs major refactoring (to be extensible etc)
*/
@SuppressWarnings("deprecation")
@@ -101,7 +101,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Constructor
- *
+ *
* @param uidl
* The UIDL recieved from the server
*/
@@ -150,7 +150,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Get the option key which represents the item on the server side.
- *
+ *
* @return The key of the item
*/
public String getOptionKey() {
@@ -159,7 +159,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Get the URI of the icon. Used when constructing the displayed option.
- *
+ *
* @return
*/
public String getIconUri() {
@@ -253,7 +253,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Shows the popup where the user can see the filtered options
- *
+ *
* @param currentSuggestions
* The filtered suggestions
* @param currentPage
@@ -336,7 +336,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Should the next page button be visible to the user?
- *
+ *
* @param active
*/
private void setNextButtonActive(boolean active) {
@@ -356,7 +356,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Should the previous page button be visible to the user
- *
+ *
* @param active
*/
private void setPrevButtonActive(boolean active) {
@@ -411,7 +411,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Select the first item of the suggestions list popup.
- *
+ *
* @since
*/
public void selectFirstItem() {
@@ -421,7 +421,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Select the last item of the suggestions list popup.
- *
+ *
* @since
*/
public void selectLastItem() {
@@ -547,7 +547,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* amount of items are visible at a time and a scrollbar or buttons are
* visible to change page. If paging is turned of then all options are
* rendered into the popup menu.
- *
+ *
* @param paging
* Should the paging be turned on?
*/
@@ -672,7 +672,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Was the popup just closed?
- *
+ *
* @return true if popup was just closed
*/
public boolean isJustClosed() {
@@ -701,7 +701,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Updates style names in suggestion popup to help theme building.
- *
+ *
* @param uidl
* UIDL for the whole combo box
* @param componentState
@@ -792,7 +792,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Sets the suggestions rendered in the menu
- *
+ *
* @param suggestions
* The suggestions to be rendered in the menu
*/
@@ -1039,7 +1039,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* TextBox variant used as input element for filter selects, which prevents
* selecting text when disabled.
- *
+ *
* @since 7.1.5
*/
public class FilterSelectTextBox extends TextBox {
@@ -1291,7 +1291,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* It is invoked during the Constructor and should only be overridden if a
* custom TextBox shall be used. The overriding method cannot use any
* instance variables.
- *
+ *
* @since 7.1.5
* @return TextBox instance used by this VFilterSelect
*/
@@ -1304,7 +1304,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* instance. It is invoked during the Constructor and should only be
* overridden if a custom SuggestionPopup shall be used. The overriding
* method cannot use any instance variables.
- *
+ *
* @since 7.1.5
* @return SuggestionPopup instance used by this VFilterSelect
*/
@@ -1332,7 +1332,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Does the Select have more pages?
- *
+ *
* @return true if a next page exists, else false if the current page is the
* last page
*/
@@ -1347,7 +1347,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Filters the options at a certain page. Uses the text box input as a
* filter
- *
+ *
* @param page
* The page which items are to be filtered
*/
@@ -1357,7 +1357,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Filters the options at certain page using the given filter
- *
+ *
* @param page
* The page to filter
* @param filter
@@ -1369,7 +1369,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Filters the options at certain page using the given filter
- *
+ *
* @param page
* The page to filter
* @param filter
@@ -1436,7 +1436,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Sets the text in the text box.
- *
+ *
* @param text
* the text to set in the text box
*/
@@ -1465,7 +1465,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* shown in the text box if nothing has been entered.
* <p>
* For internal use only. May be removed or replaced in the future.
- *
+ *
* @param text
* The text the text box should contain.
*/
@@ -1480,7 +1480,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a suggestion is selected
- *
+ *
* @param suggestion
* The suggestion that just got selected.
*/
@@ -1523,7 +1523,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Sets the icon URI of the selected item. The icon is shown on the left
* side of the item caption text. Set the URI to null to remove the icon.
- *
+ *
* @param iconUri
* The URI of the icon
*/
@@ -1649,7 +1649,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a key is pressed in the text box
- *
+ *
* @param event
* The KeyDownEvent
*/
@@ -1694,7 +1694,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a key was pressed in the suggestion popup.
- *
+ *
* @param event
* The KeyDownEvent of the key
*/
@@ -1790,7 +1790,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a key was depressed
- *
+ *
* @param event
* The KeyUpEvent of the key depressed
*/
@@ -2073,7 +2073,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
public void updateRootWidth() {
ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
-
if (paintable.isUndefinedWidth()) {
/*
@@ -2098,25 +2097,11 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
String originalBorder = style.getBorderWidth();
style.setPaddingLeft(0, Unit.PX);
style.setBorderWidth(0, Unit.PX);
+ int offset = w - Util.getRequiredWidth(this);
style.setProperty("padding", originalPadding);
style.setProperty("borderWidth", originalBorder);
- // Use util.getRequiredWidth instead of getOffsetWidth here
-
- int iconWidth = selectedItemIcon == null ? 0 : Util
- .getRequiredWidth(selectedItemIcon);
- int buttonWidth = popupOpener == null ? 0 : Util
- .getRequiredWidth(popupOpener);
-
- /*
- * Instead of setting the width of the wrapper, set the width of
- * the combobox. Subtract the width of the icon and the
- * popupopener
- */
-
- tb.setWidth((suggestionPopupMinWidth - iconWidth - buttonWidth)
- + "px");
-
+ setWidth(suggestionPopupMinWidth + offset + "px");
}
/*
@@ -2134,7 +2119,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Get the width of the select in pixels where the text area and icon has
* been included.
- *
+ *
* @return The width in pixels
*/
private int getMainWidth() {
@@ -2151,7 +2136,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Handles special behavior of the mouse down event
- *
+ *
* @param event
*/
private void handleMouseDownEvent(Event event) {
diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index 7a7366590d..5d3b0aedf0 100644
--- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -44,7 +44,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.client.Paintable#updateFromUIDL(com.vaadin.client.UIDL,
* com.vaadin.client.ApplicationConnection)
*/
@@ -206,11 +206,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().popupOpenerClicked = false;
- /*
- * if this is our first time we need to recalculate the root width.
- */
if (!getWidget().initDone) {
-
getWidget().updateRootWidth();
}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboboxStyleChangeWidthTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboboxStyleChangeWidthTest.java
index 01a3dc7e0f..034319ac70 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboboxStyleChangeWidthTest.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboboxStyleChangeWidthTest.java
@@ -21,7 +21,6 @@ import org.junit.Test;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.ComboBoxElement;
-import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally;
import com.vaadin.tests.tb3.MultiBrowserTest;
/**
@@ -31,7 +30,6 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
* @author Vaadin Ltd
*/
-@RunLocally()
public class ComboboxStyleChangeWidthTest extends MultiBrowserTest {
@Test