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:com.ephesoft.gxt.login.client.LoginEntryPoint.java

License:Open Source License

@Override
public void onLoad() {
    Window.setTitle(LocaleDictionary.getConstantValue(LoginConstants.LOGIN_TITLE));

    Label userName = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_username));
    Label password = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_password));
    RootPanel.get("loginHeader").getElement()
            .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.login_button_text));
    RootPanel.get("j_username").getElement().setAttribute("placeholder", userName.getText());
    RootPanel.get("j_username").getElement().focus();
    RootPanel.get("j_password").getElement().setAttribute("placeholder", password.getText());
    final Label versionNumber = new Label();

    ((LoginRemoteServiceAsync) createRpcService()).getProductVersion(new AsyncCallback<String>() {

        @Override/*from  w  w  w.  j av  a 2  s  . c om*/
        public void onSuccess(String version) {
            versionNumber.setText(version);
            RootPanel.get("versionLabel").getElement().setInnerText(versionNumber.getText());
        }

        @Override
        public void onFailure(Throwable arg0) {
            DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE),
                    LocaleDictionary.getConstantValue(LoginConstants.UNABLE_TO_RETRIVE_VERSION_INFO),
                    DialogIcon.ERROR);

        }
    });

    final Label expiryMsg = new Label();
    final Label failOverMsg = new Label();
    ((LoginRemoteServiceAsync) createRpcService()).getLicenseExpiryMsg(new AsyncCallback<Void>() {

        @Override
        public void onFailure(Throwable arg0) {
            String alertMsg = arg0.getLocalizedMessage();
            int indexOfDelimiter = alertMsg.indexOf('@');
            String days = alertMsg.substring(0, indexOfDelimiter);
            int remainingDays = Integer.parseInt(days);
            String dateString = alertMsg.substring(indexOfDelimiter + 1);
            if (remainingDays != 0) {
                expiryMsg.setText(
                        LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG, days, dateString));
            } else {
                expiryMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG_TODAY));
            }
            expiryMsg.addStyleName(FONT_RED_CSS);
            expiryMsg.addStyleName(BOLD_TEXT_CSS);
            RootPanel.get(EXPIRY_MSG_LEBEL).getElement().setInnerText(expiryMsg.getText());
            RootPanel.get(EXPIRY_MSG_LEBEL).addStyleName(expiryMsg.getStyleName());
        }

        @Override
        public void onSuccess(Void arg0) {
        }
    });

    ((LoginRemoteServiceAsync) createRpcService()).getFailOverMessage(new AsyncCallback<Boolean>() {

        @Override
        public void onSuccess(Boolean result) {
            if (true == result) {
                // failOverMsg.setText("");
            } else {
                failOverMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.FAILOVER_MSG));
                failOverMsg.addStyleName(FONT_RED_CSS);
                failOverMsg.addStyleName(BOLD_TEXT_CSS);
                RootPanel.get(FAIL_OVER_LABEL).getElement().setInnerText(failOverMsg.getText());
                RootPanel.get(FAIL_OVER_LABEL).addStyleName(failOverMsg.getStyleName());
            }
        }

        @Override
        public void onFailure(Throwable arg0) {

        }

    });
    final HorizontalPanel horPanel = new HorizontalPanel();
    horPanel.addStyleName("horizontalPanel");
    RootPanel.get().add(horPanel);
    ScreenMaskUtility.maskScreen(LocaleDictionary.getMessageValue(LoginMessages.LOADING));
    rpcService.getFooterProperties(new AsyncCallback<Map<String, String>>() {

        @Override
        public void onSuccess(Map<String, String> footerProperties) {
            footerText = footerProperties.get(CoreCommonConstants.FOOTER_TEXT_KEY);
            footerLink = footerProperties.get(CoreCommonConstants.FOOTER_LINK_KEY);
            final Anchor footerInfo = new Anchor(footerText, footerLink);
            horPanel.addStyleName("loginFooter");
            horPanel.add(footerInfo);
            horPanel.setCellHorizontalAlignment(footerInfo, HasHorizontalAlignment.ALIGN_CENTER);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void onFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
            DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE),
                    LocaleDictionary.getMessageValue(LoginMessages.APPLICATION_NOT_AUTHORIZED),
                    DialogIcon.ERROR);
        }
    });
    RootPanel.get("error").getElement()
            .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.INVALID_CREDENTIALS));
    RootPanel.get("error").addStyleName(FONT_RED_CSS);

    SubmitButton submitButton = new SubmitButton();
    //            (SubmitButton) SubmitButton.wrap(RootPanel.get("button").getElement());
    // submitButton.setFocus(true);

    submitButton.getElement().setTitle(LocaleDictionary.getConstantValue(LoginConstants.login_button_text));
    submitButton.getElement().setInnerHTML("<i class=\"icon-arrow-right icon-large\"></i>");
    submitButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            login();
        }
    });

    submitButton.setStyleName("gwt-Button");
    RootPanel.get("button").getElement().addClassName("submit");
    RootPanel.get("button").add(submitButton);

}

