Example usage for com.vaadin.ui HorizontalLayout setMargin

List of usage examples for com.vaadin.ui HorizontalLayout setMargin

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setMargin.

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:edu.nps.moves.mmowgli.modules.actionplans.AddVideoDialog.java

License:Open Source License

@SuppressWarnings("serial")
public AddVideoDialog() {
    super("Add a Video");
    addStyleName("m-greybackground");

    setClosable(false); // no x in corner
    setWidth("530px");
    setHeight("400px");

    VerticalLayout mainVL = new VerticalLayout();
    mainVL.setSpacing(true);/* w  w w  . j a v  a 2 s.c om*/
    mainVL.setMargin(true);
    mainVL.setSizeUndefined(); // auto size
    mainVL.setWidth("100%");
    setContent(mainVL);

    Label helpLab = new HtmlLabel("Add YouTube videos to your Action Plan this way:"
            + "<OL><LI>Find the video you want at <a href=\"https://www.youtube.com\" target=\""
            + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a>.</LI>"
            + "<LI>Click the \"share\" button below the video screen.</LI>"
            + "<LI>Copy the URL under \"Link to this video:\"</LI>"
            + "<LI>Paste the URL into the field below.</LI>" + "</OL>" + "If you have media that "
            + "has not been uploaded to YouTube, see <a href=\"https://www.youtube.com\" target=\""
            + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a> "
            + "for help with establishing a free account.<br/>");
    helpLab.setWidth("100%");
    mainVL.addComponent(helpLab);

    HorizontalLayout mainHL = new HorizontalLayout();
    mainHL.setMargin(false);
    mainHL.setSpacing(true);
    mainVL.addComponent(mainHL);

    holder = new AbsoluteLayout();
    mainHL.addComponent(holder);
    holder.addStyleName("m-darkgreyborder");
    holder.setWidth("150px");
    holder.setHeight("150px");
    holder.addComponent(new Label("Test video display"), "top:0px;left:0px;");
    VerticalLayout rightVL = new VerticalLayout();
    mainHL.addComponent(rightVL);
    rightVL.setMargin(false);
    rightVL.setSpacing(true);
    rightVL.addComponent(new Label("YouTube video address"));

    HorizontalLayout tfHL = new HorizontalLayout();
    tfHL.setSpacing(true);
    rightVL.addComponent(tfHL);
    addrTf = new TextField();
    tfHL.addComponent(addrTf);
    addrTf.setColumns(21);
    tfHL.addComponent(testButt = new Button("Test"));

    rightVL.addComponent(new Label("Using the test button will set the"));
    rightVL.addComponent(new Label("default title and description."));

    Label sp;
    rightVL.addComponent(sp = new Label());
    sp.setHeight("15px");

    HorizontalLayout bottomHL = new HorizontalLayout();
    rightVL.addComponent(bottomHL);
    rightVL.setComponentAlignment(bottomHL, Alignment.TOP_RIGHT);
    bottomHL.setSpacing(true);
    bottomHL.setWidth("100%");
    Label spacer;
    bottomHL.addComponent(spacer = new Label());
    spacer.setWidth("100%");
    bottomHL.setExpandRatio(spacer, 1.0f);

    bottomHL.addComponent(cancelButt = new Button("Cancel"));
    bottomHL.addComponent(submitButt = new Button("Add"));
    testButt.addClickListener(new TestVidHandler());

    submitButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(AddVideoDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });

    cancelButt.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            media = null;
            UI.getCurrent().removeWindow(AddVideoDialog.this);
            if (closer != null)
                closer.windowClose(null);
        }
    });
}

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

License:Open Source License

