List of usage examples for com.vaadin.ui Label setHeight
@Override public void setHeight(String height)
From source file:edu.nps.moves.mmowgli.components.AvatarChooser.java
License:Open Source License
@SuppressWarnings("serial") @Override/* w ww.j ava 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.CardSummary.java
License:Open Source License
@SuppressWarnings("serial") public void initGui(Session sess) { setHeight(heightStr);//from www . ja va 2 s . c o m setWidth(widthStr); addStyleName("m-cursor-pointer"); // pointer when over me, because I'm clickable if (bckgrndResource != null) { backImg = new Embedded(null, bckgrndResource); addComponent(backImg, "top:0px;left:0px"); } if (!isFactCard) { String hdrTxt = card.getCardType().getSummaryHeader(); header.setDescription(hdrTxt); if (hdrTxt != null && hdrTxt.length() > 0) { //if(hdrTxt.length()>=15) { // hdrTxt = hdrTxt.substring(0, 15).trim()+"..."; // } header.setValue(hdrTxt); header.setWidth(headerWidthStr); header.setHeight(headerHeightStr); addComponent(header, headerPositionStr); header.addStyleName(headerStyleStr); header.addStyleName(textColorStyleStr); header.addStyleName("m-cursor-pointer"); } if (starGreyResource != null && starRedResource != null) { Set<Card> favs = me.getFavoriteCards(); if (favs != null && favs.contains(card)) { star.setIcon(starRedResource); } else { star.setIcon(starGreyResource); } addComponent(star, starPositionStr); if (!mockupOnly) star.addClickListener(new StarClick()); star.addStyleName("borderless"); star.setDescription("Mark or unmark as a favorite of yours"); } } idLab.setWidth(idLabWidthStr); idLab.setHeight(idLabHeightStr); idLab.setValue("" + card.getId()); idLab.addStyleName(idLabStyleStr); idLab.addStyleName("m-text-align-right"); addComponent(idLab, idLabPositionStr); content.setWidth(contentWidthStr); content.setHeight(contentHeightStr); addComponent(content, contentPositionStr); content.addStyleName(contentStyle); if (card.isHidden()) content.addStyleName(hiddenStyle); // red "HIDDEN" text background content.setValue(formatText(card.getText())); content.addStyleName("m-cursor-pointer"); content.setDescription(card.getText()); if (!isFactCard) { /* We shouldn't have to be setting widths on the components within this horizontal layout. The * fact that we do is, I think, related to the absolutelayout parent. Get rid of that and we might * be able to yank the .setwidth, setheight stuff. */ HorizontalLayout hLay = new HorizontalLayout(); hLay.setMargin(false); hLay.setHeight(userHeightStr); hLay.setWidth(userDateWidthStr); addComponent(hLay, userDatePositionStr); user.setValue(card.getAuthorName()); //.getAuthor().getUserName()); hLay.addComponent(user); user.setWidth(userWidthStr); user.setHeight(userHeightStr); user.addStyleName(userStyle); user.addStyleName("m-cursor-pointer"); Label sp; hLay.addComponent(sp = new Label()); sp.setWidth("1px"); hLay.setExpandRatio(sp, 1.0f); dateLab.setValue(dateFormatter.format(card.getCreationDate())); hLay.addComponent(dateLab); dateLab.setHeight(userHeightStr); dateLab.setWidth(null); //dateWidthStr); dateLab.addStyleName(userStyle); } if (card.getCreatedInMove().getId() != Move.getCurrentMove(sess).getId()) { Label lab = new Label(card.getCreatedInMove().getName()); lab.addStyleName(moveStyleStr); lab.setWidth(moveWidthStr); lab.setHeight(moveHeightStr); addComponent(lab, movePositionStr); } // Listen for layout click events if (!mockupOnly) this.addLayoutClickListener(new LayoutClickListener() { @MmowgliCodeEntry @HibernateOpened @HibernateRead public void layoutClick(LayoutClickEvent event) { HSess.init(); Component c = event.getChildComponent(); Card card = Card.getTL(cardId); if (c == star) { //Let the starlistener below handle it } else if (c == user) { AppEvent evt = new AppEvent(CARDAUTHORCLICK, CardSummary.this, card.getAuthor().getId()); Mmowgli2UI.getGlobals().getController().miscEventTL(evt); } else { //if (c == content) { AppEvent evt = new AppEvent(CARDCLICK, CardSummary.this, card.getId()); Mmowgli2UI.getGlobals().getController().miscEventTL(evt); } HSess.close(); } }); }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
private Label makeScoreLabel(String style, String width, String height) { Label lab = new Label(); lab.setWidth(width);//from ww w. j a v a 2s . c o m lab.setHeight(height); lab.addStyleName(style); return lab; }
From source file:edu.nps.moves.mmowgli.components.Leaderboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();// w ww. j ava 2 s .c o m setWidth(APPLICATION_SCREEN_WIDTH); setSpacing(false); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); Label sp; HorizontalLayout titleHL = new HorizontalLayout(); addComponent(titleHL); titleHL.setMargin(new MarginInfo(false, true, false, true)); //sides only titleHL.setWidth("100%"); Component c; titleHL.addComponent(c = globs.getMediaLocator().getLeaderboardTitle()); titleHL.setComponentAlignment(c, Alignment.MIDDLE_LEFT); titleHL.setExpandRatio(c, .5f); maybeShowMoveSelector(titleHL); tips.setStyleName(BaseTheme.BUTTON_LINK); tips.addStyleName("m-link-button"); titleHL.addComponent(tips); titleHL.setComponentAlignment(tips, Alignment.MIDDLE_RIGHT); titleHL.setExpandRatio(tips, 0.5f); tableVLayout = new VerticalLayout(); tableVLayout.setSizeUndefined(); tableVLayout.setWidth(APPLICATION_SCREEN_WIDTH); tableVLayout.setSpacing(true); tableVLayout.setMargin(true); tableVLayout.addStyleName("m-whitepage-header"); addComponent(tableVLayout); tableVLayout.addComponent(sp = new Label()); sp.setHeight("20px"); // to fit top of background tableVLayout.addComponent(table = createTableTL()); tableVLayout.setComponentAlignment(table, Alignment.TOP_CENTER); table.setValue(globs.getUserID()); tableVLayout.setExpandRatio(table, 1.0f); /* I can't get this to properly refresh, todo refreshButt = new Button("Refresh"); mainVLayout.addComponent(refreshButt); mainVLayout.setComponentAlignment(refreshButt, Alignment.TOP_CENTER); refreshButt.addListener(new RefreshListener()); refreshButt.setEnabled(false); */ }
From source file:edu.nps.moves.mmowgli.components.MmowgliDialog.java
License:Open Source License
@Override public void initGui() { outerLayout = new VerticalLayout(); outerLayout.setSpacing(false);/*from www. j av a 2s .c o m*/ outerLayout.setSizeUndefined(); outerLayout.addStyleName("m-transparent"); setContent(outerLayout); Label sp; sp = new Label(); sp.setHeight("100px"); outerLayout.addComponent(sp); HorizontalLayout headerWrapper2 = new HorizontalLayout(); outerLayout.addComponent(headerWrapper2); // at the top headerWrapper2.addStyleName("m-dialog-header"); headerWrapper2.setHeight("75px"); headerWrapper2.setWidth("592px"); headerWrapper2.setSpacing(false); headerWrapper2.setMargin(false); headerWrapper2.addComponent(sp = new Label()); // indent from left sp.setWidth("45px"); headerHL2 = new HorizontalLayout(); // Where the title gets written headerHL2.setSpacing(false); headerHL2.setMargin(false); headerHL2.setHeight("75px"); headerWrapper2.addComponent(headerHL2); headerWrapper2.setExpandRatio(headerHL2, 1.0f); cancelButt = makeCancelButton(); cancelButt.addClickListener(new MyCancelListener()); cancelButt.setClickShortcut(KeyCode.ESCAPE); headerWrapper2.addComponent(cancelButt); headerWrapper2.setComponentAlignment(cancelButt, Alignment.MIDDLE_CENTER); headerWrapper2.addComponent(sp = new Label()); sp.setWidth("15px"); contentVLayout = new VerticalLayout(); contentVLayout.addStyleName("m-dialog-content"); contentVLayout.setSizeUndefined(); contentVLayout.setWidth("592px"); // but do the width explicitly outerLayout.addComponent(contentVLayout); Image footer = new Image(null, Mmowgli2UI.getGlobals().mediaLocator().getDialogFooterBackground()); footer.setWidth("592px"); footer.setHeight("36px"); outerLayout.addComponent(footer); }
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);// w ww.j a v a2 s . com 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;/*w ww .j av a 2 s . c o m*/ 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; } 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.ActionDashboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();//w w w . j a v a2s . c o m setWidth(APPLICATION_SCREEN_WIDTH); // setHeight("855px"); //ACTIONDASHBOARD_H); Label sp; addComponent(sp = new Label()); sp.setHeight("10px"); HorizontalLayout titleHL = new HorizontalLayout(); titleHL.setWidth("95%"); addComponent(titleHL); titleHL.addComponent(sp = new Label()); sp.setWidth("20px"); Component titleC; titleHL.addComponent(titleC = Mmowgli2UI.getGlobals().getMediaLocator().getActionDashboardTitle()); titleHL.setComponentAlignment(titleC, Alignment.MIDDLE_LEFT); titleHL.addComponent(sp = new Label()); sp.setWidth("1px"); titleHL.setExpandRatio(sp, 1.0f); titleHL.addComponent(howToWinActionButt); howToWinActionButt.setDescription(howWinAction_tt); AbsoluteLayout absL = new AbsoluteLayout(); addComponent(absL); absL.setWidth(APPLICATION_SCREEN_WIDTH); absL.setHeight(ACTIONDASHBOARD_H); MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH); mainAbsLay.setHeight(ACTIONDASHBOARD_H); absL.addComponent(mainAbsLay, ACTIONDASHBOARD_OFFSET_POS); // Now the background Embedded backgroundImage = new Embedded(null, medLoc.getActionDashboardPlanBackground()); backgroundImage.setWidth(ACTIONDASHBOARD_W); backgroundImage.setHeight(ACTIONDASHBOARD_H); mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionDashboardBlackTabs"); tabsHL.setSpacing(false); tabsHL.addComponent(sp = new Label()); sp.setWidth("12px"); TabClickHandler tabHndlr = new TabClickHandler(); actionPlansTabButt.setStyleName("m-actionDashboardActionPlansTab"); actionPlansTabButt.addClickListener(tabHndlr); actionPlansTabButt.setId(ACTION_DASHBOARD_ACTION_PLANS_TAB); tabsHL.addComponent(actionPlansTabButt); tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); myPlansTabButt.setStyleName("m-actionDashboardMyPlansTab"); myPlansTabButt.addClickListener(tabHndlr); myPlansTabButt.setId(ACTION_DASHBOARD_MY_ACTION_PLANS_TAB); tabsHL.addComponent(myPlansTabButt); myPlansTabButt.addStyleName("m-transparent-background"); // initially tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); needAuthorsTabButt.setStyleName("m-actionDashboardNeedAuthorsTab"); needAuthorsTabButt.addClickListener(tabHndlr); needAuthorsTabButt.setId(ACTION_DASHBOARD_NEED_AUTHORS_TAB); tabsHL.addComponent(needAuthorsTabButt); needAuthorsTabButt.addStyleName("m-transparent-background"); // initially absL.addComponent(tabsHL, "left:7px;top:8px"); // stack the pages absL.addComponent(actionPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); actionPlansTab.initGuiTL(); absL.addComponent(myPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); myPlansTab.initGuiTL(); myPlansTab.setVisible(false); absL.addComponent(needAuthorsTab, ACTIONDASHBOARD_TABCONTENT_POS); needAuthorsTab.initGuiTL(); needAuthorsTab.setVisible(false); User me = Mmowgli2UI.getGlobals().getUserTL(); Set<ActionPlan> invitedSet = me.getActionPlansInvited(); if (invitedSet != null && (invitedSet.size()) > 0) { Notification note = new Notification("<center>You're invited to an Action Plan!</center>", "<center> Look for the \"you're invited to join!\" notice.<br/>" + "First, check out the plan. Then, if you want to join,<br/>" + "click the link to become an author." + "</center>", Type.HUMANIZED_MESSAGE, true); // allow html note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(5000);// 5 secs note.show(Page.getCurrent()); } }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabMyPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);//ww w . j ava 2s . co m Label titleLab = new Label("My Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("Choose a link below to display the filtered list of your choice."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Label lab; flowLay.addComponent(lab = new Label()); lab.setHeight("25px"); Button myPlansButt = new Button("My Plans"); //myPlansButt.setStyleName(BaseTheme.BUTTON_LINK); //flowLay.addComponent(myPlansButt); Button requestActionPlanButt = new IDButton("Request Action Plan Authorship", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); // Note for the above button request flowLay.addComponent(new Label("(appears in another browser tab)")); ClickListener firstLis; myPlansButt.addClickListener(firstLis = new ButtListener2(buildMyPlansFilter(), null)); // @HibernateUserRead AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-heading { blah:blah;} ) firstLis.buttonClick(null); // loads the table }
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);//ww w . j a v a 2 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(); }