Example usage for com.vaadin.ui VerticalLayout setWidth

List of usage examples for com.vaadin.ui VerticalLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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

License:Open Source License

@SuppressWarnings("serial")

@HibernateOpened//from   w w  w  . j  a  v a2s. co m
@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.CardChainPage.java

License:Open Source License

private void addChildListsTL() {
    MovePhase phase = MovePhase.getCurrentMovePhaseTL();
    Set<CardType> allowedTypes = phase.getAllowedCards();
    followOnTypes = new ArrayList<CardType>();
    for (CardType ct : allowedTypes)
        if (!ct.isIdeaCard()) // "idea/initiating" is the opposite of followon
            followOnTypes.add(ct);// w w w.  j  a v  a  2s  . c o  m

    Collections.sort(followOnTypes, new Comparator<CardType>() {
        @Override
        public int compare(CardType arg0, CardType arg1) {
            return (int) (arg0.getDescendantOrdinal() - arg1.getDescendantOrdinal());
        }
    });

    columnVLs = new ArrayList<VerticalLayout>(followOnTypes.size());

    for (int i = 0; i < followOnTypes.size(); i++) {
        VerticalLayout vl = new VerticalLayout();
        vl.setSpacing(true);
        columnVLs.add(vl);
        listsHL.addComponent(vl);
    }
    Card card = Card.getTL(cardId);
    Card parent = card.getParentCard();
    VerticalLayout spacerVL = new VerticalLayout();

    if (parent != null) {
        topHL.addComponent(spacerVL);
        topHL.setExpandRatio(spacerVL, 1.0f);
        spacerVL.setWidth("100%");

        parentSumm = CardSummary.newCardSummarySmallTL(parent.getId());
        spacerVL.addComponent(parentSumm);
        parentSumm.initGui();
        spacerVL.setComponentAlignment(parentSumm, Alignment.MIDDLE_CENTER);
        parentSumm.setCaption("Parent Card");
        parentSumm.addStyleName("m-parent-card-summary");
    } else {
        topHL.addComponent(spacerVL);
        topHL.setExpandRatio(spacerVL, 1.0f);
        spacerVL.setWidth("100%");

        gotoTopLevelButt.setStyleName("m-gotoTopLevelButton");
        gotoTopLevelButt.setDescription(idea_dash_tt);
        gotoTopLevelButt.setId(PLAY_AN_IDEA_BLUE_BUTTON);
        gotoTopLevelButt.setDescription("Show two top-level card rows");
        spacerVL.addComponent(gotoTopLevelButt);
        spacerVL.setComponentAlignment(gotoTopLevelButt, Alignment.MIDDLE_CENTER);

    }
    if (isGameMaster) {
        spacerVL.addComponent(cardMarkingPanel);
        spacerVL.setComponentAlignment(cardMarkingPanel, Alignment.BOTTOM_LEFT);
    }

    cardLg = CardLarge.newCardLargeTL(card.getId());
    topHL.addComponent(cardLg);
    cardLg.initGuiTL();

    VerticalLayout buttVL = new VerticalLayout();
    buttVL.setHeight("100%");
    topHL.addComponent(buttVL);
    topHL.setComponentAlignment(buttVL, Alignment.MIDDLE_CENTER);
    topHL.setExpandRatio(buttVL, 1.0f);

    Label spacer = new Label();
    buttVL.addComponent(spacer);
    buttVL.setExpandRatio(spacer, 1.0f);

    buttVL.addComponent(gotoIdeaDashButt);
    gotoIdeaDashButt.setStyleName("m-gotoIdeaDashboardButton");
    gotoIdeaDashButt.setDescription(idea_dash_tt);
    gotoIdeaDashButt.setId(GO_TO_IDEA_DASHBOARD_BUTTON);
    buttVL.setComponentAlignment(gotoIdeaDashButt, Alignment.MIDDLE_CENTER);

    buttVL.addComponent(chainButt);
    chainButt.setStyleName("m-viewCardChainButton");
    chainButt.setDescription(view_chain_tt);
    buttVL.setComponentAlignment(chainButt, Alignment.MIDDLE_CENTER);

    spacer = new Label();
    buttVL.addComponent(spacer);
    buttVL.setExpandRatio(spacer, 1.0f);

    int col = -1;
    for (CardType ct : followOnTypes) {
        col++;
        VerticalLayout columnV = columnVLs.get(col);

        CardSummaryListHeader lstHdr = CardSummaryListHeader.newCardSummaryListHeader(ct, card);
        lstHdr.addNewCardListener(this);
        columnV.addComponent(lstHdr);
        lstHdr.initGui();
    }

    listFollowers_oobTL(card.getId()); // gets current vaadin transaction session
}

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

