Browse Source

Revert "Force recalc of width when the ComboBox style has changed. (#13444)"

This reverts commit 4058b7b063.

Revert "Treat initial rendering and style changes separately. (#13444)"

This reverts commit b3d683e974.

Revert "Force recalc of width when the ComboBox style has changed  (#13444)"

This reverts commit 09ca9bc823.

Change-Id: I8c4edb1079be428f5ccb06ff9da396f9ead8501e
tags/7.2.1
Sauli Tähkäpää 10 years ago
parent
commit
be13ed082e

+ 1
- 16
client/src/com/vaadin/client/ui/VFilterSelect.java View File

@@ -1930,20 +1930,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* For internal use only. May be removed or replaced in the future.
*/
public void updateRootWidth() {
updateRootWidth(false);
}

/**
* Calculates the width of the select if the select has undefined width.
* Should be called when the width changes or when the icon changes.
* <p>
* For internal use only. May be removed or replaced in the future.
*
* @param forceUpdate
* a flag that forces a recalculation even if one would not
* normally be done
*/
public void updateRootWidth(boolean forceUpdate) {
ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
if (paintable.isUndefinedWidth()) {
@@ -1956,8 +1942,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* wide.
*/
int w = Util.getRequiredWidth(this);

if (forceUpdate || (!initDone || currentPage + 1 < 0)
if ((!initDone || currentPage + 1 < 0)
&& suggestionPopupMinWidth > w) {
/*
* We want to compensate for the paddings just to preserve the

+ 1
- 27
client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java View File

@@ -24,7 +24,6 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.Paintable;
import com.vaadin.client.UIDL;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.SimpleManagedLayout;
import com.vaadin.client.ui.VFilterSelect;
@@ -44,10 +43,6 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
// update textbox text by a changed item caption.
private boolean oldSuggestionTextMatchTheOldSelection;

// Need to recompute the width of the combobox when styles change, see
// #13444
private boolean stylesChanged;

/*
* (non-Javadoc)
*
@@ -200,17 +195,8 @@ public class ComboBoxConnector extends AbstractFieldConnector implements

getWidget().popupOpenerClicked = false;

/*
* if styles have changed or this is our first time we need to
* recalculate the root width.
*/
if (!getWidget().initDone) {
// no need to force update since we have no existing width
getWidget().updateRootWidth(false);
} else if (stylesChanged) {
// we have previously calculated a width, we must force an update
// due to changed styles
getWidget().updateRootWidth(true);
getWidget().updateRootWidth();
}

// Focus dependent style names are lost during the update, so we add
@@ -219,9 +205,6 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().addStyleDependentName("focus");
}

// width has been recalculated above, clear style change flag
stylesChanged = false;

getWidget().initDone = true;
}

@@ -344,13 +327,4 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().enabled = widgetEnabled;
getWidget().tb.setEnabled(widgetEnabled);
}

@Override
public void onStateChanged(StateChangeEvent event) {
super.onStateChanged(event);
if (event.hasPropertyChanged("styles")) {
stylesChanged = true;
}
}

}

Loading…
Cancel
Save