Example usage for com.google.gwt.user.client Window setTitle

List of usage examples for com.google.gwt.user.client Window setTitle

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window setTitle.

Prototype

public static void setTitle(String title) 

Source Link

Usage

From source file:org.parallax3d.parallax.tests.client.WebApp.java

License:Open Source License

public void onAppInitialized() {
    final ParallaxTestCases testCases = GWT.create(ParallaxTestCases.class);
    pageIndex = new PageIndex(testCases);
    pageExample = new PageExample(testCases);

    // Setup a history handler to reselect the associate menu item.
    final ValueChangeHandler<String> historyHandler = new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            final ParallaxTest test = testCases
                    .getContentWidgetForToken(event.getValue().replaceFirst("!", ""));

            RootLayoutPanel.get().clear();
            if (test != null) {
                pageExample.addGwtReadyListener(new PageExample.PanelReady() {
                    @Override//w  ww .ja  va2 s.c o  m
                    public void onRenderingReady(GwtRenderingContext rendering) {
                        rendering.setAnimation(test);
                    }
                });
                RootLayoutPanel.get().add(pageExample);

                Window.setTitle("Parallax: " + test.getName());
            } else {
                RootLayoutPanel.get().add(pageIndex);

                History.newItem("", true);
                Window.setTitle("Parallax: Cross-platform Java 3D library");
            }
        }
    };

    History.addValueChangeHandler(historyHandler);
    History.fireCurrentHistoryState();

    // Remove loading panel
    RootPanel.get("loading").getElement().removeFromParent();
}

From source file:org.pentaho.mantle.client.commands.SaveCommand.java

License:Open Source License

