List of usage examples for com.vaadin.ui VerticalLayout setHeight
@Override public void setHeight(String height)
From source file:edu.nps.moves.mmowgli.components.MmowgliDialogContent.java
License:Open Source License
private void doHeaderWrapper() { Label sp;/*from w w w. jav a2 s .c om*/ VerticalLayout titleWrapper = new VerticalLayout(); titleWrapper.setSpacing(false); titleWrapper.setMargin(false); titleWrapper.setHeight("75px"); titleWrapper.setWidth("100%");//("460px"); //"504px"); //"592px"); headerWrapper.addComponent(titleWrapper); headerWrapper.setExpandRatio(titleWrapper, 1.0f); // titleWrapper.addComponent(sp=new Label()); // sp.setHeight("25px"); header = new HorizontalLayout(); // Where the title gets written header.setSpacing(false); header.setMargin(false); header.setHeight("55px"); header.setWidth("100%"); header.addStyleName("m-transparent"); titleWrapper.addComponent(header); titleWrapper.setComponentAlignment(header, Alignment.MIDDLE_CENTER); headerWrapper.addComponent(sp = new Label()); sp.setWidth("25px"); //"50px"); cancelButt = makeCancelButton(); cancelButt.setClickShortcut(KeyCode.ESCAPE); headerWrapper.addComponent(cancelButt);//, "top:9px;left:504px"); headerWrapper.setComponentAlignment(cancelButt, Alignment.MIDDLE_CENTER); }
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);/*from www . j a v a 2s .co m*/ 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.components.VideoWithRightTextPanel.java
License:Open Source License
public void initGui() { addStyleName("m-calltoaction-novideo"); // m-calltoaction"); // puts up background setMargin(false);/*from w ww .j a v a 2s . c o m*/ setSpacing(false); setWidth("988px"); Label lab; addComponent(lab = new Label()); lab.setHeight("41px"); HorizontalLayout horLay = new HorizontalLayout(); horLay.setSpacing(false); horLay.setMargin(false); horLay.setWidth("100%"); addComponent(horLay); horLay.addComponent(lab = new Label()); lab.setWidth("38px"); if (vidMedia != null && vidMedia.getUrl() != null && vidMedia.getUrl().trim().length() > 0) { if (vidMedia.getType() == MediaType.YOUTUBE) { try { Flash ytp = new Flash(); ytp.setSource(new ExternalResource("https://www.youtube.com/v/" + vidMedia.getUrl())); ytp.setParameter("allowFullScreen", "true"); ytp.setParameter("showRelated", "false"); ytp.setWidth(539.0f, Unit.PIXELS); //VID_W_PX,Unit.PIXELS); ytp.setHeight(342.0f, Unit.PIXELS); //VID_H_PX,Unit.PIXELS); player = ytp; } catch (Exception ex) { System.err.println("Exception instantiating YouTubePlayer: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } } else { System.err.println("Bad media file in VideoWithRightTextPanel"); player = new Label("missing video"); } VerticalLayout plyrLinkWrap = new VerticalLayout(); plyrLinkWrap.setMargin(false); plyrLinkWrap.setSpacing(true); plyrLinkWrap.setSizeUndefined(); VerticalLayout playerVL = new VerticalLayout(); //AbsoluteLayout(); playerVL.setWidth("539px"); playerVL.setHeight("342px"); playerVL.addStyleName("m-boxshadow-5"); playerVL.addComponent(player); plyrLinkWrap.addComponent(playerVL); Link link = getAlternateVideoLink(vidMedia); if (link != null) { plyrLinkWrap.addComponent(link); plyrLinkWrap.setComponentAlignment(link, Alignment.BOTTOM_CENTER); } horLay.addComponent(plyrLinkWrap); horLay.addComponent(lab = new Label()); lab.setWidth("22px"); } VerticalLayout rightColVLayout = new VerticalLayout(); horLay.addComponent(rightColVLayout); horLay.setExpandRatio(rightColVLayout, 1.0f); horLay.addComponent(lab = new Label()); lab.setWidth("35px"); rightColVLayout.setSpacing(true); if (headerImg != null) { // Image takes priority over text rightColVLayout.addComponent(headerImg); } else { headingLab = new HtmlLabel(heading); if (largerText) headingLab.addStyleName("m-orientation-heading"); else headingLab.addStyleName("m-calltoaction-thesituation-heading"); rightColVLayout.addComponent(headingLab); } summaryLab = new HtmlLabel(summary); if (largerText) summaryLab.addStyleName("m-orientation-summary"); else summaryLab.addStyleName("m-calltoaction-thesituation-summary"); rightColVLayout.addComponent(summaryLab); // text = text.replace("\n", "<br/><br/>"); // pure html with <p> tags seems to work well textLab = new HtmlLabel(text); if (largerText) textLab.addStyleName("m-orientation-text"); else textLab.addStyleName("m-calltoaction-thesituation-text"); rightColVLayout.addComponent(textLab); // Move 2, no room /* * if (promptImg != null) { // Image priority over text rightColVLayout.addComponent(promptImg); } else if (prompt != null){ promptLab = new Label(prompt); * promptLab.setContentMode(Label.CONTENT_XHTML); if(largerText) promptLab.addStyleName("m-orientation-prompt"); else * promptLab.addStyleName("m-calltoaction-thesituation-prompt"); rightColVLayout.addComponent(promptLab); } */ // spacer so background doesn't look cut-off addComponent(lab = new Label()); lab.setHeight("25px"); }
From source file:edu.nps.moves.mmowgli.components.WebContentDisplayer.java
License:Open Source License
private void initGui(String text) { VerticalLayout vl; setContent(vl = new VerticalLayout()); vl.setHeight("100%"); StringBuffer sb = new StringBuffer(); boolean needHTML = false; if (!text.toLowerCase().startsWith("<html>")) { sb.append("<html><body>"); needHTML = true;/* www. ja v a2 s . com*/ } sb.append(text); if (needHTML) sb.append("</body></html>"); Label lab = new HtmlLabel(sb.toString()); lab.setWidth("100%"); lab.setHeight("100%"); vl.addComponent(lab); // StreamResource sr = new StreamResource(new MyStringResource(sb.toString()),"dummy",app); // sr.setMIMEType("text/html"); // Embedded emb = new Embedded(null,sr); // emb.setType(Embedded.TYPE_BROWSER); // emb.setWidth("100%"); // emb.setHeight("100%"); // vl.addComponent(emb); }
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;// ww w. j a v 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.ActionPlanPageTabPanel.java
License:Open Source License
public ActionPlanPageTabPanel(Object apId, boolean isMockup, boolean isReadOnly) { this.apId = apId; this.isMockup = isMockup; this.isReadOnly = isReadOnly; setSpacing(true);/*w w w . ja v a2 s .co m*/ setMargin(false); setWidth("970px"); setHeight("750px"); VerticalLayout leftWrapper = new VerticalLayout(); addComponent(leftWrapper); leftWrapper.setSpacing(false); leftWrapper.setMargin(false); leftWrapper.setWidth("261px"); Label sp; leftWrapper.addComponent(sp = new Label()); sp.setHeight("15px"); GhostVerticalLayoutWrapper gWrap = new GhostVerticalLayoutWrapper(); leftWrapper.addComponent(gWrap); leftVertLay = new VerticalLayout(); gWrap.ghost_setContent(leftVertLay); leftWrapper.addComponent(sp = new Label()); sp.setHeight("1px"); leftWrapper.setExpandRatio(sp, 1.0f); VerticalLayout rightWrapper = new VerticalLayout(); addComponent(rightWrapper); rightWrapper.setSpacing(false); rightWrapper.setMargin(false); rightWrapper.setWidth("100%"); rightWrapper.setHeight("690px"); rightVertLay = new VerticalLayout(); rightWrapper.addComponent(rightVertLay); rightVertLay.setWidth("690px"); rightVertLay.setHeight("695px"); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.RfeDialog.java
License:Open Source License
@HibernateSessionThreadLocalConstructor @SuppressWarnings("serial") public RfeDialog(Object aplnId) { this.apId = aplnId; setCaption("Request for Expertise"); setModal(true);/*w w w. j a v a2 s.co m*/ setSizeUndefined(); setWidth("500px"); setHeight("400px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeFull(); IDButton searchButt = new IDButton("Option 1: Search for players with needed expertise", SEARCHCLICK, null); searchButt.enableAction(false); // do manually searchButt.addClickListener(new SearchListener()); vLay.addComponent(searchButt); VerticalLayout nuts = new VerticalLayout(); vLay.addComponent(nuts); nuts.setSizeFull(); vLay.setExpandRatio(nuts, 1.0f); Label lab; /*vLay*/nuts.addComponent(lab = new Label("Option 2: Post help-wanted notice to action plan")); lab.addStyleName("m-font-bold11"); final VerticalLayout helpWantedPan = new VerticalLayout(); /*vLay*/nuts.addComponent(helpWantedPan); helpWantedPan.addStyleName("m-greyborder"); helpWantedPan.setWidth("99%"); helpWantedPan.setHeight("99%"); helpWantedPan.setSpacing(true); helpWantedPan.setMargin(true); /*vLay*/nuts.setExpandRatio(helpWantedPan, 1.0f); helpWantedTA = new TextArea("Current posting"); helpWantedTA.setWidth("100%"); helpWantedTA.setHeight("100%"); helpWantedTA.setNullRepresentation(""); helpWantedPan.addComponent(helpWantedTA); helpWantedPan.setExpandRatio(helpWantedTA, 1.0f); HorizontalLayout buttLay = new HorizontalLayout(); helpWantedPan.addComponent(buttLay); buttLay.setSpacing(true); buttLay.setWidth("100%"); buttLay.addComponent(lab = new Label()); lab.setWidth("10px"); clearButt = new Button("Clear"); buttLay.addComponent(clearButt); clearButt.addClickListener(clearButtLis = new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); ActionPlan ap = ActionPlan.getTL(apId); helpWantedTA.setValue(null); if (null != ap.getHelpWanted()) { ap.setHelpWanted(null); ActionPlan.updateTL(ap); Notification notif = new Notification("Cleared"); notif.setDelayMsec(3000); notif.show(Page.getCurrent()); GameEventLogger.logHelpWantedTL(ap); notifyAuthorsOfChangeTL(ap); } HSess.close(); } }); buttLay.addComponent(lab = new Label()); buttLay.setExpandRatio(lab, 1.0f); postButt = new Button("Post"); buttLay.addComponent(postButt); postButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { Object val = helpWantedTA.getValue(); if (val == null || val.toString().length() <= 0) { clearButtLis.buttonClick(event); return; } HSess.init(); String s = val.toString(); ActionPlan ap = ActionPlan.getTL(apId); if (s == null ? ap.getHelpWanted() != null : !s.equals(ap.getHelpWanted())) { ap.setHelpWanted(s); ActionPlan.updateTL(ap); Notification notif = new Notification("Posted"); notif.setDelayMsec(3000); notif.show(Page.getCurrent()); GameEventLogger.logHelpWantedTL(ap); notifyAuthorsOfChangeTL(ap); } HSess.close(); } }); buttLay.addComponent(lab = new Label()); lab.setWidth("10px"); helpWantedPan.addComponent(lab = new Label()); lab.setHeight("10px"); IDButton troubleButt = new IDButton("Option 3: Post Trouble Report", POSTTROUBLECLICK, null); troubleButt.enableAction(false); // managed manually troubleButt.addClickListener(new TroubleListener()); vLay.addComponent(troubleButt); Button closeButt = new Button("Close"); vLay.addComponent(closeButt); closeButt.addClickListener(new CloseListener()); vLay.setComponentAlignment(closeButt, Alignment.MIDDLE_RIGHT); ActionPlan ap = ActionPlan.getTL(apId); String s = ap.getHelpWanted(); helpWantedTA.setValue(s); }
From source file:edu.nps.moves.mmowgli.modules.administration.ScoringHelpWindow.java
License:Open Source License
private Component doCards() { StringBuilder sb = new StringBuilder(); sb.append(author);//from www .j ava 2 s . c om sb.append("<b>+" + game.getCardAuthorPoints()); sb.append("</b> (cardAuthorPoints)"); float[] factors = ScoreManager2.parseGenerationFactors(game); float points = game.getCardAncestorPoints(); if (factors.length > 0) { parentPart(parent, sb, 0, points, factors); } if (factors.length > 1) { parentPart(gparent, sb, 1, points, factors); } if (factors.length > 2) { parentPart(ggparent, sb, 2, points, factors); } if (factors.length > 3) { parentPart(gggparent, sb, 3, points, factors); } if (factors.length > 4) { parentPart(ggggparent, sb, 4, points, factors); } if (factors.length > 5) { parentPart(gggggparent, sb, 5, points, factors); } if (factors.length > 6) { parentPart(ggggggparent, sb, 6, points, factors); } if (factors.length > 7) { parentPart(gggggggparent, sb, 7, points, factors); } sb.append(nopoints); sb.append(superint); sb.append("<b>+"); sb.append(game.getCardSuperInterestingPoints()); sb.append("</b> (cardSuperInterestingPoints)"); sb.append(tail); Label lab = new HtmlLabel(sb.toString()); VerticalLayout vl = new VerticalLayout(); vl.addComponent(lab); vl.setHeight("100%"); vl.setMargin(true); return vl; }
From source file:edu.nps.moves.mmowgli.modules.administration.ScoringHelpWindow.java
License:Open Source License
private Component doActionPlans() { StringBuilder sb = new StringBuilder(); sb.append(apauthor);/*from www . jav a 2 s.com*/ sb.append("<b>+" + game.getActionPlanAuthorPoints()); sb.append("</b> (actionPlanAuthorPoints)"); sb.append(thum); sb.append("<b>"); sb.append(game.getActionPlanThumbFactor()); sb.append("</b> times total user thumbs"); sb.append(thum2); sb.append("<b>"); sb.append(game.getActionPlanRaterPoints()); sb.append("</b>"); sb.append(comment); sb.append("<b>"); sb.append(game.getActionPlanCommentPoints()); sb.append("</b>"); sb.append(comment1); sb.append("<b>"); sb.append(game.getUserActionPlanCommentPoints()); sb.append("</b>"); sb.append(aptail); Label lab = new HtmlLabel(sb.toString()); VerticalLayout vl = new VerticalLayout(); vl.addComponent(lab); vl.setHeight("100%"); vl.setMargin(true); return vl; }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
@SuppressWarnings("serial") @HibernateOpened//from w ww .ja v a 2s . co m @HibernateRead @HibernateClosed public void initGuiTL() { VerticalLayout outerVl = this; outerVl.setWidth("100%"); outerVl.setSpacing(true); cardMarkingPanel = makeCardMarkingPanelTL(); Card c = Card.getTL(cardId); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); User me = globs.getUserTL(); if (c.isHidden() && !me.isAdministrator() && !me.isGameMaster()) { // This case should only come into play when a non-gm user is showing this page // by explicitly using the url. Not too frequent an occurance. Label lab = new Label("This card is not active"); lab.addStyleName("m-cardlarge-hidden-label"); outerVl.setHeight("300px"); outerVl.addComponent(lab); outerVl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); return; } loadMarkingPanel_oobTL(c); // won't have Roles lazily update w/out above loadMarkingPanel_oob(DBGet.getCard(cardId)); markingRadioGroup.addValueChangeListener(markingListener = new MarkingChangeListener()); // Top part topHL = new HorizontalLayout(); addComponent(topHL); topHL.setWidth("95%"); setComponentAlignment(topHL, Alignment.TOP_CENTER); // Card columns listsHL = new HorizontalLayout(); addComponent(listsHL); listsHL.setSpacing(true); setComponentAlignment(listsHL, Alignment.TOP_CENTER); addChildListsTL(); chainButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); AppEvent evt = new AppEvent(CARDCHAINPOPUPCLICK, CardChainPage.this, cardId); Mmowgli2UI.getGlobals().getController().miscEventTL(evt); HSess.close(); return; } }); }