List of usage examples for com.vaadin.ui NativeButton NativeButton
public NativeButton()
From source file:edu.kit.dama.ui.repo.components.PaginationPanel.java
License:Apache License
/** * Build the navigation layout including the appropriate buttons to navigate * through the pagination pages.//from w w w . j av a 2 s. c o m * * @return The navigation layout component. */ private HorizontalLayout buildNavigationComponent() { HorizontalLayout result = new HorizontalLayout(); //add "JumpToFirstPage" button final NativeButton first = new NativeButton(); first.setIcon(new ThemeResource("img/16x16/beginning.png")); first.setDescription("First Page"); first.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { currentPage = 0; updatePage(); } }); //add "PreviousPage" button final NativeButton prev = new NativeButton(); prev.setIcon(new ThemeResource("img/16x16/prev.png")); prev.setDescription("Previous Page"); prev.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (currentPage > 0) { currentPage--; updatePage(); } } }); //add "NextPage" button final NativeButton next = new NativeButton(); next.setDescription("Next Page"); next.setIcon(new ThemeResource("img/16x16/next.png")); next.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (currentPage + 1 < overallPages) { currentPage++; updatePage(); } } }); //add "JumpToLastPage" button final NativeButton last = new NativeButton(); last.setDescription("Last Page"); last.setIcon(new ThemeResource("img/16x16/end.png")); last.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { currentPage = overallPages - 1; updatePage(); } }); //enable/disable buttons depending on the current page if (overallPages == 0) { first.setEnabled(false); prev.setEnabled(false); next.setEnabled(false); last.setEnabled(false); } else { first.setEnabled(!(currentPage == 0) || !(overallPages < 2)); prev.setEnabled(!(currentPage == 0) || !(overallPages < 2)); next.setEnabled(!(currentPage == overallPages - 1) || !(overallPages < 2)); last.setEnabled(!(currentPage == overallPages - 1) || !(overallPages < 2)); } Label leftFiller = new Label(); result.addComponent(leftFiller); result.setExpandRatio(leftFiller, 1.0f); result.addComponent(first); result.addComponent(prev); int start = currentPage - 5; start = (start < 0) ? 0 : start; int end = start + 10; end = (end > overallPages) ? overallPages : end; if (end - start < 10 && overallPages > 10) { start = end - 10; } if (overallPages == 0) { Label noEntryLabel = new Label("<i>No entries</i>", ContentMode.HTML); //noEntryLabel.setWidth("80px"); noEntryLabel.setSizeUndefined(); result.addComponent(noEntryLabel); result.setComponentAlignment(noEntryLabel, Alignment.MIDDLE_CENTER); } //build the actual page entries for (int i = start; i < end; i++) { if (i == currentPage) { //the current page is marked with a special style Label pageLink = new Label("<b>" + Integer.toString(i + 1) + "</b>", ContentMode.HTML); pageLink.setStyleName("currentpage"); pageLink.setWidth("15px"); result.addComponent(pageLink); result.setComponentAlignment(pageLink, Alignment.MIDDLE_CENTER); } else { //otherwise normal links are added, click-events are handled via LayoutClickListener Link pageLink = new Link(Integer.toString(i + 1), null); result.addComponent(pageLink); result.setComponentAlignment(pageLink, Alignment.MIDDLE_CENTER); } } //add right navigation buttons result.addComponent(next); result.addComponent(last); //...and fill the remaining space Label rightFiller = new Label(); result.addComponent(rightFiller); result.setExpandRatio(rightFiller, 1.0f); result.setSpacing(true); //put everything ot the middle result.setComponentAlignment(first, Alignment.MIDDLE_CENTER); result.setComponentAlignment(prev, Alignment.MIDDLE_CENTER); result.setComponentAlignment(next, Alignment.MIDDLE_CENTER); result.setComponentAlignment(last, Alignment.MIDDLE_CENTER); //add layout click listener to be able to navigate by clicking the single pages result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { // Get the child component which was clicked Component child = event.getChildComponent(); if (child == null) { // Not over any child component } else // Over a child component { if (child instanceof Link) { } } } }); //finalize result.setWidth("100%"); result.setHeight("25px"); return result; }
From source file:edu.kit.dama.ui.repo.MyVaadinUI.java
License:Apache License
/** * Build the search view and execute the provided query immediately. * * @param pQuery The query to execute or null if an empty view should be * shown./*from ww w . j a v a 2s .com*/ */ private void buildSearchView(String pQuery) { loginButton.setWidth("70px"); loginButton.setStyleName(BaseTheme.BUTTON_LINK); logoutButton.setWidth("70px"); logoutButton.setStyleName(BaseTheme.BUTTON_LINK); adminButton.setWidth("70px"); adminButton.setStyleName(BaseTheme.BUTTON_LINK); logoutButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { loggedInUser = UserData.NO_USER; refreshMainLayout(); } }); adminButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Page.getCurrent() .open(DataManagerSettings.getSingleton().getStringProperty( DataManagerSettings.GENERAL_BASE_URL_ID, "http://localhost:8889/BaReDemo") + "/admin", "_blank"); } }); searchField = UIUtils7.factoryTextField(null, "Search for..."); searchField.setWidth("920px"); searchField.setHeight("60px"); searchField.addStyleName("searchField"); paginationPanel = new PaginationPanel(this); paginationPanel.setSizeFull(); paginationPanel.setAllEntries(new LinkedList<DigitalObjectId>()); searchProvider = new FulltextElasticSearchProvider( DataManagerSettings.getSingleton() .getStringProperty(DataManagerSettings.ELASTIC_SEARCH_DEFAULT_CLUSTER_ID, "KITDataManager"), DataManagerSettings.getSingleton() .getStringProperty(DataManagerSettings.ELASTIC_SEARCH_DEFAULT_HOST_ID, "localhost"), DataManagerSettings.getSingleton().getStringProperty( DataManagerSettings.ELASTIC_SEARCH_DEFAULT_INDEX_ID, ElasticsearchHelper.ELASTICSEARCH_TYPE), ElasticsearchHelper.ELASTICSEARCH_TYPE); NativeButton goButton = new NativeButton(); goButton.setIcon(new ThemeResource("img/24x24/search.png")); goButton.setWidth("60px"); goButton.setHeight("60px"); goButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { doSearch(); } }); goButton.setClickShortcut(KeyCode.ENTER); setupLoginForm(); loginForm.setWidth("320px"); loginForm.setHeight("150px"); final PopupView loginPopup = new PopupView(null, loginForm); loginPopup.setHideOnMouseOut(false); loginButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { //mainLayout.replaceComponent(searchLayout, loginForm); loginPopup.setPopupVisible(true); } }); Label filler = new Label(); memberLayout = new HorizontalLayout(filler, adminButton, loginButton, loginPopup); memberLayout.setComponentAlignment(loginButton, Alignment.TOP_RIGHT); memberLayout.setComponentAlignment(adminButton, Alignment.TOP_RIGHT); memberLayout.setComponentAlignment(loginPopup, Alignment.TOP_RIGHT); memberLayout.setExpandRatio(filler, 1.0f); memberLayout.setMargin(false); memberLayout.setSpacing(false); memberLayout.setWidth("100%"); memberLayout.setHeight("30px"); Label spacer = new Label("<hr/>", ContentMode.HTML); spacer.setHeight("20px"); searchLayout = new UIUtils7.GridLayoutBuilder(3, 4) .addComponent(searchField, Alignment.TOP_LEFT, 0, 0, 2, 1) .addComponent(goButton, Alignment.TOP_RIGHT, 2, 0, 1, 1).fillRow(spacer, 0, 1, 1) .addComponent(paginationPanel, Alignment.MIDDLE_CENTER, 0, 2, 3, 2).getLayout(); searchLayout.addStyleName("paper"); searchLayout.setSpacing(true); searchLayout.setMargin(true); paginationPanel.setWidth("980px"); //wrapper Label icon8Link = new Label("<a href=\"http://icons8.com\">Icons by icon8.com</a>", ContentMode.HTML); mainLayout = new VerticalLayout(memberLayout, searchLayout, icon8Link); mainLayout.setComponentAlignment(memberLayout, Alignment.TOP_CENTER); mainLayout.setComponentAlignment(searchLayout, Alignment.TOP_CENTER); mainLayout.setComponentAlignment(icon8Link, Alignment.BOTTOM_RIGHT); mainLayout.setExpandRatio(memberLayout, .05f); mainLayout.setExpandRatio(searchLayout, .93f); mainLayout.setExpandRatio(icon8Link, .02f); VerticalLayout fullscreen = new VerticalLayout(mainLayout); fullscreen.setComponentAlignment(mainLayout, Alignment.TOP_CENTER); fullscreen.setSizeFull(); setContent(fullscreen); mainLayout.setWidth("1024px"); mainLayout.setHeight("768px"); if (pQuery != null) { searchField.setValue(pQuery); doSearch(); } }
From source file:edu.nps.moves.mmowgli.components.AvatarChooser.java
License:Open Source License
@SuppressWarnings("serial") @Override/* ww w .j a va 2 s. c om*/ public void initGui() { VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setMargin(true); //test mainLayout.setSpacing(true); MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); Label sp; setContent(mainLayout); Panel p = new Panel(imgLay = new HorizontalLayout()); imgLay.setSpacing(true); p.setWidth("100%"); mainLayout.addComponent(p); Collection<?> lis = Avatar.getContainer().getItemIds(); avIdArr = new Object[lis.size()]; int idx = 0; for (Object id : lis) { avIdArr[idx++] = id; if (initSelectedID == null) initSelectedID = id; // sets first one Avatar a = Avatar.getTL(id); Image em = new Image(null, medLoc.locate(a.getMedia())); em.setWidth("95px"); em.setHeight("95px"); em.addClickListener(new ImageClicked()); if (id.equals(initSelectedID)) { em.addStyleName("m-orangeborder5"); lastSel = em; } else em.addStyleName("m-greyborder5"); imgLay.addComponent(em); } butts = new HorizontalLayout(); butts.setWidth("100%"); butts.setSpacing(true); mainLayout.addComponent(butts); butts.addComponent(sp = new Label()); sp.setWidth("1px"); butts.setExpandRatio(sp, 1.0f); NativeButton cancelButt = new NativeButton(); medLoc.decorateCancelButton(cancelButt); butts.addComponent(cancelButt); NativeButton selectButt = new NativeButton(); medLoc.decorateSelectButton(selectButt); butts.addComponent(selectButt); butts.addComponent(sp = new Label("")); sp.setWidth("20px"); mainLayout.addComponent(sp = new Label("")); sp.setHeight("1px"); mainLayout.setExpandRatio(sp, 1.0f); ; cancelButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry public void buttonClick(ClickEvent event) { cancelClick(); } }); selectButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry public void buttonClick(ClickEvent event) { selectClick(); } }); }
From source file:edu.nps.moves.mmowgli.components.CardLarge.java
License:Open Source License
private CardLarge(Object cardId) { this.cardId = cardId; starButton = new NativeButton(); title = new Label(); content = new HtmlLabel(); uname = new Label(); dateLab = new Label(); moveLab = new Label(); idLab = new HtmlLabel(); dateFormatter = new SimpleDateFormat("MM/dd HH:mm z"); }
From source file:edu.nps.moves.mmowgli.components.CardSummary.java
License:Open Source License
@HibernateSessionThreadLocalConstructor @HibernateRead/*from w w w . ja v a 2 s. c om*/ private CardSummary(Object cardId, boolean isFactCard, Session sess, boolean mockupOnly) { this.cardId = cardId; this.isFactCard = isFactCard; this.mockupOnly = mockupOnly; // Assumption: the initGui() method below, where these 2 hib. objects are referenced, will be called in // the same thread/vaadin session so the hib. session passed in on the constructor will still be valid card = Card.getTL(cardId); me = Mmowgli2UI.getGlobals().getUserTL(); content = new HtmlLabel(); user = new Label(); dateLab = new Label(); header = new Label(); idLab = new Label(); star = new NativeButton(); dateFormatter = new SimpleDateFormat("MM/dd HH:mm z"); textColorStyleStr = CardStyler.getCardTextColorOverWhiteStyle(card.getCardType()); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboard.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public ActionDashboard() { User me = Mmowgli2UI.getGlobals().getUserTL(); actionPlansTab = new ActionDashboardTabActionPlans(); myPlansTab = new ActionDashboardTabMyPlans(me); needAuthorsTab = new ActionDashboardTabNeedAuthors(); actionPlansTabButt = new NativeButton(); myPlansTabButt = new NativeButton(); needAuthorsTabButt = new NativeButton(); howToWinActionButt = new IDNativeButton(null, HOWTOWINACTIONCLICK); howToWinActionButt.setStyleName("m-howToWinAction"); currentTabButton = actionPlansTabButt; currentTabPanel = actionPlansTab;// www . j a v a 2 s. co m }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPage2.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public ActionPlanPage2(Object actPlnId, boolean isMockup) { this.apId = actPlnId; ActionPlan actPln = ActionPlan.getTL(actPlnId); Game g = Game.getTL();//from w w w . j a v a2 s .c o m MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); if (globs.isGameReadOnly()) readonly = true; if (globs.isViewOnlyUser()) readonly = true; if ((actPln.getCreatedInMove().getNumber() != g.getCurrentMove().getNumber()) && globs.isPriorActionPlansReadOnly()) readonly = true; ChatLog cl = actPln.getChatLog(); if (cl != null) chatLogId = cl.getId(); saveCanPan = new SaveCancelPan(); MyTitleListener scLis = new MyTitleListener(saveCanPan); titleUnion = new TextAreaLabelUnion(null, null, scLis, "m-actionplan-title"); commentPanel = new ActionPlanPageCommentPanel2(this, actPlnId, readonly); commentsButt = new NativeButton(); envelopeButt = new NativeButton(); addCommentButt = new NativeButton(); addCommentButt.setEnabled(!readonly); addCommentButtBottom = new NativeButton(); addCommentButtBottom.setEnabled(!readonly); viewChainButt = new NativeButton(); browseBackButt = new NativeButton(); browseFwdButt = new NativeButton(); rfeButt = new IDNativeButton(null, RFECLICK); rfeButt.setParam(actPlnId); addAuthButton = new NativeButton(); thePlanTab = new ActionPlanPageTabThePlan2(this, actPlnId, isMockup, readonly); talkTab = new ActionPlanPageTabTalk(actPlnId, isMockup, readonly); imagesTab = new ActionPlanPageTabImages(actPlnId, isMockup, readonly); videosTab = new ActionPlanPageTabVideos(actPlnId, isMockup, readonly); mapTab = new ActionPlanPageTabMap(actPlnId, isMockup, readonly); thePlanTabButt = new NativeButton(); talkTabButt = new NativeButton(); imagesTabButt = new NativeButton(); videosTabButt = new NativeButton(); mapTabButt = new NativeButton(); currentTabButton = thePlanTabButt; currentTabPanel = thePlanTab; newChatLab = new NativeButton(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPage2.java
License:Open Source License
@SuppressWarnings("serial") public void initGuiTL() { ActionPlan actPln = ActionPlan.getTL(apId); User me = Mmowgli2UI.getGlobals().getUserTL(); addStyleName("m-cssleft-45"); setWidth("1089px"); setHeight("1821px"); Label sp;//from ww w . j av a 2 s . co m VerticalLayout mainVL = new VerticalLayout(); addComponent(mainVL, "top:0px;left:0px"); mainVL.addStyleName("m-overflow-visible"); mainVL.setWidth("1089px"); mainVL.setHeight(null); mainVL.setSpacing(false); mainVL.setMargin(false); VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setSpacing(false); mainVLayout.setMargin(false); mainVLayout.addStyleName("m-actionplan-background2"); mainVLayout.setWidth("1089px"); mainVLayout.setHeight(null); //"1821px"); mainVL.addComponent(mainVLayout); mainVLayout.addComponent(makeIdField(actPln)); mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); VerticalLayout leftTopVL = new VerticalLayout(); leftTopVL.setWidth("820px"); leftTopVL.setSpacing(false); leftTopVL.setMargin(false); mainVLayout.addComponent(leftTopVL); HorizontalLayout titleAndThumbsHL = new HorizontalLayout(); titleAndThumbsHL.setSpacing(false); titleAndThumbsHL.setMargin(false); titleAndThumbsHL.setHeight("115px"); titleAndThumbsHL.addStyleName("m-actionplan-header-container"); leftTopVL.addComponent(titleAndThumbsHL); titleAndThumbsHL.addComponent(sp = new Label()); sp.setWidth("55px"); VerticalLayout vl = new VerticalLayout(); vl.addComponent(titleUnion); //titleTA); titleUnion.initGui(); titleHistoryButt = new NativeButton(); titleHistoryButt.setCaption("history"); titleHistoryButt.setStyleName(BaseTheme.BUTTON_LINK); titleHistoryButt.addStyleName("borderless"); titleHistoryButt.addStyleName("m-actionplan-history-button"); titleHistoryButt.addClickListener(new TitleHistoryListener()); titleHistoryButt.setEnabled(!readonly); vl.addComponent(titleHistoryButt); vl.setComponentAlignment(titleHistoryButt, Alignment.TOP_RIGHT); titleAndThumbsHL.addComponent(vl); //titleTA); titleUnion.setWidth(ACTIONPLAN_TITLE_W); titleUnion.setValueTL(actPln.getTitle() == null ? "" : actPln.getTitle()); titleUnion.addStyleName("m-lightgrey-border"); // titleUnion.addStyleName("m-opacity-75"); titleUnion.setHeight("95px"); // 120 px); must make it this way for alignment of r/o vs rw addComponent(saveCanPan, "top:0px;left:395px"); saveCanPan.setVisible(false); titleAndThumbsHL.addComponent(sp = new Label()); sp.setWidth("50px"); VerticalLayout thumbVL = new VerticalLayout(); titleAndThumbsHL.addComponent(thumbVL); thumbVL.addComponent(sp = new Label()); sp.setHeight("50px"); thumbPanel = new ThumbPanel(); Map<User, Integer> map = actPln.getUserThumbs(); Integer t = map.get(me); /* if(t == null) { map.put(me, 0); ActionPlan.update(actPln); GameEventLogger.logActionPlanUpdate(actPln, "thumbs changed",me.getUserName()); t = 0; } */ thumbPanel.setNumUserThumbs(t == null ? 0 : t); thumbVL.addComponent(thumbPanel); HorizontalLayout commentAndViewChainHL = new HorizontalLayout(); leftTopVL.addComponent(commentAndViewChainHL); commentAndViewChainHL.setSpacing(false); commentAndViewChainHL.setMargin(false); commentAndViewChainHL.addComponent(sp = new Label()); sp.setWidth("55px"); VerticalLayout commLeftVL = new VerticalLayout(); commentAndViewChainHL.addComponent(commLeftVL); commLeftVL.setWidth("95px"); commLeftVL.addComponent(commentsButt); commentsButt.setStyleName(BaseTheme.BUTTON_LINK); commentsButt.addStyleName("borderless"); commentsButt.addStyleName("m-actionplan-comments-button"); ClickListener commLis; commentsButt.addClickListener(commLis = new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().setScrollTop(1250); //commentsButt.getWindow().setScrollTop(1250); } }); commLeftVL.addComponent(sp = new Label()); sp.setHeight("65px"); //"50px"); commLeftVL.addComponent(envelopeButt); envelopeButt.addStyleName("m-actionplan-envelope-button"); envelopeButt.addClickListener(commLis); // same as the link button above commentAndViewChainHL.addComponent(sp = new Label()); sp.setWidth("5px"); VerticalLayout commMidVL = new VerticalLayout(); commentAndViewChainHL.addComponent(commMidVL); commMidVL.setWidth("535px"); commMidVL.addComponent(addCommentButt); addCommentButt.setCaption("Add Comment"); addCommentButt.setStyleName(BaseTheme.BUTTON_LINK); addCommentButt.addStyleName("borderless"); addCommentButt.addStyleName("m-actionplan-comments-button"); addCommentButt.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_TOP); addCommentButt.addClickListener(addCommentListener = new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().setScrollTop(1250); //addCommentButt.getWindow().setScrollTop(1250); commentPanel.AddCommentClicked(event); } }); commMidVL.addComponent(sp = new Label()); sp.setHeight("5px"); commMidVL.addComponent(lastCommentLabel = new HtmlLabel()); lastCommentLabel.setWidth("100%"); lastCommentLabel.setHeight("94px"); lastCommentLabel.addStyleName("m-actionplan-textentry"); lastCommentLabel.addStyleName("m-opacity-75"); addComponent(viewChainButt, "left:690px;top:140px"); viewChainButt.setStyleName("m-viewCardChainButton"); viewChainButt.addClickListener(new ViewCardChainHandler()); viewChainButt.setId(ACTIONPLAN_VIEW_CARD_CHAIN_BUTTON); // This guy sits on the bottom naw, gets covered // author list and rfe VerticalLayout rightVL = new VerticalLayout(); this.addComponent(rightVL, "left:830px;top:0px"); rightVL.setSpacing(false); rightVL.setMargin(false); rightVL.setWidth(null); VerticalLayout listVL = new VerticalLayout(); listVL.setSpacing(false); listVL.addStyleName("m-actionPlanAddAuthorList"); listVL.addStyleName("m-actionplan-header-container"); listVL.setHeight(null); listVL.setWidth("190px"); listVL.addComponent(sp = new Label()); sp.setHeight("35px"); sp.setDescription("List of current authors and (invited authors)"); Label subTitle; listVL.addComponent(subTitle = new Label("(invited in parentheses)")); subTitle.setWidth(null); // keep it from being 100% wide subTitle.setDescription("List of current authors and (invited authors)"); subTitle.addStyleName("m-actionplan-authorlist-sublabel"); listVL.setComponentAlignment(subTitle, Alignment.MIDDLE_CENTER); rightVL.addComponent(listVL); TreeSet<User> ts = new TreeSet<User>(new User.AlphabeticalComparator()); ts.addAll(actPln.getAuthors()); TreeSet<User> greyTs = new TreeSet<User>(new User.AlphabeticalComparator()); greyTs.addAll(actPln.getInvitees()); authorList = new UserList(null, ts, greyTs); listVL.addComponent(authorList); authorList.addStyleName("m-greyborder"); listVL.setComponentAlignment(authorList, Alignment.TOP_CENTER); authorList.setWidth("150px"); authorList.setHeight("95px"); listVL.addComponent(sp = new Label()); sp.setHeight("5px"); listVL.addComponent(addAuthButton); listVL.setComponentAlignment(addAuthButton, Alignment.TOP_CENTER); addAuthButton.setStyleName("m-actionPlanAddAuthorButt"); addAuthButton.addClickListener(new AddAuthorHandler()); addAuthButton.setDescription("Invite players to be authors of this action plan"); rightVL.addComponent(sp = new Label()); sp.setHeight("5px"); rightVL.addComponent(rfeButt); rightVL.setComponentAlignment(rfeButt, Alignment.TOP_CENTER); // done in handleDisabledments() rfeButt.setStyleName("m-rfeButton"); // end authorList and rfe mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); sp.setWidth("20px"); // Tabs: AbsoluteLayout absL = new AbsoluteLayout(); mainVLayout.addComponent(absL); absL.setHeight("60px"); absL.setWidth("830px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionPlanBlackTabs"); tabsHL.setSpacing(false); absL.addComponent(tabsHL, "left:40px;top:0px"); NewTabClickHandler ntabHndlr = new NewTabClickHandler(); tabsHL.addComponent(sp = new Label()); sp.setWidth("19px"); thePlanTabButt.setStyleName("m-actionPlanThePlanTab"); thePlanTabButt.addStyleName(ACTIONPLAN_TAB_THEPLAN); // debug thePlanTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(thePlanTabButt); talkTabButt.setStyleName("m-actionPlanTalkItOverTab"); //talkTabButt.addStyleName(ACTIONPLAN_TAB_TALK); talkTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(talkTabButt); talkTabButt.addStyleName("m-transparent-background"); // initially imagesTabButt.setStyleName("m-actionPlanImagesTab"); imagesTabButt.addStyleName(ACTIONPLAN_TAB_IMAGES); imagesTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(imagesTabButt); imagesTabButt.addStyleName("m-transparent-background"); // initially videosTabButt.setStyleName("m-actionPlanVideosTab"); videosTabButt.addStyleName(ACTIONPLAN_TAB_VIDEO); videosTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(videosTabButt); videosTabButt.addStyleName("m-transparent-background"); // initially mapTabButt.setStyleName("m-actionPlanMapTab"); mapTabButt.addStyleName(ACTIONPLAN_TAB_MAP); mapTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(mapTabButt); mapTabButt.addStyleName("m-transparent-background"); // initially newChatLab.setStyleName("m-newChatLabel"); absL.addComponent(newChatLab, "left:340px;top:15px"); newChatLab.setVisible(false); // stack the pages HorizontalLayout hsp = new HorizontalLayout(); hsp.setHeight("742px"); // allows for differing ghost box heights mainVLayout.addComponent(hsp); hsp.addComponent(sp = new Label()); sp.setWidth("45px"); hsp.addComponent(thePlanTab); thePlanTab.initGui(); hsp.addComponent(talkTab); talkTab.initGui(); talkTab.setVisible(false); hsp.addComponent(imagesTab); imagesTab.initGui(); imagesTab.setVisible(false); hsp.addComponent(videosTab); videosTab.initGui(); videosTab.setVisible(false); hsp.addComponent(mapTab); mapTab.initGui(); mapTab.setVisible(false); mainVLayout.addComponent(sp = new Label()); sp.setHeight("90px"); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.addStyleName("m-marginleft-60"); mainVLayout.addComponent(buttLay); buttLay.setWidth(ActionPlanPageCommentPanel2.COMMENT_PANEL_WIDTH); addCommentButtBottom.setCaption("Add Comment"); addCommentButtBottom.setStyleName(BaseTheme.BUTTON_LINK); addCommentButtBottom.addStyleName("borderless"); addCommentButtBottom.addStyleName("m-actionplan-comments-button"); addCommentButtBottom.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_BOTTOM); addCommentButtBottom.addClickListener(addCommentListener); buttLay.addComponent(addCommentButtBottom); if (me.isAdministrator() || me.isGameMaster()) { buttLay.addComponent(sp = new Label()); sp.setWidth("1px"); // "810px"); buttLay.setExpandRatio(sp, 1.0f); ToggleLinkButton tlb = new ToggleLinkButton("View all", "View unhidden only", "m-actionplan-comment-text"); tlb.setToolTips("Temporarily show all messages, including those marked \"hidden\" (gm)", "Temporarily hide messages marked \"hidden\" (gm)"); tlb.addStyleName("m-actionplan-comments-button"); tlb.addOnListener(new ViewAllListener()); tlb.addOffListener(new ViewUnhiddenOnlyListener()); buttLay.addComponent(tlb); buttLay.addComponent(sp = new Label()); sp.setWidth("5px"); } // And the comments hsp = new HorizontalLayout(); mainVLayout.addComponent(hsp); mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); hsp.addComponent(sp = new Label()); sp.setWidth("56px"); hsp.addComponent(commentPanel); commentPanel.initGui(); // Set thumbs double thumbs = actPln.getAverageThumb(); long round = Math.round(thumbs); int numApThumbs = (int) (Math.min(round, 3)); thumbPanel.setNumApThumbs(numApThumbs); Integer myRating = actPln.getUserThumbs().get(me); if (myRating == null) myRating = 0; thumbPanel.setNumUserThumbs(myRating); helpWantedListener = new HelpWantedListener(); interestedListener = new InterestedListener(); handleDisablementsTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabImages.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public ActionPlanPageTabImages(Object apId, boolean isMockup, boolean readonly) { super(apId, isMockup, readonly); addImageButt = new NativeButton(); replaceLis = new ImageReplacer(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabTalk.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public ActionPlanPageTabTalk(Object apId, boolean isMockup, boolean readonly) { super(apId, isMockup, readonly); submitButt = new NativeButton(); discardButt = new NativeButton(); dateFormatter = new SimpleDateFormat("MM/dd HH:mm z"); chatEntryComponent = createChatEntryField(); User me = Mmowgli2UI.getGlobals().getUserTL(); isGameMasterOrAdmin = me.isAdministrator() || me.isGameMaster(); }