List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
From source file:edu.nps.moves.mmowgli.components.CardSummaryListHeader.java
License:Open Source License
@SuppressWarnings("serial") @Override/*w ww. j a v a 2 s . co m*/ public void initGui() { addStyleName("m-cursor-pointer"); if (bckgrndResource != null) { Embedded bkgnd = new Embedded(null, bckgrndResource); addComponent(bkgnd, "top:0px;left:0px"); } final MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); ct = CardType.getTL(ctId); String textColorStyle = CardStyler.getCardTextColorOverBaseStyle(ct); // nested abslay for the click handler AbsoluteLayout topHalfLay = new AbsoluteLayout(); topHalfLay.setWidth(CARDLISTHEADER_W); topHalfLay.setHeight(HEIGHT_NODRAWER); addComponent(topHalfLay, "top:0px;left:0px"); title.setValue(ct.getTitle()); // .toUpperCase()); title.setHeight(CARDLISTHEADER_TITLE_H); title.setWidth(CARDLISTHEADER_TITLE_W); title.addStyleName("m-cardsummarylist-header-title"); title.addStyleName("m-cursor-pointer"); title.addStyleName("m-vagabond-font"); if (textColorStyle != null) title.addStyleName(textColorStyle); topHalfLay.addComponent(title, CARDLISTHEADER_TITLE_POS); content.setValue(ct.getPrompt()); content.setHeight(CARDLISTHEADER_CONTENT_H); content.setWidth(CARDLISTHEADER_CONTENT_W); content.addStyleName("m-cardsummarylist-header-content"); content.addStyleName("m-cursor-pointer"); if (textColorStyle != null) content.addStyleName(textColorStyle); // cause exception w/ 2 windows? content.setId(CardDebug.getCardCreateClickDebugId(ct)); topHalfLay.addComponent(content, CARDLISTHEADER_CONTENT_POS); boolean cantCreateBecauseHiddenParent = checkNoCreateBecauseHiddenTL(parent); boolean cantCreateBecauseParentMarkedNoChild = false; //todo enable with gameswitch checkNoCreateBecauseParentMarkedNoChild(parent); if (globs.canCreateCard(ct.isIdeaCard())) { markedAsNoCreate = false; if (!cantCreateBecauseHiddenParent && !cantCreateBecauseParentMarkedNoChild) { //Add the text at the bottom Label lab; topHalfLay.addComponent(lab = new Label("click to add new"), "top:130px;left:75px"); lab.addStyleName("m-click-to-add-new"); if (textColorStyle != null) lab.addStyleName(textColorStyle); } } else markedAsNoCreate = true; drawerComponent = new BuilderDrawer(); addComponent(drawerComponent, CARDLISTHEADER_DRAWER_POS); drawerComponent.setVisible(false); setWidth(CARDLISTHEADER_W); setHeight(HEIGHT_NODRAWER); if (!mockupOnly) topHalfLay.addLayoutClickListener(new LayoutClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void layoutClick(LayoutClickEvent event) { HSess.init(); if (checkNoCreateBecauseHiddenTL(parent)) { //todo enable with game switch || checkNoCreateBecauseParentMarkedNoChild(parent)) { if (drawerComponent.isVisible()) closeDrawer(); HSess.close(); return; } if (drawerComponent.isVisible()) closeDrawer(); else { CardPermission cp = globs.cardPermissionsCommon(ct.isIdeaCard()); if (!cp.canCreate) { if (!markedAsNoCreate) handleNoCreate(); Notification.show(cp.whyNot); } else { showDrawer(); handleCanCreate(); // reset tt, etc. if (newCardListener != null) newCardListener.drawerOpenedTL(ctId); } } HSess.close(); } }); if (cantCreateBecauseHiddenParent) handleNoCreate("Can't add card to hidden parent"); else if (cantCreateBecauseParentMarkedNoChild) handleNoCreate("New child cards cannot be added to this card"); else if (!globs.canCreateCard(ct.isIdeaCard())) handleNoCreate(); else setTooltip("Click to add card"); }
From source file:edu.nps.moves.mmowgli.components.CardTable.java
License:Open Source License
private Component buildAuthorNameColumn(String name) { Label lab = new Label(name); lab.addStyleName("m-cursor-pointer"); lab.addStyleName("m-bluetext-on-hover"); return lab;//from w ww. j a v a 2 s . c o m }
From source file:edu.nps.moves.mmowgli.components.Footer.java
License:Open Source License
@Override public void initGui() { setWidth(FOOTER_W);//from w w w. ja v a 2s.c o m setHeight("130px"); //room for fouo butt//FOOTER_H); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(FOOTER_W); mainAbsLay.setHeight(FOOTER_H); addComponent(mainAbsLay, FOOTER_OFFSET_POS); MediaLocator medLoc = ((Mmowgli2UI) UI.getCurrent()).getMediaLocator(); Embedded back = new Embedded(null, medLoc.getFooterBackground()); mainAbsLay.addComponent(back, "top:0px;left:0px"); HorizontalLayout outerHorLay = new HorizontalLayout(); addComponent(outerHorLay, "top:45px;left:0px"); outerHorLay.setWidth(FOOTER_W); HorizontalLayout innerHorLay = new HorizontalLayout(); innerHorLay.setSpacing(true); outerHorLay.addComponent(innerHorLay); outerHorLay.setComponentAlignment(innerHorLay, Alignment.MIDDLE_CENTER); Label sp; innerHorLay.addComponent(aboutButt); innerHorLay.addComponent(pingPushLab = new HtmlLabel()); pingPushLab.setWidth("7px"); innerHorLay.addComponent(creditsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(faqsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(fixesButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(glossaryButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(reportsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(termsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(troubleButt); troubleButt.addStyleName("m-red-text"); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(twitterButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(videosButt); GameLinks gl = GameLinks.getTL(); if (gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech")) { ; // This is a hack, but I don't want to pollute the db with a bogus boolean...this is a special case just for these folks. } else { HorizontalLayout hl = new HorizontalLayout(); Label lab = null; hl.addComponent(lab = new HtmlLabel("Build " + MMOWGLI_BUILD_ID)); lab.addStyleName("m-footer-servername"); //small text lab.setDescription(Mmowgli2UI.getGlobals().getVaadinSessionCookie()); hl.addComponent(lab = new HtmlLabel(" Vaadin " + VAADIN_BUILD_VERSION)); lab.addStyleName("m-footer-servername"); //small text hl.addComponent(lab = new HtmlLabel(" " + AppMaster.instance().getServerName())); lab.addStyleName("m-footer-servername"); //small text hl.setSizeUndefined(); mainAbsLay.addComponent(hl, "bottom:3px;right:15px;"); } fouoLink = Footer.buildFouoNoticeTL(); addComponent(fouoLink, "top:92px;left:365px"); fouoLink.setVisible(Game.getTL().isShowFouo()); }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
private Label makeScoreLabel(String style, String width, String height) { Label lab = new Label(); lab.setWidth(width);//from w ww . j a v a 2 s . c o m lab.setHeight(height); lab.addStyleName(style); return lab; }
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);/*w ww . j a v a 2 s . c o 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.UserTable.java
License:Open Source License
private Component handleFloatScore(Float f) { Label lab = new Label("" + f.floatValue()); lab.addStyleName("m-userTableText"); lab.addStyleName("m-text-align-right"); return lab;/*from w ww.ja va 2 s. c o m*/ }
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 . ja v a 2 s . c o 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.modules.actionplans.ActionDashboardTabActionPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.addStyleName("m-padding15"); flowLay.setSpacing(true);/*ww w .j av a2 s. c o m*/ Label titleLab = new Label("All Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("The Action Plans tab displays a list of all action plans in the game."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt.setDescription("Open a page where you can submit a request to create an action plan"); flowLay.addComponent(requestActionPlanButt); AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-headling { blah:blah;} ) loadTableTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabMyPlans.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);// w w w . ja v a2 s . c o m Label titleLab = new Label("My Plans"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("Choose a link below to display the filtered list of your choice."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Label lab; flowLay.addComponent(lab = new Label()); lab.setHeight("25px"); Button myPlansButt = new Button("My Plans"); //myPlansButt.setStyleName(BaseTheme.BUTTON_LINK); //flowLay.addComponent(myPlansButt); Button requestActionPlanButt = new IDButton("Request Action Plan Authorship", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); // Note for the above button request flowLay.addComponent(new Label("(appears in another browser tab)")); ClickListener firstLis; myPlansButt.addClickListener(firstLis = new ButtListener2(buildMyPlansFilter(), null)); // @HibernateUserRead AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-heading { blah:blah;} ) firstLis.buttonClick(null); // loads the table }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabNeedAuthors.java
License:Open Source License
public void initGuiTL() { AbstractLayout leftLay = getLeftLayout(); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); flowLay.addStyleName("m-padding15"); leftLay.addComponent(flowLay); //, "top:0px;left:0px"); flowLay.setSpacing(true);/*from w w w . j a v a 2 s . c om*/ Label titleLab = new Label("Action Plans needing Authors"); flowLay.addComponent(titleLab); flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT); titleLab.addStyleName("m-actionplan-mission-title-text"); Label contentLab = new Label("You may sign up for authorship in any of these plans."); flowLay.addComponent(contentLab); flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK); requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK); requestActionPlanButt .setDescription("Open a page where you can submit a request to be an action plan author"); flowLay.addComponent(requestActionPlanButt); AbsoluteLayout rightLay = getRightLayout(); flowLay = new VerticalLayout(); rightLay.addComponent(flowLay, "top:0px;left:0px"); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside // .m-actionplan-plan-headling { blah:blah;} ) loadTableTL(); }