List of usage examples for com.vaadin.ui Label setDescription
public void setDescription(String description)
From source file:edu.kit.dama.ui.simon.panel.SimonMainPanel.java
License:Apache License
/** * Build the overview tab including the list of all categories and der * overall status.//ww w. ja va2 s .co m * * @param pCategories A list of all categories. * * @return The tab component. */ private Component buildOverviewTab(String[] pCategories) { AbsoluteLayout abLay = new AbsoluteLayout(); UIUtils7.GridLayoutBuilder layoutBuilder = new UIUtils7.GridLayoutBuilder(4, pCategories.length + 1); updateButton = new Button("Update Status"); updateButton.addClickListener(this); Embedded logo = new Embedded(null, new ThemeResource("img/simon.png")); abLay.addComponent(logo, "top:30px;left:30px;"); Label simonSaysLabel = new Label("", ContentMode.HTML); simonSaysLabel.setHeight("150px"); setSimonSaysContent(simonSaysLabel, "Everything is fine."); abLay.addComponent(simonSaysLabel, "top:30px;left:250px;"); int row = 0; for (String category : pCategories) { HorizontalLayout rowLayout = new HorizontalLayout(); Label name = new Label(category); name.setWidth("200px"); name.setHeight("24px"); List<AbstractProbe> probes = probesByCategory.get(category); Collections.sort(probes, new Comparator<AbstractProbe>() { @Override public int compare(AbstractProbe o1, AbstractProbe o2) { return o1.getCurrentStatus().compareTo(o2.getCurrentStatus()); } }); int failed = 0; int unknown = 0; int unavailable = 0; int charactersPerProbe = 100; if (probes.size() > 0) { charactersPerProbe = (int) Math.rint((700.0 / probes.size()) / 8.0); } for (AbstractProbe probe : probes) { Label probeLabel = new Label(StringUtils.abbreviate(probe.getName(), charactersPerProbe)); probeLabel.setHeight("24px"); switch (probe.getCurrentStatus()) { case UNKNOWN: probeLabel.setDescription(probe.getName() + ": UNKNOWN"); probeLabel.addStyleName("probe-unknown"); unknown++; break; case UPDATING: probeLabel.setDescription(probe.getName() + ": UPDATING"); probeLabel.addStyleName("probe-updating"); break; case UNAVAILABLE: probeLabel.setDescription(probe.getName() + ": UNAVAILABLE"); probeLabel.addStyleName("probe-unavailable"); unavailable++; break; case FAILED: probeLabel.setDescription(probe.getName() + ": FAILED"); probeLabel.addStyleName("probe-failed"); failed++; break; default: probeLabel.setDescription(probe.getName() + ": SUCCESS"); probeLabel.addStyleName("probe-success"); } probeLabel.addStyleName("probe"); rowLayout.addComponent(probeLabel); } if (failed != 0) { setSimonSaysContent(simonSaysLabel, "There are errors!"); } else { if (unknown != 0) { setSimonSaysContent(simonSaysLabel, "There are unknown states. Please select 'Update Status'."); } else { if (unavailable != 0) { setSimonSaysContent(simonSaysLabel, "Some probes are unavailable. Please check their configuration."); } } } rowLayout.setWidth("700px"); layoutBuilder.addComponent(name, Alignment.TOP_LEFT, 0, row, 1, 1).addComponent(rowLayout, Alignment.TOP_LEFT, 1, row, 3, 1); row++; } layoutBuilder.addComponent(updateButton, Alignment.BOTTOM_RIGHT, 3, row, 1, 1); GridLayout tabLayout = layoutBuilder.getLayout(); tabLayout.setSpacing(true); tabLayout.setMargin(true); Panel p = new Panel(); p.setContent(tabLayout); p.setWidth("1024px"); p.setHeight("400px"); abLay.addComponent(p, "top:160px;left:30px;"); abLay.setSizeFull(); return abLay; }
From source file:edu.nps.moves.mmowgli.components.Footer.java
License:Open Source License
@Override public void initGui() { setWidth(FOOTER_W);/*from www. jav a2 s . c o m*/ setHeight("130px"); //room for fouo butt//FOOTER_H); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(FOOTER_W); mainAbsLay.setHeight(FOOTER_H); addComponent(mainAbsLay, FOOTER_OFFSET_POS); MediaLocator medLoc = ((Mmowgli2UI) UI.getCurrent()).getMediaLocator(); Embedded back = new Embedded(null, medLoc.getFooterBackground()); mainAbsLay.addComponent(back, "top:0px;left:0px"); HorizontalLayout outerHorLay = new HorizontalLayout(); addComponent(outerHorLay, "top:45px;left:0px"); outerHorLay.setWidth(FOOTER_W); HorizontalLayout innerHorLay = new HorizontalLayout(); innerHorLay.setSpacing(true); outerHorLay.addComponent(innerHorLay); outerHorLay.setComponentAlignment(innerHorLay, Alignment.MIDDLE_CENTER); Label sp; innerHorLay.addComponent(aboutButt); innerHorLay.addComponent(pingPushLab = new HtmlLabel()); pingPushLab.setWidth("7px"); innerHorLay.addComponent(creditsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(faqsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(fixesButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(glossaryButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(reportsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(termsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(troubleButt); troubleButt.addStyleName("m-red-text"); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(twitterButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(videosButt); GameLinks gl = GameLinks.getTL(); if (gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech")) { ; // This is a hack, but I don't want to pollute the db with a bogus boolean...this is a special case just for these folks. } else { HorizontalLayout hl = new HorizontalLayout(); Label lab = null; hl.addComponent(lab = new HtmlLabel("Build " + MMOWGLI_BUILD_ID)); lab.addStyleName("m-footer-servername"); //small text lab.setDescription(Mmowgli2UI.getGlobals().getVaadinSessionCookie()); hl.addComponent(lab = new HtmlLabel(" Vaadin " + VAADIN_BUILD_VERSION)); lab.addStyleName("m-footer-servername"); //small text hl.addComponent(lab = new HtmlLabel(" " + AppMaster.instance().getServerName())); lab.addStyleName("m-footer-servername"); //small text hl.setSizeUndefined(); mainAbsLay.addComponent(hl, "bottom:3px;right:15px;"); } fouoLink = Footer.buildFouoNoticeTL(); addComponent(fouoLink, "top:92px;left:365px"); fouoLink.setVisible(Game.getTL().isShowFouo()); }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
private Label makeImplementationPtsLabel(String width, String height) { Label lab = makeScoreLabel("m-implscore-text", width, height); lab.setDescription("Points for action plans"); return lab;//w w w .j av a2 s . c o m }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
private Label makeExplorationPtsLabel(String width, String height) { Label lab = makeScoreLabel("m-explscore-text", width, height); lab.setDescription("Points for idea cards"); return lab;/*w ww . j ava2 s . c o m*/ }
From source file:edu.nps.moves.mmowgli.components.SendMessageWindow.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public SendMessageWindow(List<String> emails) { super("A message to mmowgli followers"); this.emails = emails; setModal(true);/* ww w .j av a2 s. c om*/ VerticalLayout layout = new VerticalLayout(); setContent(layout); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("100%"); layout.setHeight("100%"); Label lab = new Label(makeString(emails)); lab.setCaption("To: (other addresses hidden from each recipient)"); lab.setDescription(lab.getValue().toString()); lab.addStyleName("m-nowrap"); // lab.setHeight("100%"); // makes label clip lab.addStyleName("m-greyborder"); layout.addComponent(lab); subjTf = new TextField(); subjTf.setCaption("Subject:"); subjTf.setWidth("100%"); Game game = Game.getTL(); String acronym = game.getAcronym(); acronym = acronym == null ? "" : acronym + " "; subjTf.setValue("Message from " + acronym + "Mmowgli"); layout.addComponent(subjTf); ta = new TextArea(); ta.setCaption("Content: (may include HTML tags)"); ta.setRows(10); ta.setColumns(50); ta.setWidth("100%"); ta.setHeight("100%"); ta.setInputPrompt("Type message here"); layout.addComponent(ta); layout.setExpandRatio(ta, 1.0f); HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(true); ClickListener closeListener = new SignupsWindowCloser(this); cancelButt = new Button("Cancel", closeListener); buttHL.addComponent(cancelButt); sendButt = new Button("Send", closeListener); sendButt.addClickListener(closeListener); buttHL.addComponent(sendButt); layout.addComponent(buttHL); layout.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT); setWidth("650px"); setHeight("500px"); UI.getCurrent().addWindow(this); ta.focus(); }
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; VerticalLayout mainVL = new VerticalLayout(); addComponent(mainVL, "top:0px;left:0px"); mainVL.addStyleName("m-overflow-visible"); mainVL.setWidth("1089px"); mainVL.setHeight(null);// www .j a v a2 s . c o m 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.administration.AbstractGameBuilderPanel.java
License:Open Source License
@Override public void initGui() { String title = getTitle();// w ww .j av a2 s . c o m if (title != null) { Label titleLab; addComponent(titleLab = new Label(title)); titleLab.addStyleName("m-centeralign"); } Embedded e = this.getImage(); if (e != null) { e.setWidth("800px"); // "930px"); e.setHeight("400px"); // "465px"); e.addStyleName("m-greyborder3"); addComponent(e); setComponentAlignment(e, Alignment.MIDDLE_CENTER); } if (lines.size() > 0) { grid.setColumns(3); String heading = getHeading(); Component footer = getFooter(); int nRows = lines.size() + (heading != null ? 1 : 0) + (footer != null ? 1 : 0); grid.setRows(nRows); int rowOffst = 0; if (heading != null) { grid.addComponent(makeLabel(heading), 0, 0, 2, 0); rowOffst = 1; } for (int r = 0; r < lines.size(); r++) { EditLine edLine = lines.get(r); if (edLine.ta != null) edLine.ta.setDescription(edLine.tooltip); if (edLine.isSeparator()) { addSeparator(grid, r + rowOffst); continue; } if (edLine.justComponent()) { addLineComponent(grid, r + rowOffst, edLine.ta); continue; } Label textLab = new HtmlLabel(edLine.name); textLab.setDescription(edLine.tooltip); textLab.addStyleName("m-font-bold14"); textLab.setWidth(getColumn1WidthString()); grid.addComponent(textLab, 0, r + rowOffst); // c0,r0,c1,r1 Label fieldLab = new Label(edLine.info); fieldLab.setDescription(edLine.tooltip); fieldLab.addStyleName("m-italic"); fieldLab.setWidth(getColumn2WidthString()); grid.addComponent(fieldLab, 1, r + rowOffst); if (edLine.ta instanceof TextArea) { TextArea ta = (TextArea) edLine.ta; ta.setDescription(edLine.tooltip); ta.setImmediate(true); ta.setWidth("100%"); if (edLine.fieldName != null && autoSave) ta.addValueChangeListener(new IndivListener(edLine, updatesOK, edLine.fieldClass == null ? String.class : edLine.fieldClass)); grid.addComponent(ta, 2, r + rowOffst); } else if (edLine.ta instanceof CheckBox) { CheckBox cb = (CheckBox) edLine.ta; cb.setDescription(edLine.tooltip); cb.setImmediate(true); if (edLine.fieldName != null && autoSave) cb.addValueChangeListener(new IndivListener(edLine, updatesOK, boolean.class)); grid.addComponent(cb, 2, r + rowOffst); } else if (edLine.ta instanceof Component) { grid.addComponent(edLine.ta, 2, r + rowOffst); } } if (footer != null) { int frow = lines.size() + rowOffst; grid.addComponent(footer, 0, frow, 2, frow); } grid.setWidth("99%"); grid.setHeight("100%"); addComponent(grid); grid.setColumnExpandRatio(2, 1.0f); if (showTestButton) { Button testButt = new Button(getTextButtonText(), new ClickListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); testButtonClickedTL(event); HSess.close(); } }); addComponent(testButt); setComponentAlignment(testButt, Alignment.MIDDLE_CENTER); } } }
From source file:edu.nps.moves.mmowgli.modules.cards.CardSummaryLine.java
License:Open Source License
@Override public void initGui() { Card c = Card.getTL(cardId);/*from w w w .j av a 2 s .co m*/ String tooltip = c.getText(); User auth = c.getAuthor(); Label lab = new Label(dateForm.format(c.getCreationDate())); lab.setWidth(6.0f, Unit.EM); addComponent(lab); setComponentAlignment(lab, Alignment.MIDDLE_LEFT); lab.addStyleName("m-cursor-pointer"); lab.setDescription(tooltip); addComponent(lab = new Label(c.getCardType().getTitle())); lab.setWidth(5.0f, Unit.EM); setComponentAlignment(lab, Alignment.MIDDLE_LEFT); lab.addStyleName("m-cursor-pointer"); lab.setDescription(tooltip); MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator(); Embedded emb = new Embedded(null, mLoc.getCardDot(c.getCardType())); emb.setWidth("19px"); emb.setHeight("15px"); addComponent(emb); setComponentAlignment(emb, Alignment.MIDDLE_LEFT); emb.addStyleName("m-cursor-pointer"); emb.setDescription(tooltip); addComponent(lab = new Label(c.getText())); lab.setHeight(1.0f, Unit.EM); ; setComponentAlignment(lab, Alignment.MIDDLE_LEFT); setExpandRatio(lab, 1.0f); // all the extra lab.addStyleName("m-cursor-pointer"); lab.setDescription(tooltip); if (auth.getAvatar() != null) { avatar = new Embedded(null, mLoc.locate(auth.getAvatar().getMedia(), 32)); avatar.setWidth("24px"); avatar.setHeight("24px"); addComponent(avatar); setComponentAlignment(avatar, Alignment.MIDDLE_LEFT); avatar.addStyleName("m-cursor-pointer"); avatar.setDescription(tooltip); } IDButton uButt = new IDButton(c.getAuthorName(), SHOWUSERPROFILECLICK, c.getAuthor().getId()); uButt.addStyleName(BaseTheme.BUTTON_LINK); uButt.setWidth(8.0f, Unit.EM); addComponent(uButt); setComponentAlignment(uButt, Alignment.MIDDLE_LEFT); uButt.setDescription(tooltip); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java
License:Open Source License
@Override public void initGui() { setWidth("988px"); // same width as included panel setHeight(BIGGESTWINDOW_HEIGHT_S); // try to handle making the popup miss the video Instrumentation.addInstrumentation(this); Game game = Game.getTL();// w ww .j av a 2 s. com MovePhase phase = game.getCurrentMove().getCurrentMovePhase(); HorizontalLayout outerLayout = new HorizontalLayout(); outerLayout.setSpacing(true); addComponent(outerLayout); outerLayout.setWidth("988px"); setExpandRatio(outerLayout, 1); Label spacer; outerLayout.addComponent(baseVLayout = new VerticalLayout()); baseVLayout.setWidth("988px"); outerLayout.setComponentAlignment(baseVLayout, Alignment.TOP_CENTER); baseVLayout.setSpacing(true); // This is just to give us a hidden widget to update to keep push channel alive through Akamai outerLayout.addComponent(pushPingLab = new HtmlLabel("")); pushPingLab.setWidth("5px"); String headingStr = phase.getOrientationCallToActionText(); String summaryStr = phase.getOrientationHeadline(); String textStr = phase.getOrientationSummary(); Media vid = phase.getOrientationVideo(); vidPan = new VideoWithRightTextPanel(vid, headingStr, summaryStr, textStr, null); vidPan.setLargeText(true); baseVLayout.addComponent(vidPan); vidPan.initGui(); HorizontalLayout bottomHLayout = new HorizontalLayout(); bottomHLayout.addComponent(spacer = new Label()); // special spacer bottomHLayout.setExpandRatio(spacer, 1.0f); Label[] spacers = new Label[5]; Label lab; int numButts = 0; // Email signup button //----------------------- if (phase.isSignupButtonShow()) { VerticalLayout signupVL = new VerticalLayout(); signupVL.setHeight("50px"); signupVL.setMargin(false); if (mockupOnly) signupVL.addComponent(signupButt = new NativeButton(null)); // no handler else signupVL.addComponent(signupButt = new NativeButton(null, this)); signupButt.addStyleName("signupbutton"); signupButt.setEnabled(phase.isSignupButtonEnabled()); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(signupButt, phase.getSignupButtonIcon()); signupVL.setComponentAlignment(signupButt, Alignment.MIDDLE_CENTER); signupVL.addComponent(lab = new Label()); lab.setHeight("1px"); signupVL.setExpandRatio(lab, 1.0f); signupVL.addComponent(lab = new HtmlLabel(phase.getSignupButtonSubText())); lab.addStyleName("m-text-align-center"); signupButt.setDescription(phase.getSignupButtonToolTip()); lab.setDescription(phase.getSignupButtonToolTip()); lab.setEnabled(phase.isSignupButtonEnabled()); signupVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); bottomHLayout.addComponent(signupVL); numButts++; } // New player reg button //---------------------- if (phase.isNewButtonShow()) { if (numButts > 0) bottomHLayout.addComponent(spacers[numButts] = new Label()); VerticalLayout newButtVL = new VerticalLayout(); newButtVL.setHeight("50px"); newButtVL.setMargin(false); if (mockupOnly) newButtVL.addComponent(imNewButt = new NativeButton(null)); // no handler else newButtVL.addComponent(imNewButt = new NativeButton(null, this)); imNewButt.setEnabled(phase.isNewButtonEnabled()); imNewButt.addStyleName("newuserbutton"); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imNewButt, phase.getNewButtonIcon()); newButtVL.setComponentAlignment(imNewButt, Alignment.MIDDLE_CENTER); newButtVL.addComponent(lab = new Label()); lab.setHeight("1px"); newButtVL.setExpandRatio(lab, 1.0f); /* boolean gameRO = game.isReadonly(); boolean gameClamped = game.isRegisteredLogonsOnly(); imNewButt.setEnabled(!gameRO & !gameClamped); // Label lab; if (gameRO) { newButtVL.addComponent(lab = new Label("No new player accounts, for now")); // "Player registration is currently closed")); // //"Sorry, no more new players")); String s; lab.setDescription(s = "New player accounts will open when game play starts"); imNewButt.setDescription(s); } else if (gameClamped) newButtVL.addComponent(lab = new Label("The game is full, please retry later")); // "Sorry, no more new players")); else newButtVL.addComponent(lab = new Label("You can get started in 2 minutes...")); */ newButtVL.addComponent(lab = new HtmlLabel(phase.getNewButtonSubText())); newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); lab.addStyleName("m-text-align-center"); lab.setEnabled(phase.isNewButtonEnabled()); imNewButt.setDescription(phase.getNewButtonToolTip()); lab.setDescription(phase.getNewButtonToolTip()); newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); bottomHLayout.addComponent(newButtVL); numButts++; } // Existing player button //----------------------- if (phase.isLoginButtonShow()) { if (numButts > 0) bottomHLayout.addComponent(spacers[numButts] = new Label()); VerticalLayout rightButtVL = new VerticalLayout(); rightButtVL.setHeight("50px"); rightButtVL.setMargin(false); if (mockupOnly) rightButtVL.addComponent(imRegisteredButt = new NativeButton(null)); // no handler else rightButtVL.addComponent(imRegisteredButt = new NativeButton(null, this)); imRegisteredButt.addStyleName("loginbutton"); imRegisteredButt.setEnabled(phase.isLoginButtonEnabled()); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imRegisteredButt, phase.getLoginButtonIcon()); rightButtVL.setComponentAlignment(imRegisteredButt, Alignment.MIDDLE_CENTER); rightButtVL.addComponent(lab = new Label()); lab.setHeight("1px"); rightButtVL.setExpandRatio(lab, 1.0f); rightButtVL.addComponent(lab = new HtmlLabel(phase.getLoginButtonSubText())); lab.addStyleName("m-text-align-center"); lab.setEnabled(phase.isLoginButtonEnabled()); rightButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); imRegisteredButt.setDescription(phase.getLoginButtonToolTip()); lab.setDescription(phase.getLoginButtonToolTip()); bottomHLayout.addComponent(rightButtVL); numButts++; checkQuickCACLoginTL(); } // Guest signup button //----------------------- if (phase.isGuestButtonShow()) { if (numButts > 0) bottomHLayout.addComponent(spacers[numButts] = new Label()); VerticalLayout guestButtVL = new VerticalLayout(); guestButtVL.setHeight("50px"); guestButtVL.setMargin(false); if (mockupOnly) guestButtVL.addComponent(guestButt = new NativeButton(null)); else guestButtVL.addComponent(guestButt = new NativeButton(null, this)); guestButt.addStyleName("guestbutton"); guestButt.setEnabled(phase.isGuestButtonEnabled()); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(guestButt, phase.getGuestButtonIcon()); guestButtVL.setComponentAlignment(guestButt, Alignment.MIDDLE_CENTER); guestButtVL.addComponent(lab = new Label()); lab.setHeight("1px"); guestButtVL.setExpandRatio(lab, 1.0f); guestButtVL.addComponent(lab = new HtmlLabel(phase.getGuestButtonSubText())); lab.addStyleName("m-text-align-center"); guestButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); guestButt.setDescription(phase.getGuestButtonToolTip()); lab.setDescription(phase.getGuestButtonToolTip()); lab.setEnabled(phase.isGuestButtonEnabled()); bottomHLayout.addComponent(guestButtVL); numButts++; } for (int i = 0; i < numButts; i++) if (spacers[i] != null) spacers[i].setWidth(BUTTON_SPACING[numButts]); bottomHLayout.addComponent(spacer = new Label()); // special spacer bottomHLayout.setExpandRatio(spacer, 1.0f); baseVLayout.addComponent(bottomHLayout); baseVLayout.setComponentAlignment(bottomHLayout, Alignment.TOP_CENTER); lab = new HtmlLabel( "<center>Each MMOWGLI game is independent.<br> You need a new account for every game. </center>"); lab.setSizeUndefined(); lab.addStyleName("m-margintop-20"); lab.addStyleName("m-greyborder"); lab.addStyleName("m-background-white"); lab.addStyleName("m-opacity-75"); baseVLayout.addComponent(lab); baseVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); String troubleUrl = GameLinks.getTL().getTroubleLink(); Link lnk = new Link("Trouble signing in?", new ExternalResource(troubleUrl)); baseVLayout.addComponent(lnk); lnk.setTargetName(PORTALTARGETWINDOWNAME); lnk.setTargetBorder(BorderStyle.DEFAULT); lnk.addStyleName("m-margin-top-20"); baseVLayout.setComponentAlignment(lnk, Alignment.MIDDLE_CENTER); //checkUserLimits(); done from app entry point }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
private void row(String s, int largest, int sz, CardType ct, GridLayout grid) { float pct = (float) sz / (float) largest; float wd = pct * MAXBARWIDTH; int width = Math.max(Math.round(wd), 1); Label lab; grid.addComponent(lab = new Label(s)); lab.setWidth("160"); lab.setDescription(s); HorizontalLayout hLay = new HorizontalLayout(); hLay.setSpacing(true);//from w w w . j a va2 s .c o m hLay.setMargin(false); hLay.addComponent(lab = new HtmlLabel(" ")); ; lab.addStyleName(CardType.getColorStyle(ct)); //CardTypeManager.getColorStyle(ct)); lab.setWidth("" + width + "px"); hLay.addComponent(lab = new Label("" + sz)); grid.addComponent(hLay); }