List of usage examples for com.google.gwt.dom.client SelectElement setSelectedIndex
public void setSelectedIndex(int index)
From source file:gwtquery.plugins.enhance.client.gwt.ListBoxWidgetFactory.java
License:Apache License
protected void copyAttributes(SelectElement source, SelectElement destination) { destination.setDisabled(source.isDisabled()); destination.setName(source.getName()); destination.setSelectedIndex(source.getSelectedIndex()); destination.setSize(source.getSize()); }
From source file:org.swellrt.webclient.WebClientMod.java
License:Apache License
private void setupLocaleSelect() { final SelectElement select = (SelectElement) Document.get().getElementById("lang"); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); String[] localeNames = LocaleInfo.getAvailableLocaleNames(); for (String locale : localeNames) { if (!DEFAULT_LOCALE.equals(locale)) { String displayName = LocaleInfo.getLocaleNativeDisplayName(locale); OptionElement option = Document.get().createOptionElement(); option.setValue(locale);//from w w w. j a v a2 s .c o m option.setText(displayName); select.add(option, null); if (locale.equals(currentLocale)) { select.setSelectedIndex(select.getLength() - 1); } } } EventDispatcherPanel.of(select).registerChangeHandler(null, new WaveChangeHandler() { @Override public boolean onChange(ChangeEvent event, Element context) { UrlBuilder builder = Location.createUrlBuilder().setParameter("locale", select.getValue()); Window.Location.replace(builder.buildString()); localeService.storeLocale(select.getValue()); return true; } }); }