Преглед изворни кода

Moved ComboBox suggestion popup width to shared state

Change-Id: Ic6da82bc309d90d769e9967feee7fb8a58e9fffc
feature/eventbus
Henri Sara пре 7 година
родитељ
комит
020fe73bfd

+ 2
- 7
client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java Прегледај датотеку



getWidget().filteringmode = getState().filteringMode; getWidget().filteringmode = getState().filteringMode;


getWidget().suggestionPopupWidth = getState().suggestionPopupWidth;

Profiler.leave("ComboBoxConnector.onStateChanged update content"); Profiler.leave("ComboBoxConnector.onStateChanged update content");
} }




getWidget().currentPage = uidl.getIntVariable("page"); getWidget().currentPage = uidl.getIntVariable("page");


if (uidl.hasAttribute("suggestionPopupWidth")) {
getWidget().suggestionPopupWidth = uidl
.getStringAttribute("suggestionPopupWidth");
} else {
getWidget().suggestionPopupWidth = null;
}

getWidget().suggestionPopup.updateStyleNames(getState()); getWidget().suggestionPopup.updateStyleNames(getState());


getWidget().allowNewItem = uidl.hasAttribute("allownewitem"); getWidget().allowNewItem = uidl.hasAttribute("allownewitem");

+ 2
- 10
server/src/main/java/com/vaadin/ui/ComboBox.java Прегледај датотеку

*/ */
private boolean scrollToSelectedItem = true; private boolean scrollToSelectedItem = true;


private String suggestionPopupWidth = null;

/** /**
* If text input is not allowed, the ComboBox behaves like a pretty * If text input is not allowed, the ComboBox behaves like a pretty
* NativeSelect - the user can not enter any text and clicking the text * NativeSelect - the user can not enter any text and clicking the text
String[] selectedKeys = new String[(getValue() == null String[] selectedKeys = new String[(getValue() == null
&& getNullSelectionItemId() == null ? 0 : 1)]; && getNullSelectionItemId() == null ? 0 : 1)];


if (suggestionPopupWidth != null) {
target.addAttribute("suggestionPopupWidth",
suggestionPopupWidth);
}

// Paints the options and create array of selected id keys // Paints the options and create array of selected id keys
int keyIndex = 0; int keyIndex = 0;


* @since 7.7 * @since 7.7
*/ */
public String getPopupWidth() { public String getPopupWidth() {
return suggestionPopupWidth;
return getState(false).suggestionPopupWidth;
} }


/** /**
* the width * the width
*/ */
public void setPopupWidth(String width) { public void setPopupWidth(String width) {
suggestionPopupWidth = width;
markAsDirty();
getState().suggestionPopupWidth = width;
} }


/** /**

+ 7
- 0
shared/src/main/java/com/vaadin/shared/ui/combobox/ComboBoxState.java Прегледај датотеку

*/ */
public FilteringMode filteringMode = FilteringMode.STARTSWITH; public FilteringMode filteringMode = FilteringMode.STARTSWITH;


/**
* Suggestion pop-up's width as a CSS string. By using relative units (e.g.
* "50%") it's possible to set the popup's width relative to the ComboBox
* itself.
*/
public String suggestionPopupWidth = null;

} }

Loading…
Откажи
Сачувај