Example usage for com.vaadin.ui Label addStyleName

List of usage examples for com.vaadin.ui Label addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Label addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

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);//from w w  w. j  a v a2 s . c  o  m
    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.AbstractGameBuilderPanel.java

License:Open Source License

protected void addSeparator(GridLayout grid, int row) {
    Label lab;
    grid.addComponent(lab = new Label(), 0, row, 2, row);
    lab.setHeight("5px");
    lab.addStyleName("m-greybackground");
}

From source file:edu.nps.moves.mmowgli.modules.administration.AbstractGameBuilderPanel.java

License:Open Source License

@Override
public void initGui() {
    String title = getTitle();//from   w ww .  j  a  va  2s  . c o m
    if (title != null) {
        Label titleLab;
        addComponent(titleLab = new Label(title));
        titleLab.addStyleName("m-centeralign");
    }
    Embedded e = this.getImage();
    if (e != null) {
        e.setWidth("800px"); // "930px");
        e.setHeight("400px"); // "465px");
        e.addStyleName("m-greyborder3");
        addComponent(e);
        setComponentAlignment(e, Alignment.MIDDLE_CENTER);
    }

    if (lines.size() > 0) {
        grid.setColumns(3);
        String heading = getHeading();
        Component footer = getFooter();
        int nRows = lines.size() + (heading != null ? 1 : 0) + (footer != null ? 1 : 0);
        grid.setRows(nRows);
        int rowOffst = 0;

        if (heading != null) {
            grid.addComponent(makeLabel(heading), 0, 0, 2, 0);
            rowOffst = 1;
        }
        for (int r = 0; r < lines.size(); r++) {
            EditLine edLine = lines.get(r);
            if (edLine.ta != null)
                edLine.ta.setDescription(edLine.tooltip);

            if (edLine.isSeparator()) {
                addSeparator(grid, r + rowOffst);
                continue;
            }
            if (edLine.justComponent()) {
                addLineComponent(grid, r + rowOffst, edLine.ta);
                continue;
            }
            Label textLab = new HtmlLabel(edLine.name);
            textLab.setDescription(edLine.tooltip);
            textLab.addStyleName("m-font-bold14");
            textLab.setWidth(getColumn1WidthString());
            grid.addComponent(textLab, 0, r + rowOffst); // c0,r0,c1,r1

            Label fieldLab = new Label(edLine.info);
            fieldLab.setDescription(edLine.tooltip);
            fieldLab.addStyleName("m-italic");
            fieldLab.setWidth(getColumn2WidthString());
            grid.addComponent(fieldLab, 1, r + rowOffst);

            if (edLine.ta instanceof TextArea) {
                TextArea ta = (TextArea) edLine.ta;
                ta.setDescription(edLine.tooltip);
                ta.setImmediate(true);
                ta.setWidth("100%");

                if (edLine.fieldName != null && autoSave)
                    ta.addValueChangeListener(new IndivListener(edLine, updatesOK,
                            edLine.fieldClass == null ? String.class : edLine.fieldClass));
                grid.addComponent(ta, 2, r + rowOffst);
            } else if (edLine.ta instanceof CheckBox) {
                CheckBox cb = (CheckBox) edLine.ta;
                cb.setDescription(edLine.tooltip);
                cb.setImmediate(true);

                if (edLine.fieldName != null && autoSave)
                    cb.addValueChangeListener(new IndivListener(edLine, updatesOK, boolean.class));
                grid.addComponent(cb, 2, r + rowOffst);
            } else if (edLine.ta instanceof Component) {
                grid.addComponent(edLine.ta, 2, r + rowOffst);
            }
        }
        if (footer != null) {
            int frow = lines.size() + rowOffst;
            grid.addComponent(footer, 0, frow, 2, frow);
        }
        grid.setWidth("99%");
        grid.setHeight("100%");

        addComponent(grid);
        grid.setColumnExpandRatio(2, 1.0f);

        if (showTestButton) {
            Button testButt = new Button(getTextButtonText(), new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                @MmowgliCodeEntry
                @HibernateOpened
                @HibernateClosed
                public void buttonClick(ClickEvent event) {
                    HSess.init();
                    testButtonClickedTL(event);
                    HSess.close();
                }
            });
            addComponent(testButt);
            setComponentAlignment(testButt, Alignment.MIDDLE_CENTER);
        }
    }
}