protected void performOperation(boolean feedback) {
    final SolutionBrowserPanel navigatorPerspective = SolutionBrowserPanel.getInstance();

    retrieveCachedValues(navigatorPerspective.getContentTabPanel().getCurrentFrame());
    boolean forceReload = false;
    if (FileChooserDialog.getIsDirty()) {
        forceReload = true;//from  w  w w .  ja  v  a  2 s  . co m
        WaitPopup.getInstance().setVisibleById(true, spinnerId);
        FileChooserDialog.setIsDirty(Boolean.FALSE);
    }
    RepositoryFileTreeManager.getInstance().fetchRepositoryFileTree(new AsyncCallback<RepositoryFileTree>() {
        public void onFailure(Throwable caught) {
        }

        public void onSuccess(RepositoryFileTree tree) {

            retrieveCachedValues(navigatorPerspective.getContentTabPanel().getCurrentFrame());
            if (isSaveAs || name == null) {
                String fileDir = "";
                if (path != null && !StringUtils.isEmpty(path)) {
                    // If has extension
                    if (path.endsWith(name)) {
                        fileDir = path.substring(0, path.lastIndexOf("/"));
                    } else {
                        fileDir = path;
                    }

                }
                WaitPopup.getInstance().setVisibleById(false, spinnerId);
                final FileChooserDialog dialog = new FileChooserDialog(FileChooserMode.SAVE, fileDir, tree,
                        false, true, Messages.getString("save"), Messages.getString("save"), //$NON-NLS-1$//$NON-NLS-2$
                        navigatorPerspective.getSolutionTree().isShowHiddenFiles()); //$NON-NLS-3$
                dialog.setSubmitOnEnter(MantleApplication.submitOnEnter);
                if (isSaveAs) {
                    dialog.setTitle(Messages.getString("saveAs")); //$NON-NLS-1$
                    dialog.setText(Messages.getString("saveAs")); //$NON-NLS-1$
                } else {
                    dialog.setTitle(Messages.getString("save")); //$NON-NLS-1$
                    dialog.setText(Messages.getString("save")); //$NON-NLS-1$
                }
                // TODO Uncomment the line below and delete the line after that once gwtwidets have been branched
                dialog.addFileChooserListener(new FileChooserListener() {

                    public void dialogCanceled() {

                    }

                    @Override
                    public void fileSelected(final RepositoryFile file, String filePath, String fileName,
                            String title) {
                        SaveCommand.this.type = SolutionFileInfo.Type.XACTION;
                        SaveCommand.this.name = fileName;
                        SaveCommand.this.path = filePath;
                        tabName = name;
                        if (tabName.indexOf("analysisview.xaction") != -1) {
                            // trim off the analysisview.xaction from the localized-name
                            tabName = tabName.substring(0, tabName.indexOf("analysisview.xaction") - 1);
                        }

                        JsArrayString extensions = getPossibleExtensions(
                                navigatorPerspective.getContentTabPanel().getCurrentFrameElementId());
                        final String fileExtension = extensions.length() == 1 ? extensions.get(0) : null;

                        if (dialog.doesSelectedFileExist(fileExtension)) {
                            dialog.hide();
                            PromptDialogBox overWriteDialog = new PromptDialogBox(
                                    Messages.getString("question"), Messages.getString("yes"), //$NON-NLS-1$//$NON-NLS-2$
                                    Messages.getString("no"), //$NON-NLS-1$
                                    false, true);
                            overWriteDialog
                                    .setContent(new Label(Messages.getString("fileExistsOverwrite"), false)); //$NON-NLS-1$
                            overWriteDialog.setCallback(new IDialogCallback() {
                                public void okPressed() {
                                    if (fileExtension != null && tabName.endsWith(fileExtension)) {
                                        tabName = tabName.substring(0, tabName.lastIndexOf(fileExtension));
                                    }
                                    doSaveAs(navigatorPerspective.getContentTabPanel()
                                            .getCurrentFrameElementId(), name, path, type, true);
                                    Window.setTitle(Messages.getString("productName") + " - " + name); //$NON-NLS-1$ //$NON-NLS-2$
                                    FileChooserDialog.setIsDirty(Boolean.TRUE);
                                    persistFileInfoInFrame();
                                }

                                public void cancelPressed() {
                                    dialog.show();
                                }
                            });
                            overWriteDialog.center();
                        } else {

                            // [Fix for PIR-833]
                            if (file != null && !file.isFolder() && !fileName.equals(title)
                                    && filePath.endsWith(file.getName())) {
                                SaveCommand.this.path = filePath.substring(0,
                                        filePath.lastIndexOf("/" + file.getName()));
                            }

                            doSaveAs(navigatorPerspective.getContentTabPanel().getCurrentFrameElementId(), name,
                                    path, type, true);
                            Window.setTitle(Messages.getString("productName") + " - " + name); //$NON-NLS-1$ //$NON-NLS-2$
                            persistFileInfoInFrame();
                            // navigatorPerspective.addRecent(fullPathWithName, name);
                            clearValues();
                        }
                    }

                    @Override
                    public void fileSelectionChanged(RepositoryFile file, String filePath, String fileName,
                            String title) {
                        // TODO Auto-generated method stub

                    }

                });
                dialog.center();
            } else {
                doSaveAs(navigatorPerspective.getContentTabPanel().getCurrentFrameElementId(), name, path, type,
                        true);
                clearValues();
            }
            WaitPopup.getInstance().setVisibleById(false, spinnerId);
        }
    }, forceReload, null, null, SolutionBrowserPanel.getInstance().getSolutionTree().isShowHiddenFiles());
}

From source file:org.pentaho.mantle.client.MantleEntryPoint.java

License:Open Source License

public void bundleLoaded(String bundleName) {
    Window.setTitle(Messages.getString("productName")); //$NON-NLS-1$

    MantleApplication mantle = MantleApplication.getInstance();
    mantle.loadApplication();// ww  w . ja v  a 2s . c om

    RootPanel loadingPanel = RootPanel.get("loading"); //$NON-NLS-1$
    if (loadingPanel != null) {
        loadingPanel.removeFromParent();
        loadingPanel.setVisible(false);
        loadingPanel.setHeight("0px"); //$NON-NLS-1$
    }
}

From source file:org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPerspective.java

License:Open Source License

