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.allen_sauer.gwt.dnd.demo.client.ui.MultiRowTabPanel.java

License:Apache License

private void whenTabSelected(int row, int tabIndex) {
    if (tabIndex == -1) {
        return;/*from  w ww  . ja v  a 2  s  . co  m*/
    }
    if (row != selectedRow) {
        selectedRow = row;
        for (int i = 0; i < rows; i++) {
            if (i != row) {
                TabBar tabBar = (TabBar) tabBarsVerticalPanel.getWidget(i);
                tabBar.selectTab(-1);
            }
        }
    }
    TabBar tabBar = (TabBar) tabBarsVerticalPanel.getWidget(selectedRow);
    Integer widgetOffset = tabBarIndexOffsetMap.get(tabBar);
    int index = widgetOffset.intValue() + tabIndex;
    masterDeckPanel.showWidget(index);
    History.newItem(historyTokenMap.getHistoryToken(index));
    Window.setTitle(historyTokenMap.getPageTitle(historyTokenMap.getHistoryToken(index)));
}

From source file:com.audata.client.AuDoc.java

License:Open Source License

/**
 * This is the entry point method. and is responsible for building the UI
 *///  w  w w . j  a v a  2 s  .co  m
public void onModuleLoad() {
    //set static variable to instance of this object
    if (AuDoc.instance == null) {
        AuDoc.instance = this;
    }

    //Set window title
    Window.setTitle(LANG.site_title_Text());

    //get timeout value
    String tout = AuDoc.getConfigItem("timeout");
    int timeout;
    if (tout.equals("")) {
        timeout = 500000;
    } else {
        timeout = Integer.parseInt(tout);
    }
    //get server url
    String url = AuDoc.getConfigItem("url");
    if (url.equals("")) {
        url = this.getURL();
    }
    //create JSONCall object
    AuDoc.jsonCall = new JSONCall(url, timeout);
    //create state object
    AuDoc.state = new State();

    //Build UI
    RootPanel.get("logo").add(new Image("images/title/Logo.jpg"));
    RootPanel.get("menu").add(this.buildMenu());
    RootPanel.get("stack").add(this.buildStack());
    this.quicksearch = new QuickSearchPanel(this);
    RootPanel.get("quickSearch").add(this.quicksearch);
    this.main = new ScrollPanel();
    this.main.setHeight("100%");
    this.main.addStyleName("audoc-main");
    RootPanel.get("main").add(this.main);
    this.main.add(new HomePanel());

    //build login dialog and reset app to starting state
    this.loginDialog = new LoginDialog(this);
    this.resetApp();
}

From source file:com.calclab.emiteuimodule.client.EmiteUIDialog.java

License:Open Source License

public void start(final UserChatOptions userChatOptions, final String httpBase, final String host,
        final String roomHost) {
    // We define, default AvatarProvider and MultiChaListener for simple
    // facade/* www  .java2 s  .  c  o  m*/
    start(userChatOptions, httpBase, host, roomHost, new AvatarProvider() {
        public String getAvatarURL(final XmppURI userURI) {
            return "images/person-def.gif";
        }
    }, EMITE_DEF_TITLE);
    final String initialWindowTitle = Window.getTitle();
    onChatAttended(new Listener<String>() {
        public void onEvent(final String parameter) {
            Window.setTitle(initialWindowTitle);
        }
    });
    onChatUnattendedWithActivity(new Listener<String>() {
        public void onEvent(final String chatTitle) {
            Window.setTitle("(* " + chatTitle + ") " + initialWindowTitle);
        }
    });
}

From source file:com.charlie.client.panels.SonglistPanel.java

License:Open Source License