From source file:edu.nps.moves.mmowgli.modules.administration.AbstractGameBuilderPanel.java

License:Open Source License

private Label makeLabel(String s) {
    Label lab = new Label(s);
    lab.addStyleName("m-centeralign");
    return lab;//from ww  w  .  java 2s  .  c o m
}

From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java

License:Open Source License

@SuppressWarnings("serial")

@HibernateOpened/*from   www.ja v  a 2 s . com*/
@HibernateRead
@HibernateClosed
public void initGuiTL() {
    VerticalLayout outerVl = this;
    outerVl.setWidth("100%");
    outerVl.setSpacing(true);

    cardMarkingPanel = makeCardMarkingPanelTL();
    Card c = Card.getTL(cardId);
    MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
    User me = globs.getUserTL();

    if (c.isHidden() && !me.isAdministrator() && !me.isGameMaster()) {
        // This case should only come into play when a non-gm user is showing this page
        // by explicitly using the url.  Not too frequent an occurance.
        Label lab = new Label("This card is not active");
        lab.addStyleName("m-cardlarge-hidden-label");
        outerVl.setHeight("300px");
        outerVl.addComponent(lab);
        outerVl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);
        return;
    }
    loadMarkingPanel_oobTL(c);
    // won't have Roles lazily update w/out above loadMarkingPanel_oob(DBGet.getCard(cardId));

    markingRadioGroup.addValueChangeListener(markingListener = new MarkingChangeListener());

    // Top part
    topHL = new HorizontalLayout();
    addComponent(topHL);
    topHL.setWidth("95%");
    setComponentAlignment(topHL, Alignment.TOP_CENTER);

    // Card columns
    listsHL = new HorizontalLayout();
    addComponent(listsHL);
    listsHL.setSpacing(true);
    setComponentAlignment(listsHL, Alignment.TOP_CENTER);

    addChildListsTL();

    chainButt.addClickListener(new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            HSess.init();
            AppEvent evt = new AppEvent(CARDCHAINPOPUPCLICK, CardChainPage.this, cardId);
            Mmowgli2UI.getGlobals().getController().miscEventTL(evt);
            HSess.close();
            return;
        }
    });
}

From source file:edu.nps.moves.mmowgli.modules.cards.CardSummaryLine.java

License:Open Source License

@Override
public void initGui() {
    Card c = Card.getTL(cardId);//w ww  .  j ava2s . co  m
    String tooltip = c.getText();

    User auth = c.getAuthor();

    Label lab = new Label(dateForm.format(c.getCreationDate()));
    lab.setWidth(6.0f, Unit.EM);
    addComponent(lab);
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    addComponent(lab = new Label(c.getCardType().getTitle()));
    lab.setWidth(5.0f, Unit.EM);
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    Embedded emb = new Embedded(null, mLoc.getCardDot(c.getCardType()));
    emb.setWidth("19px");
    emb.setHeight("15px");
    addComponent(emb);
    setComponentAlignment(emb, Alignment.MIDDLE_LEFT);
    emb.addStyleName("m-cursor-pointer");
    emb.setDescription(tooltip);

    addComponent(lab = new Label(c.getText()));
    lab.setHeight(1.0f, Unit.EM);
    ;
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    setExpandRatio(lab, 1.0f); // all the extra
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    if (auth.getAvatar() != null) {
        avatar = new Embedded(null, mLoc.locate(auth.getAvatar().getMedia(), 32));
        avatar.setWidth("24px");
        avatar.setHeight("24px");
        addComponent(avatar);
        setComponentAlignment(avatar, Alignment.MIDDLE_LEFT);
        avatar.addStyleName("m-cursor-pointer");
        avatar.setDescription(tooltip);
    }
    IDButton uButt = new IDButton(c.getAuthorName(), SHOWUSERPROFILECLICK, c.getAuthor().getId());
    uButt.addStyleName(BaseTheme.BUTTON_LINK);
    uButt.setWidth(8.0f, Unit.EM);
    addComponent(uButt);
    setComponentAlignment(uButt, Alignment.MIDDLE_LEFT);
    uButt.setDescription(tooltip);
}

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboard.java

