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.registrationlogin.RegistrationPageSecondPermissionPopup.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public RegistrationPageSecondPermissionPopup(Button.ClickListener listener) {
    super(listener);
    super.initGui();

    Game g = Game.getTL();/*ww  w  .j  a va  2  s . c om*/

    setTitleString(g.getSecondLoginPermissionPageTitle());

    contentVLayout.setSpacing(true);
    Label lab;
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("15px");

    lab = new HtmlLabel(g.getSecondLoginPermissionPageText());
    lab.setWidth("82%");
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("98%");
    contentVLayout.addComponent(hl);

    hl.addComponent(lab = new Label());
    lab.setWidth("20px");

    NativeButton rejectButt = new NativeButton();
    hl.addComponent(rejectButt);
    rejectButt.setStyleName("m-rejectNoThanksButton");
    rejectButt.addClickListener(new RejectListener());

    hl.addComponent(lab = new Label());
    hl.setExpandRatio(lab, 1.0f);

    NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    continueButt.setStyleName("m-acceptAndContinueButton");
    continueButt.addClickListener(new MyContinueListener());

    continueButt.setClickShortcut(KeyCode.ENTER);
}

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RoleSelectionPage.java

License:Open Source License

public RoleSelectionPage(ClickListener listener, Long uId) {
    super(listener);
    super.initGui();
    this.localUserId = uId;

    setTitleString("Last Step: tell others of your interests"); //"Role Selection");

    contentVLayout.setSpacing(true);/*from w  w  w .j av  a2  s.c  o  m*/
    contentVLayout.setMargin(true);
    contentVLayout.addStyleName("m-role-page");

    Label lab;
    contentVLayout.addComponent(lab = new HtmlLabel(
            "          This optional information is revealed to other players."));
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("10px");

    expertiseTf = new TextField();
    expertiseTf.addStyleName("m-noleftmargin");
    expertiseTf.setCaption("Enter a short description of your pertinent expertise.");
    expertiseTf.setColumns(38);
    expertiseTf.setInputPrompt("optional");
    contentVLayout.addComponent(expertiseTf);

    Game game = Game.getTL();
    ques = game.getQuestion();

    ansTf = new TextArea(ques.getQuestion());
    ansTf.setWidth("98%");
    ansTf.setRows(10);
    ansTf.setInputPrompt("(optional, but worth 10 points if you answer)");
    contentVLayout.addComponent(ansTf);

    emailCb = new CheckBox("I agree to receive private email during game play.");
    contentVLayout.addComponent(emailCb);
    emailCb.addStyleName(labelStyle);
    emailCb.addStyleName("m-nopaddingormargin");
    emailCb.setValue(true);

    messagesCb = new CheckBox("I agree to receive private in-game messages during game play.");
    contentVLayout.addComponent(messagesCb);
    messagesCb.addStyleName(labelStyle);
    messagesCb.addStyleName("m-nopaddingormargin");
    messagesCb.setValue(true);

    HorizontalLayout buttPan = new HorizontalLayout();
    buttPan.setWidth("100%");
    buttPan.setSpacing(true);

    buttPan.addComponent(lab = new Label("OK great, thanks for registering!  Let's play."));
    lab.addStyleName(labelStyle);
    lab.addStyleName("m-nopaddingormargin");
    lab.setSizeUndefined();

    Label spacer;
    buttPan.addComponent(spacer = new Label());
    spacer.setWidth("1px");
    buttPan.setExpandRatio(spacer, 1.0f);

    buttPan.addComponent(continueButt = new NativeButton(null));
    Mmowgli2UI.getGlobals().mediaLocator().decorateGetABriefingButton(continueButt);

    Label sp;
    buttPan.addComponent(sp = new Label());
    sp.setWidth("10px");

    contentVLayout.addComponent(buttPan);

    continueButt.addClickListener(new ContinueListener());
    continueButt.setClickShortcut(KeyCode.ENTER);
    expertiseTf.focus();
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java

License:Open Source License

private void row(String s, int largest, int sz, CardType ct, GridLayout grid) {
    float pct = (float) sz / (float) largest;
    float wd = pct * MAXBARWIDTH;
    int width = Math.max(Math.round(wd), 1);

    Label lab;
    grid.addComponent(lab = new Label(s));
    lab.setWidth("160");
    lab.setDescription(s);//from  ww w.  j  a  v a2 s  .  c om

    HorizontalLayout hLay = new HorizontalLayout();
    hLay.setSpacing(true);
    hLay.setMargin(false);

    hLay.addComponent(lab = new HtmlLabel(" "));
    ;
    lab.addStyleName(CardType.getColorStyle(ct)); //CardTypeManager.getColorStyle(ct));
    lab.setWidth("" + width + "px");
    hLay.addComponent(lab = new Label("" + sz));

    grid.addComponent(hLay);
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java

License:Open Source License

private Component buildNoIdeasYet() {
    if (!userIsMe) {
        Label lab = new Label("No idea cards yet");
        lab.addStyleName("m-userprofile-tabpanel-font");
        return lab;
    }/*from w  w  w .j a v  a 2  s .co  m*/
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(true);
    hl.setWidth("100%");
    Label lab;
    hl.addComponent(lab = new Label("No idea cards yet"));
    lab.addStyleName("m-userprofile-tabpanel-font");
    lab.setSizeUndefined();
    hl.setExpandRatio(lab, 0.5f);
    hl.setComponentAlignment(lab, Alignment.TOP_RIGHT);
    hl.addComponent(lab = new Label());
    lab.setWidth("30px");
    IDNativeButton butt = new IDNativeButton("Play a card now", MmowgliEvent.PLAYIDEACLICK);
    butt.setStyleName(BaseTheme.BUTTON_LINK);
    butt.addStyleName("m-link-button-18");
    hl.addComponent(butt);
    hl.setExpandRatio(butt, 0.5f);
    hl.setComponentAlignment(butt, Alignment.TOP_LEFT);
    return hl;
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java

License:Open Source License

private Component createTable(HbnContainer<Card> cntnr, Object nullComponent) {
    Collection<?> ids = cntnr.getItemIds();
    if (ids.size() <= 0) {
        if (nullComponent instanceof String) {
            VerticalLayout vl = new VerticalLayout();
            vl.setWidth("670px");
            Label lab;
            vl.addComponent(lab = new Label((String) nullComponent));
            lab.addStyleName("m-userprofile-tabpanel-font");
            lab.setSizeUndefined(); // prevents 100% w
            vl.setComponentAlignment(lab, Alignment.TOP_CENTER);
            vl.addComponent(lab = new Label());
            vl.setExpandRatio(lab, 1.0f);
            return vl;
        }//from ww w  .ja va2s .  c o  m
        return buildNoIdeasYet();
    }
    Table tab = new CardTableSimple(null, cntnr);
    tab.setPageLength(40);
    tab.addStyleName("m-greyborder");
    return tab;
}

From source file:edu.nps.moves.mmowgliMobile.ui.ActionPlanRenderer2.java

License:Open Source License

private Component makeLabel(String s) {
    Label lab = new Label(s);
    lab.setSizeUndefined();/*from  www .ja  v  a 2  s.  c  o m*/
    lab.addStyleName("m-actionplan-label");
    return lab;
}

From source file:edu.nps.moves.mmowgliMobile.ui.ActionPlanRenderer2.java

License:Open Source License

private Component makeText(String s) {
    Label lab = new Label(s);
    lab.addStyleName("m-actionplan-text");
    return lab;//from   w  w w .  ja v a 2s .c  o  m
}

From source file:edu.nps.moves.mmowgliMobile.ui.ActionPlanRenderer2.java

License:Open Source License

private Component makeHr() {
    Label lab = new Hr();
    lab.addStyleName("m-actionplan-hr");
    return lab;
}

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) {//  ww  w.  j a  v a 2 s .c om
    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);
}

From source file:edu.nps.moves.mmowgliMobile.ui.FullEntryView2.java

License:Open Source License

public void setEntry(final ListEntry ent, ListView2 messageList) {
    entry = ent;//from w w  w . j  a va 2 s.  c o  m
    //currentMessageList = messageList;
    if (ent != null) {
        renderer = getRenderer(ent);
        removeStyleName("no-message");
        renderer.setMessage(this, ent, messageList, layout);
    } else {
        layout.removeAllComponents();
        Label noMessageLbl = new Label("No Message Selected");
        noMessageLbl.setStyleName(Reindeer.LABEL_SMALL);
        noMessageLbl.addStyleName(Reindeer.LABEL_H1);
        layout.addComponent(noMessageLbl);
        addStyleName("no-message");
    }
    updateNewListItems();
}