Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment MIDDLE_LEFT.

Prototype

Alignment MIDDLE_LEFT

To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.

Click Source Link

Usage

From source file:edu.nps.moves.mmowgli.components.CardTable.java

License:Open Source License

@SuppressWarnings("unused")
private Component orig_buildGenAuthorColumn(Card card) {
    // IE7 can't handle fanciness:
    if (Mmowgli2UI.getGlobals().isIE7()) {
        return new Label(card.getAuthorName()); //.getAuthor().getUserName());
    }/*  w  w w .j  a  va2  s. c  o m*/

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

    User auth = card.getAuthor();

    if (auth.getAvatar() != null) {
        Embedded avatar = new Embedded(null,
                Mmowgli2UI.getGlobals().getMediaLocator().locate(auth.getAvatar().getMedia(), 32));
        avatar.setWidth("24px");
        avatar.setHeight("24px");
        hl.addComponent(avatar);
        hl.setComponentAlignment(avatar, Alignment.MIDDLE_LEFT);
        avatar.addStyleName("m-cursor-pointer");
    }
    IDButton uButt = new IDButton(auth.getUserName(), SHOWUSERPROFILECLICK, auth.getId());
    uButt.addStyleName(BaseTheme.BUTTON_LINK);
    uButt.setWidth(8.0f, Unit.EM);

    hl.addComponent(uButt);
    hl.setComponentAlignment(uButt, Alignment.MIDDLE_LEFT);

    return hl;
}

From source file:edu.nps.moves.mmowgli.components.Leaderboard.java

License:Open Source License

public void initGuiTL() {
    setSizeUndefined();//from   w  w w.  j a v  a 2 s.  c  om
    setWidth(APPLICATION_SCREEN_WIDTH);
    setSpacing(false);

    MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
    Label sp;

    HorizontalLayout titleHL = new HorizontalLayout();
    addComponent(titleHL);
    titleHL.setMargin(new MarginInfo(false, true, false, true)); //sides only
    titleHL.setWidth("100%");

    Component c;
    titleHL.addComponent(c = globs.getMediaLocator().getLeaderboardTitle());
    titleHL.setComponentAlignment(c, Alignment.MIDDLE_LEFT);
    titleHL.setExpandRatio(c, .5f);

    maybeShowMoveSelector(titleHL);

    tips.setStyleName(BaseTheme.BUTTON_LINK);
    tips.addStyleName("m-link-button");
    titleHL.addComponent(tips);
    titleHL.setComponentAlignment(tips, Alignment.MIDDLE_RIGHT);
    titleHL.setExpandRatio(tips, 0.5f);

    tableVLayout = new VerticalLayout();
    tableVLayout.setSizeUndefined();
    tableVLayout.setWidth(APPLICATION_SCREEN_WIDTH);
    tableVLayout.setSpacing(true);
    tableVLayout.setMargin(true);
    tableVLayout.addStyleName("m-whitepage-header");

    addComponent(tableVLayout);

    tableVLayout.addComponent(sp = new Label());
    sp.setHeight("20px"); // to fit top of background

    tableVLayout.addComponent(table = createTableTL());
    tableVLayout.setComponentAlignment(table, Alignment.TOP_CENTER);
    table.setValue(globs.getUserID());
    tableVLayout.setExpandRatio(table, 1.0f);

    /* I can't get this to properly refresh, todo
    refreshButt = new Button("Refresh");
    mainVLayout.addComponent(refreshButt);
    mainVLayout.setComponentAlignment(refreshButt, Alignment.TOP_CENTER);
            
    refreshButt.addListener(new RefreshListener());
    refreshButt.setEnabled(false);
    */
}

From source file:edu.nps.moves.mmowgli.components.MmowgliDialog.java

License:Open Source License

protected void setTitleString(String s, boolean small) {
    if (titleLab != null)
        headerHL2.removeComponent(titleLab);
    titleLab = new Label(s);
    titleLab.addStyleName(small ? titleStyleSmall : titleStyle);
    headerHL2.addComponent(titleLab); //, "top:25px;left:50px");
    headerHL2.setComponentAlignment(titleLab, Alignment.MIDDLE_LEFT);
}

From source file:edu.nps.moves.mmowgli.components.MmowgliDialogContent.java

License:Open Source License

