com.google.gwt.http.client.UrlBuilder Java Examples
The following examples show how to use
com.google.gwt.http.client.UrlBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopPanel.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public void execute() { final String queryParam = LocaleInfo.getLocaleQueryParam(); Command savecmd = new SaveAction(); savecmd.execute(); if (queryParam != null) { UrlBuilder builder = Window.Location.createUrlBuilder().setParameter( queryParam, localeName); Window.Location.replace(builder.buildString()); } else { // If we are using only cookies, just reload Window.Location.reload(); } }
Example #2
Source File: BackendService.java From mvn-golang with Apache License 2.0 | 5 votes |
private static String makeUrlForResource(final String path) { final UrlBuilder urlBuilder = new UrlBuilder(); urlBuilder.setHost(Window.Location.getHost()); urlBuilder.setPath(path); final String port = Window.Location.getPort(); if (!port.isEmpty()) { urlBuilder.setPort(Integer.parseInt(port)); } return urlBuilder.buildString(); }
Example #3
Source File: Editor.java From proarc with GNU General Public License v3.0 | 5 votes |
/** * Switches the application locale. * @param locale new locale */ private void switchLocale(String locale) { UrlBuilder urlBuilder = Window.Location.createUrlBuilder(); urlBuilder.setParameter(LOCALE_ATTRIBUTE, locale); String url = urlBuilder.buildString(); Window.Location.assign(url); }
Example #4
Source File: WebClient.java From swellrt with Apache License 2.0 | 5 votes |
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); 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; } }); }
Example #5
Source File: WebClient.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
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); 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; } }); }