License:Open Source License

protected void buildCardTable() {
    VerticalLayout vLay = new VerticalLayout();
    vLay.setWidth("95%");
    vLay.setHeight("100%");
    getRightLayout().addComponent(vLay);

    vLay.addComponent(makeTableHeaders());

    Panel pan = new Panel();
    pan.setWidth("99%");
    pan.setHeight("99%");
    pan.setStyleName(Reindeer.PANEL_LIGHT);
    vLay.addComponent(pan);// ww w.  j  a  v  a 2s. c  om
    vLay.setExpandRatio(pan, 1.0f); // all of it

    VerticalLayout tableLay;
    pan.setContent(tableLay = new VerticalLayout());
    pan.addStyleName("m-greyborder");
    tableLay.setWidth("99%");

    List<Card> cards = getCardList();

    for (Card c : cards) {
        if (confirmCard(c)) {
            CardSummaryLine csl;
            tableLay.addComponent(csl = new CardSummaryLine(c.getId()));
            csl.initGui();
            csl.setWidth("98%");
        }
    }
}

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

License:Open Source License

public void initGuiTL() {
    setWidth(APPLICATION_SCREEN_WIDTH);// www  .j  ava  2  s.  co  m
    setHeight("100%");
    setSpacing(false);

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

    VerticalLayout tableVLayout = new VerticalLayout();
    tableContainer = tableVLayout;
    tableVLayout.setWidth(APPLICATION_SCREEN_WIDTH);
    tableVLayout.setHeight("900px");
    tableVLayout.setSpacing(true);
    tableVLayout.addStyleName("m-whitepage-header");

    addComponent(tableVLayout);

    tableVLayout.addComponent(lab = new Label());
    lab.setHeight("20px");
    tableVLayout.addComponent(
            lab = new HtmlLabel("<span style='margin-left:40px;color:red;'>" + WARNING_LABEL + "</span>"));
    lab.addStyleName("m-text-align-center");
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberUsersLabelTL() + "</span>"));
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberOnlineLabel() + "</span>"));
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberGameMastersTL() + "</span>"));
    tableVLayout.addComponent(
            new HtmlLabel("<span style='margin-left:40px;'>" + getNumberCardsLabelTL() + "</span>"));
    tableVLayout
            .addComponent(new HtmlLabel("<span style='margin-left:40px;'>Double click a row to edit</span>"));

    tableVLayout.addComponent(lab = new HtmlLabel(
            "<center><b><span style='font-size:175%'>Player Administration</span></b></center>"));

    HorizontalLayout srchHL = buildSearchRow();
    tableVLayout.addComponent(srchHL);
    tableVLayout.setComponentAlignment(srchHL, Alignment.MIDDLE_CENTER);

    table = createTable(lastTableFiller = new SimpleTableFiller());

    table.setCaption(null);
    addTableToLayout(Mmowgli2UI.getGlobals().getUserID());
}

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

License:Open Source License

