private void addImageAndTitle(HorizontalPanel hp, GWTAppProperties properties) { Image logo = new Image(properties.getHeaderLogo()); logo.setStyleName("square-header-LogoImage"); logo.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // when you click on the image, go to the home page. History.newItem(ChooseCasePilot.generateNavigationId(ChooseCasePilot.PageId.home)); } }); logo.setPixelSize(50, 50); hp.add(logo); VerticalPanel titleVerticalPane = new VerticalPanel(); titleVerticalPane.setSize("100%", "100%"); Label title = new Label(properties.getHeaderTitle1()); Label subTitle = new Label(properties.getHeaderTitle2()); title.setStyleName("square-headerpane-title"); subTitle.setStyleName("square-headerpane-tagline"); titleVerticalPane.add(title); titleVerticalPane.add(subTitle); hp.add(titleVerticalPane); }
private void addNavigationLinks(State currentState) { // If the user is not authenticated we're not going to bother setting up the link bar // they shouldn't have access to any of the stuff anyway. String role = ""; if (!currentState.isAuthenticated()) { return; } if (!currentState.getUserProjectRole().equals(ProjectRole.None)) { role = " (" + currentState.getUserProjectRole().getLabel() + ")"; } Label userName = new Label(currentState.getUserName() + role); this.linksPanel.add(userName); this.linksPanel.add(new Label(messages.delimiter())); // Only the admin and aoe can mange the site settings. if (currentState.isSiteAdministrator() || currentState.getUserProjectRole() == ProjectRole.Acquisition_Organization_Engineer) { currentState.setMode(GwtModesType.ReadWrite); } { Hyperlink adminLink = new Hyperlink( messages.adminLinkText(), ManageSitePilot.generateNavigationId(ManageSitePilot.PageId.home)); this.linksPanel.add(adminLink); this.linksPanel.add(new Label(messages.delimiter())); } // user preferences page Hyperlink preference = new Hyperlink( messages.linkTitle2(), ChooseCasePilot.generateNavigationId(ChooseCasePilot.PageId.preferences)); this.linksPanel.add(preference); this.linksPanel.add(new Label(messages.delimiter())); // help page // Hyperlink help = new Hyperlink(messages.linkTitle3(), // HomePilot.generateNavigationId(HomePilot.PageId.help)); HTML helpLink = new HTML("<a href='" + properties.getHelpLink() + "'>help</a>"); this.linksPanel.add(helpLink); this.linksPanel.add(new Label(messages.delimiter())); // sign out Hyperlink signOut = new Hyperlink( "sign out", ChooseCasePilot.generateNavigationId(ChooseCasePilot.PageId.logout)); this.linksPanel.add(signOut); signOut.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { logInService.logOut( new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub } @Override public void onSuccess(Void result) { // TODO Auto-generated method stub } }); } }); this.linksPanel.setSpacing(3); this.linksPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); this.linksPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); }