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.rstudio.studio.client.dataviewer.DataViewerWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    DataItem item = params.cast();//ww  w.  j  a  va2  s. c o  m
    Window.setTitle(item.getCaption());
    DataViewerPresenter appPresenter = pPresenter_.get();
    appPresenter.showData(item);

    // make it fill the containing layout panel
    Widget presWidget = appPresenter.asWidget();
    mainPanel.add(presWidget);
    mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
    mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}

From source file:org.rstudio.studio.client.htmlpreview.ui.HTMLPreviewApplicationWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    Window.setTitle("RStudio: Preview HTML");

    // create the presenter and activate it with the passed params
    HTMLPreviewParams htmlPreviewParams = params.<HTMLPreviewParams>cast();
    presenter_ = pPresenter_.get();//from   w  ww. ja  v a  2s  . c  o  m
    presenter_.onActivated(htmlPreviewParams);

    // make it fill the containing layout panel
    Widget presWidget = presenter_.asWidget();
    mainPanel.add(presWidget);
    mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
    mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}

From source file:org.rstudio.studio.client.pdfviewer.ui.PDFViewerApplicationWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    Window.setTitle("RStudio: Compile PDF");

    // create the presenter and activate it with the passed params
    PDFViewerParams pdfParams = params.<PDFViewerParams>cast();
    presenter_ = pPresenter_.get();//from  ww w . ja v a2  s  .co  m
    presenter_.addInitCompleteHandler(new InitCompleteEvent.Handler() {
        @Override
        public void onInitComplete(InitCompleteEvent event) {
            initCompleted_ = true;
            fireEvent(new InitCompleteEvent());
        }
    });
    presenter_.onActivated(pdfParams);

    // PDF.js doesn't work correctly unless the viewer takes its natural
    // height and the window is allowed to scroll. So get rid of the main
    // panel and add the PDFViewer directly to the root panel.
    mainPanel.setVisible(false);
    RootPanel.get().add(presenter_);
}

From source file:org.rstudio.studio.client.plumber.ui.PlumberAPIWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    PlumberAPIParams appParams = params.cast();
    Window.setTitle(appParams.getPath() + " - " + "Plumber");
    PlumberAPIPresenter appPresenter = pPresenter_.get();
    appPresenter.loadApp(appParams);//from   w ww .j  ava2  s .c  o  m

    // make it fill the containing layout panel
    Widget presWidget = appPresenter.asWidget();
    mainPanel.add(presWidget);
    mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
    mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}

From source file:org.rstudio.studio.client.rmarkdown.ui.RmdOutputWindow.java

License:Open Source License

private void showRenderResult(RmdPreviewParams params) {
    Window.setTitle(params.getOutputFile());
    presenter_.showOutput(params);
}

From source file:org.rstudio.studio.client.shiny.ui.ShinyApplicationWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    ShinyApplicationParams appParams = params.cast();
    Window.setTitle(appParams.getPath() + " - " + "Shiny");
    ShinyApplicationPresenter appPresenter = pPresenter_.get();
    appPresenter.loadApp(appParams);/*from w  w w  .java  2 s .c  o m*/

    // make it fill the containing layout panel
    Widget presWidget = appPresenter.asWidget();
    mainPanel.add(presWidget);
    mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
    mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}

From source file:org.rstudio.studio.client.vcs.ui.VCSApplicationWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    // set our window title
    Window.setTitle("RStudio: Review Changes");

    // always show scrollbars on the mac
    StyleUtils.forceMacScrollbars(mainPanel);

    // show the vcs ui in our main panel
    VCSApplicationParams vcsParams = params.<VCSApplicationParams>cast();
    ReviewPresenter rpres = pReviewPresenter_.get();
    ArrayList<StatusAndPath> selected = vcsParams.getSelected();
    if (selected.size() > 0)
        rpres.setSelectedPaths(selected);
    HistoryPresenter hpres = pHistoryPresenter_.get();
    if (vcsParams.getHistoryFileFilter() != null)
        hpres.setFileFilter(vcsParams.getHistoryFileFilter());

    vcsPopupController_ = VCSPopup.show(mainPanel, rpres, hpres, vcsParams.getShowHistory());
}