private void makeResetAnnounceDialogTL_5(String email, ArrayList<User> aLis) {
    UI myUI = getUI();/*ww w  .j a va2  s  .  c o  m*/
    myUI.removeWindow(PasswordResetPopup.this);

    final Window resetAnnounceDialog = new Window("Password Reset Announcement");
    resetAnnounceDialog.setModal(true);
    resetAnnounceDialog.setClosable(false);
    VerticalLayout vLay = new VerticalLayout();
    resetAnnounceDialog.setContent(vLay);
    vLay.setMargin(true);
    vLay.setSpacing(true);
    vLay.setSizeUndefined();
    vLay.setWidth("400px");

    Label message = new HtmlLabel("An email has been sent to <b>" + email + "</b>.");
    vLay.addComponent(message);

    message = new Label(
            "Follow the link in the message to confirm your password reset request to enable login to your mmowgli player account.");
    vLay.addComponent(message);

    message = new Label(
            "Please be advised that you will only have three hours to complete this process, after which time "
                    + "you will have to re-initiate a new password reset process from the game login page.");
    vLay.addComponent(message);

    message = new HtmlLabel(
            "Now, press <b>Homepage -- Return to login</b> after receiving a reset request confirmation email.");
    vLay.addComponent(message);

    @SuppressWarnings("serial")
    Button laterButt = new Button("Homepage -- Return to login", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            HSess.init();
            Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getGameHomeUrl());
            HSess.close();
        }
    });
    vLay.addComponent(laterButt);

    @SuppressWarnings("serial")
    Button troubleButt = new Button("Send trouble report", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            HSess.init();
            Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getTroubleLink());
            HSess.close();
        }
    });
    vLay.addComponent(troubleButt);

    myUI.addWindow(resetAnnounceDialog);
    resetAnnounceDialog.center();

    // This process generates unique uId for th3 reset process that will
    // need to be confirmed once the user receives a confirmation email and
    // click on the link containing the uId
    Iterator<User> itr = aLis.iterator();
    // sends email to all user accounts (which are at the same email address)
    // if a game name was entered, only that account receives the email
    while (itr.hasNext()) {
        User usr = itr.next();
        PasswordReset pr = new PasswordReset(usr);
        PasswordReset.saveTL(pr);

        String confirmUrl = buildConfirmUrl(pr);
        AppMaster.instance().getMailManager().sendPasswordResetEmailTL(email, usr.getUserName(), confirmUrl);
    }
}

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

License:Open Source License

