List of usage examples for com.vaadin.ui VerticalLayout addStyleName
@Override public void addStyleName(String style)
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 a v a2 s .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.SubCardsGameDesignPanel.java
License:Open Source License
private Component renderFields(CardTypeFields fields, NativeSelect combo, String name) { VerticalLayout topPan = new VerticalLayout(); topPan.setWidth("98%"); topPan.addStyleName("m-greyborder3"); Label lab;// w w w . j a va 2 s. c om topPan.addComponent(lab = new Label()); lab.setHeight("18px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true); ; topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>")); lab.setSizeUndefined(); topHL.addComponent(combo); Button newTypeButt; topHL.addComponent(newTypeButt = new NativeButton("Define new type")); newTypeButt.addStyleName(Runo.BUTTON_SMALL); newTypeButt.setReadOnly(globs.readOnlyCheck(false)); newTypeButt.setEnabled(!newTypeButt.isReadOnly()); if (!newTypeButt.isReadOnly()) newTypeButt.addClickListener(new NewTypeListener(fields.typeOrdinal)); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topPan.addComponent(topHL); topHL.setWidth("100%"); topPan.addComponent(fields); fields.setWidth("100%"); return topPan; }
From source file:edu.nps.moves.mmowgli.modules.administration.TopCardsGameDesignPanel.java
License:Open Source License
private Component renderFields(CardTypeFields fields, NativeSelect combo, String name, Label editWarningLab) { VerticalLayout topPan = new VerticalLayout(); topPan.setWidth("98%"); topPan.addStyleName("m-greyborder3"); Label lab;/* w w w . j av a 2s . c om*/ topPan.addComponent(lab = new Label()); lab.setHeight("18px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true); ; topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>")); lab.setSizeUndefined(); topHL.addComponent(combo); Button newTypeButt; topHL.addComponent(newTypeButt = new NativeButton("Define new top-level type")); newTypeButt.addStyleName(Runo.BUTTON_SMALL); newTypeButt.setReadOnly(globals.readOnlyCheck(false)); newTypeButt.setEnabled(!newTypeButt.isReadOnly()); if (!newTypeButt.isReadOnly()) newTypeButt.addClickListener(new NewCardClassListener(fields.cardClass)); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topPan.addComponent(topHL); topHL.setWidth("100%"); addComponent(editWarningLab); topPan.addComponent(fields); fields.setWidth("100%"); return topPan; }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.SetBlogHeadlineWindow.java
License:Open Source License
@Override public void attach() { Panel p = new Panel(); setContent(p);/*from ww w. j av a2 s .c o m*/ p.setSizeFull(); VerticalLayout layout = new VerticalLayout(); layout.addStyleName("m-blogheadline"); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); p.setContent(layout); layout.addComponent(infoLab = new Label( "Game masters can communicate with players throughout the game. Add a new headling, tooltip and link here.")); layout.addComponent(textLab = new Label("Enter headline:")); textTF = new TextField(); textTF.setInputPrompt("Enter new headline or choose from previous ones below"); textTF.setWidth("100%"); textTF.addStyleName("m-blogtextfield"); layout.addComponent(textTF); layout.addComponent(toolTipLab = new Label("Enter headline tooltip:")); toolTipTF = new TextField(); toolTipTF.setWidth("100%"); layout.addComponent(toolTipTF); layout.addComponent(urlLab = new Label("Enter blog entry url:")); urlTF = new TextField(); urlTF.setWidth("100%"); layout.addComponent(urlTF); table = new Table("Previous headlines"); table.setSizeFull(); table.setImmediate(true); table.setColumnExpandRatio("date", 1); table.setColumnExpandRatio("text", 1); table.setColumnExpandRatio("tooltip", 1); table.setColumnExpandRatio("url", 1); table.setSelectable(true); table.setMultiSelect(true); // return whole pojo table.addItemClickListener(this); table.setContainerDataSource(MessageUrl.getContainer()); layout.addComponent(table); layout.addComponent(nullCheckBox); nullCheckBox.addValueChangeListener(new CBListener()); HorizontalLayout buttHl = new HorizontalLayout(); buttHl.setSpacing(true); buttHl.addComponent(cancelButt); buttHl.addComponent(okButt); layout.addComponent(buttHl); layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT); layout.setExpandRatio(table, 1.0f); // gets all setWidth("675px"); setHeight("455px"); }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.UserAdminPanel.java
License:Open Source License
public void initGuiTL() { setWidth(APPLICATION_SCREEN_WIDTH);/*from w w w. j a v a 2 s . c o m*/ setHeight("100%"); setSpacing(false); HorizontalLayout titleHL = new HorizontalLayout(); addComponent(titleHL); Label lab; titleHL.addComponent(lab = new Label()); lab.setWidth("20px"); VerticalLayout tableVLayout = new VerticalLayout(); tableContainer = tableVLayout; tableVLayout.setWidth(APPLICATION_SCREEN_WIDTH); tableVLayout.setHeight("900px"); tableVLayout.setSpacing(true); tableVLayout.addStyleName("m-whitepage-header"); addComponent(tableVLayout); tableVLayout.addComponent(lab = new Label()); lab.setHeight("20px"); tableVLayout.addComponent( lab = new HtmlLabel("<span style='margin-left:40px;color:red;'>" + WARNING_LABEL + "</span>")); lab.addStyleName("m-text-align-center"); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberUsersLabelTL() + "</span>")); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberOnlineLabel() + "</span>")); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberGameMastersTL() + "</span>")); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberCardsLabelTL() + "</span>")); tableVLayout .addComponent(new HtmlLabel("<span style='margin-left:40px;'>Double click a row to edit</span>")); tableVLayout.addComponent(lab = new HtmlLabel( "<center><b><span style='font-size:175%'>Player Administration</span></b></center>")); HorizontalLayout srchHL = buildSearchRow(); tableVLayout.addComponent(srchHL); tableVLayout.setComponentAlignment(srchHL, Alignment.MIDDLE_CENTER); table = createTable(lastTableFiller = new SimpleTableFiller()); table.setCaption(null); addTableToLayout(Mmowgli2UI.getGlobals().getUserID()); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java
License:Open Source License
@SuppressWarnings("serial") @HibernateUserRead/*w w w.jav a2 s. c o m*/ public void checkUserLimitsTL() { Serializable uid = Mmowgli2UI.getGlobals().getUserID(); if (uid != NO_LOGGEDIN_USER_ID) { // can't do this check if we don't have a user yet MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.checkUserLimitsTL()"); User u = User.getTL(uid); if (u != null) // why should it be? if (u.getUserName() != null) // why should it be? if (u.isGameMaster())//getUserName().toLowerCase().startsWith("gm_")) return; } int maxIn = Game.getTL().getMaxUsersOnline(); // List<User> lis = (List<User>)HibernateContainers.getSession().createCriteria(User.class).add(Restrictions.eq("online", true)).list(); // if(lis.size()>=maxIn) { if (Mmowgli2UI.getGlobals().getSessionCount() >= maxIn) { // new improved lockedOut = true; VerticalLayout vl = new VerticalLayout(); vl.setWidth("325px"); vl.addStyleName("m-errorNotificationEquivalent"); vl.setSpacing(false); vl.setMargin(true); Label lab = new Label("We're loaded to the max with players right now."); lab.setSizeUndefined(); vl.addComponent(lab); lab = new Label("Idle players are timed-out after 15 minutes."); lab.setSizeUndefined(); vl.addComponent(lab); lab = new Label("Please try again later."); lab.setSizeUndefined(); vl.addComponent(lab); Window win = new Window("Sorry, but...."); win.setSizeUndefined(); win.addStyleName("m-transparent"); win.setWidth("308px"); win.setResizable(false); win.setContent(vl); openPopupWindowInMainWindow(win, 400); win.setModal(false); win.addCloseListener(new CloseListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void windowClose(CloseEvent e) { HSess.init(); Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getGameFullLink()); HSess.close(); } }); } }
From source file:edu.nps.moves.mmowgli.modules.userprofile.EditAwardTypeDialog.java
License:Open Source License
@SuppressWarnings("serial") private EditAwardTypeDialog(AwardType awt, EditAwardResultListener lis) { Object sessKey = HSess.checkInit(); listener = lis;//from www . j ava 2 s . c o m awardType = awt; setCaption("Edit Award Type"); setModal(true); setWidth("450px"); VerticalLayout vLay = new VerticalLayout(); setContent(vLay); vLay.setMargin(true); vLay.setSpacing(true); vLay.addStyleName("m-greybackground"); FormLayout formLay; vLay.addComponent(formLay = new FormLayout()); formLay.setSizeFull(); formLay.addComponent( nameTF = new MTextField("Award Title").withFullWidth().withNullRepresentation("required field")); nameTF.setRequired(true); nameTF.setRequiredError("Required field"); nameTF.setSizeFull(); formLay.addComponent( descTF = new MTextField("Description").withFullWidth().withNullRepresentation("required field")); descTF.setRequired(true); descTF.setRequiredError("Required field"); Label sp; formLay.addComponent(hLay55 = new HorizontalLayout()); hLay55.setWidth("100%"); hLay55.setCaption("55x55 pixel icon"); hLay55.setSpacing(true); hLay55.addComponent(lab55 = new HtmlLabel("<i>image name</i>")); hLay55.setComponentAlignment(lab55, Alignment.MIDDLE_CENTER); hLay55.addComponent(butt55 = new NativeButton("Choose 55x55 image")); hLay55.setComponentAlignment(butt55, Alignment.MIDDLE_CENTER); hLay55.addComponent(sp = new Label()); hLay55.setExpandRatio(sp, 1.0f); hLay55.addComponent(image55 = new Image(null)); image55.setWidth("55px"); image55.setHeight("55px"); image55.addStyleName("m-greyborder3"); formLay.addComponent(hLay300 = new HorizontalLayout()); hLay300.setWidth("100%"); hLay300.setCaption("300x300 pixel icon"); hLay300.setSpacing(true); hLay300.addComponent(lab300 = new HtmlLabel("<i>image name</i>")); hLay300.setComponentAlignment(lab300, Alignment.MIDDLE_CENTER); hLay300.addComponent(butt300 = new NativeButton("Choose 300x300 image")); hLay300.setComponentAlignment(butt300, Alignment.MIDDLE_CENTER); hLay300.addComponent(sp = new Label()); hLay300.setExpandRatio(sp, 1.0f); hLay300.addComponent(image300 = new Image(null)); image300.setWidth("55px"); image300.setHeight("55px"); image300.addStyleName("m-greyborder3"); ClickListener chooseIconListener = new ClickListener() { boolean is55 = false; @Override public void buttonClick(ClickEvent event) { is55 = (event.getButton() == butt55); String txt = (is55 ? pix55text : pix300text); InstallImageResultListener lis = new InstallImageResultListener() { @Override public void doneTL(MediaImage mimg) { Media m = null; if (mimg != null) m = mimg.media; if (m != null) { MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator(); String handle = m.getHandle(); if (handle != null && handle.trim().length() <= 0) handle = null; if (is55) { media55 = m; if (handle == null) { m.setHandle("55x55"); Media.updateTL(m); } lab55.setValue(m.getUrl()); image55.setSource(mediaLoc.locate(m)); } else { media300 = m; if (handle == null) { m.setHandle("300x300"); Media.updateTL(m); } lab300.setValue(m.getUrl()); image300.setSource(mediaLoc.locate(m)); } } } }; InstallImageDialog.show(txt, lis, is55 ? pix55filter : pix300filter); } }; butt55.addClickListener(chooseIconListener); butt300.addClickListener(chooseIconListener); HorizontalLayout buttHL = new HorizontalLayout(); vLay.addComponent(buttHL); buttHL.setWidth("100%"); buttHL.addComponent(sp = new Label()); sp.setWidth("1px"); buttHL.setExpandRatio(sp, 1.0f); buttHL.addComponent(new NativeButton("Cancel", new ClickListener() { @Override public void buttonClick(ClickEvent event) { awardType = null; doneHereTL(); } })); buttHL.addComponent(new NativeButton("Close", new ClickListener() { @Override public void buttonClick(ClickEvent event) { String title = nameTF.getValue().trim(); String description = descTF.getValue().trim(); if (title.length() <= 0 || description.length() <= 0 || media300 == null || media55 == null) { Notification.show("All fields must be completed", Notification.Type.ERROR_MESSAGE); return; } HSess.init(); boolean save = false; if (awardType == null) { awardType = new AwardType(); save = true; } awardType.setName(nameTF.getValue().trim()); awardType.setDescription(descTF.getValue().trim()); awardType.setIcon300x300(media300); awardType.setIcon55x55(media55); if (save) HSess.get().save(awardType); else HSess.get().update(awardType); doneHereTL(); HSess.close(); } })); HSess.checkClose(sessKey); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.InstallImageDialog.java
License:Open Source License
@SuppressWarnings("serial") private InstallImageDialog(String topText, InstallImageResultListener lis, boolean showExisting, String nameFilter) {/*from w w w . j a va 2 s . c om*/ Object sessKey = HSess.checkInit(); listener = lis; setCaption(showExisting ? "Choose Existing or Upload New Image" : "Upload New Image"); setModal(true); setWidth("350px"); VerticalLayout vl; VerticalLayout vLay = new VerticalLayout(); setContent(vLay); vLay.setMargin(true); vLay.setSpacing(true); if (topText != null && topText.length() > 0) { HtmlLabel lab = new HtmlLabel(topText); lab.setWidth("100%"); vLay.addComponent(lab); } if (showExisting) { // put the existing selector in the dialog Criteria crit = HSess.get().createCriteria(Media.class) .add(Restrictions.eq("source", Media.Source.DATABASE)).addOrder(Order.asc("url")); if (nameFilter != null) crit.add(Restrictions.like("handle", nameFilter, MatchMode.ANYWHERE)); @SuppressWarnings({ "unchecked" }) List<Media> mlis = crit.list(); BeanItemContainer<Media> beanContainer = new BeanItemContainer<Media>(Media.class, mlis); vLay.addComponent(existingCB = new CheckBox("Choose from existing images", true)); vLay.addComponent(vl = new VerticalLayout()); vl.addStyleName("m-greyborder"); vl.addStyleName("m-greybackground"); vl.setMargin(true); vl.setSpacing(true); vl.addComponent(sel = new ListSelect()); sel.setWidth("100%"); sel.setNullSelectionAllowed(false); sel.setContainerDataSource(beanContainer); sel.setItemCaptionPropertyId("url"); vl.addComponent(saveExistingButt = new NativeButton("Return selected image", new ClickListener() { @Override public void buttonClick(ClickEvent event) { HSess.init(); mediaImage = new MediaImage((Media) sel.getValue(), null); doneHereTL(); HSess.close(); } })); vLay.addComponent(newCB = new CheckBox("Upload new image", false)); } // Here for the file chooser vLay.addComponent(vl = new VerticalLayout()); vl.addStyleName("m-greyborder"); vl.addStyleName("m-greybackground"); vl.setSpacing(true); vl.setMargin(true); ImgReceiver rec; uploadFileWidget = new Upload();// "Image name", rec = new ImgReceiver()); uploadFileWidget.setReceiver(rec = new ImgReceiver()); uploadFileWidget.setButtonCaption("Browse"); uploadFileWidget.setImmediate(true); uploadFileWidget.addFailedListener(rec); uploadFileWidget.addFinishedListener(rec); uploadFileWidget.setEnabled(showExisting ? false : true); vl.addComponent(uploadFileWidget); vl.addComponent(fileNameTF = new TextField()); fileNameTF.setWidth("100%"); fileNameTF.setEnabled(showExisting ? false : true); fileNameTFState = false; HorizontalLayout hLay; vl.addComponent(hLay = new HorizontalLayout()); hLay.setSpacing(true); hLay.addComponent(saveImageButt = new NativeButton("Save image with above name", rec)); // hLay.addComponent(savedLab = new HtmlLabel("<i>saved</i>")); saveImageButt.setImmediate(true); saveImageButt.addClickListener(rec); saveImageButt.setEnabled(false); saveImageButtState = false; vLay.addComponent(new NativeButton("Close", new ClickListener() { @Override public void buttonClick(ClickEvent event) { HSess.init(); doneHereTL(); HSess.close(); } })); if (showExisting) { existingCB.addValueChangeListener(new CheckBoxListener(existingCB)); newCB.addValueChangeListener(new CheckBoxListener(newCB)); } HSess.checkClose(sessKey); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
@SuppressWarnings("unchecked") private Component createProfileTL() { VerticalLayout lay = new VerticalLayout(); lay.setWidth("670px"); Label lab;// w ww . j a v a 2 s .com lay.addComponent(lab = new Label()); lab.setHeight("10px"); VerticalLayout innerVL = new VerticalLayout(); innerVL.setSpacing(true); innerVL.setMargin(true); innerVL.setWidth("100%"); //"90%"); innerVL.addStyleName("m-myideaprofile-table"); lay.addComponent(innerVL); GridLayout gridL = new GridLayout(); gridL.setColumns(2); gridL.addStyleName("m-userprofile-text"); gridL.setSpacing(true); CardType ct; int count = 0; int largest = -1; List<Card> lisPos = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType .getCurrentPositiveIdeaCardTypeTL()/*CardTypeManager.getPositiveIdeaCardTypeTL()*/)) .list(); count += lisPos.size(); largest = Math.max(largest, lisPos.size()); List<Card> lisNeg = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType.getCurrentNegativeIdeaCardTypeTL())).list(); //CardTypeManager.getNegativeIdeaCardTypeTL())).list(); count += lisNeg.size(); largest = Math.max(largest, lisNeg.size()); List<Card> lisExpand = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExpandTypeTL())) .list();//CardTypeManager.getExpandTypeTL())).list(); count += lisExpand.size(); largest = Math.max(largest, lisExpand.size()); List<Card> lisAdapt = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getAdaptTypeTL())) .list();//CardTypeManager.getAdaptTypeTL())).list(); count += lisAdapt.size(); largest = Math.max(largest, lisAdapt.size()); List<Card> lisCounter = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getCounterTypeTL())) .list();//CardTypeManager.getCounterTypeTL())).list(); count += lisCounter.size(); largest = Math.max(largest, lisCounter.size()); List<Card> lisExplore = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExploreTypeTL())) .list();//CardTypeManager.getExploreTypeTL())).list(); count += lisExplore.size(); largest = Math.max(largest, lisExplore.size()); ct = CardType.getCurrentPositiveIdeaCardTypeTL(); //CardTypeManager.getPositiveIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisPos.size(), ct, gridL); ct = CardType.getCurrentNegativeIdeaCardTypeTL(); //CardTypeManager.getNegativeIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisNeg.size(), ct, gridL); ct = CardType.getExpandTypeTL(); //CardTypeManager.getExpandTypeTL(); row(ct.getSummaryHeader(), largest, lisExpand.size(), ct, gridL); ct = CardType.getAdaptTypeTL(); //CardTypeManager.getAdaptTypeTL(); row(ct.getSummaryHeader(), largest, lisAdapt.size(), ct, gridL); ct = CardType.getCounterTypeTL(); //CardTypeManager.getCounterTypeTL(); row(ct.getSummaryHeader(), largest, lisCounter.size(), ct, gridL); ct = CardType.getExploreTypeTL(); //CardTypeManager.getExploreTypeTL(); row(ct.getSummaryHeader(), largest, lisExplore.size(), ct, gridL); gridL.addComponent(new Label("")); gridL.addComponent(new Label("")); gridL.addComponent(new Label("TOTAL")); gridL.addComponent(new Label("" + count)); innerVL.addComponent(gridL); lay.addComponent(lab = new Label()); lab.setHeight("1px"); lay.setExpandRatio(lab, 1.0f); return lay; }
From source file:edu.nps.moves.mmowgliMobile.ui.CardRenderer2.java
License:Open Source License
public void setMessage(FullEntryView2 mView, ListEntry message, ListView2 messageList, AbstractOrderedLayout layout) {// www. j a v a 2 s. c o m Object key = HSess.checkInit(); CardListEntry wc = (CardListEntry) message; Card c = wc.getCard(); CardType typ = c.getCardType(); layout.removeAllComponents(); layout.setSpacing(true); VerticalLayout cardLay = new VerticalLayout(); cardLay.addStyleName("m-card-render"); cardLay.setWidth("98%"); //100%"); cardLay.setSpacing(true); layout.addComponent(cardLay); HorizontalLayout horl = new HorizontalLayout(); horl.addStyleName("m-card-header"); String stl = CardStyler.getCardBaseStyle(typ); horl.addStyleName(stl); horl.addStyleName(CardStyler.getCardTextColorOverBaseStyle(typ)); horl.setMargin(true); horl.setWidth("100%"); Label lbl = new Label(typ.getTitle());//c.getText()); horl.addComponent(lbl); lbl = new Label("" + getPojoId(message)); lbl.addStyleName("m-text-align-right"); horl.addComponent(lbl); cardLay.addComponent(horl); horl = new HorizontalLayout(); horl.setWidth("100%"); horl.setMargin(true); cardLay.addComponent(horl); lbl = new Label(c.getText()); horl.addComponent(lbl); horl = new HorizontalLayout(); horl.addStyleName("m-card-footer"); horl.setMargin(true); horl.setWidth("100%"); horl.addComponent(lbl = new Label("")); lbl.setWidth("5px"); Image img = new Image(); img.setSource(mediaLocator.locate(c.getAuthor().getAvatar().getMedia())); img.setWidth("30px"); img.setHeight("30px"); horl.addComponent(img); // horl.addComponent(lbl=new Label(c.getAuthorName())); // lbl.setWidth("100%"); // lbl.addStyleName("m-text-align-center"); // horl.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER); // horl.setExpandRatio(lbl, 1.0f); Button authButt = new MyButton(c.getAuthorName(), c, mView); authButt.setStyleName(BaseTheme.BUTTON_LINK); authButt.setWidth("100%"); horl.addComponent(authButt); horl.setComponentAlignment(authButt, Alignment.MIDDLE_CENTER); horl.setExpandRatio(authButt, 1.0f); horl.addComponent(lbl = new HtmlLabel(formatter.format(message.getTimestamp()))); lbl.setWidth("115px"); ; lbl.addStyleName("m-text-align-right"); horl.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER); cardLay.addComponent(horl); // lbl = new Hr(); // layout.addComponent(lbl); lbl = new Label("Child Cards"); layout.addComponent(lbl); lbl.addStyleName("m-text-center"); // lbl = new Hr(); // layout.addComponent(lbl); horl = new HorizontalLayout(); horl.setSpacing(true); horl.setMargin(true); horl.setWidth("100%"); layout.addComponent(horl); horl.addComponent( makeChildGroupButton("Expand", (CardListEntry) message, CardType.getExpandTypeTL(), messageList)); horl.addComponent( makeChildGroupButton("Counter", (CardListEntry) message, CardType.getCounterTypeTL(), messageList)); horl.addComponent( makeChildGroupButton("Adapt", (CardListEntry) message, CardType.getAdaptTypeTL(), messageList)); horl.addComponent( makeChildGroupButton("Explore", (CardListEntry) message, CardType.getExploreTypeTL(), messageList)); HSess.checkClose(key); }