From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ChunkSatelliteWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    chunkWindowParams_ = params.cast();/*  w ww. ja  va 2s .  c o  m*/

    String title = "RStudio: Notebook Output";
    Window.setTitle(title);

    ChunkOutputHost chunkOutputHost = new ChunkOutputHost() {
        @Override
        public void onOutputRemoved(final ChunkOutputWidget widget) {
        }

        @Override
        public void onOutputHeightChanged(ChunkOutputWidget widget, int height, boolean ensureVisible) {
        }
    };

    chunkOutputWidget_ = new ChunkOutputWidget(chunkWindowParams_.getDocId(), chunkWindowParams_.getChunkId(),
            RmdChunkOptions.create(), ChunkOutputWidget.EXPANDED, false, // can close
            chunkOutputHost, ChunkOutputSize.Full);

    Element ele = chunkOutputWidget_.getElement();
    ele.addClassName(ThemeStyles.INSTANCE.selectableText());

    // Append the chunkOutputWidget as an HTML element, not as a widget.
    // Why? Chunks are widgets that are attached to the ACE editor as HTML
    // elements, not as widgets. The reason being that GWT does not support
    // triggering events for widgets that are not attached to their hierarchy.
    // Therefore, if we attach this element as a widget, GWT will remove 
    // events in some cases which will cause functionality to be lost.
    mainPanel.getElement().appendChild(chunkOutputWidget_.getElement());

    chunkOutputWidget_.getElement().getStyle().setHeight(100, Unit.PCT);

    mainPanel.addStyleName("ace_editor_theme");

    pEventBus_.get().addHandler(ChunkSatelliteCodeExecutingEvent.TYPE, this);
    pEventBus_.get().addHandler(ChunkSatelliteCacheEditorStyleEvent.TYPE, this);
    pEventBus_.get().addHandler(ChunkPlotRefreshedEvent.TYPE, this);
    pEventBus_.get().addHandler(ChunkPlotRefreshFinishedEvent.TYPE, this);
    pEventBus_.get().addHandler(ChunkChangeEvent.TYPE, this);
    pEventBus_.get().addHandler(RmdChunkOutputFinishedEvent.TYPE, this);
    pEventBus_.get().addHandler(RmdChunkOutputEvent.TYPE, this);

    Window.addWindowClosingHandler(new ClosingHandler() {
        @Override
        public void onWindowClosing(ClosingEvent arg0) {
            server_.cleanReplayNotebookChunkPlots(chunkWindowParams_.getDocId(),
                    chunkWindowParams_.getChunkId(), new ServerRequestCallback<Void>() {
                        @Override
                        public void onError(ServerError error) {
                        }
                    });
        }
    });

    pEventBus_.get().fireEventToMainWindow(new ChunkSatelliteWindowOpenedEvent(chunkWindowParams_.getDocId(),
            chunkWindowParams_.getChunkId()));
}

From source file:org.rstudio.studio.client.workbench.views.source.SourceSatelliteWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    // read the params and set up window ordinal / title
    SourceWindowParams windowParams = params.cast();
    String title = null;/*from w w w . j ava  2 s.co m*/
    if (windowParams != null) {
        pWindowManager_.get().setSourceWindowOrdinal(windowParams.getOrdinal());
        title = windowParams.getTitle();
    }
    if (title == null)
        title = "";
    else
        title += " - ";
    title += "RStudio Source Editor";
    Window.setTitle(title);

    // set up the source window
    SourceWindow sourceWindow = pSourceWindow_.get();
    if (windowParams != null && windowParams.getDocId() != null && windowParams.getSourcePosition() != null) {
        // if this source window is being opened to pop out a particular doc,
        // read that doc's ID and current position so we can restore it 
        sourceWindow.setInitialDoc(windowParams.getDocId(), windowParams.getSourcePosition());
    }

    SourceSatellitePresenter appPresenter = pPresenter_.get();

    // initialize build commands (we want these to work from source windows)
    BuildCommands.setBuildCommandState(RStudioGinjector.INSTANCE.getCommands(),
            RStudioGinjector.INSTANCE.getSession().getSessionInfo());

    // initialize MRUs on Cocoa desktop (on Qt and in server mode the MRU
    // menu entries aren't accessible from the source window)
    if (Desktop.isDesktop() && Desktop.getFrame().isCocoa()) {
        pFileMRUList_.get();
        pProjectMRUList_.get();
    }

    // initialize working directory
    if (!StringUtil.isNullOrEmpty(windowParams.getWorkingDir())) {
        pEventBus_.get().fireEvent(new WorkingDirChangedEvent(windowParams.getWorkingDir()));
    }

    // make it fill the containing layout panel
    Widget presWidget = appPresenter.asWidget();
    mainPanel.add(presWidget);
    mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
    mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}

From source file:org.spiffyui.hellospiffylocalization.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*/*from   w w w. j a  v a  2 s  .c o m*/
     We need to set the title from a localized string
     */
    Window.setTitle(PROJ_STRINGS.hello());

    /*
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    MainHeader header = new MainHeader();
    header.setHeaderTitle(PROJ_STRINGS.hello());

    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(PROJ_STRINGS.footer());

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
             Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
     These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    panel.add(m_text, "nameField");
    final Button button = new Button(PROJ_STRINGS.submit());
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

}