public void addEventHandlers() {
    Controller.getEventBus().addHandler(GetRecentlyUploadedSongsFromUserAndAllFriendsEvent.TYPE,
            new GetRecentlyUploadedSongsFromUserAndAllFriendsEventHandler() {

                @Override/*from   ww  w.j  av a  2 s.c o m*/
                public void handle(Long userId) {
                    setTitleForContentPanel("Playlist - Recently Uploaded");
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.RECENLTY_UPLOADED);
                    loader.load();
                }
            });
    Controller.getEventBus().addHandler(GetRecentlyUploadedSongsFromAllEvent.TYPE,
            new GetRecentlyUploadedSongsFromAllEventHandler() {

                @Override
                public void handle(Long userId) {

                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.RECENLTY_UPLOADED_ALL);
                    loader.load();
                }
            });

    Controller.getEventBus().addHandler(ShowNowPlayingEvent.TYPE, new ShowNowPlayingEventHandler() {

        @Override
        public void handle() {
            setTitleForContentPanel("Playlist - Now Playing");

            grid.getStore().removeAll();
            grid.getStore().add(Controller.getPlaylistManager().getPlaylist());

        }
    });

    Controller.getEventBus().addHandler(SongFinishedLoadingEvent.TYPE, new SongFinishedLoadingEventHandler() {

        @Override
        public void handle(SongModelData song) {

        }
    });

    Controller.getEventBus().addHandler(PlaySongEvent.TYPE, new PlaySongEventHandler() {

        @Override
        public void handle(SongModelData song, Integer volume) {
            RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
                    GWT.getHostPageBaseURL() + "servlet/albumArtwork?artist=" + URL.encode(song.getArtist())
                            + "&album=" + URL.encode(song.getAlbum()));
            try {
                selectSongOnGrid(song);
                Window.setTitle(song.getArtist() + " - " + song.getSongName());

            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }

    });

    Controller.getEventBus().addHandler(GetCollectiveSongsForUserEvent.TYPE,
            new GetCollectiveSongsForUserEventHandler() {

                @Override
                public void handle(Long userId) {
                    setTitleForContentPanel("Playlist - Collective Songs For User");
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.USER_COLLECTIVE);
                    collectiveUserId = userId;
                    loader.load();

                }
            });

    Controller.getEventBus().addHandler(RandomizePlaylistEvent.TYPE, new RandomizePlaylistEventHandler() {

        @Override
        public void handle() {
            grid.mask("Shuffling...");
            randomizePlaylist();
            grid.unmask();

        }
    });

    Controller.getEventBus().addHandler(UnrandomizePlaylistEvent.TYPE, new UnrandomizePlaylistEventHandler() {

        @Override
        public void handle() {
            unrandomizePlaylist();

        }
    });

    Controller.getEventBus().addHandler(PlaylistsNeedReloadingEvent.TYPE,
            new PlaylistsNeedReloadingEventHandler() {

                @Override
                public void handle() {

                    PlaylistModelData model = new PlaylistModelData();
                    model.setUserId(Controller.getIntsance().getUserId());
                    SiteServiceImpl.getInstance().getPlaylists(model, Controller.getIntsance().getUserId(),
                            new AsyncCallback<List<PlaylistModelData>>() {

                                @Override
                                public void onSuccess(List<PlaylistModelData> result) {
                                    Controller.getEventBus().fireEvent(new PlaylistsListLoadedEvent(result));

                                }

                                @Override
                                public void onFailure(Throwable caught) {

                                }
                            });

                }
            });

    Controller.getEventBus().addHandler(GetSongsForUserAndAllFriendsEvent.TYPE,
            new GetSongsForUserAndAllFriendsEventHandler() {

                @Override
                public void handle(Long userId) {
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.ALL_USERS);
                    loader.load();

                }
            });

    Controller.getEventBus().addHandler(GetSongsForAllEvent.TYPE, new GetSongsForAllEventHandler() {

        @Override
        public void handle(Long userId) {
            setTitleForContentPanel("Playlist - All Music");
            Controller.getIntsance().setSongRetrievalType(SongRetrievalType.ALL_USERS);
            loader.load();

        }
    });

    Controller.getEventBus().addHandler(GetCollectiveSongsForUserAndAllFriendsEvent.TYPE,
            new GetCollectiveSongsForUserAndAllFriendsEventHandler() {

                @Override
                public void handle(Long userId) {
                    // setTitleForContentPanel("Playlist - The Collective");
                    // starCountcolumn.setHeader("# Users");
                    setTitleForContentPanel("Playlist - The Collective");
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.COLLECTIVE);
                    loader.load();

                }
            });

    Controller.getEventBus().addHandler(PlaylistsListLoadedEvent.TYPE, new PlaylistsListLoadedEventHandler() {

        @Override
        public void handle(List<PlaylistModelData> playlists) {

            playlistSubMenu.removeAll();
            playlistSubMenu.add(newPlaylist);
            playlistSubMenu.add(new SeparatorMenuItem());

            for (final PlaylistModelData playlistModelData : playlists) {
                playlistSubMenu
                        .add(new MenuItem(playlistModelData.getName(), new SelectionListener<MenuEvent>() {

                            @Override
                            public void componentSelected(MenuEvent ce) {

                                Controller.getEventBus().fireEvent(
                                        new AddSongToPlaylistEvent(playlistModelData, getSelectedSongs()));
                            }

                        }));
            }

            playlistTopLevelMenu.setSubMenu(playlistSubMenu);
        }
    });

    Controller.getEventBus().addHandler(PlayPlaylistEvent.TYPE, new PlayPlaylistEventHandler() {

        @Override
        public void handle(PlaylistModelData playlist) {
            setTitleForContentPanel("Playlist - Playing playlist [" + playlist.getName() + "]");

            Controller.getIntsance().setPlaylist(playlist);
            Controller.getIntsance().setSongRetrievalType(SongRetrievalType.PLAYLIST);

            loader.load();

        }
    });

    Controller.getEventBus().addHandler(EditPlaylistEvent.TYPE, new EditPlaylistEventHandler() {

        @Override
        public void handle(PlaylistModelData playlist) {
            setTitleForContentPanel("Playlist - Editing playlist [" + playlist.getName() + "]");

            Controller.getIntsance().setPlaylist(playlist);
            Controller.getIntsance().setSongRetrievalType(SongRetrievalType.EDIT_PLAYLIST);

            loader.load();

        }
    });

    Controller.getEventBus().addHandler(GetSongsForUserEvent.TYPE, new GetSongsForUserEventHandler() {

        @Override
        public void handle(Long userId) {
            setTitleForContentPanel("Playlist - All Songs For User");
            Controller.getIntsance().getMainPage().showPlayListInCenter();
            Controller.getIntsance().setPlaylistUserId(userId);
            Controller.getIntsance().setSongRetrievalType(SongRetrievalType.SINGLE_USER);
            loader.load();

            // DeferredCommand.addCommand(new Command() {
            //
            // @Override
            // public void execute() {
            //
            // pagingToolBar.enable();
            // }
            //
            // });

        }
    });

    Controller.getEventBus().addHandler(SearchSongsFromAllFriendsPagedEvent.TYPE,
            new SearchSongsFromAllFriendsPagedEventHandler() {

                @Override
                public void handle(Long userId, String searchTerm) {
                    setTitleForContentPanel("Playlist - Song search [" + searchTerm + "]");
                    MP3PlayerInfo.display("Info", "Now searching for " + searchTerm);
                    Controller.getIntsance().setSearchTerm(searchTerm);
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.SEARCH);
                    loader.load();
                    DeferredCommand.addCommand(new Command() {

                        @Override
                        public void execute() {
                            pagingToolBar.first();

                        }
                    });
                }

            });

    Controller.getEventBus().addHandler(SearchSongsByArtistFromAllFriendsPagedEvent.TYPE,
            new SearchSongsByArtistFromAllFriendsPagedEventHandler() {

                @Override
                public void handle(Long userId, String searchTerm) {
                    MP3PlayerInfo.display("Info", "Now searching for the artist " + searchTerm);
                    setTitleForContentPanel("Playlist - Song search by artist [" + searchTerm + "]");
                    Controller.getIntsance().setSearchTerm(searchTerm);
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.ARIST_SEARCH);
                    loader.load();
                    DeferredCommand.addCommand(new Command() {

                        @Override
                        public void execute() {
                            pagingToolBar.first();

                        }
                    });
                }

            });

    Controller.getEventBus().addHandler(SearchSongsByAlbumFromAllFriendsPagedEvent.TYPE,
            new SearchSongsByAlbumFromAllFriendsPagedEventHandler() {

                @Override
                public void handle(Long userId, String searchTerm) {
                    setTitleForContentPanel("Playlist - Song search by album [" + searchTerm + "]");
                    MP3PlayerInfo.display("Info", "Now searching for the album " + searchTerm);
                    Controller.getIntsance().setSearchTerm(searchTerm);
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.ALBUM_SEARCH);
                    loader.load();
                    DeferredCommand.addCommand(new Command() {

                        @Override
                        public void execute() {
                            pagingToolBar.first();

                        }
                    });
                }

            });

    Controller.getEventBus().addHandler(SearchSongsByGenreFromAllFriendsPagedEvent.TYPE,
            new SearchSongsByGenreFromAllFriendsPagedEventHandler() {

                @Override
                public void handle(Long userId, String searchTerm) {
                    MP3PlayerInfo.display("Info", "Now searching for the genre " + searchTerm);
                    setTitleForContentPanel("Playlist - Song search by album [" + searchTerm + "]");
                    Controller.getIntsance().setSearchTerm(searchTerm);
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.GENRE_SEARCH);
                    loader.load();
                    DeferredCommand.addCommand(new Command() {

                        @Override
                        public void execute() {
                            pagingToolBar.first();

                        }
                    });
                }

            });

    Controller.getEventBus().addHandler(SearchSongsByThisAndSimilarArtistsFromAllFriendsPagedEvent.TYPE,
            new SearchSongsByThisAndSimilarArtistsFromAllFriendsPagedEventHandler() {

                @Override
                public void handle(Long userId, String searchTerm) {
                    MP3PlayerInfo.display("Info", "Now searching for " + searchTerm + " and similar artists.");
                    Controller.getIntsance().setSearchTerm(searchTerm);
                    Controller.getIntsance().setSongRetrievalType(SongRetrievalType.SIMILAR_ARTIST_SEARCH);
                    loader.load();
                    DeferredCommand.addCommand(new Command() {

                        @Override
                        public void execute() {
                            pagingToolBar.first();

                        }
                    });
                }

            });

    Controller.getEventBus().addHandler(SearchSongsRandomByThisAndSimilarArtistsFromAllFriendsPagedEvent.TYPE,
            new SearchSongsRandomByThisAndSimilarArtistsFromAllFriendsPagedEventHandler() {

                @Override
                public void handle(Long userId, String searchTerm) {
                    MP3PlayerInfo.display("Info",
                            "Creating a playlist for similar artists of  " + searchTerm + "");
                    Controller.getIntsance().setSearchTerm(searchTerm);
                    Controller.getIntsance()
                            .setSongRetrievalType(SongRetrievalType.SIMILAR_ARTIST_SEARCH_RANDOM);
                    loader.load();
                    DeferredCommand.addCommand(new Command() {

                        @Override
                        public void execute() {

                            Controller.getPlaylistManager().resetPlaylist();
                            List<SongModelData> playlist = Controller.getPlaylistManager().getPlaylist();

                            Controller.getPlaylistManager().setPlaylist(playlist, 0);

                        }
                    });
                }

            });

    // Legacy shit, this calls arent used anymore
    // Controller.getEventBuss().addHandler(SearchSongsForUserEvent.TYPE,
    // new SearchSongsForUserEventHandler(){
    //
    // @Override
    // public void handle(ArrayList<SongModelData> songs) {
    //            
    // songsByUserIdStore.removeAll();
    // songsByUserIdStore.add(songs);
    // grid.unmask();
    // Controller.getIntsance().ensurePlaylistIsVisible();
    // }
    //         
    // });
    //      
    // Controller.getEventBuss().addHandler(SearchSongsFromAllFriendsEvent.TYPE,
    // new SearchSongsFromAllFriendsEventHandler(){
    //
    // @Override
    // public void handle(ArrayList<SongModelData> songs) {
    //            
    // songsByUserIdStore.removeAll();
    // songsByUserIdStore.add(songs);
    // grid.unmask();
    // Controller.getIntsance().ensurePlaylistIsVisible();
    // }
    //         
    // });

}

