List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPage2.java
License:Open Source License
@SuppressWarnings("serial") public void initGuiTL() { ActionPlan actPln = ActionPlan.getTL(apId); User me = Mmowgli2UI.getGlobals().getUserTL(); addStyleName("m-cssleft-45"); setWidth("1089px"); setHeight("1821px"); Label sp;//from w w w. j a v a 2s .c om VerticalLayout mainVL = new VerticalLayout(); addComponent(mainVL, "top:0px;left:0px"); mainVL.addStyleName("m-overflow-visible"); mainVL.setWidth("1089px"); mainVL.setHeight(null); mainVL.setSpacing(false); mainVL.setMargin(false); VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setSpacing(false); mainVLayout.setMargin(false); mainVLayout.addStyleName("m-actionplan-background2"); mainVLayout.setWidth("1089px"); mainVLayout.setHeight(null); //"1821px"); mainVL.addComponent(mainVLayout); mainVLayout.addComponent(makeIdField(actPln)); mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); VerticalLayout leftTopVL = new VerticalLayout(); leftTopVL.setWidth("820px"); leftTopVL.setSpacing(false); leftTopVL.setMargin(false); mainVLayout.addComponent(leftTopVL); HorizontalLayout titleAndThumbsHL = new HorizontalLayout(); titleAndThumbsHL.setSpacing(false); titleAndThumbsHL.setMargin(false); titleAndThumbsHL.setHeight("115px"); titleAndThumbsHL.addStyleName("m-actionplan-header-container"); leftTopVL.addComponent(titleAndThumbsHL); titleAndThumbsHL.addComponent(sp = new Label()); sp.setWidth("55px"); VerticalLayout vl = new VerticalLayout(); vl.addComponent(titleUnion); //titleTA); titleUnion.initGui(); titleHistoryButt = new NativeButton(); titleHistoryButt.setCaption("history"); titleHistoryButt.setStyleName(BaseTheme.BUTTON_LINK); titleHistoryButt.addStyleName("borderless"); titleHistoryButt.addStyleName("m-actionplan-history-button"); titleHistoryButt.addClickListener(new TitleHistoryListener()); titleHistoryButt.setEnabled(!readonly); vl.addComponent(titleHistoryButt); vl.setComponentAlignment(titleHistoryButt, Alignment.TOP_RIGHT); titleAndThumbsHL.addComponent(vl); //titleTA); titleUnion.setWidth(ACTIONPLAN_TITLE_W); titleUnion.setValueTL(actPln.getTitle() == null ? "" : actPln.getTitle()); titleUnion.addStyleName("m-lightgrey-border"); // titleUnion.addStyleName("m-opacity-75"); titleUnion.setHeight("95px"); // 120 px); must make it this way for alignment of r/o vs rw addComponent(saveCanPan, "top:0px;left:395px"); saveCanPan.setVisible(false); titleAndThumbsHL.addComponent(sp = new Label()); sp.setWidth("50px"); VerticalLayout thumbVL = new VerticalLayout(); titleAndThumbsHL.addComponent(thumbVL); thumbVL.addComponent(sp = new Label()); sp.setHeight("50px"); thumbPanel = new ThumbPanel(); Map<User, Integer> map = actPln.getUserThumbs(); Integer t = map.get(me); /* if(t == null) { map.put(me, 0); ActionPlan.update(actPln); GameEventLogger.logActionPlanUpdate(actPln, "thumbs changed",me.getUserName()); t = 0; } */ thumbPanel.setNumUserThumbs(t == null ? 0 : t); thumbVL.addComponent(thumbPanel); HorizontalLayout commentAndViewChainHL = new HorizontalLayout(); leftTopVL.addComponent(commentAndViewChainHL); commentAndViewChainHL.setSpacing(false); commentAndViewChainHL.setMargin(false); commentAndViewChainHL.addComponent(sp = new Label()); sp.setWidth("55px"); VerticalLayout commLeftVL = new VerticalLayout(); commentAndViewChainHL.addComponent(commLeftVL); commLeftVL.setWidth("95px"); commLeftVL.addComponent(commentsButt); commentsButt.setStyleName(BaseTheme.BUTTON_LINK); commentsButt.addStyleName("borderless"); commentsButt.addStyleName("m-actionplan-comments-button"); ClickListener commLis; commentsButt.addClickListener(commLis = new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().setScrollTop(1250); //commentsButt.getWindow().setScrollTop(1250); } }); commLeftVL.addComponent(sp = new Label()); sp.setHeight("65px"); //"50px"); commLeftVL.addComponent(envelopeButt); envelopeButt.addStyleName("m-actionplan-envelope-button"); envelopeButt.addClickListener(commLis); // same as the link button above commentAndViewChainHL.addComponent(sp = new Label()); sp.setWidth("5px"); VerticalLayout commMidVL = new VerticalLayout(); commentAndViewChainHL.addComponent(commMidVL); commMidVL.setWidth("535px"); commMidVL.addComponent(addCommentButt); addCommentButt.setCaption("Add Comment"); addCommentButt.setStyleName(BaseTheme.BUTTON_LINK); addCommentButt.addStyleName("borderless"); addCommentButt.addStyleName("m-actionplan-comments-button"); addCommentButt.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_TOP); addCommentButt.addClickListener(addCommentListener = new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().setScrollTop(1250); //addCommentButt.getWindow().setScrollTop(1250); commentPanel.AddCommentClicked(event); } }); commMidVL.addComponent(sp = new Label()); sp.setHeight("5px"); commMidVL.addComponent(lastCommentLabel = new HtmlLabel()); lastCommentLabel.setWidth("100%"); lastCommentLabel.setHeight("94px"); lastCommentLabel.addStyleName("m-actionplan-textentry"); lastCommentLabel.addStyleName("m-opacity-75"); addComponent(viewChainButt, "left:690px;top:140px"); viewChainButt.setStyleName("m-viewCardChainButton"); viewChainButt.addClickListener(new ViewCardChainHandler()); viewChainButt.setId(ACTIONPLAN_VIEW_CARD_CHAIN_BUTTON); // This guy sits on the bottom naw, gets covered // author list and rfe VerticalLayout rightVL = new VerticalLayout(); this.addComponent(rightVL, "left:830px;top:0px"); rightVL.setSpacing(false); rightVL.setMargin(false); rightVL.setWidth(null); VerticalLayout listVL = new VerticalLayout(); listVL.setSpacing(false); listVL.addStyleName("m-actionPlanAddAuthorList"); listVL.addStyleName("m-actionplan-header-container"); listVL.setHeight(null); listVL.setWidth("190px"); listVL.addComponent(sp = new Label()); sp.setHeight("35px"); sp.setDescription("List of current authors and (invited authors)"); Label subTitle; listVL.addComponent(subTitle = new Label("(invited in parentheses)")); subTitle.setWidth(null); // keep it from being 100% wide subTitle.setDescription("List of current authors and (invited authors)"); subTitle.addStyleName("m-actionplan-authorlist-sublabel"); listVL.setComponentAlignment(subTitle, Alignment.MIDDLE_CENTER); rightVL.addComponent(listVL); TreeSet<User> ts = new TreeSet<User>(new User.AlphabeticalComparator()); ts.addAll(actPln.getAuthors()); TreeSet<User> greyTs = new TreeSet<User>(new User.AlphabeticalComparator()); greyTs.addAll(actPln.getInvitees()); authorList = new UserList(null, ts, greyTs); listVL.addComponent(authorList); authorList.addStyleName("m-greyborder"); listVL.setComponentAlignment(authorList, Alignment.TOP_CENTER); authorList.setWidth("150px"); authorList.setHeight("95px"); listVL.addComponent(sp = new Label()); sp.setHeight("5px"); listVL.addComponent(addAuthButton); listVL.setComponentAlignment(addAuthButton, Alignment.TOP_CENTER); addAuthButton.setStyleName("m-actionPlanAddAuthorButt"); addAuthButton.addClickListener(new AddAuthorHandler()); addAuthButton.setDescription("Invite players to be authors of this action plan"); rightVL.addComponent(sp = new Label()); sp.setHeight("5px"); rightVL.addComponent(rfeButt); rightVL.setComponentAlignment(rfeButt, Alignment.TOP_CENTER); // done in handleDisabledments() rfeButt.setStyleName("m-rfeButton"); // end authorList and rfe mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); sp.setWidth("20px"); // Tabs: AbsoluteLayout absL = new AbsoluteLayout(); mainVLayout.addComponent(absL); absL.setHeight("60px"); absL.setWidth("830px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionPlanBlackTabs"); tabsHL.setSpacing(false); absL.addComponent(tabsHL, "left:40px;top:0px"); NewTabClickHandler ntabHndlr = new NewTabClickHandler(); tabsHL.addComponent(sp = new Label()); sp.setWidth("19px"); thePlanTabButt.setStyleName("m-actionPlanThePlanTab"); thePlanTabButt.addStyleName(ACTIONPLAN_TAB_THEPLAN); // debug thePlanTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(thePlanTabButt); talkTabButt.setStyleName("m-actionPlanTalkItOverTab"); //talkTabButt.addStyleName(ACTIONPLAN_TAB_TALK); talkTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(talkTabButt); talkTabButt.addStyleName("m-transparent-background"); // initially imagesTabButt.setStyleName("m-actionPlanImagesTab"); imagesTabButt.addStyleName(ACTIONPLAN_TAB_IMAGES); imagesTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(imagesTabButt); imagesTabButt.addStyleName("m-transparent-background"); // initially videosTabButt.setStyleName("m-actionPlanVideosTab"); videosTabButt.addStyleName(ACTIONPLAN_TAB_VIDEO); videosTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(videosTabButt); videosTabButt.addStyleName("m-transparent-background"); // initially mapTabButt.setStyleName("m-actionPlanMapTab"); mapTabButt.addStyleName(ACTIONPLAN_TAB_MAP); mapTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(mapTabButt); mapTabButt.addStyleName("m-transparent-background"); // initially newChatLab.setStyleName("m-newChatLabel"); absL.addComponent(newChatLab, "left:340px;top:15px"); newChatLab.setVisible(false); // stack the pages HorizontalLayout hsp = new HorizontalLayout(); hsp.setHeight("742px"); // allows for differing ghost box heights mainVLayout.addComponent(hsp); hsp.addComponent(sp = new Label()); sp.setWidth("45px"); hsp.addComponent(thePlanTab); thePlanTab.initGui(); hsp.addComponent(talkTab); talkTab.initGui(); talkTab.setVisible(false); hsp.addComponent(imagesTab); imagesTab.initGui(); imagesTab.setVisible(false); hsp.addComponent(videosTab); videosTab.initGui(); videosTab.setVisible(false); hsp.addComponent(mapTab); mapTab.initGui(); mapTab.setVisible(false); mainVLayout.addComponent(sp = new Label()); sp.setHeight("90px"); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.addStyleName("m-marginleft-60"); mainVLayout.addComponent(buttLay); buttLay.setWidth(ActionPlanPageCommentPanel2.COMMENT_PANEL_WIDTH); addCommentButtBottom.setCaption("Add Comment"); addCommentButtBottom.setStyleName(BaseTheme.BUTTON_LINK); addCommentButtBottom.addStyleName("borderless"); addCommentButtBottom.addStyleName("m-actionplan-comments-button"); addCommentButtBottom.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_BOTTOM); addCommentButtBottom.addClickListener(addCommentListener); buttLay.addComponent(addCommentButtBottom); if (me.isAdministrator() || me.isGameMaster()) { buttLay.addComponent(sp = new Label()); sp.setWidth("1px"); // "810px"); buttLay.setExpandRatio(sp, 1.0f); ToggleLinkButton tlb = new ToggleLinkButton("View all", "View unhidden only", "m-actionplan-comment-text"); tlb.setToolTips("Temporarily show all messages, including those marked \"hidden\" (gm)", "Temporarily hide messages marked \"hidden\" (gm)"); tlb.addStyleName("m-actionplan-comments-button"); tlb.addOnListener(new ViewAllListener()); tlb.addOffListener(new ViewUnhiddenOnlyListener()); buttLay.addComponent(tlb); buttLay.addComponent(sp = new Label()); sp.setWidth("5px"); } // And the comments hsp = new HorizontalLayout(); mainVLayout.addComponent(hsp); mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); hsp.addComponent(sp = new Label()); sp.setWidth("56px"); hsp.addComponent(commentPanel); commentPanel.initGui(); // Set thumbs double thumbs = actPln.getAverageThumb(); long round = Math.round(thumbs); int numApThumbs = (int) (Math.min(round, 3)); thumbPanel.setNumApThumbs(numApThumbs); Integer myRating = actPln.getUserThumbs().get(me); if (myRating == null) myRating = 0; thumbPanel.setNumUserThumbs(myRating); helpWantedListener = new HelpWantedListener(); interestedListener = new InterestedListener(); handleDisablementsTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabImages.java
License:Open Source License
@Override public void initGui() { setSizeUndefined();/* w ww. j a v a2s.com*/ VerticalLayout leftLay = getLeftLayout(); leftLay.setSpacing(false); leftLay.setMargin(false); VerticalLayout flowLay = new VerticalLayout(); flowLay.setWidth("100%"); leftLay.addComponent(flowLay); flowLay.setSpacing(true); Label missionLab = new Label("Authors, add some images!"); flowLay.addComponent(missionLab); flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT); missionLab.addStyleName("m-actionplan-mission-title-text"); ActionPlan ap = ActionPlan.getTL(apId); Label missionContentLab; if (!isMockup) missionContentLab = new HtmlLabel(ap.getImagesInstructions()); else { Game g = Game.getTL(); missionContentLab = new HtmlLabel(g.getDefaultActionPlanImagesText()); } flowLay.addComponent(missionContentLab); flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); flowLay.addComponent(addImageButt); addImageButt.addStyleName("m-actionplan-addimage-butt"); addImageButt.addStyleName("borderless"); addImageButt.setIcon(globs.getMediaLocator().getActionPlanAddImageButt()); addImageButt.addClickListener(new ImageAdder()); addImageButt.setEnabled(!isReadOnly); flowLay.addComponent(nonAuthorLabel = new Label("Authors may add images when editing the plan.")); nonAuthorLabel.setVisible(false); VerticalLayout rightLay = getRightLayout(); rightLay.setSpacing(false); rightLay.setMargin(false); imageScroller = new Panel(); GridLayout gridL = new GridLayout(); gridL.setColumns(2); gridL.setSpacing(true); gridL.setMargin(new MarginInfo(true)); imageScroller.setContent(gridL); imageScroller.setStyleName(Reindeer.PANEL_LIGHT); // make a transparent scroller imageScroller.setWidth("100%"); imageScroller.setHeight("99%"); setUpIndexListener(imageScroller); rightLay.addComponent(imageScroller); fillWithImagesTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabImages.java
License:Open Source License
private void addOneImage(Media m) { MPanelWrapper wrap = new MPanelWrapper(); wrap.setMargin(false);/* w w w . j a va2s. c om*/ wrap.setSpacing(false); wrap.ip = new MediaPanel(m, apId, 0, replaceLis); wrap.addComponent(wrap.ip); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth(MediaPanel.WIDTH); Label lab; hl.addComponent(lab = new Label()); lab.setWidth("3px"); hl.addComponent(lab = new Label(getDisplayedName(m))); lab.addStyleName("m-font-size-11"); hl.setExpandRatio(lab, 1.0f); hl.addComponent(wrap.killButt = new NativeButton(null)); hl.addComponent(lab = new Label()); lab.setWidth("3px"); wrap.addComponent(hl); wrap.killButt.setCaption("delete"); wrap.killButt.setStyleName(BaseTheme.BUTTON_LINK); wrap.killButt.addStyleName("borderless"); wrap.killButt.addStyleName("m-actionplan-nothumbs-button"); wrap.killButt.addClickListener(new ImageRemover(m)); ((AbstractLayout) imageScroller.getContent()).addComponent(wrap); wrap.ip.initGui(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabMap.java
License:Open Source License
@Override public void initGui() { setSizeUndefined();/*from w ww. j a v a 2 s . c om*/ ActionPlan ap = ActionPlan.getTL(apId); mmowgliMap = ap.getMap(); if (mmowgliMap == null) { mmowgliMap = new edu.nps.moves.mmowgli.db.GoogleMap(); GoogleMap.saveTL(mmowgliMap); ap.setMap(mmowgliMap); ActionPlan.updateTL(ap); } VerticalLayout leftLay = getLeftLayout(); leftLay.setSpacing(false); leftLay.setMargin(false); Label missionLab = new Label("Authors, put your plan on the map!"); leftLay.addComponent(missionLab); leftLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT); missionLab.addStyleName("m-actionplan-mission-title-text"); Label missionContentLab; if (!isMockup) missionContentLab = new HtmlLabel(ap.getMapInstructions()); else { Game g = Game.getTL(); missionContentLab = new HtmlLabel(g.getDefaultActionPlanMapText()); } leftLay.addComponent(missionContentLab); leftLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT); leftLay.addStyleName("m-actionplan-mission-content-text"); /* Component c; c=buildMapFlags(leftLay); // does the addComponent leftLay.setComponentAlignment(c, Alignment.TOP_CENTER); */ toggleFlags(editingOK); Label sp; leftLay.addComponent(sp = new Label()); sp.setHeight("1px"); leftLay.setExpandRatio(sp, 1.0f); map.setAttributionPrefix("Powered by Leaflet with v-leaflet"); map.addStyleName("m-greyborder"); map.removeAllComponents(); try { LeafletLayers.installAllProviders(map); } catch (Exception ex) { System.err.println("ActionPlanPageTabMap error loading layers: " + ex.getClass().getSimpleName() + " " + ex.getLocalizedMessage()); } double lat = mmowgliMap.getLatCenter(); double lon = mmowgliMap.getLonCenter(); map.setCenter(lat, lon); map.setZoomLevel(mmowgliMap.getZoom()); map.setWidth(MAPWIDTH); map.setHeight(editingOK ? MAPHEIGHT_WITH_BUTTONS : MAPHEIGHT); // Build a mmowgliMap widget from our content /* googleMapWidget = new MmowgliMapWidget(app, mmowgliMap.getLatLonCenter(), mmowgliMap.getZoom(), GOOGLEMAPS_KEY); googleMapWidget.setWidth(MAPWIDTH); googleMapWidget.setHeight(editingOK ? MAPHEIGHT_WITH_BUTTONS : MAPHEIGHT); googleMapWidget.addControl(MapControl.MenuMapTypeControl); googleMapWidget.addControl(MapControl.SmallMapControl); //googleMapWidget.addListener(new MyMapClickListener()); googleMapWidget.addListener(new MyMapMoveListener()); //googleMapWidget.addListener(new MyMarkerClickListener()); googleMapWidget.addListener(new MyMarkerMovedListener()); googleMapWidget.reportMapBounds(); */ loadMarkers(ap); VerticalLayout rightLay = getRightLayout(); rightLay.setSpacing(false); rightLay.setMargin(false); rightLay.addComponent(sp = new Label()); sp.setHeight("15px"); savePanel = new MapSaveButtPan(); rightLay.addComponent(savePanel); rightLay.setComponentAlignment(savePanel, Alignment.TOP_CENTER); savePanel.setVisible(editingOK); // MapSaveListener msLis = new MapSaveListener(); // savePanel.setClickHearers(msLis.mapLocListener,msLis.mapMarkerListener,msLis.cancelListener); /* DragAndDropWrapper ddw = new DragAndDropWrapper(googleMapWidget); ddw.setDropHandler(new MapDropHandler()); ddw.setSizeFull(); rightLay.addComponent(ddw); rightLay.setExpandRatio(ddw, 1.0f); */ rightLay.addComponent(map); rightLay.setExpandRatio(map, 1); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabTalk.java
License:Open Source License
@Override public void initGui() { setSizeUndefined();//w w w .java 2s . co m VerticalLayout leftVL = this.getLeftLayout(); leftVL.setSpacing(true); Label missionLab = new Label("Authors, this is your team space."); leftVL.addComponent(missionLab); leftVL.setComponentAlignment(missionLab, Alignment.TOP_LEFT); missionLab.addStyleName("m-actionplan-mission-title-text"); ActionPlan ap = ActionPlan.getTL(apId); Label missionContentLab; Game g = Game.getTL(); if (!isMockup) missionContentLab = new HtmlLabel(ap.getTalkItOverInstructions()); else { missionContentLab = new HtmlLabel(g.getDefaultActionPlanTalkText()); } leftVL.addComponent(missionContentLab); leftVL.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT); leftVL.addStyleName("m-actionplan-mission-content-text"); Label sp; leftVL.addComponent(sp = new Label()); sp.setHeight("1px"); leftVL.setExpandRatio(sp, 1.0f); VerticalLayout rightVL = getRightLayout(); rightVL.setSpacing(true); Label lab; rightVL.addComponent(lab = new Label()); lab.setHeight("15px"); rightVL.addComponent(nonAuthorLabel = new Label("This is a space for plan authors to communicate.")); nonAuthorLabel.setVisible(false); rightVL.addComponent(chatEntryComponent); chatEntryComponent.setWidth("100%"); if (isGameMasterOrAdmin) { HorizontalLayout hl = new HorizontalLayout(); rightVL.addComponent(hl); hl.setWidth("100%"); hl.addComponent(sp = new Label()); sp.setWidth("1px"); hl.setExpandRatio(sp, 1.0f); viewAllButt = new ToggleLinkButton("View all", "View unhidden only", "m-actionplan-comment-text"); viewAllButt.setToolTips("Temporarily show all messages, including those marked \"hidden\" (gm)", "Temporarily hide messages marked \"hidden\" (gm)"); viewAllButt.addStyleName("m-actionplan-comments-button"); viewAllButt.addOnListener(new ViewAllListener()); viewAllButt.addOffListener(new ViewUnhiddenOnlyListener()); hl.addComponent(viewAllButt); hl.addComponent(sp = new Label()); sp.setWidth("8px"); } Component comp = createChatScroller(rightVL); comp.setWidth("99%"); rightVL.setExpandRatio(comp, 1.0f); comp.setHeight("99%"); fillChatScrollerTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabThePlan2.java
License:Open Source License
@Override public void initGui() { setSizeUndefined(); // let flow to right VerticalLayout leftLay = getLeftLayout(); leftLay.setSpacing(false);// www .ja va 2 s . co m leftLay.setMargin(false); VerticalLayout flowLay = new VerticalLayout(); leftLay.addComponent(flowLay); flowLay.setSpacing(true); Label missionLab = new Label("Authors, this is your workspace."); flowLay.addComponent(missionLab); flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT); missionLab.addStyleName("m-actionplan-mission-title-text"); ActionPlan actPln = ActionPlan.getTL(apId); Label missionContentLab; if (!isMockup) missionContentLab = new HtmlLabel(actPln.getPlanInstructions()); else { Game g = Game.getTL(); missionContentLab = new HtmlLabel(g.getDefaultActionPlanThePlanText()); } MovePhase ph = MovePhase.getCurrentMovePhaseTL(); flowLay.addComponent(missionContentLab); flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); VerticalLayout rightLay = getRightLayout(); rightLay.setMargin(false); rightLay.setSpacing(false); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); rightLay.addComponent(flowLay); 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-headling { blah:blah;} ) Label lab = new Label(); lab.setHeight("20px"); flowLay.addComponent(lab); flowLay.addComponent(whoGroup = buildTextAreaGroup( ph.getActionPlanWhoIsInvolvedHeader()/*"Who is involved?"*/, whoTA, "Who-is-involved history", "Previous values", "Text", "getSubTitleEditHistory", "getSubTitle", "setSubTitleWithHistoryTL")); whoGroup.setValueTL(actPln.getSubTitle()); // misnamed since we're calling it it who is involved instead of subtitle flowLay.addComponent(whatGroup = buildTextAreaGroup(ph.getActionPlanWhatIsItHeader()/*"What is it?"*/, whatTA, "What-is-it history", "Previous values", "Text", "getWhatIsItEditHistory", "getWhatIsItText", "setWhatIsItTextWithHistoryTL")); whatGroup.setValueTL(actPln.getWhatIsItText()); flowLay.addComponent( whatTakeGroup = buildTextAreaGroup(ph.getActionPlanWhatWillItTakeHeader()/*"What will it take?"*/, whatWillItTakeTA, "What-will-it-take history", "Previous values", "Text", "getWhatTakeEditHistory", "getWhatWillItTakeText", "setWhatWillItTakeTextWithHistoryTL")); whatTakeGroup.setValueTL(actPln.getWhatWillItTakeText()); flowLay.addComponent( howGroup = buildTextAreaGroup(ph.getActionPlanHowWillItWorkHeader()/*"How will it work?"*/, howWorkTA, "How-will-it-work history", "Previous values", "Text", "getHowWorkEditHistory", "getHowWillItWorkText", "setHowWillItWorkTextWithHistoryTL")); howGroup.setValueTL(actPln.getHowWillItWorkText()); flowLay.addComponent(howChangeGroup = buildTextAreaGroup( ph.getActionPlanHowWillItChangeHeader()/*"How will it change the situation?"*/, howChangeTA, "How-will-it-change-things history", "Previous values", "Text", "getHowChangeEditHistory", "getHowWillItChangeText", "setHowWillItChangeTextWithHistoryTL")); howChangeGroup.setValueTL(actPln.getHowWillItChangeText()); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabVideos.java
License:Open Source License
@Override public void initGui() { setSizeUndefined();/* www. j a v a 2 s.c om*/ VerticalLayout leftLay = getLeftLayout(); leftLay.setSpacing(false); leftLay.setMargin(false); VerticalLayout flowLay = new VerticalLayout(); flowLay.setWidth("100%"); leftLay.addComponent(flowLay); flowLay.setSpacing(true); Label missionLab = new Label("Authors, add some videos!"); flowLay.addComponent(missionLab); flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT); missionLab.addStyleName("m-actionplan-mission-title-text"); ActionPlan ap = ActionPlan.getTL(apId); Label missionContentLab; if (!isMockup) missionContentLab = new HtmlLabel(ap.getVideosInstructions()); else { Game g = Game.getTL(); missionContentLab = new HtmlLabel(g.getDefaultActionPlanVideosText()); } flowLay.addComponent(missionContentLab); flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); flowLay.addComponent(addVideoButt); addVideoButt.addStyleName("m-actionplan-addimage-butt"); addVideoButt.addStyleName("borderless"); addVideoButt.setIcon(globs.getMediaLocator().getActionPlanAddVideoButt()); addVideoButt.addClickListener(new VideoAdder()); addVideoButt.setEnabled(!isReadOnly); flowLay.addComponent(nonAuthorLabel = new Label("Authors may add videos when editing the plan.")); nonAuthorLabel.setVisible(false); VerticalLayout rightLay = getRightLayout(); rightLay.setSpacing(false); rightLay.setMargin(false); rightScroller = new Panel(); GridLayout gridL = new GridLayout(); gridL.setColumns(2); gridL.setSpacing(true); gridL.setMargin(new MarginInfo(true)); rightScroller.setContent(gridL); rightScroller.setStyleName(Reindeer.PANEL_LIGHT); // make a transparent scroller rightScroller.setWidth("100%"); rightScroller.setHeight("99%"); setUpIndexListener(rightScroller); rightLay.addComponent(rightScroller); ; fillWithVideosTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabVideos.java
License:Open Source License
private void addOneVideo(Media m) { VMPanelWrapper vl = new VMPanelWrapper(); vl.setMargin(false);/*from w w w . j a va2 s.co m*/ vl.setSpacing(false); vl.ip = new MediaPanel(m, apId, 0, replaceLis); vl.addComponent(vl.ip); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth(MediaPanel.WIDTH); Label lab; hl.addComponent(lab = new Label()); lab.setWidth("3px"); if (m.getType() != MediaType.YOUTUBE) { hl.addComponent(lab = new Label(getDisplayedName(m))); // label lab.addStyleName("m-font-size-11"); hl.setExpandRatio(lab, 1.0f); } else { NativeButton linkButt; hl.addComponent(linkButt = new NativeButton(null)); // link linkButt.setCaption(getDisplayedName(m)); linkButt.setStyleName(BaseTheme.BUTTON_LINK); linkButt.addStyleName("borderless"); linkButt.addStyleName("m-actionplan-nothumbs-button"); linkButt.addClickListener(new LinkVisitor(m)); hl.addComponent(lab = new Label()); lab.setWidth("1px"); hl.setExpandRatio(lab, 1.0f); } hl.addComponent(vl.killButt = new NativeButton(null)); vl.killButt.setCaption("delete"); vl.killButt.setStyleName(BaseTheme.BUTTON_LINK); vl.killButt.addStyleName("borderless"); vl.killButt.addStyleName("m-actionplan-nothumbs-button"); vl.killButt.addClickListener(new VideoRemover(m)); hl.addComponent(lab = new Label()); lab.setWidth("3px"); vl.addComponent(hl); ((AbstractLayout) rightScroller.getContent()).addComponent(vl); vl.ip.initGui(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.AuthorThisPlanPopup.java
License:Open Source License
@SuppressWarnings("serial") public AuthorThisPlanPopup(Object apPlnId) { super(null);// w ww . j a v a 2 s.co m super.initGui(); this.apId = apPlnId; setListener(this); setTitleString("Author This Plan"); contentVLayout.setSpacing(true); Label lab; contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); contentVLayout.addComponent(lab = new Label("Become an author of this plan?")); lab.addStyleName("m-dialog-text"); lab.setWidthUndefined(); contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); HorizontalLayout buttHL = new HorizontalLayout(); contentVLayout.addComponent(buttHL); contentVLayout.setComponentAlignment(buttHL, Alignment.MIDDLE_CENTER); buttHL.setSpacing(true); buttHL.addComponent(okButt = new Button("Yes, I'm in.")); buttHL.addComponent(noButt = new Button("I'll pass.")); noButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed @HibernateUpdate @HibernateUserUpdate public void buttonClick(ClickEvent event) { HSess.init(); User me = Mmowgli2UI.getGlobals().getUserTL(); ActionPlan ap = ActionPlan.getTL(apId); if (usrContainsByIds(ap.getInvitees(), me)) ap.removeInvitee(me); if (!usrContainsByIds(ap.getDeclinees(), me)) ap.getDeclinees().add(me); ActionPlan.updateTL(ap); if (apContainsByIds(me.getActionPlansInvited(), ap)) me.getActionPlansInvited().remove(ap); User.updateTL(me); GameEventLogger.logActionPlanInvitationDeclinedTL(ap, me.getUserName()); HSess.close(); AuthorThisPlanPopup.this.buttonClick(event); } }); okButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed @HibernateUpdate @HibernateUserUpdate public void buttonClick(ClickEvent event) { HSess.init(); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); User me = globs.getUserTL(); //feb refactor DBGet.getUserFreshTL(globs.getUserID()); ActionPlan thisAp = ActionPlan.getTL(apId); Set<ActionPlan> myInvites = me.getActionPlansInvited(); Set<ActionPlan> myAuthored = me.getActionPlansAuthored(); boolean usrNeedsUpdate = false; if (apContainsByIds(myInvites, thisAp)) { //System.out.println("AP-AUTHOR_DEBUG: removing aplan from users invite list, AuthorThisPlanPopup.128"); myInvites.remove(thisAp); // Jam it in here //ScoreManager.userJoinsActionPlan(me); // replace by... globs.getScoreManager().actionPlanUserJoinsTL(thisAp, me); usrNeedsUpdate = true; } if (!apContainsByIds(myAuthored, thisAp)) {// if already there, causes exception //System.out.println("AP-AUTHOR_DEBUG: adding aplan to users authored list, AuthorThisPlanPopup.133"); myAuthored.add(thisAp); usrNeedsUpdate = true; } if (usrNeedsUpdate) { // User update here User.updateTL(me); } boolean apNeedsUpdate = false; if (usrContainsByIds(thisAp.getInvitees(), me)) { //System.out.println("AP-AUTHOR_DEBUG: removing user from ap invite list, AuthorThisPlanPopup.146"); thisAp.removeInvitee(me); //apInvitees.remove(me); apNeedsUpdate = true; } if (!usrContainsByIds(thisAp.getAuthors(), me)) { //System.out.println("AP-AUTHOR_DEBUG: adding user to ap authors list, AuthorThisPlanPopup.151"); thisAp.addAuthor(me); //apAuthors.add(me); apNeedsUpdate = true; } if (apNeedsUpdate) ActionPlan.updateTL(thisAp); GameEventLogger.logActionPlanInvitationAcceptedTL(thisAp, me.getUserName()); HSess.close(); AuthorThisPlanPopup.this.buttonClick(event); // sets up its own session return; } }); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.HelpWantedDialog.java
License:Open Source License
@SuppressWarnings("serial") @HibernateSessionThreadLocalConstructor/* ww w. j av a 2 s .c om*/ public HelpWantedDialog(final Object aplnId, boolean interested) { setCaption(interested ? "Express Interest in Action Plan" : "Offer Assistance with Action Plan"); setModal(true); setSizeUndefined(); setWidth("500px"); setHeight("550px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeFull(); StringBuilder sb = new StringBuilder(); ActionPlan ap = ActionPlan.getTL(aplnId); String s = ap.getHelpWanted(); if (s != null) { vLay.addComponent(new Label(msg1)); Label helpWantedLab = new Label(s); helpWantedLab.addStyleName("m-helpWantedLabel"); helpWantedLab.setWidth("100%"); vLay.addComponent(helpWantedLab); } vLay.addComponent(new Label(msg2)); final TextArea toTA = new TextArea("To"); toTA.addStyleName("m-textareaboldcaption"); toTA.setWidth("100%"); toTA.setRows(1); toTA.setNullRepresentation(""); toTA.setValue(getAuthors(sb, ap)); vLay.addComponent(toTA); final TextArea ccTA = new TextArea("CC"); ccTA.addStyleName("m-textareaboldcaption"); ccTA.setWidth("100%"); ccTA.setRows(1); ccTA.setNullRepresentation(""); PagesData pd = new PagesData(); ccTA.setValue(pd.gettroubleMailto()); vLay.addComponent(ccTA); final TextArea subjTA = new TextArea("Subject"); subjTA.addStyleName("m-textareaboldcaption"); subjTA.setWidth("100%"); subjTA.setRows(2); subjTA.setNullRepresentation(""); sb.setLength(0); sb.append("My interest in Action Plan "); sb.append(ap.getId()); sb.append(", \""); sb.append(ap.getTitle()); sb.append('"'); subjTA.setValue(sb.toString()); vLay.addComponent(subjTA); final TextArea msgTA = new TextArea("Message"); msgTA.addStyleName("m-textareaboldcaption"); msgTA.setWidth("100%"); msgTA.setHeight("100%"); msgTA.setNullRepresentation(""); vLay.addComponent(msgTA); vLay.setExpandRatio(msgTA, 1.0f); HorizontalLayout buttLay = new HorizontalLayout(); vLay.addComponent(buttLay); buttLay.setSpacing(true); buttLay.setWidth("100%"); Label sp; buttLay.addComponent(sp = new Label()); sp.setHeight("1px"); buttLay.setExpandRatio(sp, 1.0f); Button canButt = new Button("Cancel"); buttLay.addComponent(canButt); Button sendButt = new Button("Send to authors"); buttLay.addComponent(sendButt); canButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(HelpWantedDialog.this); } }); sendButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { Object tos = toTA.getValue(); if (tos == null || tos.toString().length() <= 0) { Notification.show("No recipients", Notification.Type.ERROR_MESSAGE); return; } Object cc = ccTA.getValue(); if (cc == null || cc.toString().length() <= 0) cc = null; Object msg = msgTA.getValue(); if (msg == null || msg.toString().length() <= 0) { Notification.show("No Message", Notification.Type.ERROR_MESSAGE); return; } Object subj = subjTA.getValue(); if (subj == null) subj = ""; HSess.init(); List<User> authors = parseAuthorsTL(tos.toString().trim()); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); MailManager mmgr = AppMaster.instance().getMailManager(); User me = globs.getUserTL(); for (User u : authors) { mmgr.mailToUserTL(me.getId(), u.getId(), subj.toString(), msg.toString()); } if (cc == null) mmgr.mailToUserTL(me.getId(), me.getId(), "(CC:)" + subj.toString(), msg.toString()); else mmgr.mailToUserTL(me.getId(), me.getId(), subj.toString(), msg.toString(), cc.toString(), MailManager.Channel.BOTH); // the cc is an email, not a user name UI.getCurrent().removeWindow(HelpWantedDialog.this); Notification.show("Message(s) sent", Notification.Type.HUMANIZED_MESSAGE); // fixed 21 Jan 2015 HSess.close(); } }); }