protected void setTitleString(String s, boolean small) {
    if (titleLab != null)
        header.removeComponent(titleLab);
    titleLab = new Label(s);
    titleLab.addStyleName(small ? titleStyleSmall : titleStyle);
    titleLab.setWidth("450px"); // can't overlay cancel butt
    header.addComponent(titleLab); //, "top:25px;left:50px");
    header.setComponentAlignment(titleLab, Alignment.MIDDLE_LEFT);
}

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

License:Open Source License

public void initGuiTL() {
    setSizeUndefined();/*  ww w . ja  v a  2  s . co m*/
    setWidth(APPLICATION_SCREEN_WIDTH);
    //    setHeight("855px"); //ACTIONDASHBOARD_H);

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

    HorizontalLayout titleHL = new HorizontalLayout();
    titleHL.setWidth("95%");
    addComponent(titleHL);

    titleHL.addComponent(sp = new Label());
    sp.setWidth("20px");
    Component titleC;
    titleHL.addComponent(titleC = Mmowgli2UI.getGlobals().getMediaLocator().getActionDashboardTitle());
    titleHL.setComponentAlignment(titleC, Alignment.MIDDLE_LEFT);

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

    titleHL.addComponent(howToWinActionButt);
    howToWinActionButt.setDescription(howWinAction_tt);

    AbsoluteLayout absL = new AbsoluteLayout();
    addComponent(absL);

    absL.setWidth(APPLICATION_SCREEN_WIDTH);
    absL.setHeight(ACTIONDASHBOARD_H);

    MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator();

    AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master
    mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH);
    mainAbsLay.setHeight(ACTIONDASHBOARD_H);
    absL.addComponent(mainAbsLay, ACTIONDASHBOARD_OFFSET_POS);

    // Now the background     
    Embedded backgroundImage = new Embedded(null, medLoc.getActionDashboardPlanBackground());
    backgroundImage.setWidth(ACTIONDASHBOARD_W);
    backgroundImage.setHeight(ACTIONDASHBOARD_H);
    mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px");

    HorizontalLayout tabsHL = new HorizontalLayout();
    tabsHL.setStyleName("m-actionDashboardBlackTabs");
    tabsHL.setSpacing(false);

    tabsHL.addComponent(sp = new Label());
    sp.setWidth("12px");

    TabClickHandler tabHndlr = new TabClickHandler();
    actionPlansTabButt.setStyleName("m-actionDashboardActionPlansTab");
    actionPlansTabButt.addClickListener(tabHndlr);
    actionPlansTabButt.setId(ACTION_DASHBOARD_ACTION_PLANS_TAB);
    tabsHL.addComponent(actionPlansTabButt);

    tabsHL.addComponent(sp = new Label());
    sp.setWidth("1px");

    myPlansTabButt.setStyleName("m-actionDashboardMyPlansTab");
    myPlansTabButt.addClickListener(tabHndlr);
    myPlansTabButt.setId(ACTION_DASHBOARD_MY_ACTION_PLANS_TAB);
    tabsHL.addComponent(myPlansTabButt);
    myPlansTabButt.addStyleName("m-transparent-background"); // initially

    tabsHL.addComponent(sp = new Label());
    sp.setWidth("1px");

    needAuthorsTabButt.setStyleName("m-actionDashboardNeedAuthorsTab");
    needAuthorsTabButt.addClickListener(tabHndlr);
    needAuthorsTabButt.setId(ACTION_DASHBOARD_NEED_AUTHORS_TAB);
    tabsHL.addComponent(needAuthorsTabButt);
    needAuthorsTabButt.addStyleName("m-transparent-background"); // initially

    absL.addComponent(tabsHL, "left:7px;top:8px");

    // stack the pages
    absL.addComponent(actionPlansTab, ACTIONDASHBOARD_TABCONTENT_POS);
    actionPlansTab.initGuiTL();

    absL.addComponent(myPlansTab, ACTIONDASHBOARD_TABCONTENT_POS);
    myPlansTab.initGuiTL();
    myPlansTab.setVisible(false);

    absL.addComponent(needAuthorsTab, ACTIONDASHBOARD_TABCONTENT_POS);
    needAuthorsTab.initGuiTL();
    needAuthorsTab.setVisible(false);

    User me = Mmowgli2UI.getGlobals().getUserTL();
    Set<ActionPlan> invitedSet = me.getActionPlansInvited();
    if (invitedSet != null && (invitedSet.size()) > 0) {
        Notification note = new Notification("<center>You're invited to an Action Plan!</center>",
                "<center> Look for the \"you're invited to join!\" notice.<br/>"
                        + "First, check out the plan.  Then, if you want to join,<br/>"
                        + "click the link to become an author." + "</center>",
                Type.HUMANIZED_MESSAGE, true); // allow html

        note.setPosition(Position.MIDDLE_CENTER);
        note.setDelayMsec(5000);// 5 secs
        note.show(Page.getCurrent());
    }
}

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