From source file:com.dawg6.web.dhcalc.client.DHCalc.java

License:Open Source License

@Override
public void onModuleLoad() {

    Util.getInstance().setFormatter(new Util.Formatter() {

        @Override//from   ww  w.  j a  va  2  s.  c  o m
        public String format(double d) {
            return NumberFormat.getFormat("#,###.####").format(d);
        }
    });

    Util.getInstance().setLogger(new ILogger() {

        @Override
        public void log(String message) {
            GWT.log(message);
        }

        @Override
        public void log(String message, Throwable t) {
            GWT.log(message, t);
        }
    });

    Window.setTitle("DH Damage Calculator (" + Version.getShortVersionString() + ")");

    final MainPanel panel = new MainPanel();

    Service.getInstance().execute(new AsyncTask() {

        @Override
        public void run(final AsyncTaskHandler handler) {

            Scheduler.get().scheduleDeferred(new Command() {

                @Override
                public void execute() {
                    RootPanel.get("main").add(panel);
                    handler.taskCompleted();
                }
            });

        }
    });

}

From source file:com.dimad.map.executor.client.Main.java

License:Apache License

@Override
public void onModuleLoad() {
    try {/*from  w w w .j  av  a 2s  .c  om*/
        GWT.log("Loading module ...");
        mainPanel = new MainPanel(this).buildPanel();

        Window.enableScrolling(true);
        Window.setMargin("0px");
        Window.setTitle(constants.applicationTitle());

        RootPanel.get().add(mainPanel);

        redraw();
        //disable();
        GWT.log("Module loaded");
    } catch (Throwable e) {
        GWT.log("Could not start application", e);
        Window.alert(e.getMessage());
    }
}