License:Open Source License

private void makeBlackLabelOverlays(String gameTitleLC) {
    if (gameTitleLC.contains("energy") || gameTitleLC.contains("innovate"))
        return;/*from w  ww.j  av a2 s. c  o  m*/

    AbsoluteLayout absL = new AbsoluteLayout();
    absL.addStyleName("m-ideaDashboardTabStrip");
    absL.setHeight("60px");
    absL.setWidth("778px");

    String posText = CardType.getCurrentPositiveIdeaCardTypeTL().getTitle();
    String negText = CardType.getCurrentNegativeIdeaCardTypeTL().getTitle();

    Label lab;
    absL.addComponent(lab = new Label(posText), "top:0px;left:210px;");
    lab.setWidth("162px");
    lab.setHeight("60px");
    lab.addStyleName("m-ideaDashboardPositiveBlackTab");

    absL.addComponent(lab = new Label(negText), "top:0px;left:370px;");
    lab.setWidth("182px");
    lab.setHeight("60px");
    lab.addStyleName("m-ideaDashboardNegativeBlackTab");
    addComponent(absL, "top:60px;left:7px");
}

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabPanel.java

License:Open Source License

private Label buildTitleLabel(HorizontalLayout c, String s) {
    Label lab = new HtmlLabel(s);
    lab.addStyleName("m-tabpanel-right-title");
    c.addComponent(lab);//from   w  w  w.  ja  v  a2  s  .co m
    c.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    return lab;
}

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabRecent.java

License:Open Source License

private void setupLeftPanel() {
    VerticalLayout vLay = new VerticalLayout();
    getLeftLayout().addComponent(vLay, "top:0px;left:0px");
    vLay.setSpacing(true);/* ww  w  . ja v  a  2s  .c om*/

    vLay.addComponent(new Label("Card Filters"));
    Label lab;
    vLay.addComponent(lab = new HtmlLabel(
            "<p>Card play can be fast and thoughtful.  Here are the most recent.  Look for the cards most relevant to your thinking.</p>"));
    lab.addStyleName("m-font-12");

    //todo style here
    vLay.addComponent(allIdeasButt);
    vLay.addComponent(supInterestingButt);
    vLay.addComponent(expandButt);
    vLay.addComponent(adaptButt);
    vLay.addComponent(counterButt);
    vLay.addComponent(exploreButt);
    vLay.addComponent(lab = new HtmlLabel(
            "<br/><br/><p>(Hint: mouse-over the text entry and a popup tooltip should appear with the full text.)</p>"));
    lab.addStyleName("m-font-12");
}

From source file:edu.nps.moves.mmowgli.modules.cards.PlayAnIdeaPage2.java

License:Open Source License