@SuppressWarnings("serial")
private void wereInTL(User _usr) {
    Game g = Game.getTL();/*from w w  w  .  j av  a2 s  .co m*/
    if (!g.isEmailConfirmation()/* && !g.isSMSConfirmation()*/) {
        _usr.setEmailConfirmed(true); // confirmation didn't happen, but they want to login
        wereInReallyTL(_usr); // will do update
    }
    /*  else if(g.isSMSConfirmation()) {  // if both are selected, only sms is done
                
      } */
    else {
        List<String> sLis = VHibPii.getUserPiiEmails(_usr.getId());
        String email = sLis.get(0);
        final Window emailDialog = new Window("Email Confirmation");
        emailDialog.setModal(true);
        emailDialog.setClosable(false);
        VerticalLayout vLay = new VerticalLayout();
        emailDialog.setContent(vLay);
        vLay.setMargin(true);
        vLay.setSpacing(true);
        vLay.setSizeUndefined();
        vLay.setWidth("400px");

        Label message = new HtmlLabel("A confirmation email has been sent to <b>" + email + "</b>.");
        vLay.addComponent(message);

        message = new Label("Follow the link in the message "
                + "to confirm your registration and unlock your mmowgli user account.");
        vLay.addComponent(message);

        message = new HtmlLabel("Press the <b>Am I confirmed yet?</b> button " + "to play if ready.");
        vLay.addComponent(message);

        message = new HtmlLabel(
                "Alternatively, press <b>Quit -- I'll come back later</b> to login at a future time.");
        vLay.addComponent(message);

        GridLayout grid = new GridLayout();
        vLay.addComponent(grid);

        MSysOut.println(NEWUSER_CREATION_LOGS,
                "email confirmation dialog displayed, user " + _usr.getUserName());

        final Button contButt = new Button("Am I confirmed yet?", new ClickListener() {
            boolean confirmed = false;

            @Override
            @HibernateUpdate
            @HibernateUserUpdate
            public void buttonClick(ClickEvent event) {
                MSysOut.println(DEBUG_LOGS, "\"Am I confirmed?\" button handler entered");

                HSess.init();
                User u = User.getTL(userId);
                MSysOut.println(NEWUSER_CREATION_LOGS, "\"Am I confirmed?\" clicked, user " + u.getUserName());

                if (confirmed) {
                    closePopup(emailDialog);
                    wereInReallyTL(u); //  @HibernateUserUpdate //@HibernateUserRead
                    MSysOut.println(NEWUSER_CREATION_LOGS,
                            "\"Am I confirmed?\", positive confirmation, user " + u.getUserName());
                } else {
                    MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.wereInTL()");
                    //User locUsr = User.getTL(userId);  why necessary?
                    //if(locUsr.isEmailConfirmed()) {
                    if (u.isEmailConfirmed()) {
                        confirmed = true;
                        event.getButton().setCaption("I'm ready to play mmowgli!");
                    } else {
                        MSysOut.println(NEWUSER_CREATION_LOGS,
                                "\"Am I confirmed?\", negative confirmation, user " + u.getUserName());
                        Notification.show("Your email is not yet confirmed");
                    }
                }
                HSess.close();
            }
        });
        grid.addComponent(contButt);
        contButt.setImmediate(true);

        Button laterButt = new Button("Quit -- I'll come back later", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                MSysOut.println(DEBUG_LOGS, "\"Quit -- I'll come back later\" button handler entered");

                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getThanksForInterestLink());
                HSess.close();
            }
        });
        grid.addComponent(laterButt);

        Button troubleButt = new Button("Send trouble report", new ClickListener() {
            @Override
            @MmowgliCodeEntry
            @HibernateOpened
            @HibernateClosed
            public void buttonClick(ClickEvent event) // no need for HSess
            {
                MSysOut.println(DEBUG_LOGS, "\"Send trouble report\" button handler entered");

                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getTroubleLink());
                HSess.close();
            }
        });
        grid.addComponent(troubleButt);

        openPopupWindowInMainWindow(emailDialog, 500);

        EmailConfirmation ec = new EmailConfirmation(_usr);
        EmailConfirmation.saveTL(ec);

        String confirmUrl = buildConfirmUrl(ec);
        AppMaster.instance().getMailManager().sendEmailConfirmationTL(email, _usr.getUserName(), confirmUrl);
    } // else weren't confirmed
}

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

License:Open Source License

@SuppressWarnings("serial")
@HibernateUserRead//from   ww  w . j  a v a  2  s .co m
public void checkUserLimitsTL() {
    Serializable uid = Mmowgli2UI.getGlobals().getUserID();
    if (uid != NO_LOGGEDIN_USER_ID) { // can't do this check if we don't have a user yet
        MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.checkUserLimitsTL()");
        User u = User.getTL(uid);
        if (u != null) // why should it be?
            if (u.getUserName() != null) // why should it be?
                if (u.isGameMaster())//getUserName().toLowerCase().startsWith("gm_"))
                    return;
    }

    int maxIn = Game.getTL().getMaxUsersOnline();
    // List<User> lis = (List<User>)HibernateContainers.getSession().createCriteria(User.class).add(Restrictions.eq("online", true)).list();
    // if(lis.size()>=maxIn) {
    if (Mmowgli2UI.getGlobals().getSessionCount() >= maxIn) { // new improved
        lockedOut = true;
        VerticalLayout vl = new VerticalLayout();
        vl.setWidth("325px");
        vl.addStyleName("m-errorNotificationEquivalent");
        vl.setSpacing(false);
        vl.setMargin(true);
        Label lab = new Label("We're loaded to the max with players right now.");
        lab.setSizeUndefined();
        vl.addComponent(lab);
        lab = new Label("Idle players are timed-out after 15 minutes.");
        lab.setSizeUndefined();
        vl.addComponent(lab);
        lab = new Label("Please try again later.");
        lab.setSizeUndefined();
        vl.addComponent(lab);

        Window win = new Window("Sorry, but....");
        win.setSizeUndefined();
        win.addStyleName("m-transparent");
        win.setWidth("308px");
        win.setResizable(false);
        win.setContent(vl);

        openPopupWindowInMainWindow(win, 400);
        win.setModal(false);

        win.addCloseListener(new CloseListener() {
            @Override
            @MmowgliCodeEntry
            @HibernateOpened
            @HibernateClosed
            public void windowClose(CloseEvent e) {
                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getGameFullLink());
                HSess.close();
            }
        });
    }
}

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