From source file:com.dingziran.effective.client.Showcase.java

License:Apache License

/**
 * Set the content to the {@link ContentWidget}.
 *
 * @param content the {@link ContentWidget} to display
 */// w w  w  . ja  v a 2s. c o  m
private void displayContentWidget(ContentWidget content) {
    if (content == null) {
        return;
    }

    shell.setContent(content);
    Window.setTitle("Showcase of Features: " + content.getName());
}

From source file:com.edgenius.wiki.gwt.client.page.PageMain.java

License:Open Source License

/**
 * Switch from Preview,Edit, View panel.
 * @return false, then stop switch. This happens when user is in editing, but click some link, then confirm if exit editing, and user choose no.
 *///w w  w .  j a v a 2s.  c  om
public boolean switchTo(int index) {

    //source deck index
    int vIdx = deck.getVisibleWidget();

    //      //if target are not loading, then hide loading anyway..
    //      if(index != LOADING_PANEL){
    //         //hide loading first, it will display again if request is LOADING
    //         GwtClientUtils.hideLoading(true);
    //      }

    Log.info("Visible deck index:" + vIdx + ". To deck index:" + index);

    Widget widget = null;
    if (vIdx >= 0) {
        widget = deck.getWidget(deck.getVisibleWidget());
    }

    //firePanelSwitching
    if (panelSwitchListeners != null) {
        for (PanelSwitchListener listener : panelSwitchListeners) {
            if (!listener.onPanelSwitching(widget, index))
                return false;
        }
    }

    if (index == PREVIEW_PANEL) {
        setFromPanelIndex(PageMain.PREVIEW_PANEL);

        if (!isPreviewReady()) {
            //save draft first, need show loading page, 
            index = LOADING_PANEL;
            editPanel.saveDraft(PageSaveMethod.SAVE_DRAFT_LOAD_PREVIEW);
        }
    } else if (index == EDIT_PANEL) {
        setFromPanelIndex(PageMain.PREVIEW_PANEL);
    } else if (index == EDIT_SIDEBAR_PANEL) {
        setFromPanelIndex(PageMain.PREVIEW_PANEL);
    } else if (index == EDIT_TEMPLATE_PANEL) {
        setFromPanelIndex(PageMain.PREVIEW_PANEL);
    } else if (index == LOADING_PANEL) {
        GwtClientUtils.clearBeforeUnload();
        Window.setTitle(getSystemTitle() + " - " + Msg.consts.loading());
        //         //show loading
        //         GwtClientUtils.hideLoading(false);
    } else if (index == VIEW_PANEL) {
        GwtClientUtils.clearBeforeUnload();
        //EDIT_PANEL, PREVIEW_PANEL VIEW_PANEL: page title, 
        //         here do nothing, it already set in ViewPanel
    } else {
        //dashboard
        GwtClientUtils.clearBeforeUnload();
        Window.setTitle(getSystemTitle());
    }

    deck.showWidget(index);
    if (panelSwitchListeners != null) {
        for (PanelSwitchListener listener : panelSwitchListeners) {
            listener.onPanelSwitched(widget, index);
        }
    }
    return true;
}

