List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:edu.nps.moves.mmowgli.modules.actionplans.HowToWinActionPopup.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public HowToWinActionPopup(String title) { super();/*from ww w. j a v a2 s . c om*/ setTitleString(title); VerticalLayout vl = new VerticalLayout(); vl.setMargin(true); Link l = new Link("Learn more", new ExternalResource("http://portal.mmowgli.nps.edu/instructions")); l.setTargetName(PORTALTARGETWINDOWNAME); l.setTargetBorder(BorderStyle.DEFAULT); l.addStyleName("m-learn-more-link"); vl.addComponent(l); vl.setComponentAlignment(l, Alignment.MIDDLE_CENTER); addLowerComponent(vl); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.MediaSubWindow.java
License:Open Source License
public MediaSubWindow(Resource res) { setCaption("Action Plan Image"); setModal(true);/* w w w . j a v a 2 s.c o m*/ setWidth("640px"); setHeight("480px"); TabSheet tabs = new TabSheet(); tabs.setSizeFull(); setContent(tabs); Panel pan = new Panel(); tabs.addTab(pan, "Fit Window"); pan.setSizeFull(); VerticalLayout layout = new VerticalLayout(); pan.setContent(layout); layout.setSizeFull(); layout.addStyleName("m-background-lightgrey"); layout.setMargin(false); image = new ScaleImage(); image.setSizeFull(); image.setSource(res); layout.addComponent(image); layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); layout.setExpandRatio(image, 1.0f); tabs.addTab(buildNestedImage(res), "Actual Size"); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.MediaSubWindow.java
License:Open Source License
private Component buildNestedImage(Resource res) { VerticalLayout content = new MVerticalLayout().withMargin(false).withFullHeight().withFullWidth(); content.addStyleName("m-background-lightgrey"); Label sp;//from w w w . j a v a2 s . co m content.addComponent(sp = new Label()); content.setExpandRatio(sp, 0.5f); Component comp = buildNestedHL(res); content.addComponent(comp); content.setComponentAlignment(comp, Alignment.MIDDLE_CENTER); content.addComponent(sp = new Label()); content.setExpandRatio(sp, 0.5f); return content; }
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 . ja v a 2s . c om 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 w w . ja v a 2s. c o m 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); }
From source file:edu.nps.moves.mmowgli.modules.administration.AddCardTypeDialog.java
License:Open Source License
public AddCardTypeDialog(int descType, String title) { super(title); this.typ = descType; VerticalLayout vl = new VerticalLayout(); setContent(vl);//w w w . j av a2 s .c om vl.setSizeUndefined(); vl.setMargin(true); vl.setSpacing(true); 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); }
From source file:edu.nps.moves.mmowgli.modules.administration.VipListManager.java
License:Open Source License
@SuppressWarnings({ "unchecked", "serial" }) private void showViewOrDelete(final DeleteListener lis) { dialog = new Window("View / Delete VIPs"); dialog.setModal(true);// w ww . j a v a 2s.c o m VerticalLayout layout = new VerticalLayout(); dialog.setContent(layout); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); List<VipPii> vLis = VHibPii.getAllVips(); vipListSelect = new ListSelect("Select items to delete"); StringBuffer sb = new StringBuffer(); // for popup vipListSelect.addStyleName("m-greyborder"); String lf = System.getProperty("line.separator"); for (int i = 0; i < vLis.size(); i++) { VipPii v; vipListSelect.addItem(v = vLis.get(i)); sb.append(v.getEntry()); sb.append(lf); } if (sb.length() > 0) sb.setLength(sb.length() - 1); // last space vipListSelect.setNullSelectionAllowed(true); vipListSelect.setMultiSelect(true); vipListSelect.setImmediate(true); vipListSelect.addValueChangeListener(new VipSelectListener()); layout.addComponent(vipListSelect); Label copyPopupList = new HtmlLabel("<pre>" + sb.toString() + "</pre>"); Panel p = new Panel(); VerticalLayout lay = new VerticalLayout(); p.setContent(lay); lay.addComponent(copyPopupList); p.setWidth("400px"); p.setHeight("300px"); PopupView popup = new PopupView("Display list as copyable text", p); popup.setHideOnMouseOut(false); if (sb.length() <= 0) popup.setEnabled(false); layout.addComponent(popup); layout.setComponentAlignment(popup, Alignment.MIDDLE_CENTER); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); Button cancelButt = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); lis.continueOrCancel(null); } }); deleteButt = new Button("Delete & Close", new Button.ClickListener() { public void buttonClick(ClickEvent event) { Set<VipPii> set = (Set<VipPii>) vipListSelect.getValue(); if (set.size() <= 0) set = null; dialog.close(); lis.continueOrCancel(set); } }); deleteButt.setEnabled(false); hl.addComponent(cancelButt); hl.addComponent(deleteButt); hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(cancelButt, 1.0f); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(hl); dialog.setWidth("300px"); dialog.setHeight("350px"); hl.setWidth("100%"); vipListSelect.setWidth("99%"); vipListSelect.setHeight("99%"); layout.setExpandRatio(vipListSelect, 1.0f); UI.getCurrent().addWindow(dialog); dialog.center(); }
From source file:edu.nps.moves.mmowgli.modules.cards.CallToActionPage.java
License:Open Source License
public void initGui() { Object sessKey = HSess.checkInit(); Label spacer = new Label(); spacer.setWidth(CALLTOACTION_HOR_OFFSET_STR); addComponent(spacer);/* w w w . j a v a 2 s . c o m*/ VerticalLayout mainVl = new VerticalLayout(); addComponent(mainVl); mainVl.setSpacing(true); mainVl.setWidth("100%"); MovePhase phase = MovePhase.getCurrentMovePhaseTL(); String sum = phase.getCallToActionBriefingSummary(); String tx = phase.getCallToActionBriefingText(); Media v = phase.getCallToActionBriefingVideo(); Embedded headerImg = new Embedded(null, Mmowgli2UI.getGlobals().mediaLocator().getCallToActionBang()); headerImg.setDescription("Review motivation and purpose of this game"); NativeButton needButt = new NativeButton(); needButt.setStyleName("m-weNeedYourHelpButton"); vidPan = new VideoWithRightTextPanel(v, headerImg, sum, tx, needButt); // needImg); vidPan.initGui(); mainVl.addComponent(vidPan); String playCardString = Game.getTL().getCurrentMove().getCurrentMovePhase().getPlayACardTitle(); NativeButton butt; if (!mockupOnly) butt = new IDNativeButton(playCardString, MmowgliEvent.PLAYIDEACLICK); else butt = new NativeButton(playCardString); // no listener butt.addStyleName("borderless"); butt.addStyleName("m-calltoaction-playprompt"); butt.setDescription("View existing cards and play new ones"); mainVl.addComponent(butt); mainVl.setComponentAlignment(butt, Alignment.MIDDLE_CENTER); HSess.checkClose(sessKey); }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
@SuppressWarnings("serial") @HibernateOpened//from w w w . j a v a 2 s. com @HibernateRead @HibernateClosed public void initGuiTL() { VerticalLayout outerVl = this; outerVl.setWidth("100%"); outerVl.setSpacing(true); cardMarkingPanel = makeCardMarkingPanelTL(); Card c = Card.getTL(cardId); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); User me = globs.getUserTL(); if (c.isHidden() && !me.isAdministrator() && !me.isGameMaster()) { // This case should only come into play when a non-gm user is showing this page // by explicitly using the url. Not too frequent an occurance. Label lab = new Label("This card is not active"); lab.addStyleName("m-cardlarge-hidden-label"); outerVl.setHeight("300px"); outerVl.addComponent(lab); outerVl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); return; } loadMarkingPanel_oobTL(c); // won't have Roles lazily update w/out above loadMarkingPanel_oob(DBGet.getCard(cardId)); markingRadioGroup.addValueChangeListener(markingListener = new MarkingChangeListener()); // Top part topHL = new HorizontalLayout(); addComponent(topHL); topHL.setWidth("95%"); setComponentAlignment(topHL, Alignment.TOP_CENTER); // Card columns listsHL = new HorizontalLayout(); addComponent(listsHL); listsHL.setSpacing(true); setComponentAlignment(listsHL, Alignment.TOP_CENTER); addChildListsTL(); chainButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); AppEvent evt = new AppEvent(CARDCHAINPOPUPCLICK, CardChainPage.this, cardId); Mmowgli2UI.getGlobals().getController().miscEventTL(evt); HSess.close(); return; } }); }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
@HibernateRead private GhostVerticalLayoutWrapper makeCardMarkingPanelTL() { GhostVerticalLayoutWrapper wrapper = new GhostVerticalLayoutWrapper(); VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true);/*from w w w . ja va2 s. co m*/ wrapper.ghost_setContent(vl); Label lab = new HtmlLabel("<b><i>Game Master Actions</i></b>"); vl.addComponent(lab); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); NativeButton editCardButt = new NativeButton("Edit Card"); editCardButt.addStyleName(BaseTheme.BUTTON_LINK); editCardButt.addClickListener(new EditCardTextListener()); vl.addComponent(editCardButt); markingRadioGroup = new OptionGroup(null); markingRadioGroup.setMultiSelect(false); markingRadioGroup.setImmediate(true); markingRadioGroup.setDescription("Only game masters may change."); vl.addComponent(markingRadioGroup); NativeButton clearButt = new NativeButton("clear card marking"); clearButt.addStyleName(BaseTheme.BUTTON_LINK); vl.addComponent(clearButt); clearButt.addClickListener(new MarkingClearListener()); Collection<?> markings = CardMarking.getContainer().getItemIds(); CardMarking hiddencm = null; for (Object o : markings) { CardMarking cm = CardMarking.getTL(o); if (cm == CardMarkingManager.getHiddenMarking()) hiddencm = cm; else if (cm == CardMarkingManager.getNoChildrenMarking()) ; // todo enable with game switch else markingRadioGroup.addItem(cm); } if (hiddencm != null) markingRadioGroup.addItem(hiddencm); Card card = Card.getTL(cardId); // feb refactor DBGet.getCardTL(cardId); vl.addComponent(lab = new Label()); lab.setHeight("5px"); NativeButton newActionPlanButt = new IDNativeButton("create action plan from this card", CARDCREATEACTIONPLANCLICK, cardId); newActionPlanButt.addStyleName(BaseTheme.BUTTON_LINK); vl.addComponent(newActionPlanButt); if (Mmowgli2UI.getGlobals().getUserTL().isTweeter()) { String tweet = TWEETBUTTONEMBEDDED_0 + buildTweet(card) + TWEETBUTTONEMBEDDED_1; Label tweeter = new HtmlLabel(tweet); tweeter.setHeight(TWEETBUTTON_HEIGHT); tweeter.setWidth(TWEETBUTTON_WIDTH); vl.addComponent(tweeter); } return wrapper; }