From source file:com.github.gwt.sample.showcase.client.Showcase.java

License:Apache License

private void bindHistory(final SingleSelectionModel<Widget> selectionModel,
        final LeftMenuTreeViewModel treeModel) {

    // Setup a history handler to reselect the associate menu item.
    final CellTree mainMenu = showCase.getMainMenu();

    // Change the history token when a main menu item is selected.
    selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
        public void onSelectionChange(SelectionChangeEvent event) {
            Widget selected = selectionModel.getSelectedObject();
            if (selected != null) {
                History.newItem(selected.getTitle(), true);
            }//from  www  .  j a v  a 2 s.  c om
        }
    });

    final ValueChangeHandler<String> historyHandler = new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            // Get the content widget associated with the history token.
            Widget contentWidget = treeModel.getWidget(event.getValue());
            if (contentWidget == null) {
                return;
            }

            // Expand the tree node associated with the content.
            LeftMenuTreeViewModel.Category category = treeModel.getCategoryForWidget(contentWidget);
            TreeNode node = mainMenu.getRootTreeNode();
            int childCount = node.getChildCount();
            for (int i = 0; i < childCount; i++) {
                if (node.getChildValue(i) == category) {
                    node.setChildOpen(i, true, true);
                    break;
                }
            }

            // Select the node in the tree.
            selectionModel.setSelected(contentWidget, true);

            // Display the content widget.
            displayContentWidget(contentWidget);
        }

        /**
         * Set the content to the {@link com.google.gwt.user.client.ui.Widget}.
         *
         * @param content the {@link com.google.gwt.user.client.ui.Widget} to display
         */
        private void displayContentWidget(Widget content) {
            if (content == null) {
                return;
            }

            showCase.setContent(content);
            Window.setTitle("Showcase of Features: " + content.getTitle());
        }
    };
    History.addValueChangeHandler(historyHandler);
}

From source file:com.google.appinventor.client.Ode.java

License:Open Source License