From source file:com.edgenius.wiki.gwt.client.page.ViewPanel.java

License:Open Source License

/**
 * Only put value to panel, does not change visible attribute of this panel.
 * @param model//  w ww . ja  v a  2  s . c o m
 */
public void fillPanel(final PageModel model) {
    //hide pin image always at first
    GwtClientUtils.hidePagePin(true);
    if (model == null) {
        //edit is disable: current, this is just failure tolerance handle. Model never expect be null.
        functionBtnBar.loadViewFunc(null);
        return;
    }
    //view panel switch to HistoryCompare, if user go Dashboard, then go back same page, it is still in diffPanel
    //, here will switch it back to normal.
    diffResume();

    //default value for hide all tabs
    PageRender render = new PageRender(contentPanel);

    if (model.isHistory) {
        //NOTE: this title may not equals model.title as Page Title maybe changed in editing history.
        historyDiffMessage(model);

        functionBtnBar.loadHistoryFunc(model.permissions, model.currentTitle, model.pageVersion);
        //history page can not update main.setPageTitle() and main.PageUid() 
        main.setCurrentPageTitle(model.currentTitle);
        //always show history tab if users viewing history
        model.tabIndex = SharedConstants.TAB_TYPE_HISTORY;

    } else {
        functionBtnBar.loadViewFunc(model);
        if (model.pintop > 0) {
            GwtClientUtils.hidePagePin(false);
        }
        main.setCurrentPageTitle(model.title);

        // here is just for hide welcome message (validate if page has render content)
        //as PageRender logic, this method is must call before render.renderContent() method so 
        //that the listener can be invoked
        render.addRenderContentListener(new WelcomeMessageListener(model.pageUuid));
    }

    Window.setTitle(model.title + " - " + main.getSystemTitle());

    //update page info
    //      boolean sameSpace = StringUtil.equals(main.getSpaceUname(),model.spaceUname);
    main.setSpaceUname(model.spaceUname);
    main.setPageAttribute(model.attribute);
    main.setPageVersion(model.pageVersion);
    main.setPageUuid(model.pageUuid == null ? "" : model.pageUuid.toString());

    main.resetNavbar(model);

    main.setPrintBtnVisible(!GwtUtils.contains(model.attribute, PageAttribute.NO_PRINT));
    if (GwtUtils.contains(model.attribute, PageAttribute.NO_FAVORITE)) {
        //logout: hide add favorite/watch button
        favorite.setVisible(false);
    } else {
        //login
        favorite.setVisible(true);
        //enable add favorite, watch 
        favorite.setEnable(model.favorite == 1 ? true : false);
    }
    if (GwtUtils.contains(model.attribute, PageAttribute.NO_WATCHED)) {
        watch.setVisible(false);
    } else {
        watch.setVisible(true);
        watch.setEnable(model.watched == 1 ? true : false);
    }

    if (GwtUtils.contains(model.attribute, PageAttribute.NO_TITLE)) {
        title.setText("");
    } else {
        title.setText(model.title);
    }

    if (GwtUtils.contains(model.attribute, PageAttribute.NO_TAG)) {
        //clean tag panel.
        tags.hide();
    } else {
        //display tags.
        tags.display(model.spaceUname, model.tagString, model.permissions[ClientConstants.WRITE] == 1);
    }

    main.sidebar.fillPanel(model);

    if (!GwtUtils.contains(model.attribute, PageAttribute.NO_ATTACHMENT)) {
        attachmentBtn.setVisible(true);
        attPanel.mergeAttachments(model.attachmentJson);
        //does this user has permission to edit attachment?
        //page write permission
        //Anonymous cannot allow update attachment -
        //* it is dangerous 
        //* uploaded attachment in editing model, the initial status of attachment is draft status, 
        //  then it cannot decide how to set attachment status to normal as same page may have many anonymous uploading
        //* if anonymous cancel from editing - it also can not decide which attachments need to be deleted. 
        if (model.permissions[ClientConstants.WRITE] == 1 && !GwtUtils.isAnonymous(main.getLoginUser())) {
            attPanel.setReadonly(false);
        } else {
            attPanel.setReadonly(true);
        }
    } else {
        //hide all attachment and panel...
        setAttachmentCount(0);
        attachmentBtn.setVisible(false);
        attPanel.setVisible(false);
        attPanel.reset();
    }

    if (!GwtUtils.contains(model.attribute, PageAttribute.NO_PRETTY_URL)) {
        pUrlBtn.setVisible(true);
    } else {
        pUrlBtn.setVisible(false);
    }

    render.renderContent(model.spaceUname, model, model.renderContent, false);

    PageRender spaceMenuRender = new PageRender(spaceMenu);
    spaceMenuRender.renderContent(model.spaceUname, model, model.spaceMenuContent, false);

    if (!GwtUtils.contains(model.attribute, PageAttribute.NO_UNDER_TAB_BAR)) {
        //reset if a new page view: set comment read permission
        tabPanel.setVisible(true);
        tabPanel.reset(model.permissions[ClientConstants.COMMENT_READ], model.tabIndex);
        if (model.tabFocus) {
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                public void execute() {
                    GwtClientUtils.gotoAnchor(PageTabPanel.TABS_ANCHOR_NAME);
                }
            });
        }
    } else {
        tabPanel.clear();
        tabPanel.setVisible(false);
    }

    if (!GwtUtils.contains(model.attribute, PageAttribute.NO_RSS)) {
        rssFeedBtn.setSpaceUname(model.spaceUname);
    } else {
        //this will hide rssFeedBtn
        rssFeedBtn.setSpaceUname(null);
    }

    if (!GwtUtils.contains(model.attribute, PageAttribute.NO_EXPORT)) {
        exportBtn.setSpaceUname(main);
    } else {
        //this will hide exportBtn
        exportBtn.setSpaceUname(null);
    }

    //always needs to refresh, even same space - if a new page added or page title updated.
    main.refreshTreeItem(model.spaceUname, model.pageUuid);
    //      if(!sameSpace){
    //         main.refreshTreeItem(model.spaceUname,model.pageUuid);
    //      }else{
    //         main.selectTreeItem(model.pageUuid);
    //      }
    //locate to anchor
    String token = GwtClientUtils.getToken();
    final String anchor = GwtUtils.getAnchor(token);
    if (anchor != null) {
        Log.info("Get anchor " + anchor);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            public void execute() {
                GwtClientUtils.gotoAnchor(anchor);
            }
        });
    }
}

From source file:com.ephesoft.dcma.gwt.rv.client.presenter.ReviewValidatePresenter.java

License:Open Source License

public void setTitleOfTab(final String batchInstanceIdentifier) {
    if (batchInstanceIdentifier != null) {
        final String defaultTitle = LocaleDictionary.get().getConstantValue(ReviewValidateConstants.RV_TITLE);
        final String newTitle = defaultTitle + ReviewValidateConstants.SPACE + batchInstanceIdentifier;
        Window.setTitle(newTitle);
    }// w  w w. jav a2 s.c  o m
}