public void showContent() {
    int showIndex = -1;
    if (contentTabPanel.getTabCount() == 0) {
        showIndex = contentPanel.getWidgetIndex(launchPanel);
        Window.setTitle(Messages.getString("productName")); //$NON-NLS-1$
    } else {/*from w ww . j  a va2s .  c  o m*/
        showIndex = contentPanel.getWidgetIndex(contentTabPanel);
    }

    if (showIndex != -1) {
        contentPanel.showWidget(showIndex);
    }

    if (contentTabPanel.getSelectedTabIndex() != -1) {
        contentTabPanel.selectTab(contentTabPanel.getSelectedTab());
    }

    // TODO Not sure what event type to pass
    fireSolutionBrowserListenerEvent(SolutionBrowserListener.EventType.SELECT,
            contentTabPanel.getSelectedTabIndex());
    updateViewMenu();
}

From source file:org.pentaho.mantle.client.solutionbrowser.tabs.MantleTabPanel.java

License:Open Source License

public MantleTabPanel() {
    setupNativeHooks(this);
    // add window close listener
    Window.addWindowClosingHandler(new ClosingHandler() {

        public void onWindowClosing(ClosingEvent event) {
            // close only if we have stuff open
            if (getTabBar().getTabCount() > 0) {
                event.setMessage(Messages.getString("windowCloseWarning")); //$NON-NLS-1$
            }/*  w ww .j  a  v  a 2  s  .c o m*/
        }
    });

    addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            previousIndex = getTabBar().getSelectedTab();
        }
    });

    addSelectionHandler(new SelectionHandler<Integer>() {

        public void onSelection(SelectionEvent<Integer> event) {
            int tabIndex = event.getSelectedItem();
            SolutionBrowserPerspective.getInstance().fireSolutionBrowserListenerEvent(
                    SolutionBrowserListener.EventType.DESELECT, previousIndex);
            SolutionBrowserPerspective.getInstance()
                    .fireSolutionBrowserListenerEvent(SolutionBrowserListener.EventType.SELECT, tabIndex);
            if (previousIndex != tabIndex) {
                Widget tabPanel = getWidget(tabIndex);
                Window.setTitle(Messages.getString("productName") + " - " + getCurrentTab().getText()); //$NON-NLS-1$ //$NON-NLS-2$

                if (tabPanel instanceof IFrameTabPanel) {
                    NamedFrame frame = ((IFrameTabPanel) tabPanel).getFrame();
                    frame.setVisible(true);
                    refreshIfPDF();
                }
            }
            for (int i = 0; i < tabIndex; i++) {
                hideFrame(i);
            }
            for (int i = tabIndex + 1; i < getTabBar().getTabCount(); i++) {
                hideFrame(i);
            }
        }
    });
    setHeight("100%"); //$NON-NLS-1$
    setWidth("100%"); //$NON-NLS-1$
}

From source file:org.pentaho.mantle.client.ui.tabs.MantleTabPanel.java

License:Open Source License

public void selectTab(final PentahoTab selectedTab) {

    // Save previous tab's solution browser panel navigator state
    PentahoTab prevTab = getSelectedTab();
    if (prevTab != null && prevTab instanceof MantleTab) {
        MantleTab mantlePrevTab = (MantleTab) prevTab;
        boolean prevState = SolutionBrowserPanel.getInstance().isNavigatorShowing();
        if (mantlePrevTab != null) {
            mantlePrevTab.setSolutionBrowserShowing(prevState);
        }/*  www  .  j  av  a2 s .co  m*/
    }
    super.selectTab(selectedTab);

    if (selectedTab == null) {
        return;
    }
    if (selectedTab instanceof MantleTab) {
        // restore previous state of solution browser panel navigator
        MantleTab mantleTab = (MantleTab) selectedTab;
        SolutionBrowserPanel.getInstance().setNavigatorShowing(mantleTab.isSolutionBrowserShowing());
    }
    Widget selectTabContent = null;
    if (getTab(getSelectedTabIndex()) != null) {
        selectTabContent = getTab(getSelectedTabIndex()).getContent();
    }
    List<FileItem> selectedItems = SolutionBrowserPanel.getInstance().getFilesListPanel()
            .getSelectedFileItems();
    EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserSelectEvent(selectTabContent, selectedItems));

    Window.setTitle(Messages.getString("productName") + " - " + selectedTab.getLabelText()); //$NON-NLS-1$ //$NON-NLS-2$

    // first turn off all tabs that should be
    for (int i = 0; i < getTabCount(); i++) {
        final PentahoTab tab = getTab(i);
        if (tab.getContent() instanceof IFrameTabPanel) {
            if (tab.getContent() != selectedTab.getContent()) {
                FrameUtils.setEmbedVisibility(((IFrameTabPanel) tab.getContent()).getFrame(), false);
            }
        }
    }

    // now turn on the select tab
    if (selectedTab.getContent() instanceof IFrameTabPanel) {
        FrameUtils.setEmbedVisibility(((IFrameTabPanel) selectedTab.getContent()).getFrame(), true);
        // fix for BISERVER-6027 - on selection, set the focus into a textbox
        // element to allow IE mouse access in these elements
        // this was made native due to BISERVER-7400
        ieFix(((IFrameTabPanel) selectedTab.getContent()).getFrame().getElement());

        IFrameTabPanel tabPanel = (IFrameTabPanel) selectedTab.getContent();
        if (tabPanel.getUrl() != null) {
            onTabSelect(getFrameElement(selectedTab));
        }
    }
}

