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

* For internal use only. May be removed or replaced in the future. * For internal use only. May be removed or replaced in the future.
*/ */
public void updateRootWidth() { 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( ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this); this);
if (paintable.isUndefinedWidth()) { if (paintable.isUndefinedWidth()) {
* wide. * wide.
*/ */
int w = Util.getRequiredWidth(this); int w = Util.getRequiredWidth(this);

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

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

import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.Paintable; import com.vaadin.client.Paintable;
import com.vaadin.client.UIDL; import com.vaadin.client.UIDL;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.ui.SimpleManagedLayout;
import com.vaadin.client.ui.VFilterSelect; import com.vaadin.client.ui.VFilterSelect;
// update textbox text by a changed item caption. // update textbox text by a changed item caption.
private boolean oldSuggestionTextMatchTheOldSelection; private boolean oldSuggestionTextMatchTheOldSelection;


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

/* /*
* (non-Javadoc) * (non-Javadoc)
* *


getWidget().popupOpenerClicked = false; getWidget().popupOpenerClicked = false;


/*
* if styles have changed or this is our first time we need to
* recalculate the root width.
*/
if (!getWidget().initDone) { 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 // Focus dependent style names are lost during the update, so we add
getWidget().addStyleDependentName("focus"); getWidget().addStyleDependentName("focus");
} }


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

getWidget().initDone = true; getWidget().initDone = true;
} }


getWidget().enabled = widgetEnabled; getWidget().enabled = widgetEnabled;
getWidget().tb.setEnabled(widgetEnabled); getWidget().tb.setEnabled(widgetEnabled);
} }

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

} }

Loading…
Cancel
Save