public void initGuiTL() {
    tabSh.setHeight("100%");
    tabSh.setWidth("930px");

    HorizontalLayout topHL = new HorizontalLayout();
    topHL.setSpacing(true);//from   w  w w. j av  a2  s  . com
    topHL.setMargin(true);
    Label lab;
    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);
    topHL.addComponent(lab = new Label("Round being edited:"));
    lab.setSizeUndefined();
    topHL.addComponent(moveSelector = new MoveSelector(null));
    moveSelector.addValueChangeListener(new MoveSelectorListener());
    topHL.addComponent(
            runningMoveWarningLabel = new HtmlLabel("<font color='red'><i>Active game round!</i></font>"));
    runningMoveWarningLabel.setSizeUndefined();
    runningMoveWarningLabel.setVisible(AbstractGameBuilderPanel.isRunningMoveTL(moveBeingEdited));

    topHL.addComponent(newMoveButt = new NativeButton("Add new round to game", new NewMoveListener()));
    topHL.addComponent(lab = new Label());
    lab.setWidth("1px");
    topHL.setExpandRatio(lab, 0.5f);
    topHL.setWidth("100%");
    addComponent(topHL);

    addComponent(lab = new Label("The currently active round is set through the Game Administrator menu"));
    lab.setSizeUndefined();
    setComponentAlignment(lab, Alignment.TOP_CENTER);

    tabSh.addTab(titlesPan, "Game Titles");
    tabSh.addTab(topCardsPan, "Top Card Types");
    tabSh.addTab(subCardsPan, "Sub Card Types");
    //tabSh.addTab(seedCardsPan, "Seed Card Initialization");
    tabSh.addTab(chaptersPan, "Action Plan Headings");
    addComponent(tabSh);

    titlesPan.initGui();
    topCardsPan.initGui();
    subCardsPan.initGui();
    //seedCardsPan.initGui();
    chaptersPan.initGui();
    moveSelector.setMove(Game.getTL().getCurrentMove());
}

From source file:edu.nps.moves.mmowgli.modules.gamemaster.EventMonitorPanel.java

License:Open Source License

private void buildTopInfo(VerticalLayout vertL) {
    captionLabel = new HtmlLabel("dummy");
    vertL.addComponent(captionLabel);//from w  ww  .ja v  a 2  s  .c o m

    HorizontalLayout bottomHL = new HorizontalLayout();
    bottomHL.setMargin(false);
    bottomHL.setWidth("100%");
    vertL.addComponent(bottomHL);

    statsLabel = new HtmlLabel("dummy");
    statsLabel.setSizeUndefined();
    bottomHL.addComponent(statsLabel);

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

    newEventLabel = new HtmlLabel("new event&nbsp;&nbsp;"); // safari cuts off tail
    newEventLabel.setSizeUndefined();
    newEventLabel.addStyleName("m-newcardpopup");
    newEventLabel.setImmediate(true);
    bottomHL.addComponent(newEventLabel);
    Animator.animate(newEventLabel, new Css().opacity(0.0d)); // hide it
}

From source file:edu.nps.moves.mmowgli.modules.maps.LeafletMap.java

License:Open Source License

public void initGuiTL() {
    setSpacing(true);/*from   w w  w.j a v a  2s .c om*/
    setSizeUndefined();
    setWidth("950px");
    addStyleName("m-marginleft-20");
    Label lab;

    HorizontalLayout hLay = new HorizontalLayout();
    hLay.setMargin(false);
    hLay.setSpacing(false);
    hLay.setWidth("100%");
    NativeButton butt;
    hLay.addComponent(butt = new NativeButton("go to default game location", new MyDefaultLocationListener()));
    hLay.setExpandRatio(butt, 0.5f);
    hLay.setComponentAlignment(butt, Alignment.BOTTOM_LEFT);

    hLay.addComponent(lab = new HtmlLabel(title));
    lab.setWidth(null);

    makeLayerPopups();
    HorizontalLayout popLay = new HorizontalLayout();
    popLay.setMargin(false);
    popLay.setSpacing(false);
    popLay.setWidth("100%");

    popLay.addComponent(lab = new Label());
    lab.setWidth("1px");
    popLay.setExpandRatio(lab, 1.0f);
    popLay.addComponent(baseLayerPopup);
    popLay.addComponent(overlayPopup);

    hLay.addComponent(popLay);
    hLay.setComponentAlignment(popLay, Alignment.BOTTOM_RIGHT);
    hLay.setExpandRatio(popLay, 0.5f);

    addComponent(hLay);

    User me = Mmowgli2UI.getGlobals().getUserTL();
    this.imAGuest = me.isViewOnly() || me.isAccountDisabled();

    map.setAttributionPrefix("Powered by Leaflet with v-leaflet");
    map.addStyleName("m-greyborder");
    map.removeAllComponents();
    // map.addControl(new LScale());
    layerMap = installAllLayers(map);

    fillLayerPopupsTL(); // build the widgets

    setDefaultMapValuesTL(me); // set default zoom, center, layers

    if (!imAGuest)
        setUserMapValuesTL(me); // set zoom, center and layers from userID pref.

    setOptionGroupWidgetsFromLayerMap();// syncs up the widgets to match the active layers

    Collection<Extension> exts = map.getExtensions();
    LLayers llayers = null;
    for (Extension ex : exts)
        if (ex instanceof LLayers) {
            llayers = (LLayers) ex;
            break;
        }
    if (llayers != null)
        map.removeExtension(llayers);

    addComponent(map);

    setExpandRatio(map, 1);
    map.setHeight("600px");
    map.setWidth("100%");
    map.addMoveEndListener(new MyMoveEndListener());
}

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

