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.components.Header.java
License:Open Source License
private void addBlogHeadlinesLink(String pos) { VerticalLayout vl = new VerticalLayout(); vl.setWidth("955px"); vl.addComponent(blogHeadlinesLink);//from w w w. jav a 2 s. c om vl.setComponentAlignment(blogHeadlinesLink, Alignment.TOP_CENTER); addComponent(vl, pos); }
From source file:edu.nps.moves.mmowgli.components.MmowgliDialogContent.java
License:Open Source License
private void doHeaderWrapper() { Label sp;/*ww w. j a v a 2s . c om*/ VerticalLayout titleWrapper = new VerticalLayout(); titleWrapper.setSpacing(false); titleWrapper.setMargin(false); titleWrapper.setHeight("75px"); titleWrapper.setWidth("100%");//("460px"); //"504px"); //"592px"); headerWrapper.addComponent(titleWrapper); headerWrapper.setExpandRatio(titleWrapper, 1.0f); // titleWrapper.addComponent(sp=new Label()); // sp.setHeight("25px"); header = new HorizontalLayout(); // Where the title gets written header.setSpacing(false); header.setMargin(false); header.setHeight("55px"); header.setWidth("100%"); header.addStyleName("m-transparent"); titleWrapper.addComponent(header); titleWrapper.setComponentAlignment(header, Alignment.MIDDLE_CENTER); headerWrapper.addComponent(sp = new Label()); sp.setWidth("25px"); //"50px"); cancelButt = makeCancelButton(); cancelButt.setClickShortcut(KeyCode.ESCAPE); headerWrapper.addComponent(cancelButt);//, "top:9px;left:504px"); headerWrapper.setComponentAlignment(cancelButt, Alignment.MIDDLE_CENTER); }
From source file:edu.nps.moves.mmowgli.components.SendMessageWindow.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public SendMessageWindow(List<String> emails) { super("A message to mmowgli followers"); this.emails = emails; setModal(true);//from w w w. j a va 2 s .co m VerticalLayout layout = new VerticalLayout(); setContent(layout); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("100%"); layout.setHeight("100%"); Label lab = new Label(makeString(emails)); lab.setCaption("To: (other addresses hidden from each recipient)"); lab.setDescription(lab.getValue().toString()); lab.addStyleName("m-nowrap"); // lab.setHeight("100%"); // makes label clip lab.addStyleName("m-greyborder"); layout.addComponent(lab); subjTf = new TextField(); subjTf.setCaption("Subject:"); subjTf.setWidth("100%"); Game game = Game.getTL(); String acronym = game.getAcronym(); acronym = acronym == null ? "" : acronym + " "; subjTf.setValue("Message from " + acronym + "Mmowgli"); layout.addComponent(subjTf); ta = new TextArea(); ta.setCaption("Content: (may include HTML tags)"); ta.setRows(10); ta.setColumns(50); ta.setWidth("100%"); ta.setHeight("100%"); ta.setInputPrompt("Type message here"); layout.addComponent(ta); layout.setExpandRatio(ta, 1.0f); HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(true); ClickListener closeListener = new SignupsWindowCloser(this); cancelButt = new Button("Cancel", closeListener); buttHL.addComponent(cancelButt); sendButt = new Button("Send", closeListener); sendButt.addClickListener(closeListener); buttHL.addComponent(sendButt); layout.addComponent(buttHL); layout.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT); setWidth("650px"); setHeight("500px"); UI.getCurrent().addWindow(this); ta.focus(); }
From source file:edu.nps.moves.mmowgli.components.SendMessageWindow.java
License:Open Source License
public SendMessageWindow(User user, boolean ccSelf, MailManager.Channel channel, boolean showCcTroubleList) { super("A message to " + user.getUserName()); this.usr = user; this.ccSelf = ccSelf; this.channel = channel; setModal(true);/*www . j a v a2 s.c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); setContent(layout); subjTf = new TextField(); subjTf.setCaption("Subject"); subjTf.setWidth("100%"); User me = Mmowgli2UI.getGlobals().getUserTL(); Game game = Game.getTL(); String acronym = game.getAcronym(); acronym = acronym == null ? "" : acronym + " "; subjTf.setValue(acronym + "Mmowgli message to " + usr.getUserName() + " from " + me.getUserName()); layout.addComponent(subjTf); if (showCcTroubleList) { layout.addComponent(ccTroubleListCB = new CheckBox("CC mmowgli trouble list")); ccTroubleListCB.setValue(false); } ta = new TextArea(); ta.setCaption("Content"); ta.setRows(10); ta.setColumns(50); ta.setInputPrompt("Type message here"); layout.addComponent(ta); HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(true); WindowCloser closeListener = new WindowCloser(this); cancelButt = new Button("Cancel", closeListener); buttHL.addComponent(cancelButt); sendButt = new Button("Send", closeListener);//new IDButton("Send", SENDPRIVATEMESSAGECLICK, user); sendButt.addClickListener(closeListener); buttHL.addComponent(sendButt); layout.addComponent(buttHL); layout.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT); layout.setSizeUndefined(); // does a "pack" UI.getCurrent().addWindow(this); ta.focus(); }
From source file:edu.nps.moves.mmowgli.components.SignupsTable.java
License:Open Source License
@SuppressWarnings("serial") public static void showDialog(String title) { final Button bulkMailButt = new Button("Initiate bulk mail job sending to filtered list"); final Button emailButt = new Button("Compose email"); emailButt.setDescription("Opens editing dialog to compose an email message to the selected individuals"); final Button displayButt = new Button("Display as plain text"); Button closeButt;//w w w.jav a2s. co m final SignupsTable tab = new SignupsTable(null, null, new ValueChangeListener() // selected { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { emailButt.setEnabled(true); } }); final Window dialog = new Window(title); dialog.setWidth("950px"); dialog.setHeight("650px"); VerticalLayout vl = new VerticalLayout(); dialog.setContent(vl); vl.setSizeFull(); vl.setMargin(true); vl.setSpacing(true); addFilterCheckBoxes(vl); vl.addComponent(new Label("Individuals who have established game accounts are shown faintly")); tab.setSizeFull(); vl.addComponent(tab); vl.setExpandRatio(tab, 1.0f); HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(true); buttHL.addComponent(bulkMailButt); bulkMailButt.setImmediate(true); ; Label lab = new Label(""); buttHL.addComponent(lab); buttHL.setExpandRatio(lab, 1.0f); buttHL.addComponent(emailButt); emailButt.setImmediate(true); buttHL.addComponent(displayButt); displayButt.setImmediate(true); buttHL.addComponent(closeButt = new Button("Close")); closeButt.setImmediate(true); emailButt.setEnabled(false); closeButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { dialog.close(); } }); emailButt.addClickListener(new ClickListener() { @SuppressWarnings("rawtypes") @Override public void buttonClick(ClickEvent event) { HSess.init(); Set set = (Set) tab.getValue(); ArrayList<String> emails = new ArrayList<String>(set.size()); Iterator itr = set.iterator(); while (itr.hasNext()) { QueryWrapper wrap = (QueryWrapper) itr.next(); emails.add(wrap.getEmail()); } new SendMessageWindow(emails); HSess.close(); } }); displayButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); dumpSignupsTL(); HSess.close(); } }); bulkMailButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { BulkMailHandler.showDialog((QueryContainer) tab.getContainerDataSource()); } }); vl.addComponent(buttHL); vl.setComponentAlignment(buttHL, Alignment.MIDDLE_RIGHT); UI.getCurrent().addWindow(dialog); dialog.center(); }
From source file:edu.nps.moves.mmowgli.components.VideoWithRightTextPanel.java
License:Open Source License
public void initGui() { addStyleName("m-calltoaction-novideo"); // m-calltoaction"); // puts up background setMargin(false);/*from w ww .j a va 2s .co m*/ setSpacing(false); setWidth("988px"); Label lab; addComponent(lab = new Label()); lab.setHeight("41px"); HorizontalLayout horLay = new HorizontalLayout(); horLay.setSpacing(false); horLay.setMargin(false); horLay.setWidth("100%"); addComponent(horLay); horLay.addComponent(lab = new Label()); lab.setWidth("38px"); if (vidMedia != null && vidMedia.getUrl() != null && vidMedia.getUrl().trim().length() > 0) { if (vidMedia.getType() == MediaType.YOUTUBE) { try { Flash ytp = new Flash(); ytp.setSource(new ExternalResource("https://www.youtube.com/v/" + vidMedia.getUrl())); ytp.setParameter("allowFullScreen", "true"); ytp.setParameter("showRelated", "false"); ytp.setWidth(539.0f, Unit.PIXELS); //VID_W_PX,Unit.PIXELS); ytp.setHeight(342.0f, Unit.PIXELS); //VID_H_PX,Unit.PIXELS); player = ytp; } catch (Exception ex) { System.err.println("Exception instantiating YouTubePlayer: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } } else { System.err.println("Bad media file in VideoWithRightTextPanel"); player = new Label("missing video"); } VerticalLayout plyrLinkWrap = new VerticalLayout(); plyrLinkWrap.setMargin(false); plyrLinkWrap.setSpacing(true); plyrLinkWrap.setSizeUndefined(); VerticalLayout playerVL = new VerticalLayout(); //AbsoluteLayout(); playerVL.setWidth("539px"); playerVL.setHeight("342px"); playerVL.addStyleName("m-boxshadow-5"); playerVL.addComponent(player); plyrLinkWrap.addComponent(playerVL); Link link = getAlternateVideoLink(vidMedia); if (link != null) { plyrLinkWrap.addComponent(link); plyrLinkWrap.setComponentAlignment(link, Alignment.BOTTOM_CENTER); } horLay.addComponent(plyrLinkWrap); horLay.addComponent(lab = new Label()); lab.setWidth("22px"); } VerticalLayout rightColVLayout = new VerticalLayout(); horLay.addComponent(rightColVLayout); horLay.setExpandRatio(rightColVLayout, 1.0f); horLay.addComponent(lab = new Label()); lab.setWidth("35px"); rightColVLayout.setSpacing(true); if (headerImg != null) { // Image takes priority over text rightColVLayout.addComponent(headerImg); } else { headingLab = new HtmlLabel(heading); if (largerText) headingLab.addStyleName("m-orientation-heading"); else headingLab.addStyleName("m-calltoaction-thesituation-heading"); rightColVLayout.addComponent(headingLab); } summaryLab = new HtmlLabel(summary); if (largerText) summaryLab.addStyleName("m-orientation-summary"); else summaryLab.addStyleName("m-calltoaction-thesituation-summary"); rightColVLayout.addComponent(summaryLab); // text = text.replace("\n", "<br/><br/>"); // pure html with <p> tags seems to work well textLab = new HtmlLabel(text); if (largerText) textLab.addStyleName("m-orientation-text"); else textLab.addStyleName("m-calltoaction-thesituation-text"); rightColVLayout.addComponent(textLab); // Move 2, no room /* * if (promptImg != null) { // Image priority over text rightColVLayout.addComponent(promptImg); } else if (prompt != null){ promptLab = new Label(prompt); * promptLab.setContentMode(Label.CONTENT_XHTML); if(largerText) promptLab.addStyleName("m-orientation-prompt"); else * promptLab.addStyleName("m-calltoaction-thesituation-prompt"); rightColVLayout.addComponent(promptLab); } */ // spacer so background doesn't look cut-off addComponent(lab = new Label()); lab.setHeight("25px"); }
From source file:edu.nps.moves.mmowgli.components.WordCloudPanel.java
License:Open Source License
private void addAButton(WordButton butt) { if (!isIE7)/*w w w. jav a 2 s . c om*/ meat.addComponent(butt); else { VerticalLayout vLay = (VerticalLayout) meat; int numLines = vLay.getComponentCount(); HorizontalLayout hL; if (numLines == 0) { hL = new HorizontalLayout(); vLay.addComponent(hL); vLay.setComponentAlignment(hL, Alignment.MIDDLE_CENTER); numLines = 1; } hL = (HorizontalLayout) vLay.getComponent(numLines - 1); hL.addComponent(butt); if (hL.getComponentCount() >= IE7MAXCOLCOUNT) { vLay.addComponent(hL = new HorizontalLayout()); vLay.setComponentAlignment(hL, Alignment.MIDDLE_CENTER); } } }
From source file:edu.nps.moves.mmowgli.export.BaseExporter.java
License:Open Source License
protected void getMetaStringOrCancel(final MetaListener lis, String title, final Map<String, String> params) { final Window dialog = new Window(title); final TextField[] parameterFields; dialog.setModal(true);/*w w w .j ava2s . co m*/ VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); dialog.setContent(layout); final TextArea ta = new TextArea(); ta.setWidth("100%"); ta.setInputPrompt("Type a description of this data, or the game which generated this data (optional)"); ta.setImmediate(true); layout.addComponent(ta); Set<String> keySet = params.keySet(); parameterFields = new TextField[keySet.size()]; int i = 0; GridLayout pGL = new GridLayout(); pGL.addStyleName("m-greyborder"); pGL.setColumns(2); Label hdr = new HtmlLabel("<b>Parameters</b>"); hdr.addStyleName("m-textaligncenter"); pGL.addComponent(hdr, 0, 0, 1, 0); // top row pGL.setComponentAlignment(hdr, Alignment.MIDDLE_CENTER); pGL.setSpacing(false); for (String key : keySet) { pGL.addComponent(new HtmlLabel(" " + key + " ")); pGL.addComponent(parameterFields[i] = new TextField()); parameterFields[i++].setValue(params.get(key)); } if (i > 0) { layout.addComponent(pGL); layout.setComponentAlignment(pGL, Alignment.TOP_CENTER); } HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); @SuppressWarnings("serial") Button cancelButt = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); lis.continueOrCancel(null); } }); @SuppressWarnings("serial") Button exportButt = new Button("Export", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); Set<String> keySet = params.keySet(); int i = 0; for (String key : keySet) params.put(key, parameterFields[i++].getValue().toString()); lis.continueOrCancel(ta.getValue().toString()); } }); hl.addComponent(cancelButt); hl.addComponent(exportButt); 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("385px"); dialog.setHeight("310px"); hl.setWidth("100%"); ta.setWidth("100%"); ta.setHeight("100%"); layout.setExpandRatio(ta, 1.0f); UI.getCurrent().addWindow(dialog); }
From source file:edu.nps.moves.mmowgli.hibernate.SearchPopup.java
License:Open Source License
@SuppressWarnings("serial") public SearchPopup(String startingText) { super("Search for Players, Action Plans, Idea Cards"); //setModal(true); better not to be model this.initialText = startingText; setWidth("635px"); setHeight("600px"); center();//from w w w.ja va 2 s .c o m VerticalLayout vLay = new VerticalLayout(); vLay.setSizeFull(); vLay.setMargin(true); vLay.setSpacing(true); setContent(vLay); WordCloudPanel wcPan = new WordCloudPanel(new ClickListener() { @Override public void buttonClick(ClickEvent event) { WordButton wb = (WordButton) event.getButton(); tf.setValue(wb.word.text); searchButt.fireClick(); } }); wcPan.setImmediate(true); TermInfo[] tinfo = SearchManager.getHighFrequencyTerms(); List<Word> wdLis = new ArrayList<Word>(tinfo.length); for (TermInfo inf : tinfo) { String txt = inf.term.text(); Word wd = new Word(txt, inf.docFreq); wdLis.add(wd); } // V7 /* TermStats[] tstats = SearchManager.getHighFrequencyTerms(); List<Word> wdLis = new ArrayList<Word>(tstats.length); for(TermStats ts : tstats) { String txt = new String(ts.termtext.utf8ToString()); Word wd = new Word(txt,ts.docFreq); wdLis.add(wd); } */ wdLis = finalFilter(wdLis); // dumpList(wLis); wcPan.setWordData(wdLis, WordOrder.ALPHA); wcPan.setWidth("590px"); // won't work in ie"100%"); vLay.addComponent(wcPan); HorizontalLayout topHL = new HorizontalLayout(); vLay.addComponent(topHL); topHL.setWidth("100%"); topHL.setMargin(true); topHL.setSpacing(true); topHL.addComponent(tf = new TextField()); tf.addValueChangeListener(new TextFieldChangeListener()); tf.setWidth("100%"); //tf.setInputPrompt("Enter search terms"); tf.setImmediate(true); tf.setTextChangeTimeout(5000); topHL.setExpandRatio(tf, 1.0f); if (startingText != null) tf.setValue(startingText); searchButt = new FireableButton("Search", this); topHL.addComponent(searchButt); searchButt.setClickShortcut(KeyCode.ENTER); vLay.addComponent(statusLabel = new HtmlLabel(" ")); statusLabel.setImmediate(true); resultsTable = new Table(); resultsTable.addStyleName("m-actiondashboard-table"); resultsTable.setImmediate(true); vLay.addComponent(resultsTable); resultsTable.setHeight("100%"); resultsTable.setWidth("99%"); vLay.setExpandRatio(resultsTable, 1.0f); BeanItemContainer<SearchResult> bCont = new BeanItemContainer<SearchResult>(SearchResult.class); bCont.addBean(new SearchResult("", "", "")); // fix for 6.7.0 bug resultsTable.addGeneratedColumn("text", new ToolTipAdder()); resetTable(bCont); resultsTable.setNewItemsAllowed(false); resultsTable.setSelectable(true); resultsTable.addItemClickListener(new ItemClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void itemClick(ItemClickEvent event) { HSess.init(); @SuppressWarnings("unchecked") BeanItem<SearchResult> bi = (BeanItem<SearchResult>) event.getItem(); SearchResult sr = bi.getBean(); MmowgliController controller = Mmowgli2UI.getGlobals().getController(); if (sr.getType().equals(USERTYPEKEY)) controller.miscEventTL(new AppEvent(SHOWUSERPROFILECLICK, SearchPopup.this, sr.getHibId())); else if (sr.getType().equals(ACTIONPLANTYPEKEY)) controller.miscEventTL(new AppEvent(ACTIONPLANSHOWCLICK, SearchPopup.this, sr.getHibId())); else controller.miscEventTL(new AppEvent(CARDCLICK, SearchPopup.this, sr.getHibId())); HSess.close(); closeListener.buttonClick(null); } }); vLay.addComponent(closeButt = new Button("Close")); vLay.setComponentAlignment(closeButt, Alignment.TOP_RIGHT); closeButt.addClickListener(closeListener = new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (searchThread != null) searcherObj.killed = true; //V7 SearchPopup.this.getParent().removeWindow(SearchPopup.this); SearchPopup.this.close(); } }); }
From source file:edu.nps.moves.mmowgli.Mmowgli2UI.java
License:Open Source License
public void setLoginContentTL() { VerticalLayout layout = (VerticalLayout) getContent(); layout.removeAllComponents();/*from w w w . jav a2 s .c o m*/ layout.addComponent(regpg = new RegistrationPageBase()); layout.setComponentAlignment(regpg, Alignment.TOP_CENTER); }