List of usage examples for com.google.gwt.user.client Window setTitle
public static void setTitle(String title)
From source file:org.glom.web.client.activity.TableSelectionActivity.java
License:Open Source License
/** * Invoked by the ActivityManager to start a new Activity *//*from w ww . j a v a2 s . com*/ @Override public void start(final AcceptsOneWidget containerWidget, final EventBus eventBus) { final TableSelectionView tableSelectionView = clientFactory.getTableSelectionView(); tableSelectionView.setPresenter(this); // TODO: Check for authentication here? // Or just let it fail to retrieve the list of tables, // and let the other activity on the page ask for authentication. // For table changes with the tableSelector: final HasChangeHandlers tableSelector = tableSelectionView.getTableSelector(); tableChangeHandlerRegistration = tableSelector.addChangeHandler(new ChangeHandler() { @Override public void onChange(final ChangeEvent event) { // Fire a table change event so that other views (e.g. the details view) know about the change and can // update themselves. eventBus.fireEvent(new TableChangeEvent(tableSelectionView.getSelectedTableName())); // Update the browser title because there's a place change and the setPlace() method will not be called. Window.setTitle(documentTitle + ": " + tableSelectionView.getSelectedTableTitle()); } }); // For quick find changes with the quick find box: final HasChangeHandlers quickFindBox = tableSelectionView.getQuickFindBox(); quickFindChangeHandlerRegistration = quickFindBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(final ChangeEvent event) { // Fire a quickfind change event so that other views (e.g. the details view) know about the change and // can // update themselves. eventBus.fireEvent(new QuickFindChangeEvent(tableSelectionView.getQuickFindText())); // Update the browser title because there's place change and the setPlace() method will not be called. // TODO? Window.setTitle(documentTitle + ": " + tableSelectionView.getSelectedTableTitle()); } }); // For locale changes with the localeSelector: final HasChangeHandlers localeSelector = tableSelectionView.getLocaleSelector(); localeChangeHandlerRegistration = localeSelector.addChangeHandler(new ChangeHandler() { @Override public void onChange(final ChangeEvent event) { // Show the translated version of the document title and the table names: final String localeID = tableSelectionView.getSelectedLocale(); fillView(tableSelectionView); final String newURL = Window.Location.createUrlBuilder() .setParameter(LocaleInfo.getLocaleQueryParam(), localeID).buildString(); Window.Location.assign(newURL); // Fire a locale change event so that other views (e.g. the details view) know about the change and can // update themselves. eventBus.fireEvent(new LocaleChangeEvent(localeID)); } }); // For report choices with the reportSelector: final HasChangeHandlers reportSelector = tableSelectionView.getReportSelector(); reportChangeHandlerRegistration = reportSelector.addChangeHandler(new ChangeHandler() { @Override public void onChange(final ChangeEvent event) { final String reportName = tableSelectionView.getSelectedReport(); if (StringUtils.isEmpty(reportName)) { // Interpret selecting no report as requesting the list view. goTo(new ListPlace(documentID, tableName, quickFind)); } else { // Show the selected report: goTo(new ReportPlace(documentID, tableName, reportName, quickFind)); } } }); fillView(tableSelectionView); // we're done, set the widget containerWidget.setWidget(tableSelectionView.asWidget()); }
From source file:org.glom.web.client.activity.TableSelectionActivity.java
License:Open Source License
private void fillView(final TableSelectionView tableSelectionView) { // get the table names, table titles and default table index for the current document final AsyncCallback<DocumentInfo> callback = new AsyncCallback<DocumentInfo>() { @Override/* ww w. java2 s . c o m*/ public void onFailure(final Throwable caught) { // TODO: create a way to notify users of asynchronous callback failures GWT.log("AsyncCallback Failed: OnlineGlomService.getDocumentInfo(): " + caught.getMessage()); } @Override public void onSuccess(final DocumentInfo result) { tableSelectionView.setTableSelection(result.getTableNames(), result.getTableTitles()); if (StringUtils.isEmpty(tableName)) { final ArrayList<String> tableNames = result.getTableNames(); if (tableNames != null) { tableName = tableNames.get(result.getDefaultTableIndex()); } } tableSelectionView.setSelectedTableName(tableName); tableSelectionView.setLocaleList(result.getLocaleIDs(), result.getLocaleTitles()); // Show what locale is currently being used: String localeIDForCombo = Utils.getCurrentLocaleID(); // Indicate that we use English if no other locale has been specified by either // the URL or the configuration. // Alternatively we could also show the locale in the URL, even if it is en. if (StringUtils.isEmpty(localeIDForCombo)) { localeIDForCombo = "en"; } tableSelectionView.setSelectedLocale(localeIDForCombo); documentTitle = result.getTitle(); tableSelectionView.setDocumentTitle(documentTitle); Window.setTitle(documentTitle + ": " + tableSelectionView.getSelectedTableTitle()); } }; final String localeID = Utils.getCurrentLocaleID(); OnlineGlomServiceAsync.Util.getInstance().getDocumentInfo(documentID, localeID, callback); // get the reports list for the current table: final AsyncCallback<Reports> callback_report = new AsyncCallback<Reports>() { @Override public void onFailure(final Throwable caught) { // TODO: create a way to notify users of asynchronous callback failures GWT.log("AsyncCallback Failed: OnlineGlomService.getReportsList(): " + caught.getMessage()); } @Override public void onSuccess(final Reports result) { tableSelectionView.setReportList(result); // Show the selected report name again: // TODO: Avoid duplication in ReportActivity. tableSelectionView.setSelectedReport(reportName); } }; OnlineGlomServiceAsync.Util.getInstance().getReportsList(documentID, tableName, localeID, callback_report); // Show the quickFind text that was specified by the URL token: tableSelectionView.setQuickFindText(quickFind); }
From source file:org.gwtportlets.portlet.client.ui.PagePortlet.java
License:Open Source License
private void updateTitle() { String title = null, windowTitle; if (titlePortlet != null) { title = titlePortlet.getWidgetTitle(); }//from ww w . j a v a2 s . c o m if (title != null && !title.equals(appTitle)) { windowTitle = prefix + title; } else { title = windowTitle = appTitle; } if (!title.equals(currentTitle)) { Window.setTitle(windowTitle); currentTitle = title; } BroadcastManager.get().broadcast(new PageTitleChangeEvent(this, title)); }
From source file:org.n52.client.ui.Header.java
License:Open Source License
private Label getImprintLink() { Label imprint = getHeaderLinkLabel(i18n.Impressum()); imprint.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { com.smartgwt.client.widgets.Window w = new com.smartgwt.client.widgets.Window(); w.setTitle(i18n.Impressum()); w.setWidth(450);//from w ww .j a v a 2s.c o m w.setHeight(460); w.centerInPage(); w.setIsModal(true); VLayout layout = new VLayout(); HTMLPane pane = new HTMLPane(); pane.setContentsURL(i18n.imprintPath()); layout.setStyleName("n52_sensorweb_client_imprint_content"); layout.addMember(pane); w.addItem(layout); w.show(); } }); return imprint; }
From source file:org.nsesa.editor.gwt.editor.client.Editor.java
License:EUPL
/** * Registers the listeners./*from w ww . ja v a 2 s . c o m*/ */ protected void registerEventListeners() { // register the basic event listeners final EventBus eventBus = clientFactory.getEventBus(); // deal with critical errors eventBus.addHandler(CriticalErrorEvent.TYPE, new CriticalErrorEventHandler() { @Override public void onEvent(CriticalErrorEvent event) { handleError(clientFactory.getCoreMessages().errorTitleDefault(), event.getMessage(), event.getThrowable()); } }); // deal with information events eventBus.addHandler(InformationEvent.TYPE, new InformationEventHandler() { @Override public void onEvent(InformationEvent event) { handleInformation(event.getTitle(), event.getMessage()); } }); // deal with confirmations eventBus.addHandler(ConfirmationEvent.TYPE, new ConfirmationEventHandler() { @Override public void onEvent(ConfirmationEvent event) { handleConfirmation(event.getTitle(), event.getMessage(), event.getConfirmationButtonText(), event.getConfirmationHandler(), event.getCancelButtonText(), event.getCancelHandler()); } }); // handle login & logout eventBus.addHandler(AuthenticatedEvent.TYPE, new AuthenticatedEventHandler() { @Override public void onEvent(AuthenticatedEvent event) { final ClientContext clientContext = event.getClientContext(); clientFactory.setClientContext(clientContext); LOG.info("User authenticated as " + clientContext.getLoggedInPerson().getUsername() + " with roles: " + (clientContext.getRoles() != null ? Arrays.asList(clientContext.getRoles()) : "[NONE]")); // we're authenticated, time for bootstrapping the rest of the application eventBus.fireEvent(new BootstrapEvent(clientContext)); } }); // handle updates to the window title eventBus.addHandler(SetWindowTitleEvent.TYPE, new SetWindowTitleEventHandler() { @Override public void onEvent(SetWindowTitleEvent event) { LOG.info("Setting window.title to " + event.getTitle()); Window.setTitle(event.getTitle()); } }); // add notification events eventBus.addHandler(NotificationEvent.TYPE, new NotificationEventHandler() { @Override public void onEvent(NotificationEvent event) { LOG.info("Showing notification: '" + event.getMessage() + "' for " + event.getDuration() + " seconds."); handleNotification(event.getMessage(), event.getDuration()); } }); // handle browser window resizing Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { clientFactory.getScheduler().scheduleDeferred(new Command() { @Override public void execute() { eventBus.fireEvent(new org.nsesa.editor.gwt.core.client.event.ResizeEvent( Window.getClientHeight(), Window.getClientWidth())); } }); } }); // handle locale change requests eventBus.addHandler(LocaleChangeEvent.TYPE, new LocaleChangeEventHandler() { @Override public void onEvent(LocaleChangeEvent event) { LOG.info("Changing UI language to " + event.getLocale()); Window.Location.assign(Window.Location.createUrlBuilder() .setParameter(LocaleInfo.getLocaleQueryParam(), event.getLocale()).buildString()); } }); }
From source file:org.onebusaway.webapp.gwt.common.ExceptionPage.java
License:Apache License
@Override public Widget create(Context context) throws PageException { String message = context.getParam("message"); FlowPanel panel = new FlowPanel(); if (message != null) panel.add(new DivWidget(message)); Window.setTitle("ERROR"); return panel; }
From source file:org.onebusaway.webapp.gwt.oba_application.view.ExceptionPage.java
License:Apache License
@Override public Widget create(Context context) throws PageException { String message = context.getParam("message"); FlowPanel panel = new FlowPanel(); if (message != null) panel.add(new DivWidget(message, "ExceptionPage-Error")); Window.setTitle("ERROR"); return panel; }
From source file:org.opennms.features.poller.remote.gwt.client.DefaultApplicationView.java
License:Open Source License
private void setupWindow() { Window.setTitle("OpenNMS - Remote Monitor"); Window.enableScrolling(false); Window.setMargin("0px"); Window.addResizeHandler(this); }
From source file:org.openremote.manager.client.app.AppControllerImpl.java
License:Open Source License
@Override public void start() { Window.setTitle(Constants.APP_NAME); RootPanel.get().add(appView);// w w w. j av a 2 s. c o m appView.setPresenter(this); placeHistoryHandler.handleCurrentHistory(); }
From source file:org.openxdata.designer.client.util.FormDesignerUtil.java
/** * Sets the title of the form designer./* www.j a v a2 s . c o m*/ */ public static void setDesignerTitle() { String s = FormUtil.getDivValue("title"); if (s != null && s.trim().length() > 0) title = s; Window.setTitle(title); }