private void initializeUi() {
    BlocklyPanel.initUi();//from  w  ww.j  a  v  a  2  s  . com

    rpcStatusPopup = new RpcStatusPopup();

    // Register services with RPC status popup
    rpcStatusPopup.register((ExtendedServiceProxy<?>) helpService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) projectService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) galleryService);
    rpcStatusPopup.register((ExtendedServiceProxy<?>) userInfoService);

    Window.setTitle(MESSAGES.titleYoungAndroid());
    Window.enableScrolling(true);

    topPanel = new TopPanel();
    statusPanel = new StatusPanel();

    DockPanel mainPanel = new DockPanel();
    mainPanel.add(topPanel, DockPanel.NORTH);

    // Create tab panel for subsequent tabs
    deckPanel = new DeckPanel() {
        @Override
        public final void onBrowserEvent(Event event) {
            switch (event.getTypeInt()) {
            case Event.ONCONTEXTMENU:
                event.preventDefault();
                break;
            }
        }
    };

    deckPanel.setAnimationEnabled(true);
    deckPanel.sinkEvents(Event.ONCONTEXTMENU);
    deckPanel.setStyleName("ode-DeckPanel");

    // Projects tab
    VerticalPanel pVertPanel = new VerticalPanel();
    pVertPanel.setWidth("100%");
    pVertPanel.setSpacing(0);
    HorizontalPanel projectListPanel = new HorizontalPanel();
    projectListPanel.setWidth("100%");
    projectToolbar = new ProjectToolbar();
    projectListPanel.add(ProjectListBox.getProjectListBox());
    pVertPanel.add(projectToolbar);
    pVertPanel.add(projectListPanel);
    projectsTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(pVertPanel);

    // Design tab
    VerticalPanel dVertPanel = new VerticalPanel();
    dVertPanel.setWidth("100%");
    dVertPanel.setHeight("100%");

    // Add the Code Navigation arrow
    //    switchToBlocksButton = new VerticalPanel();
    //    switchToBlocksButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    //    switchToBlocksButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    //    switchToBlocksButton.setStyleName("ode-NavArrow");
    //    switchToBlocksButton.add(new Image(RIGHT_ARROW_IMAGE_URL));
    //    switchToBlocksButton.setWidth("25px");
    //    switchToBlocksButton.setHeight("100%");

    // Add the Code Navigation arrow
    //    switchToDesignerButton = new VerticalPanel();
    //    switchToDesignerButton.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    //    switchToDesignerButton.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    //    switchToDesignerButton.setStyleName("ode-NavArrow");
    //    switchToDesignerButton.add(new Image(LEFT_ARROW_IMAGE_URL));
    //    switchToDesignerButton.setWidth("25px");
    //    switchToDesignerButton.setHeight("100%");

    designToolbar = new DesignToolbar();
    dVertPanel.add(designToolbar);

    workColumns = new HorizontalPanel();
    workColumns.setWidth("100%");

    //workColumns.add(switchToDesignerButton);

    Box palletebox = PaletteBox.getPaletteBox();
    palletebox.setWidth("222px");
    workColumns.add(palletebox);

    Box viewerbox = ViewerBox.getViewerBox();
    workColumns.add(viewerbox);
    workColumns.setCellWidth(viewerbox, "97%");
    workColumns.setCellHeight(viewerbox, "97%");

    structureAndAssets = new VerticalPanel();
    structureAndAssets.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    // Only one of the SourceStructureBox and the BlockSelectorBox is visible
    // at any given time, according to whether we are showing the form editor
    // or the blocks editor. They share the same screen real estate.
    structureAndAssets.add(SourceStructureBox.getSourceStructureBox());
    structureAndAssets.add(BlockSelectorBox.getBlockSelectorBox()); // initially not visible
    structureAndAssets.add(AssetListBox.getAssetListBox());
    workColumns.add(structureAndAssets);

    Box propertiesbox = PropertiesBox.getPropertiesBox();
    propertiesbox.setWidth("222px");
    workColumns.add(propertiesbox);
    //switchToBlocksButton.setHeight("650px");
    //workColumns.add(switchToBlocksButton);
    dVertPanel.add(workColumns);
    designTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(dVertPanel);

    // Gallery list tab
    VerticalPanel gVertPanel = new VerticalPanel();
    gVertPanel.setWidth("100%");
    gVertPanel.setSpacing(0);
    galleryListToolbar = new GalleryToolbar();
    gVertPanel.add(galleryListToolbar);
    HorizontalPanel appListPanel = new HorizontalPanel();
    appListPanel.setWidth("100%");
    appListPanel.add(GalleryListBox.getGalleryListBox());

    gVertPanel.add(appListPanel);
    galleryTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(gVertPanel);

    // Gallery app tab
    VerticalPanel aVertPanel = new VerticalPanel();
    aVertPanel.setWidth("100%");
    aVertPanel.setSpacing(0);
    galleryPageToolbar = new GalleryToolbar();
    aVertPanel.add(galleryPageToolbar);
    HorizontalPanel appPanel = new HorizontalPanel();
    appPanel.setWidth("100%");
    appPanel.add(GalleryAppBox.getGalleryAppBox());

    aVertPanel.add(appPanel);
    galleryAppTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(aVertPanel);

    // User Admin Panel
    VerticalPanel uaVertPanel = new VerticalPanel();
    uaVertPanel.setWidth("100%");
    uaVertPanel.setSpacing(0);
    HorizontalPanel adminUserListPanel = new HorizontalPanel();
    adminUserListPanel.setWidth("100%");
    adminUserListPanel.add(AdminUserListBox.getAdminUserListBox());
    uaVertPanel.add(adminUserListPanel);
    userAdminTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(uaVertPanel);

    // KM: DEBUGGING BEGIN
    // User profile tab
    VerticalPanel uVertPanel = new VerticalPanel();
    uVertPanel.setWidth("100%");
    uVertPanel.setSpacing(0);
    HorizontalPanel userProfilePanel = new HorizontalPanel();
    userProfilePanel.setWidth("100%");
    userProfilePanel.add(ProfileBox.getUserProfileBox());

    uVertPanel.add(userProfilePanel);
    userProfileTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(uVertPanel);
    // KM: DEBUGGING END

    // Private User Profile TabPanel
    VerticalPanel ppVertPanel = new VerticalPanel();
    ppVertPanel.setWidth("100%");
    ppVertPanel.setSpacing(0);
    HorizontalPanel privateUserProfileTabPanel = new HorizontalPanel();
    privateUserProfileTabPanel.setWidth("100%");
    privateUserProfileTabPanel.add(PrivateUserProfileTabPanel.getPrivateUserProfileTabPanel());
    ppVertPanel.add(privateUserProfileTabPanel);
    privateUserProfileIndex = deckPanel.getWidgetCount();
    deckPanel.add(ppVertPanel);

    // Moderation Page tab
    VerticalPanel mPVertPanel = new VerticalPanel();
    mPVertPanel.setWidth("100%");
    mPVertPanel.setSpacing(0);
    HorizontalPanel moderationPagePanel = new HorizontalPanel();
    moderationPagePanel.setWidth("100%");

    moderationPagePanel.add(ModerationPageBox.getModerationPageBox());

    mPVertPanel.add(moderationPagePanel);
    moderationPageTabIndex = deckPanel.getWidgetCount();
    deckPanel.add(mPVertPanel);

    // Debugging tab
    if (AppInventorFeatures.hasDebuggingView()) {

        Button dismissButton = new Button(MESSAGES.dismissButton());
        dismissButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (currentView == DESIGNER)
                    switchToDesignView();
                else
                    switchToProjectsView();
            }
        });

        ColumnLayout defaultLayout = new ColumnLayout("Default");
        Column column = defaultLayout.addColumn(100);
        column.add(MessagesOutputBox.class, 300, false);
        column.add(OdeLogBox.class, 300, false);
        final WorkAreaPanel debuggingTab = new WorkAreaPanel(new OdeBoxRegistry(), defaultLayout);

        debuggingTab.add(dismissButton);

        debuggingTabIndex = deckPanel.getWidgetCount();
        deckPanel.add(debuggingTab);

        // Hook the window resize event, so that we can adjust the UI.
        Window.addResizeHandler(new ResizeHandler() {
            @Override
            public void onResize(ResizeEvent event) {
                resizeWorkArea(debuggingTab);
            }
        });

        // Call the window resized handler to get the initial sizes setup. Doing this in a deferred
        // command causes it to occur after all widgets' sizes have been computed by the browser.
        DeferredCommand.addCommand(new Command() {
            @Override
            public void execute() {
                resizeWorkArea(debuggingTab);
            }
        });

        resizeWorkArea(debuggingTab);
    }

    // We do not select the designer tab here because at this point there is no current project.
    // Instead, we select the projects tab. If the user has a previously opened project, we will
    // open it and switch to the designer after the user settings are loaded.
    // Remember, the user may not have any projects at all yet.
    // Or, the user may have deleted their previously opened project.
    // ***** THE DESIGNER TAB DOES NOT DISPLAY CORRECTLY IF THERE IS NO CURRENT PROJECT. *****
    deckPanel.showWidget(projectsTabIndex);

    mainPanel.add(deckPanel, DockPanel.CENTER);
    mainPanel.setCellHeight(deckPanel, "100%");
    mainPanel.setCellWidth(deckPanel, "100%");

    //    mainPanel.add(switchToDesignerButton, DockPanel.WEST);
    //    mainPanel.add(switchToBlocksButton, DockPanel.EAST);

    //Commenting out for now to gain more space for the blocks editor
    mainPanel.add(statusPanel, DockPanel.SOUTH);
    mainPanel.setSize("100%", "100%");
    RootPanel.get().add(mainPanel);

    // Add a handler to the RootPanel to keep track of Google Chrome Pinch Zooming and
    // handle relevant bugs. Chrome maps a Pinch Zoom to a MouseWheelEvent with the
    // control key pressed.
    RootPanel.get().addDomHandler(new MouseWheelHandler() {
        @Override
        public void onMouseWheel(MouseWheelEvent event) {
            if (event.isControlKeyDown()) {
                // Trip the appropriate flag in PZAwarePositionCallback when the page
                // is Pinch Zoomed. Note that this flag does not need to be removed when
                // the browser is un-zoomed because the patched function for determining
                // absolute position works in all circumstances.
                PZAwarePositionCallback.setPinchZoomed(true);
            }
        }
    }, MouseWheelEvent.getType());

    // There is no sure-fire way of preventing people from accidentally navigating away from ODE
    // (e.g. by hitting the Backspace key). What we do need though is to make sure that people will
    // not lose any work because of this. We hook into the window closing  event to detect the
    // situation.
    Window.addWindowClosingHandler(new Window.ClosingHandler() {
        @Override
        public void onWindowClosing(Window.ClosingEvent event) {
            onClosing();
        }
    });

    setupMotd();
}