From source file:org.primordion.xholon.app.Application.java

License:Open Source License

/**
 * Set the HTML head title, and the HTML body h2/h3 title.
 *//*  ww  w .  j  a  v a  2  s . co m*/
public void setHtmlTitles() {
    String title = "Xholon - " + getModelName();
    Window.setTitle(title);
    Element element = HtmlElementCache.xholontitle;
    if (element != null) {
        element.setInnerText(title);
    }
}

From source file:org.rhq.coregui.client.CoreGUI.java

License:Open Source License

public void init() {
    if (productInfo == null) {
        GWTServiceLookup.getSystemService().getProductInfo(new AsyncCallback<ProductInfo>() {
            @Override//from  ww  w  . j a  v a 2  s .  c  o  m
            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
                buildCoreUI();
            }

            @Override
            public void onSuccess(ProductInfo result) {
                productInfo = result;
                rhq = (productInfo != null) && "RHQ".equals(productInfo.getShortName());
                Window.setTitle(productInfo.getName());
                buildCoreUI();
            }
        });
    } else {
        buildCoreUI();
    }
}

From source file:org.rhq.enterprise.gui.coregui.client.CoreGUI.java

License:Open Source License

public void init() {
    if (productInfo == null) {
        GWTServiceLookup.getSystemService().getProductInfo(new AsyncCallback<ProductInfo>() {
            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_aboutBox_failedToLoad(), caught);
                buildCoreUI();//  www  . java2s . co  m
            }

            public void onSuccess(ProductInfo result) {
                productInfo = result;
                Window.setTitle(productInfo.getName());
                buildCoreUI();
            }
        });
    } else {
        buildCoreUI();
    }
}

From source file:org.roda.wui.client.main.ContentPanel.java

private void setWindowTitle(List<String> historyTokens) {
    String tokenI18N = "";
    boolean resolved = false;
    List<String> tokens = historyTokens;

    while (!resolved && !tokens.isEmpty()) {
        String token = StringUtils.join(tokens, "_");
        tokenI18N = messages.title(token).toUpperCase();

        if (tokenI18N.isEmpty()) {
            tokens = HistoryUtils.removeLast(tokens);
        } else {/*  w ww . j a v a 2s .  co  m*/
            resolved = true;
        }

    }

    if (!resolved) {
        String lastToken = historyTokens.get(historyTokens.size() - 1);

        // TODO generalize suffix approach
        if (lastToken.endsWith(".html")) {
            lastToken = lastToken.substring(0, lastToken.length() - ".html".length());
        }

        // transform camel case to spaces
        lastToken = lastToken.replaceAll("([A-Z])", " $1");

        // upper-case
        lastToken = lastToken.toUpperCase();
        tokenI18N = lastToken;
    }

    // title.setText(tokenI18N);
    Window.setTitle(messages.windowTitle(tokenI18N));
}