License:Open Source License

@Override
public void initGui() {
    Card c = Card.getTL(cardId);/*from   w  w w . j  a  v  a  2s. c om*/
    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.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.  jav  a2 s .c o m*/
    c.setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    return lab;
}

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

License:Open Source License

@Override
public void initGui() {
    setSpacing(true);/*from w w  w . j a  v a 2 s .c om*/
    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());
        }
    }
}

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

License:Open Source License

public RegistrationPageAgreement(Button.ClickListener listener) {
    super(listener);
    super.initGui();

    setTitleString(getTitle()); //"User Agreement 1");

    contentVLayout.setSpacing(true);/*from w  w w  . ja va 2s  . c o m*/
    Label lab = new HtmlLabel(getLabelText()); //"First, please confirm your willingness to meet game requirements.  I also confirm that I am at least 18 years of age.");
    lab.addStyleName(topLabelStyle);
    contentVLayout.addComponent(lab);

    HorizontalLayout hlayout = new HorizontalLayout();
    contentVLayout.addComponent(hlayout);
    hlayout.setSpacing(true);
    hlayout.setWidth("100%");
    hlayout.addStyleName(labelStyle);

    String readUrl = getReadUrlTL();
    if (readUrl != null) {
        Link readLink = new Link("Read", new ExternalResource(getReadUrlTL())); //REGISTRATIONCONSENTURL));
        readLink.setTargetName("_agreements");
        readLink.setTargetBorder(BorderStyle.DEFAULT);
        readLink.setDescription("Opens in new window/tab");
        hlayout.addComponent(readLink);
        readLink.setSizeUndefined();
        hlayout.setComponentAlignment(readLink, Alignment.MIDDLE_LEFT);
    }

    lab = new HtmlLabel(getReadLabel()); //"<i>Consent to Participate in Anonymous Survey</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);
    hlayout.setSizeUndefined();
    hlayout.setComponentAlignment(lab, Alignment.TOP_LEFT);

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

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

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

    NativeButton rejectButt = new NativeButton();
    hl.addComponent(rejectButt);
    rejectButt.setStyleName("m-rejectNoThanksButton");
    // Mmowgli2UI.getGlobals().mediaLocator().decorateDialogRejectButton(rejectButt);    
    rejectButt.addClickListener(new RejectListener());

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

    NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    //Mmowgli2UI.getGlobals().mediaLocator().decorateDialogAcceptAndContinueButton(continueButt);
    continueButt.setStyleName("m-acceptAndContinueButton");
    continueButt.addClickListener(new MyContinueListener());

    continueButt.setClickShortcut(KeyCode.ENTER);
}

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

License:Open Source License

private void fillPanelTL() {
    @SuppressWarnings("unchecked")
    List<AwardType> typs = (List<AwardType>) HSess.get().createCriteria(AwardType.class).list();
    gridList = new ArrayList<AwardType>(typs.size());
    gridList.addAll(typs);//w  w  w . j  av a2  s .co  m
    gridLayout.removeAllComponents();
    gridLayout.setRows(typs.size() + 1);
    gridLayout.setColumns(3);
    gridLayout.setSpacing(true);
    gridLayout.setColumnExpandRatio(1, 0.5f);
    gridLayout.setColumnExpandRatio(2, 0.5f);

    gridLayout.addComponent(new HtmlLabel("<b>Icon</b>"));
    gridLayout.addComponent(new HtmlLabel("<b>Name</b>"));
    gridLayout.addComponent(new HtmlLabel("<b>Description</b>"));

    MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    for (AwardType at : typs) {
        Embedded emb = new Embedded(null, mediaLoc.locate(at.getIcon55x55()));
        emb.addStyleName("m-greyborder3");
        gridLayout.addComponent(emb);
        TextArea tf;
        gridLayout.addComponent(tf = makeTa(at.getName()));
        gridLayout.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
        gridLayout.addComponent(tf = makeTa(at.getDescription()));
        gridLayout.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
    }
}