List of usage examples for com.vaadin.ui HorizontalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:ec.com.vipsoft.ce.ui.FacturaView.java
@PostConstruct public void postconstructor() { construirGui();// w w w. ja v a 2 s . c om tipoIdentificacion.addValueChangeListener(event -> { String seleccionado = (String) tipoIdentificacion.getValue(); if (seleccionado.equalsIgnoreCase("07")) { razonSocialBeneficiario.setValue("Consumidor Final"); rucBeneficiario.setValue("9999999999999"); direccion.setValue("Consumidor Final"); razonSocialBeneficiario.setReadOnly(true); rucBeneficiario.setReadOnly(true); direccion.setReadOnly(true); } else { razonSocialBeneficiario.setReadOnly(false); rucBeneficiario.setReadOnly(false); direccion.setReadOnly(false); } }); final SimpleStringFilter filtro; gridBusqueda = new Grid(); beaitem = new BeanItemContainer<BienEconomico>(BienEconomico.class); gridBusqueda.setContainerDataSource(beaitem); gridBusqueda.setSizeFull(); // gridBusqueda.setVisibleColumns(new Object[]{"codigo","descripcion"}); gridBusqueda.removeColumn("id"); gridBusqueda.removeColumn("codigoIva"); gridBusqueda.removeColumn("codigoIce"); gridBusqueda.removeColumn("entidad"); gridBusqueda.setColumnOrder("codigo", "descripcion"); gridBusqueda.setSelectionMode(SelectionMode.SINGLE); // tfiltro.setImmediate(true); botonSeleccionaDesdeVentanar = new Button("seleccionar"); HorizontalLayout lbus = new HorizontalLayout(); lbus.setSpacing(true); lbus.setMargin(true); lbus.addComponent(new Label("cdigo")); lbus.addComponent(campoBusquedaProducto); lbus.addComponent(botonSeleccionaDesdeVentanar); beaitem.addAll(listadorBienes.listarBienesDisponibles(userInfo.getRucEmisor())); VerticalLayout layoutventana = new VerticalLayout(); layoutventana.setSpacing(true); layoutventana.setMargin(true); layoutventana.addComponent(lbus); layoutventana.addComponent(gridBusqueda); ventana.setContent(layoutventana); ventana.center(); iniciarEventos(); this.campoBusquedaProducto .addTextChangeListener((FieldEvents.TextChangeListener) new FieldEvents.TextChangeListener() { private static final long serialVersionUID = 5128049403423426140L; SimpleStringFilter filter; public void textChange(FieldEvents.TextChangeEvent event) { Container.Filterable f = (Container.Filterable) gridBusqueda.getContainerDataSource(); if (this.filter != null) { f.removeContainerFilter((Container.Filter) this.filter); } this.filter = new SimpleStringFilter((Object) "codigo", event.getText(), true, false); f.addContainerFilter((Container.Filter) this.filter); } }); }
From source file:edu.nps.moves.mmowgli.components.CardSummary.java
License:Open Source License
@SuppressWarnings("serial") public void initGui(Session sess) { setHeight(heightStr);/* w ww .j a va 2 s. com*/ setWidth(widthStr); addStyleName("m-cursor-pointer"); // pointer when over me, because I'm clickable if (bckgrndResource != null) { backImg = new Embedded(null, bckgrndResource); addComponent(backImg, "top:0px;left:0px"); } if (!isFactCard) { String hdrTxt = card.getCardType().getSummaryHeader(); header.setDescription(hdrTxt); if (hdrTxt != null && hdrTxt.length() > 0) { //if(hdrTxt.length()>=15) { // hdrTxt = hdrTxt.substring(0, 15).trim()+"..."; // } header.setValue(hdrTxt); header.setWidth(headerWidthStr); header.setHeight(headerHeightStr); addComponent(header, headerPositionStr); header.addStyleName(headerStyleStr); header.addStyleName(textColorStyleStr); header.addStyleName("m-cursor-pointer"); } if (starGreyResource != null && starRedResource != null) { Set<Card> favs = me.getFavoriteCards(); if (favs != null && favs.contains(card)) { star.setIcon(starRedResource); } else { star.setIcon(starGreyResource); } addComponent(star, starPositionStr); if (!mockupOnly) star.addClickListener(new StarClick()); star.addStyleName("borderless"); star.setDescription("Mark or unmark as a favorite of yours"); } } idLab.setWidth(idLabWidthStr); idLab.setHeight(idLabHeightStr); idLab.setValue("" + card.getId()); idLab.addStyleName(idLabStyleStr); idLab.addStyleName("m-text-align-right"); addComponent(idLab, idLabPositionStr); content.setWidth(contentWidthStr); content.setHeight(contentHeightStr); addComponent(content, contentPositionStr); content.addStyleName(contentStyle); if (card.isHidden()) content.addStyleName(hiddenStyle); // red "HIDDEN" text background content.setValue(formatText(card.getText())); content.addStyleName("m-cursor-pointer"); content.setDescription(card.getText()); if (!isFactCard) { /* We shouldn't have to be setting widths on the components within this horizontal layout. The * fact that we do is, I think, related to the absolutelayout parent. Get rid of that and we might * be able to yank the .setwidth, setheight stuff. */ HorizontalLayout hLay = new HorizontalLayout(); hLay.setMargin(false); hLay.setHeight(userHeightStr); hLay.setWidth(userDateWidthStr); addComponent(hLay, userDatePositionStr); user.setValue(card.getAuthorName()); //.getAuthor().getUserName()); hLay.addComponent(user); user.setWidth(userWidthStr); user.setHeight(userHeightStr); user.addStyleName(userStyle); user.addStyleName("m-cursor-pointer"); Label sp; hLay.addComponent(sp = new Label()); sp.setWidth("1px"); hLay.setExpandRatio(sp, 1.0f); dateLab.setValue(dateFormatter.format(card.getCreationDate())); hLay.addComponent(dateLab); dateLab.setHeight(userHeightStr); dateLab.setWidth(null); //dateWidthStr); dateLab.addStyleName(userStyle); } if (card.getCreatedInMove().getId() != Move.getCurrentMove(sess).getId()) { Label lab = new Label(card.getCreatedInMove().getName()); lab.addStyleName(moveStyleStr); lab.setWidth(moveWidthStr); lab.setHeight(moveHeightStr); addComponent(lab, movePositionStr); } // Listen for layout click events if (!mockupOnly) this.addLayoutClickListener(new LayoutClickListener() { @MmowgliCodeEntry @HibernateOpened @HibernateRead public void layoutClick(LayoutClickEvent event) { HSess.init(); Component c = event.getChildComponent(); Card card = Card.getTL(cardId); if (c == star) { //Let the starlistener below handle it } else if (c == user) { AppEvent evt = new AppEvent(CARDAUTHORCLICK, CardSummary.this, card.getAuthor().getId()); Mmowgli2UI.getGlobals().getController().miscEventTL(evt); } else { //if (c == content) { AppEvent evt = new AppEvent(CARDCLICK, CardSummary.this, card.getId()); Mmowgli2UI.getGlobals().getController().miscEventTL(evt); } HSess.close(); } }); }
From source file:edu.nps.moves.mmowgli.components.CardTable.java
License:Open Source License
@SuppressWarnings("unused") private Component orig_buildGenAuthorColumn(Card card) { // IE7 can't handle fanciness: if (Mmowgli2UI.getGlobals().isIE7()) { return new Label(card.getAuthorName()); //.getAuthor().getUserName()); }/*from www . jav a2s .c o m*/ HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(false); hl.setSpacing(true); User auth = card.getAuthor(); if (auth.getAvatar() != null) { Embedded avatar = new Embedded(null, Mmowgli2UI.getGlobals().getMediaLocator().locate(auth.getAvatar().getMedia(), 32)); avatar.setWidth("24px"); avatar.setHeight("24px"); hl.addComponent(avatar); hl.setComponentAlignment(avatar, Alignment.MIDDLE_LEFT); avatar.addStyleName("m-cursor-pointer"); } IDButton uButt = new IDButton(auth.getUserName(), SHOWUSERPROFILECLICK, auth.getId()); uButt.addStyleName(BaseTheme.BUTTON_LINK); uButt.setWidth(8.0f, Unit.EM); hl.addComponent(uButt); hl.setComponentAlignment(uButt, Alignment.MIDDLE_LEFT); return hl; }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
@SuppressWarnings("serial") @Override//from w w w . j a v a 2s. c o m public void initGui() { setWidth(HEADER_W); setHeight(HEADER_H); Game g = Game.getTL(); GameLinks gl = GameLinks.getTL(); Embedded embedded = new Embedded(null, mediaLoc.getHeaderBackground()); addComponent(embedded, "top:0px;left:0px"); if (g.isActionPlansEnabled()) { embedded = new Embedded(null, mediaLoc.getImage("scoretext200w50h.png")); addComponent(embedded, "top:52px;left:63px"); addComponent(explorPtsLab, "top:55px;left:260px"); addComponent(implPtsLab, "top:79px;left:247px"); } else { embedded = new Embedded(null, mediaLoc.getImage("scoretextoneline200w50h.png")); addComponent(embedded, "top:52px;left:73px"); addComponent(explorPtsLab, "top:65px;left:205px"); } Resource res = mediaLoc.getHeaderBanner(g); if (res != null) { embedded = new Embedded(null, res); addComponent(embedded, pos_banner); } HorizontalLayout buttHL = new HorizontalLayout(); buttHL.setSpacing(false); buttHL.setMargin(false); buttHL.setWidth("291px"); buttHL.setHeight("45px"); addComponent(buttHL, "top:1px;left:687px"); Label lab; boolean armyHack = gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech"); if (armyHack) buttonChars = buttonChars - 3 + 9; // Replace "Map" with "Resources buttHL.addComponent(lab = new Label()); lab.setWidth("1px"); buttHL.setExpandRatio(lab, 0.5f); buttHL.addComponent(leaderBoardButt); buttHL.setComponentAlignment(leaderBoardButt, Alignment.MIDDLE_CENTER); addDivider(buttHL, buttonChars); // Hack if (armyHack) { //Hack Link resourceLink = makeSmallLink("Resources", "", "http://futures.armyscitech.com/resources/"); buttHL.addComponent(resourceLink); buttHL.setComponentAlignment(resourceLink, Alignment.MIDDLE_CENTER); } else { buttHL.addComponent(mapButt); buttHL.setComponentAlignment(mapButt, Alignment.MIDDLE_CENTER); } addDivider(buttHL, buttonChars); buttHL.addComponent(liveBlogButt); buttHL.setComponentAlignment(liveBlogButt, Alignment.MIDDLE_CENTER); addDivider(buttHL, buttonChars); buttHL.addComponent(learnMoreButt); buttHL.setComponentAlignment(learnMoreButt, Alignment.MIDDLE_CENTER); buttHL.addComponent(lab = new Label()); lab.setWidth("1px"); buttHL.setExpandRatio(lab, 0.5f); addComponent(playIdeaButt, pos_playIdeaButt); if (g.isActionPlansEnabled()) { addComponent(takeActionButt, pos_takeActionButt); toggleTakeActionButt(true); // everbody can click it me.isGameMaster()); } else if (armyHack) { embedded = new Embedded(null, mediaLoc.getImage("armylogoxpntbg80w80h.png")); addComponent(embedded, "top:54px;left:864px"); } Serializable uid = Mmowgli2UI.getGlobals().getUserID(); refreshUser(uid, HSess.get()); // assume in vaadin transaction here avatar.setWidth(HEADER_AVATAR_W); avatar.setHeight(HEADER_AVATAR_H); avatar.setDescription(user_profile_tt); avatar.addClickListener(new MouseEvents.ClickListener() { @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { userNameButt.buttonClick(new ClickEvent(userNameButt)); } }); userNameButt.setDescription(user_profile_tt); addComponent(userNameButt, HEADER_USERNAME_POS); addComponent(avatar, "top:13px;left:6px"); //HEADER_AVATAR_POS); searchField.setWidth("240px"); // searchField.setHeight("18px"); // this causes a text _area_ to be used, giving me two lines, default height is good, style removes borders searchField.setInputPrompt("Search"); searchField.setImmediate(true); searchField.setTextChangeEventMode(TextChangeEventMode.LAZY); searchField.setTextChangeTimeout(5000); // ms searchField.addStyleName("m-header-searchfield"); searchField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void valueChange(ValueChangeEvent event) { HSess.init(); handleSearchClickTL(); HSess.close(); /* searchButt.focus(); // make the white go away String s = event.getProperty().getValue().toString(); if (s.length() > 0) { MmowgliController controller = Mmowgli2UI.getGlobals().getController(); controller.handleEvent(SEARCHCLICK, s, searchField); } */ } }); searchButt.enableAction(false); // want a local listener searchButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); handleSearchClickTL(); HSess.close(); } }); addComponent(searchField, "top:107px;left:74px"); //"top:110px;left:74px"); addComponent(signOutButt, "top:25px;left:250px"); //"top:18px;left:250px"); addComponent(searchButt, "top:105px;left:30px"); //"top:100px;left:180px"); MessageUrl mu = MessageUrl.getLastTL(); if (mu != null) decorateBlogHeadlinesLink(mu); addBlogHeadlinesLink("top:147px;left:20px"); String headline = blogHeadlinesLink.getCaption(); if (headline != null && headline.length() > 0) { // Add Window.Notification relaying the same info as the BlogHeadLinesLink Notification note = new Notification("Today's News", "<br/>" + headline, Notification.Type.WARNING_MESSAGE, true); note.setPosition(Position.TOP_CENTER); note.setDelayMsec(5 * 1000); // Yellow is more an attention getter note.setStyleName("m-blue"); note.show(Page.getCurrent()); } addComponent(callToActionButt, "top:0px;left:333px"); /* The css has a height, width and even a background, but stupid IE will only properly size the button if an image is * used. Therefore we use an a transparent png of the proper size */ MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); callToActionButt.setIcon(medLoc.getEmpty353w135h()); Move move = g.getCurrentMove(); if (g.isShowHeaderBranding()) { Media brand = g.getHeaderBranding(); if (brand != null) { Embedded bremb = new Embedded(null, mediaLoc.locate(brand)); addComponent(bremb, "top:0px;left:333px"); } else { brandingLab.setHeight("30px"); setBrandingLabelText(move, g); addComponent(brandingLab, "top:0px;left:333px"); //HEADER_MOVETITLE_POS); //"top:151px;left:476px"; } } if (move.isShowMoveBranding()) { moveNumLab.setValue(move.getName()); addComponent(moveNumLab, "top:103px;left:333px"); } /* if(user != null && (user.isAdministrator() || user.isGameMaster() || user.isDesigner() )) { // has a menu // fouoLink.addStyleName("m-absolutePositioning"); addComponent(fouoLink,"top:-10px;left:400px"); } else addComponent(fouoLink,"top:0px;left:400px"); fouoLink.setVisible(g.isShowFouo()); */ }
From source file:edu.nps.moves.mmowgli.components.Leaderboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();//from w w w. ja v a 2 s .com setWidth(APPLICATION_SCREEN_WIDTH); setSpacing(false); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); Label sp; HorizontalLayout titleHL = new HorizontalLayout(); addComponent(titleHL); titleHL.setMargin(new MarginInfo(false, true, false, true)); //sides only titleHL.setWidth("100%"); Component c; titleHL.addComponent(c = globs.getMediaLocator().getLeaderboardTitle()); titleHL.setComponentAlignment(c, Alignment.MIDDLE_LEFT); titleHL.setExpandRatio(c, .5f); maybeShowMoveSelector(titleHL); tips.setStyleName(BaseTheme.BUTTON_LINK); tips.addStyleName("m-link-button"); titleHL.addComponent(tips); titleHL.setComponentAlignment(tips, Alignment.MIDDLE_RIGHT); titleHL.setExpandRatio(tips, 0.5f); tableVLayout = new VerticalLayout(); tableVLayout.setSizeUndefined(); tableVLayout.setWidth(APPLICATION_SCREEN_WIDTH); tableVLayout.setSpacing(true); tableVLayout.setMargin(true); tableVLayout.addStyleName("m-whitepage-header"); addComponent(tableVLayout); tableVLayout.addComponent(sp = new Label()); sp.setHeight("20px"); // to fit top of background tableVLayout.addComponent(table = createTableTL()); tableVLayout.setComponentAlignment(table, Alignment.TOP_CENTER); table.setValue(globs.getUserID()); tableVLayout.setExpandRatio(table, 1.0f); /* I can't get this to properly refresh, todo refreshButt = new Button("Refresh"); mainVLayout.addComponent(refreshButt); mainVLayout.setComponentAlignment(refreshButt, Alignment.TOP_CENTER); refreshButt.addListener(new RefreshListener()); refreshButt.setEnabled(false); */ }
From source file:edu.nps.moves.mmowgli.components.MmowgliDialog.java
License:Open Source License
@Override public void initGui() { outerLayout = new VerticalLayout(); outerLayout.setSpacing(false);/*from w w w . j a v a 2s .co m*/ outerLayout.setSizeUndefined(); outerLayout.addStyleName("m-transparent"); setContent(outerLayout); Label sp; sp = new Label(); sp.setHeight("100px"); outerLayout.addComponent(sp); HorizontalLayout headerWrapper2 = new HorizontalLayout(); outerLayout.addComponent(headerWrapper2); // at the top headerWrapper2.addStyleName("m-dialog-header"); headerWrapper2.setHeight("75px"); headerWrapper2.setWidth("592px"); headerWrapper2.setSpacing(false); headerWrapper2.setMargin(false); headerWrapper2.addComponent(sp = new Label()); // indent from left sp.setWidth("45px"); headerHL2 = new HorizontalLayout(); // Where the title gets written headerHL2.setSpacing(false); headerHL2.setMargin(false); headerHL2.setHeight("75px"); headerWrapper2.addComponent(headerHL2); headerWrapper2.setExpandRatio(headerHL2, 1.0f); cancelButt = makeCancelButton(); cancelButt.addClickListener(new MyCancelListener()); cancelButt.setClickShortcut(KeyCode.ESCAPE); headerWrapper2.addComponent(cancelButt); headerWrapper2.setComponentAlignment(cancelButt, Alignment.MIDDLE_CENTER); headerWrapper2.addComponent(sp = new Label()); sp.setWidth("15px"); contentVLayout = new VerticalLayout(); contentVLayout.addStyleName("m-dialog-content"); contentVLayout.setSizeUndefined(); contentVLayout.setWidth("592px"); // but do the width explicitly outerLayout.addComponent(contentVLayout); Image footer = new Image(null, Mmowgli2UI.getGlobals().mediaLocator().getDialogFooterBackground()); footer.setWidth("592px"); footer.setHeight("36px"); outerLayout.addComponent(footer); }
From source file:edu.nps.moves.mmowgli.components.VideoWithRightTextPanel.java
License:Open Source License
public void initGui() { addStyleName("m-calltoaction-novideo"); // m-calltoaction"); // puts up background setMargin(false);// ww w . j a v a 2s .com setSpacing(false); setWidth("988px"); Label lab; addComponent(lab = new Label()); lab.setHeight("41px"); HorizontalLayout horLay = new HorizontalLayout(); horLay.setSpacing(false); horLay.setMargin(false); horLay.setWidth("100%"); addComponent(horLay); horLay.addComponent(lab = new Label()); lab.setWidth("38px"); if (vidMedia != null && vidMedia.getUrl() != null && vidMedia.getUrl().trim().length() > 0) { if (vidMedia.getType() == MediaType.YOUTUBE) { try { Flash ytp = new Flash(); ytp.setSource(new ExternalResource("https://www.youtube.com/v/" + vidMedia.getUrl())); ytp.setParameter("allowFullScreen", "true"); ytp.setParameter("showRelated", "false"); ytp.setWidth(539.0f, Unit.PIXELS); //VID_W_PX,Unit.PIXELS); ytp.setHeight(342.0f, Unit.PIXELS); //VID_H_PX,Unit.PIXELS); player = ytp; } catch (Exception ex) { System.err.println("Exception instantiating YouTubePlayer: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } } else { System.err.println("Bad media file in VideoWithRightTextPanel"); player = new Label("missing video"); } VerticalLayout plyrLinkWrap = new VerticalLayout(); plyrLinkWrap.setMargin(false); plyrLinkWrap.setSpacing(true); plyrLinkWrap.setSizeUndefined(); VerticalLayout playerVL = new VerticalLayout(); //AbsoluteLayout(); playerVL.setWidth("539px"); playerVL.setHeight("342px"); playerVL.addStyleName("m-boxshadow-5"); playerVL.addComponent(player); plyrLinkWrap.addComponent(playerVL); Link link = getAlternateVideoLink(vidMedia); if (link != null) { plyrLinkWrap.addComponent(link); plyrLinkWrap.setComponentAlignment(link, Alignment.BOTTOM_CENTER); } horLay.addComponent(plyrLinkWrap); horLay.addComponent(lab = new Label()); lab.setWidth("22px"); } VerticalLayout rightColVLayout = new VerticalLayout(); horLay.addComponent(rightColVLayout); horLay.setExpandRatio(rightColVLayout, 1.0f); horLay.addComponent(lab = new Label()); lab.setWidth("35px"); rightColVLayout.setSpacing(true); if (headerImg != null) { // Image takes priority over text rightColVLayout.addComponent(headerImg); } else { headingLab = new HtmlLabel(heading); if (largerText) headingLab.addStyleName("m-orientation-heading"); else headingLab.addStyleName("m-calltoaction-thesituation-heading"); rightColVLayout.addComponent(headingLab); } summaryLab = new HtmlLabel(summary); if (largerText) summaryLab.addStyleName("m-orientation-summary"); else summaryLab.addStyleName("m-calltoaction-thesituation-summary"); rightColVLayout.addComponent(summaryLab); // text = text.replace("\n", "<br/><br/>"); // pure html with <p> tags seems to work well textLab = new HtmlLabel(text); if (largerText) textLab.addStyleName("m-orientation-text"); else textLab.addStyleName("m-calltoaction-thesituation-text"); rightColVLayout.addComponent(textLab); // Move 2, no room /* * if (promptImg != null) { // Image priority over text rightColVLayout.addComponent(promptImg); } else if (prompt != null){ promptLab = new Label(prompt); * promptLab.setContentMode(Label.CONTENT_XHTML); if(largerText) promptLab.addStyleName("m-orientation-prompt"); else * promptLab.addStyleName("m-calltoaction-thesituation-prompt"); rightColVLayout.addComponent(promptLab); } */ // spacer so background doesn't look cut-off addComponent(lab = new Label()); lab.setHeight("25px"); }
From source file:edu.nps.moves.mmowgli.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();// w w w .j a v a 2s . co 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.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 ww. j av a2 s. co m*/ 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.ActionPlanPage2.java
License:Open Source License
private Component makeIdField(ActionPlan ap) { HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(false); hl.setSpacing(false);//from w ww. j av a 2 s.c o m hl.setHeight("22px"); Label lab; hl.addComponent(lab = new Label()); lab.setWidth("270px"); hl.addComponent(lab = new Label("ID " + ap.getId())); hl.setComponentAlignment(lab, Alignment.BOTTOM_LEFT); maybeAddHiddenCheckBoxTL(hl, ap); return hl; }