@Override
public void initGui() {
    setSpacing(true);/*  w  w  w.  j a va  2 s  . co  m*/
    Label lab = new Label();
    lab.setWidth(CALLTOACTION_HOR_OFFSET_STR);
    addComponent(lab);

    MovePhase phase = MovePhase.getCurrentMovePhaseTL();

    String playTitle = phase.getPlayACardTitle();
    if (playTitle != null && playTitle.length() > 0) {
        addComponent(lab = new Label(playTitle));
        setComponentAlignment(lab, Alignment.TOP_CENTER);
        lab.addStyleName("m-calltoaction-playprompt");
    }
    AbsoluteLayout mainAbsL = new AbsoluteLayout();
    mainAbsL.setWidth(PAIP_WIDTH);
    mainAbsL.setHeight("675px");

    addComponent(mainAbsL);

    // do this at the bottom so z order is top: mainAbsL.addComponent(topHL = new HorizontalLayout(),"top:0px;left:0px");
    topHL = new HorizontalLayout();
    topHL.addComponent(leftAbsL = new AbsoluteLayout());
    topHL.addComponent(rightAbsL = new AbsoluteLayout());

    leftAbsL.setWidth(PAIP_HALFWIDTH);
    rightAbsL.setWidth(PAIP_HALFWIDTH);
    leftAbsL.setHeight(PAIP_TOP_HEIGHT);
    rightAbsL.setHeight(PAIP_TOP_HEIGHT);

    GameLinks gl = GameLinks.getTL();
    final String howToPlayLink = gl.getHowToPlayLink();
    if (howToPlayLink != null && howToPlayLink.length() > 0) {
        howToPlayButt = new NativeButton(null);
        BrowserWindowOpener bwo = new BrowserWindowOpener(howToPlayLink);
        bwo.setWindowName(MmowgliConstants.PORTALTARGETWINDOWNAME);
        bwo.extend(howToPlayButt);
    } else if (mockupOnly)
        howToPlayButt = new NativeButton(null);
    else
        howToPlayButt = new IDNativeButton(null, HOWTOPLAYCLICK);

    leftAbsL.addComponent(howToPlayButt, HOWTO_POS);

    leftType = CardType.getCurrentPositiveIdeaCardTypeTL();
    leftAbsL.addComponent(poshdr = CardSummaryListHeader.newCardSummaryListHeader(leftType, mockupOnly, null),
            POS_POS);
    poshdr.initGui();
    poshdr.addNewCardListener(newCardListener);

    if (mockupOnly)
        gotoDashboardButt = new NativeButton(null);
    else
        gotoDashboardButt = new IDNativeButton(null, IDEADASHBOARDCLICK);

    rightAbsL.addComponent(gotoDashboardButt, GOTO_POS);

    rightType = CardType.getCurrentNegativeIdeaCardTypeTL();
    rightAbsL.addComponent(neghdr = CardSummaryListHeader.newCardSummaryListHeader(rightType, mockupOnly, null),
            NEG_POS);
    neghdr.initGui();
    neghdr.addNewCardListener(newCardListener);

    howToPlayButt.setStyleName("m-howToPlayButton");
    gotoDashboardButt.setStyleName("m-gotoIdeaDashboardButton");
    // end of top gui

    VerticalLayout bottomVLay = new VerticalLayout();
    mainAbsL.addComponent(bottomVLay, "top:200px;left:0px");
    mainAbsL.addComponent(topHL, "top:0px;left:0px"); // doing this at the bottom so z order is top: 

    HorizontalLayout hLay = buildLabelPopupRow(leftType.getTitle(),
            topNewCardLabel = new Label("new card played"));

    bottomVLay.addComponent(hLay);
    bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT);

    User me = Mmowgli2UI.getGlobals().getUserTL();

    topholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly,
            "top");
    bottomVLay.addComponent(topholder);
    ;
    topholder.initGui();

    bottomVLay.addComponent(lab = new Label());
    lab.setHeight("10px");

    hLay = buildLabelPopupRow(rightType.getTitle(), bottomNewCardLabel = new Label("new card played"));

    bottomVLay.addComponent(hLay);
    bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT);
    bottomholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly,
            "bottom");
    bottomVLay.addComponent(bottomholder);
    bottomholder.initGui();

    MCacheManager cMgr = AppMaster.instance().getMcache();

    if (mockupOnly) {
        addCardsTL(topholder, cMgr.getPositiveIdeaCardsCurrentMove());
        addCardsTL(bottomholder, cMgr.getNegativeIdeaCardsCurrentMove());
    } else {
        Game g = Game.getTL();
        if (g.isShowPriorMovesCards() || me.isAdministrator()) {
            addCardsTL(topholder, cMgr.getAllPositiveIdeaCards());
            addCardsTL(bottomholder, cMgr.getAllNegativeIdeaCards());
        } else if (!g.isShowPriorMovesCards()) {
            addCardsTL(topholder, cMgr.getPositiveUnhiddenIdeaCardsCurrentMove());
            addCardsTL(bottomholder, cMgr.getNegativeUnhiddenIdeaCardsCurrentMove());
        }
    }
}