License:Open Source License

@SuppressWarnings("serial")
public PasswordResetPopup(Button.ClickListener listener, String uname) {
    setCaption("Password Reset");
    VerticalLayout vLay = new VerticalLayout();
    vLay.setSpacing(true);/*w  w  w  . j ava  2 s  .  co  m*/
    vLay.setMargin(true);
    setContent(vLay);

    vLay.addComponent(new HtmlLabel(
            "<center>Please fill in your player name and/or email address<br/>to initiate a password reset.</center>"));
    // Use an actual form widget here for data binding and error display.
    FormLayout formLay = new FormLayout();
    formLay.setSizeUndefined();
    formLay.setSpacing(true);
    formLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield)
    vLay.addComponent(formLay);
    vLay.setComponentAlignment(formLay, Alignment.TOP_CENTER);

    formLay.addComponent(userIDTf = new TextField("Player name:"));
    userIDTf.addStyleName("m-dialog-textfield");
    userIDTf.setWidth("85%");
    userIDTf.setTabIndex(100);

    // Help out a little here
    userIDTf.setValue(uname == null ? "" : uname);
    formLay.addComponent(emailTf = new TextField("Email:"));
    emailTf.addStyleName("m-dialog-textfield");
    emailTf.setWidth("85%");
    emailTf.setTabIndex(101);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(false);
    hl.setWidth("100%");
    vLay.addComponent(hl);

    Label lab;
    hl.addComponent(lab = new Label());
    hl.setExpandRatio(lab, 1.0f);
    Button cancelButt = new Button("Cancel");
    hl.addComponent(cancelButt);
    cancelButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getUI().setScrollTop(0);
            getUI().removeWindow(PasswordResetPopup.this);
        }
    });
    cancelButt.setClickShortcut(ShortcutAction.KeyCode.ESCAPE);

    Button continueButt = new Button("Continue");
    hl.addComponent(continueButt);
    continueButt.addClickListener(PasswordResetPopup.this);
    continueButt.setClickShortcut(ShortcutAction.KeyCode.ENTER);

    emailTf.focus();
}

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