From source file:com.google.gerrit.client.Gerrit.java

License:Apache License

public static void setWindowTitle(final Screen screen, final String text) {
    if (screen == body.getView()) {
        if (text == null || text.length() == 0) {
            Window.setTitle(M.windowTitle1(myHost));
        } else {//from ww  w . j a va  2 s  .c o m
            Window.setTitle(M.windowTitle2(text, myHost));
        }
    }
}

From source file:com.google.gerrit.client.Gerrit.java

License:Apache License

@Override
public void onModuleLoad() {
    UserAgent.assertNotInIFrame();//from   ww  w  .  j  a va2s .  c o  m

    KeyUtil.setEncoderImpl(new KeyUtil.Encoder() {
        @Override
        public String encode(String e) {
            e = URL.encodeQueryString(e);
            e = fixPathImpl(e);
            e = fixColonImpl(e);
            e = fixDoubleQuote(e);
            return e;
        }

        @Override
        public String decode(final String e) {
            return URL.decodeQueryString(e);
        }

        private native String fixPathImpl(String path)
        /*-{ return path.replace(/%2F/g, "/"); }-*/;

        private native String fixColonImpl(String path)
        /*-{ return path.replace(/%3A/g, ":"); }-*/;

        private native String fixDoubleQuote(String path)
        /*-{ return path.replace(/%22/g, '"'); }-*/;
    });

    initHostname();
    Window.setTitle(M.windowTitle1(myHost));

    final HostPageDataService hpd = GWT.create(HostPageDataService.class);
    hpd.load(new GerritCallback<HostPageData>() {
        @Override
        public void onSuccess(final HostPageData result) {
            Document.get().getElementById("gerrit_hostpagedata").removeFromParent();
            myConfig = result.config;
            myTheme = result.theme;
            if (result.account != null) {
                myAccount = result.account;
                xGerritAuth = result.xGerritAuth;
            }
            if (result.accountDiffPref != null) {
                myAccountDiffPref = result.accountDiffPref;
                applyUserPreferences();
            }
            onModuleLoad2(result);
        }
    });
}