License:Open Source License

@SuppressWarnings("unchecked")
private Component createProfileTL() {
    VerticalLayout lay = new VerticalLayout();
    lay.setWidth("670px");
    Label lab;/*from  w ww . java 2  s .  c  o m*/
    lay.addComponent(lab = new Label());
    lab.setHeight("10px");

    VerticalLayout innerVL = new VerticalLayout();
    innerVL.setSpacing(true);
    innerVL.setMargin(true);
    innerVL.setWidth("100%"); //"90%");   
    innerVL.addStyleName("m-myideaprofile-table");
    lay.addComponent(innerVL);

    GridLayout gridL = new GridLayout();
    gridL.setColumns(2);
    gridL.addStyleName("m-userprofile-text");
    gridL.setSpacing(true);

    CardType ct;
    int count = 0;
    int largest = -1;

    List<Card> lisPos = commonCriteria()
            .add(Restrictions.eq("cardType",
                    ct = CardType
                            .getCurrentPositiveIdeaCardTypeTL()/*CardTypeManager.getPositiveIdeaCardTypeTL()*/))
            .list();
    count += lisPos.size();
    largest = Math.max(largest, lisPos.size());

    List<Card> lisNeg = commonCriteria()
            .add(Restrictions.eq("cardType", ct = CardType.getCurrentNegativeIdeaCardTypeTL())).list(); //CardTypeManager.getNegativeIdeaCardTypeTL())).list();
    count += lisNeg.size();
    largest = Math.max(largest, lisNeg.size());

    List<Card> lisExpand = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExpandTypeTL()))
            .list();//CardTypeManager.getExpandTypeTL())).list();
    count += lisExpand.size();
    largest = Math.max(largest, lisExpand.size());

    List<Card> lisAdapt = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getAdaptTypeTL()))
            .list();//CardTypeManager.getAdaptTypeTL())).list();
    count += lisAdapt.size();
    largest = Math.max(largest, lisAdapt.size());

    List<Card> lisCounter = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getCounterTypeTL()))
            .list();//CardTypeManager.getCounterTypeTL())).list();
    count += lisCounter.size();
    largest = Math.max(largest, lisCounter.size());

    List<Card> lisExplore = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExploreTypeTL()))
            .list();//CardTypeManager.getExploreTypeTL())).list();
    count += lisExplore.size();
    largest = Math.max(largest, lisExplore.size());

    ct = CardType.getCurrentPositiveIdeaCardTypeTL(); //CardTypeManager.getPositiveIdeaCardTypeTL();
    row(ct.getSummaryHeader(), largest, lisPos.size(), ct, gridL);
    ct = CardType.getCurrentNegativeIdeaCardTypeTL(); //CardTypeManager.getNegativeIdeaCardTypeTL();
    row(ct.getSummaryHeader(), largest, lisNeg.size(), ct, gridL);
    ct = CardType.getExpandTypeTL(); //CardTypeManager.getExpandTypeTL();
    row(ct.getSummaryHeader(), largest, lisExpand.size(), ct, gridL);
    ct = CardType.getAdaptTypeTL(); //CardTypeManager.getAdaptTypeTL();
    row(ct.getSummaryHeader(), largest, lisAdapt.size(), ct, gridL);
    ct = CardType.getCounterTypeTL(); //CardTypeManager.getCounterTypeTL();
    row(ct.getSummaryHeader(), largest, lisCounter.size(), ct, gridL);
    ct = CardType.getExploreTypeTL(); //CardTypeManager.getExploreTypeTL();
    row(ct.getSummaryHeader(), largest, lisExplore.size(), ct, gridL);

    gridL.addComponent(new Label(""));
    gridL.addComponent(new Label(""));
    gridL.addComponent(new Label("TOTAL"));
    gridL.addComponent(new Label("" + count));

    innerVL.addComponent(gridL);

    lay.addComponent(lab = new Label());
    lab.setHeight("1px");
    lay.setExpandRatio(lab, 1.0f);
    return lay;
}

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;/*from   w w w  . j a va  2s  .c o  m*/
            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;
        }
        return buildNoIdeasYet();
    }
    Table tab = new CardTableSimple(null, cntnr);
    tab.setPageLength(40);
    tab.addStyleName("m-greyborder");
    return tab;
}

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