License:Open Source License

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

    setTitleString("We don't need much to get you started.", true); //smaller

    contentVLayout.setSpacing(true);/*from  w  w w.  j  a v  a  2 s.co  m*/

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

    contentVLayout.addComponent(
            lab = new Label("Game play for this session of mmowgli is restricted to invited users"));
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    contentVLayout.addComponent(
            lab = new Label("with a previously-registered email address or approved email domain."));
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    contentVLayout.addComponent(lab = new HtmlLabel("&nbsp;"));
    ;
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    contentVLayout
            .addComponent(lab = new Label("Please choose a player name (ID) that protects your privacy."));
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    // Use an actual form widget here for data binding and error display.
    formLay = new FormLayout();
    formLay.setSizeUndefined();
    formLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield)
    contentVLayout.addComponent(formLay);
    contentVLayout.setComponentAlignment(formLay, Alignment.TOP_CENTER);

    formLay.addComponent(userIDTf = new TextField("Pick a player name (ID)"));
    userIDTf.setColumns(24);
    // userIDTf.setRequired(true);
    // userIDTf.setRequiredError("We really need an occupation.");

    formLay.addComponent(passwordTf = new PasswordField("Password *"));
    passwordTf.setColumns(24);
    // passwordTf.setRequired(true);
    // passwordTf.setRequiredError("We really need some expertise.");

    formLay.addComponent(confirmTf = new PasswordField("Confirm password *"));
    confirmTf.setColumns(24);
    // confirmTf.setRequired(true);
    // confirmTf.setRequiredError("We really need some expertise.");

    HorizontalLayout hl;
    contentVLayout.addComponent(hl = new HorizontalLayout());
    hl.setMargin(false);

    hl.addComponent(lab = new Label());
    lab.setWidth("50px");
    hl.addComponent(lab = new Label("Choose an avatar image:"));
    lab.addStyleName("m-dialog-text"); //"m-dialog-label");

    chooser = new AvatarPanel(null); // no initselected
    chooser.setWidth("500px"); //"470px"); // doesn't work well w/ relative width 470=min for displaying 4 across of size below
    //  chooser.setHeight("130px"); // 125 enough for mac to show complete image plus bottom scrollbar, IE 7 will ALWAYS show vert scroller
    // todo, check commented-out line on windows...works well on new macs.
    chooser.initGui();
    contentVLayout.addComponent(chooser);
    contentVLayout.setComponentAlignment(chooser, Alignment.TOP_CENTER);
    chooser.setSelectedAvatarIdx(0); // choose the first one just so something is chosen

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

    contentVLayout.addComponent(lab = new Label("The following information is not revealed to other players"));
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    formLay = new FormLayout();
    formLay.setSizeUndefined();
    formLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield)
    contentVLayout.addComponent(formLay);
    contentVLayout.setComponentAlignment(formLay, Alignment.TOP_CENTER);

    formLay.addComponent(firstNameTf = new TextField("First name *"));
    firstNameTf.setColumns(27); // sets width
    firstNameTf.setInputPrompt("optional");
    // firstNameTf.setRequired(true);
    // firstNameTf.setRequiredError("We really need a location.");

    formLay.addComponent(lastNameTf = new TextField("Last name *"));
    lastNameTf.setColumns(27); // sets width
    lastNameTf.setInputPrompt("optional");
    // lastNameTf(true);
    // lastNameTf("We really need a location.");

    formLay.addComponent(emailTf = new TextField("Email address *"));
    emailTf.setColumns(27); // sets width
    // emailTf.setRequired(true);
    // emailTf.setRequiredError("We really need a location.");

    contentVLayout.addComponent(lab = new Label("* private information (encrypted in database)"));
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

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

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

    continueButt = new NativeButton(null);
    continueButt.setStyleName("m-continueButton");
    //NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    //app.globs().mediaLocator().decorateDialogContinueButton(continueButt);
    continueButt.addClickListener(new MyContinueListener());
    continueButt.setClickShortcut(KeyCode.ENTER);

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

    // if this is a cac-based registration, initialize the tf's with the cac card.
    // then, if the cac values are require to be used, mark the tf's as read-only
    CACData cData = Mmowgli2UI.getGlobals().getCACInfo();
    if (CACManager.isCacPresent(cData)) {
        Game g = Game.getTL();
        boolean force = g.isEnforceCACdataRegistration();

        String s;
        if ((s = CACManager.getFirstName(cData)) != null) {
            firstNameTf.setValue(s);
            firstNameTf.setReadOnly(force);
        }
        if ((s = CACManager.getLastName(cData)) != null) {
            lastNameTf.setValue(s);
            lastNameTf.setReadOnly(force);
        }
        if ((s = CACManager.getEmail(cData)) != null) {
            emailTf.setValue(s);
            emailTf.setReadOnly(force);
        }
    }

    userIDTf.focus(); // should do it
    FocusHack.focus(userIDTf); // this does
}

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

License:Open Source License