From source file:com.google.gwt.demos.bulkloadingtable.client.BulkLoadingTableDemo.java

License:Apache License

public void log(String log) {
    Window.setTitle(log);
}

From source file:com.google.gwt.gen2.demo.dropdownlistbox.client.DropDownListBoxDemo.java

License:Apache License

/**
 * This is the entry point method./*w  w w.ja  v a 2  s.co  m*/
 */
public void onModuleLoad() {
    Window.setTitle("Loading...");

    VerticalPanel p = new VerticalPanel();
    RootPanel.get().add(p);

    p.setStyleName("demo-pane");
    p.setHeight("100%");

    final DropDownListBox<String> customBox = new DropDownListBox<String>("My family");
    fillInBox(customBox);
    p.add(hook);
    hook.setHeight("200px");
    p.add(new Stepper(customBox));
    Window.setTitle("DropDownListBox demo");
}

From source file:com.google.gwt.gwtpages.demo.client.pages.layout.DefaultLayoutPage.java

@Override
public void showPage(LoadedPageContainer page, PageParameters parameters, PageRequestSession session) {
    bodyContent.clear();/*from ww w. j  ava  2s.c  om*/
    bodyContent.add(page.getPage().asWidget());
    String pageTitle = (String) session.get(PageConstants.PARAM_PAGE_TITLE, true);
    if (null == pageTitle) {
        this.pageTitle.setVisible(false);
        Window.setTitle("GWT Pages Demo");
    } else {
        this.pageTitle.setVisible(true);
        this.pageTitle.setText(pageTitle);
        Window.setTitle(pageTitle);
    }
}

From source file:com.google.gwt.gwtpages.demo.client.pages.layout.NoLayoutPage.java

@Override
public void showPage(LoadedPageContainer pageContainer, PageParameters parameters, PageRequestSession session) {
    bodyContent.clear();/*from   w w w.jav a 2s  . co  m*/
    bodyContent.add(pageContainer.getPage().asWidget());
    String pageTitle = (String) session.get(PageConstants.PARAM_PAGE_TITLE, true);
    if (null == pageTitle) {
        this.pageTitle.setVisible(false);
        Window.setTitle("GWT Pages Demo");
    } else {
        this.pageTitle.setVisible(true);
        this.pageTitle.setText(pageTitle);
        Window.setTitle(pageTitle);
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.ContentContainer.java

public void setContent(Content content) {
    Window.setTitle(content.getPageTitle());

    RootPanel contentPanel = RootPanel.get("content");
    contentPanel.clear();/*  w ww  .j  a va 2 s .  c o m*/

    content.loadContent();
}