License:Open Source License

@Override
public void initGui() {
    super.initGui();

    String left = "Players can choose to receive messages in-game or externally (or both or neither).<br/><br/>Player messages are private and"
            + " actual email identities are hidden.<br/><br/>You can find another player's profile by clicking on their name or using the search"
            + " feature. Then you may send a message to that player by clicking on the "
            + "<i>Send player private email</i> link.<br/><br/>If this link is not present or is disabled, then the player has opted "
            + "to receive neither email nor in-game messages.<br/><br/>";
    getLeftLabel().setValue(left);/*from w  w  w.  j a va 2 s .  co m*/

    if (!userIsMe) {
        User u = User.getTL(uid);
        if (u.isOkEmail() || u.isOkGameMessages()) {
            final NativeButton sendEmailButt = new NativeButton("Send private mail to this user");
            sendEmailButt.addStyleName(BaseTheme.BUTTON_LINK);
            sendEmailButt.addStyleName("m-userProfile3-sendmail-button");
            Label sp;
            VerticalLayout vl = getRightLayout();

            vl.setSizeUndefined();
            vl.setWidth("100%");
            vl.addComponent(sp = new Label());
            sp.setHeight("50px");
            vl.addComponent(sendEmailButt);
            vl.setComponentAlignment(sendEmailButt, Alignment.MIDDLE_CENTER);
            vl.addComponent(sp = new Label());
            sp.setHeight("1px");
            vl.setExpandRatio(sp, 1.0f);

            sendEmailButt.addClickListener(new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                @MmowgliCodeEntry
                @HibernateOpened
                @HibernateClosed
                public void buttonClick(ClickEvent event) {
                    HSess.init();

                    User u = User.getTL(uid);
                    if (u.isOkEmail() || u.isOkGameMessages()) // redundant here
                        new SendMessageWindow(u, imAdminOrGameMaster);
                    else
                        Notification.show("Sorry", "Player " + u.getUserName() + " does not receive mail.",
                                Notification.Type.WARNING_MESSAGE);

                    HSess.close();
                }
            });
        }
        return;
    }
    VerticalLayout rightVL = getRightLayout();
    rightVL.setSizeUndefined();
    rightVL.setWidth("100%");

    getLeftAddedVerticalLayout()
            .addComponent(showButt = new ToggleLinkButton("View all", "View unhidden only", null)); //,ttArray));
    showButt.addOnListener(new ViewAllListener());
    showButt.addOffListener(new ViewUnhiddenOnlyListener());
    showButt.setToolTips("Temporarily show all messages, including those marked \"hidden\"",
            "Temporarily hide messages marked \"hidden\"");
    Label sp;
    rightVL.addComponent(sp = new Label());
    sp.setHeight("10px");
    rightVL.addComponent(mailPanel);

    User me = Mmowgli2UI.getGlobals().getUserTL();
    Set<Message> msgs = me.getGameMessages();
    if (msgs.size() > 0) {
        Message[] msgsAr = new Message[msgs.size()];
        msgsAr = msgs.toArray(msgsAr); // avoid concurrent mod
        int num = msgsAr.length;// .size();
        int n = num;
        for (Message m : msgsAr) {
            addOneMessage(m, n--, num, null);
        }
    }
}