@HibernateSessionThreadLocalConstructor
public RegistrationPagePopupFirstB(ClickListener listener, Long uId) {
    super(listener);
    super.initGui();
    localUserId = uId;/*from  w  w w .j  av  a 2 s  . c o m*/

    setTitleString("The following is not revealed to other players.", true); //smaller

    contentVLayout.setSpacing(true);

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

    // Use an actual form widget here for data binding and error display.
    formLay = new FormLayout();
    formLay.setSizeUndefined();
    formLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield)
    contentVLayout.addComponent(formLay);
    contentVLayout.setComponentAlignment(formLay, Alignment.TOP_CENTER);

    formLay.addComponent(firstNameTf = new TextField("First name *"));
    firstNameTf.setColumns(27); // sets width
    firstNameTf.setInputPrompt("optional");
    // firstNameTf.setRequired(true);
    // firstNameTf.setRequiredError("We really need a location.");

    formLay.addComponent(lastNameTf = new TextField("Last name *"));
    lastNameTf.setColumns(27); // sets width
    lastNameTf.setInputPrompt("optional");
    // lastNameTf(true);
    // lastNameTf("We really need a location.");

    contentVLayout.addComponent(lab = new Label("* private information (encrypted in database)"));
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    contentVLayout.addComponent(lab = new Label());
    lab.setHeight("5px");

    HorizontalLayout hl;
    contentVLayout.addComponent(hl = new HorizontalLayout());
    hl.setMargin(false);

    hl.addComponent(lab = new Label());
    lab.setWidth("50px");
    hl.addComponent(lab = new Label("Choose an avatar image:"));
    lab.addStyleName("m-dialog-text"); //"m-dialog-label");

    chooser = new AvatarPanel(null); // no initselected
    chooser.setWidth("500px"); //"470px"); // doesn't work well w/ relative width 470=min for displaying 4 across of size below
    //  chooser.setHeight("130px"); // 125 enough for mac to show complete image plus bottom scrollbar, IE 7 will ALWAYS show vert scroller
    // todo, check commented-out line on windows...works well on new macs.
    chooser.initGui();
    contentVLayout.addComponent(chooser);
    contentVLayout.setComponentAlignment(chooser, Alignment.TOP_CENTER);
    chooser.setSelectedAvatarIdx(0); // choose the first one just so something is chosen

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

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

    continueButt = new NativeButton(null);
    continueButt.setStyleName("m-continueButton");
    //NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    //app.globs().mediaLocator().decorateDialogContinueButton(continueButt);
    continueButt.addClickListener(new MyContinueListener());
    continueButt.setClickShortcut(KeyCode.ENTER);

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

    // if this is a cac-based registration, initialize the tf's with the cac card.
    // then, if the cac values are require to be used, mark the tf's as read-only
    CACData cData = Mmowgli2UI.getGlobals().getCACInfo();
    if (CACManager.isCacPresent(cData)) {
        Game g = Game.getTL();
        boolean force = g.isEnforceCACdataRegistration();

        String s;
        if ((s = CACManager.getFirstName(cData)) != null) {
            firstNameTf.setValue(s);
            firstNameTf.setReadOnly(force);
        }
        if ((s = CACManager.getLastName(cData)) != null) {
            lastNameTf.setValue(s);
            lastNameTf.setReadOnly(force);
        }
        /*
        if((s = CACManager.getEmail(cData))!=null) {
          emailTf.setValue(s);
          emailTf.setReadOnly(force);
        }
        */
    }

    firstNameTf.focus(); // should do it
    FocusHack.focus(firstNameTf); // this does
}

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

License:Open Source License

HorizontalLayout makeCheckRow(Button butt) {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeUndefined();/* ww  w.ja  v a  2s.  c o  m*/
    hl.addStyleName("m-userprofile-linkbuttons");
    hl.setMargin(false);
    hl.setSpacing(false);
    if (checkMarkRes == null)
        checkMarkRes = Mmowgli2UI.getGlobals().getMediaLocator().getCheckMark12px();
    Embedded embedded = new Embedded(null, checkMarkRes);
    embedded.setWidth("12px");
    if (butt == buildsButt)
        embedded.setVisible(false);
    hl.addComponent(embedded);
    hl.addComponent(butt);
    hl.setExpandRatio(butt, 1.0f);
    return hl;
}

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;/*from  w  w w. ja  va 2 s.c  o m*/
    grid.addComponent(lab = new Label(s));
    lab.setWidth("160");
    lab.setDescription(s);

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

    hLay.addComponent(lab = new HtmlLabel("&nbsp;"));
    ;
    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  ww  w.ja  v  a2s .c o  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;
}