List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
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);/*from w w w . j a v a2s .c o 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.ActionPlanPageTabTalk.java
License:Open Source License
@Override public void initGui() { setSizeUndefined();// w w w. j a v a 2 s .c o 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); leftLay.setMargin(false);//from w w w.j av a2s. c o m 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();//from w w w .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 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.AddAuthorDialog.java
License:Open Source License
@SuppressWarnings("serial") public AddAuthorDialog(Collection<User> currentlySelectedNames, boolean removeExisting) { setCaption("Invite Players to be Authors"); setClosable(false); // no x in corner setWidth("300px"); setHeight("400px"); VerticalLayout mainVL = new VerticalLayout(); mainVL.setSpacing(true); mainVL.setMargin(true);/* w w w. j av a 2s . c om*/ mainVL.setSizeFull(); setContent(mainVL); mainVL.addComponent(infoLabel); userList = new ListSelect(); userList.addStyleName("m-greyborder"); List<QuickUser> qlis = AppMaster.instance().getMcache().getUsersQuickList(); BeanItemContainer<QuickUser> beanContainerQ = new BeanItemContainer<QuickUser>(QuickUser.class, qlis); userList.setContainerDataSource(beanContainerQ); userList.setItemCaptionMode(ListSelect.ItemCaptionMode.PROPERTY); // works! userList.setItemCaptionPropertyId("uname"); userList.setNewItemsAllowed(false); mainVL.addComponent(userList); userList.setSizeFull(); mainVL.setExpandRatio(userList, 1.0f); userList.setRows(15); userList.setImmediate(true); setMultiSelect(true); //userList.setMultiSelect(true); userList.setNullSelectionAllowed(false); if (currentlySelectedNames != null) for (User selU : currentlySelectedNames) { Collection<?> all = userList.getItemIds(); for (Object o : all) { QuickUser qu = (QuickUser) o; if (selU.getId() == qu.getId()) { if (removeExisting) userList.removeItem(o); else userList.select(o); break; } } } buttHL = new HorizontalLayout(); buttHL.setSpacing(true); mainVL.addComponent(buttHL); buttHL.setWidth("100%"); Label spacer; buttHL.addComponent(spacer = new Label()); spacer.setWidth("1px"); buttHL.setExpandRatio(spacer, 1.0f); buttHL.addComponent(addButt = new Button("Select")); buttHL.addComponent(cancelButt = new Button("Cancel")); cancelButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { selected = null; addClicked = false; UI.getCurrent().removeWindow(AddAuthorDialog.this);//getParent().removeWindow(AddAuthorDialog.this); if (closer != null) closer.windowClose(null); } }); addButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { selected = userList.getValue(); addClicked = true; UI.getCurrent().removeWindow(AddAuthorDialog.this);//getParent().removeWindow(AddAuthorDialog.this); if (closer != null) closer.windowClose(null); } }); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.AddImageDialog.java
License:Open Source License
@SuppressWarnings("serial") @HibernateSessionThreadLocalConstructor// ww w .j a v a2 s .c om public AddImageDialog(Object apId) { super("Add an Image"); addStyleName("m-greybackground"); setClosable(false); // no x in corner VerticalLayout mainVL = new VerticalLayout(); mainVL.setSpacing(true); mainVL.setMargin(true); mainVL.setSizeUndefined(); // auto size setContent(mainVL); mainHL = new HorizontalLayout(); mainVL.addComponent(mainHL); mainHL.setSpacing(true); holder = new AbsoluteLayout(); mainHL.addComponent(holder); holder.setWidth("150px"); holder.setHeight("150px"); holder.addStyleName("m-darkgreyborder"); VerticalLayout rightVL = new VerticalLayout(); mainHL.addComponent(rightVL); fromWebCheck = new CheckBox(); fromWebCheck.addStyleName("v-radiobutton"); fromWebCheck.setValue(true); fromWebCheck.setImmediate(true); fromWebCheck.addValueChangeListener(new RadioListener(fromWebCheck)); HorizontalLayout frWebHL = new HorizontalLayout(); rightVL.addComponent(frWebHL); frWebHL.addComponent(fromWebCheck); VerticalLayout frWebVL = new VerticalLayout(); frWebVL.setMargin(true); frWebVL.addStyleName("m-greyborder"); frWebHL.addComponent(frWebVL); frWebVL.setWidth("370px"); frWebVL.addComponent(new Label("From the web:")); HorizontalLayout webHL = new HorizontalLayout(); webHL.setSpacing(true); frWebVL.addComponent(webHL); webHL.addComponent(webUrl = new TextField()); webUrl.setColumns(21); webHL.addComponent(testButt = new Button("Test")); Label sp; webHL.addComponent(sp = new Label()); sp.setWidth("1px"); webHL.setExpandRatio(sp, 1.0f); fromDeskCheck = new CheckBox(); fromDeskCheck.addStyleName("v-radiobutton"); fromDeskCheck.setValue(false); fromDeskCheck.addValueChangeListener(new RadioListener(fromDeskCheck)); fromDeskCheck.setImmediate(true); HorizontalLayout dtHL = new HorizontalLayout(); rightVL.addComponent(dtHL); dtHL.addComponent(fromDeskCheck); VerticalLayout dtopVL = new VerticalLayout(); dtopVL.setMargin(true); dtopVL.addStyleName("m-greyborder"); dtHL.addComponent(dtopVL); dtopVL.setWidth("370px"); dtopVL.addComponent(new Label("From your desktop:")); HorizontalLayout localHL = new HorizontalLayout(); localHL.setSpacing(true); dtopVL.addComponent(localHL); localHL.addComponent(localTF = new TextField()); localTF.setColumns(21); localHL.addComponent(uploadWidget = new Upload()); panel = new UploadStatus(uploadWidget); uploadWidget.setButtonCaption("Browse"); File tempDir = Files.createTempDir(); tempDir.deleteOnExit(); handler = new UploadHandler(uploadWidget, panel, tempDir.getAbsolutePath()); uploadWidget.setReceiver(handler); uploadWidget.setImmediate(true); panel.setWidth("100%"); dtopVL.addComponent(panel); dtopVL.setComponentAlignment(panel, Alignment.TOP_CENTER); HorizontalLayout bottomHL = new HorizontalLayout(); mainVL.addComponent(bottomHL); bottomHL.setSpacing(true); bottomHL.setWidth("100%"); Label spacer; bottomHL.addComponent(spacer = new Label()); spacer.setWidth("100%"); bottomHL.setExpandRatio(spacer, 1.0f); bottomHL.addComponent(cancelButt = new Button("Cancel")); bottomHL.addComponent(submitButt = new Button("Add")); setDisabledFields(); uploadWidget.addFinishedListener(new FinishedListener() { @Override public void uploadFinished(FinishedEvent event) { Object key = HSess.checkInit(); System.out.println("AddImageDialog.uploadFinished()"); String fpath = handler.getFullUploadedPath(); if (fpath != null) { // error of some kind if null if (!MalwareChecker.isFileVirusFree(fpath)) { panel.state.setValue("<span style='color:red;'>Failed malware check</span>"); fpath = null; localTF.setValue(""); HSess.checkClose(key); return; } File f = new File(fpath); f.deleteOnExit(); try { MediaImage mediaImage = InstallImageDialog.putFileImageIntoDbTL(f, f.getName(), event.getMIMEType()); f.delete(); media = mediaImage.media; image = mediaImage.image; media.setCaption(null); Resource res = Mmowgli2UI.getGlobals().getMediaLocator().locate(media); setupEmbeddedImageThumbnail(res, media); localTF.setValue(event.getFilename()); } catch (IOException ex) { Notification.show("Error loading image", Notification.Type.ERROR_MESSAGE); MSysOut.println(ERROR_LOGS, "Error in AddImageDialog loading image: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } } HSess.checkClose(key); } }); testButt.addClickListener(new testWebImageHandler()); submitButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (fromWebCheck.getValue()) { if (checkBadUrl(webUrl.getValue(), event.getButton())) return; } UI.getCurrent().removeWindow(AddImageDialog.this); if (closer != null) closer.windowClose(null); } }); cancelButt.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { Object key = HSess.checkInit(); if (media != null) { Media.deleteTL(media); media = null; } if (image != null) { Image.deleteTL(image); image = null; } uploadWidget.interruptUpload(); UI.getCurrent().removeWindow(AddImageDialog.this); if (closer != null) closer.windowClose(null); HSess.checkClose(key); } }); webUrl.focus(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.AddVideoDialog.java
License:Open Source License
@SuppressWarnings("serial") public AddVideoDialog() { super("Add a Video"); addStyleName("m-greybackground"); setClosable(false); // no x in corner setWidth("530px"); setHeight("400px"); VerticalLayout mainVL = new VerticalLayout(); mainVL.setSpacing(true); mainVL.setMargin(true);/*from w w w . j a va 2 s . com*/ mainVL.setSizeUndefined(); // auto size mainVL.setWidth("100%"); setContent(mainVL); Label helpLab = new HtmlLabel("Add YouTube videos to your Action Plan this way:" + "<OL><LI>Find the video you want at <a href=\"https://www.youtube.com\" target=\"" + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a>.</LI>" + "<LI>Click the \"share\" button below the video screen.</LI>" + "<LI>Copy the URL under \"Link to this video:\"</LI>" + "<LI>Paste the URL into the field below.</LI>" + "</OL>" + "If you have media that " + "has not been uploaded to YouTube, see <a href=\"https://www.youtube.com\" target=\"" + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a> " + "for help with establishing a free account.<br/>"); helpLab.setWidth("100%"); mainVL.addComponent(helpLab); HorizontalLayout mainHL = new HorizontalLayout(); mainHL.setMargin(false); mainHL.setSpacing(true); mainVL.addComponent(mainHL); holder = new AbsoluteLayout(); mainHL.addComponent(holder); holder.addStyleName("m-darkgreyborder"); holder.setWidth("150px"); holder.setHeight("150px"); holder.addComponent(new Label("Test video display"), "top:0px;left:0px;"); VerticalLayout rightVL = new VerticalLayout(); mainHL.addComponent(rightVL); rightVL.setMargin(false); rightVL.setSpacing(true); rightVL.addComponent(new Label("YouTube video address")); HorizontalLayout tfHL = new HorizontalLayout(); tfHL.setSpacing(true); rightVL.addComponent(tfHL); addrTf = new TextField(); tfHL.addComponent(addrTf); addrTf.setColumns(21); tfHL.addComponent(testButt = new Button("Test")); rightVL.addComponent(new Label("Using the test button will set the")); rightVL.addComponent(new Label("default title and description.")); Label sp; rightVL.addComponent(sp = new Label()); sp.setHeight("15px"); HorizontalLayout bottomHL = new HorizontalLayout(); rightVL.addComponent(bottomHL); rightVL.setComponentAlignment(bottomHL, Alignment.TOP_RIGHT); bottomHL.setSpacing(true); bottomHL.setWidth("100%"); Label spacer; bottomHL.addComponent(spacer = new Label()); spacer.setWidth("100%"); bottomHL.setExpandRatio(spacer, 1.0f); bottomHL.addComponent(cancelButt = new Button("Cancel")); bottomHL.addComponent(submitButt = new Button("Add")); testButt.addClickListener(new TestVidHandler()); submitButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(AddVideoDialog.this); if (closer != null) closer.windowClose(null); } }); cancelButt.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { media = null; UI.getCurrent().removeWindow(AddVideoDialog.this); if (closer != null) closer.windowClose(null); } }); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.HelpWantedDialog.java
License:Open Source License
@SuppressWarnings("serial") @HibernateSessionThreadLocalConstructor//ww w . j a va 2s .co m 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(); } }); }
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 av a 2 s.c o 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.AddCardClassDialog.java
License:Open Source License
public AddCardClassDialog(CardClass cls, String title) { super(title); this.cls = cls; VerticalLayout vl = new VerticalLayout(); setContent(vl);/*from w ww.j a va2s . c om*/ vl.setSpacing(true); vl.setMargin(true); vl.setSizeUndefined(); vl.addComponent(titleTF = new TextField("Title")); titleTF.setValue("title goes here"); titleTF.setColumns(35); vl.addComponent(summTF = new TextField("Summary")); summTF.setValue("summary goes here"); summTF.setColumns(35); vl.addComponent(promptTF = new TextField("Prompt")); promptTF.setValue("prompt goes here"); promptTF.setColumns(35); vl.addComponent(colorCombo = new NativeSelect("Color")); fillCombo(); HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(true); buttHL.addComponent(cancelButt = new Button("Cancel")); cancelButt.addClickListener(new CancelListener()); buttHL.addComponent(saveButt = new Button("Save")); saveButt.addClickListener(new SaveListener()); vl.addComponent(buttHL); vl.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT); }