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.cards.PlayAnIdeaPage2.java

License:Open Source License

private HorizontalLayout buildLabelPopupRow(String text, Label popup) {
    HorizontalLayout hLay = new HorizontalLayout();
    hLay.setHeight("25px");
    hLay.setWidth("980px");

    Label lab;
    hLay.addComponent(lab = new Label());
    lab.setWidth("25px");

    hLay.addComponent(lab = new HtmlLabel(text + "  ")); // to keep italics from clipping
    lab.setSizeUndefined();//from  ww  w  . ja  va 2  s  .c o  m
    lab.addStyleName("m-playanidea-heading-text");
    hLay.setExpandRatio(lab, 0.5f);
    popup.addStyleName("m-newcardpopup");
    hLay.addComponent(popup);
    hLay.setExpandRatio(popup, 0.5f);
    popup.setImmediate(true);
    Animator.animate(popup, new Css().opacity(0.0d));
    hLay.addComponent(lab = new Label());
    lab.setWidth("20px");

    return hLay;
}

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

License:Open Source License

public void initGuiTL() {
    setWidth(APPLICATION_SCREEN_WIDTH);/*from   ww  w.  j  av  a 2 s  .c  o 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.LoginPopup.java

License:Open Source License

public LoginPopup(Button.ClickListener listener, boolean guest) {
    super(listener);
    super.initGui();
    if (guest) {//w w  w . j ava2  s .c  o m
        @SuppressWarnings("unchecked")
        List<User> lis = (List<User>) HSess.get().createCriteria(User.class)
                .add(Restrictions.eq("viewOnly", true)).add(Restrictions.eq("accountDisabled", false)).list();
        if (lis.size() > 0) {
            for (User u : lis) {
                if (u.getUserName().toLowerCase().equals("guest")) {
                    userID = u.getId();
                    return;
                }
            }
        }
        // If here, the guest logon is enabled, but no userID named guest is marked "viewOnly", continue and let
        // caller realize what happened
    }
    setTitleString("Sign in please.");

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

    VerticalLayout lay = new VerticalLayout();
    contentVLayout.addComponent(lay);
    contentVLayout.setComponentAlignment(lay, Alignment.TOP_CENTER);

    lay.addComponent(lab = new Label("Player name:"));
    lab.addStyleName("m-dialog-label");

    lay.addComponent(userIDTf = new TextField());
    userIDTf.setColumns(35);
    userIDTf.setTabIndex(100);
    userIDTf.setId(USER_NAME_TEXTBOX);
    userIDTf.addStyleName("m-dialog-entryfield");

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

    lay.addComponent(lab = new Label("Password:"));
    lab.addStyleName("m-dialog-label");

    lay.addComponent(passwordTf = new PasswordField());
    passwordTf.setColumns(35);
    passwordTf.setTabIndex(101);
    passwordTf.setId(USER_PASSWORD_TEXTBOX);
    passwordTf.addStyleName("m-dialog-entryfield");

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

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

    continueButt = new NativeButton();
    continueButt.setId(LOGIN_CONTINUE_BUTTON);
    hl.addComponent(continueButt);
    Mmowgli2UI.getGlobals().mediaLocator().decorateDialogContinueButton(continueButt);

    continueButt.addClickListener(new MyContinueListener());
    continueButt.setClickShortcut(KeyCode.ENTER);

    // Password reset
    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidth("100%");
    contentVLayout.addComponent(h2);

    h2.addComponent(lab = new Label());
    h2.setExpandRatio(lab, 01.0f);
    pwResetButt = new NativeButton("Forgot password or player name?");
    pwResetButt.addStyleName("m-signin-forgotButton");
    h2.addComponent(pwResetButt);

    pwResetButt.addClickListener(new MyForgotLoginInfoListener());

    userIDTf.focus(); // won't do it
    FocusHack.focus(userIDTf); // will do it
}

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);//  w w w.j a v  a 2  s.co  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.registrationlogin.RegistrationPageAgreementCombo.java

License:Open Source License

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

    setTitleString("User Agreement");

    contentVLayout.setSpacing(true);/*from   w  ww  .ja  v  a2s . c  om*/

    Label lab = new Label("I confirm my willingness to meet game requirements:");
    lab.addStyleName(topLabelStyle);
    contentVLayout.addComponent(lab);

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

    contentVLayout.addComponent(lab = new HtmlLabel(
            "First, I confirm that I am at least 18 years of age, I have been informed of risks<br/>and benefits, and I consent to participate."));
    lab.addStyleName(labelStyle);

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

    // First read
    hlayout.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;"));
    lab.setHeight("10px");
    GameLinks gl = GameLinks.getTL();
    Link readLink = new Link("Read", new ExternalResource(gl.getInformedConsentLink())); //REGISTRATIONCONSENTURL));
    readLink.setTargetName("_agreements");
    readLink.setTargetBorder(BorderStyle.DEFAULT);
    readLink.setDescription("Opens in new window/tab");
    hlayout.addComponent(readLink);
    readLink.setSizeUndefined();

    lab = new HtmlLabel("<i>Informed Consent to Participate in Research</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);

    hlayout.setSizeUndefined();

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

    lab = new HtmlLabel(
            "Second, I understand that <b style='color:red;'>no classified or sensitive information can be<br/>posted</b> to the game since participation is open.  Violation of this policy may<br/>lead to serious consequences.");
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab);

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

    // Second read
    hlayout.addComponent(lab = new HtmlLabel("&nbsp;&nbsp;"));

    readLink = new Link("Read", new ExternalResource(gl.getUserAgreementLink()));
    readLink.setTargetName("_agreements");
    readLink.setTargetBorder(BorderStyle.DEFAULT);
    readLink.setDescription("Opens in new window/tab");
    hlayout.addComponent(readLink);
    readLink.setSizeUndefined();

    lab = new HtmlLabel("<i>Department of Defense Social Media User Agreement</i>");
    lab.setSizeUndefined();
    hlayout.addComponent(lab);

    hlayout.setSizeUndefined();

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

    lab = new HtmlLabel(
            "Third, the official language of the MMOWGLI game is English.  Other languages<br/>are not supported in order to ensure that player postings are appropriate.");
    lab.addStyleName(labelStyle);
    contentVLayout.addComponent(lab);

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

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

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

    NativeButton rejectButt = new NativeButton();
    hl.addComponent(rejectButt);
    rejectButt.setStyleName("m-rejectNoThanksButton"); //new way
    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"); // new way
    continueButt.addClickListener(new MyContinueListener());

    continueButt.setClickShortcut(KeyCode.ENTER);
}

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

License:Open Source License

@Override
public void initGui() {
    setWidth("988px"); // same width as included panel
    setHeight(BIGGESTWINDOW_HEIGHT_S); // try to handle making the popup miss the video

    Instrumentation.addInstrumentation(this);

    Game game = Game.getTL();/*  ww w.ja v  a2  s .c  o m*/
    MovePhase phase = game.getCurrentMove().getCurrentMovePhase();

    HorizontalLayout outerLayout = new HorizontalLayout();
    outerLayout.setSpacing(true);
    addComponent(outerLayout);
    outerLayout.setWidth("988px");
    setExpandRatio(outerLayout, 1);
    Label spacer;

    outerLayout.addComponent(baseVLayout = new VerticalLayout());
    baseVLayout.setWidth("988px");
    outerLayout.setComponentAlignment(baseVLayout, Alignment.TOP_CENTER);
    baseVLayout.setSpacing(true);

    // This is just to give us a hidden widget to update to keep push channel alive through Akamai
    outerLayout.addComponent(pushPingLab = new HtmlLabel(""));
    pushPingLab.setWidth("5px");

    String headingStr = phase.getOrientationCallToActionText();
    String summaryStr = phase.getOrientationHeadline();
    String textStr = phase.getOrientationSummary();
    Media vid = phase.getOrientationVideo();

    vidPan = new VideoWithRightTextPanel(vid, headingStr, summaryStr, textStr, null);
    vidPan.setLargeText(true);
    baseVLayout.addComponent(vidPan);
    vidPan.initGui();

    HorizontalLayout bottomHLayout = new HorizontalLayout();
    bottomHLayout.addComponent(spacer = new Label()); // special spacer
    bottomHLayout.setExpandRatio(spacer, 1.0f);

    Label[] spacers = new Label[5];

    Label lab;
    int numButts = 0;

    // Email signup button
    //-----------------------
    if (phase.isSignupButtonShow()) {
        VerticalLayout signupVL = new VerticalLayout();
        signupVL.setHeight("50px");
        signupVL.setMargin(false);

        if (mockupOnly)
            signupVL.addComponent(signupButt = new NativeButton(null)); // no handler
        else
            signupVL.addComponent(signupButt = new NativeButton(null, this));
        signupButt.addStyleName("signupbutton");
        signupButt.setEnabled(phase.isSignupButtonEnabled());
        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(signupButt, phase.getSignupButtonIcon());
        signupVL.setComponentAlignment(signupButt, Alignment.MIDDLE_CENTER);

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

        signupVL.addComponent(lab = new HtmlLabel(phase.getSignupButtonSubText()));
        lab.addStyleName("m-text-align-center");
        signupButt.setDescription(phase.getSignupButtonToolTip());
        lab.setDescription(phase.getSignupButtonToolTip());
        lab.setEnabled(phase.isSignupButtonEnabled());
        signupVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        bottomHLayout.addComponent(signupVL);
        numButts++;
    }

    // New player reg button
    //----------------------
    if (phase.isNewButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout newButtVL = new VerticalLayout();
        newButtVL.setHeight("50px");
        newButtVL.setMargin(false);

        if (mockupOnly)
            newButtVL.addComponent(imNewButt = new NativeButton(null)); // no handler
        else
            newButtVL.addComponent(imNewButt = new NativeButton(null, this));
        imNewButt.setEnabled(phase.isNewButtonEnabled());
        imNewButt.addStyleName("newuserbutton");
        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imNewButt, phase.getNewButtonIcon());
        newButtVL.setComponentAlignment(imNewButt, Alignment.MIDDLE_CENTER);

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

        /*
              boolean gameRO = game.isReadonly();
              boolean gameClamped = game.isRegisteredLogonsOnly();
              imNewButt.setEnabled(!gameRO & !gameClamped);
                
              // Label lab;
              if (gameRO) {
                newButtVL.addComponent(lab = new Label("No new player accounts, for now")); // "Player registration is currently closed"));
                                                                            // //"Sorry, no more new players"));
                String s;
                lab.setDescription(s = "New player accounts will open when game play starts");
                imNewButt.setDescription(s);
              }
              else if (gameClamped)
                newButtVL.addComponent(lab = new Label("The game is full, please retry later")); // "Sorry, no more new players"));
              else
                newButtVL.addComponent(lab = new Label("You can get started in 2 minutes..."));
        */
        newButtVL.addComponent(lab = new HtmlLabel(phase.getNewButtonSubText()));
        newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);
        lab.addStyleName("m-text-align-center");
        lab.setEnabled(phase.isNewButtonEnabled());
        imNewButt.setDescription(phase.getNewButtonToolTip());
        lab.setDescription(phase.getNewButtonToolTip());

        newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        bottomHLayout.addComponent(newButtVL);
        numButts++;
    }

    // Existing player button
    //-----------------------
    if (phase.isLoginButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout rightButtVL = new VerticalLayout();
        rightButtVL.setHeight("50px");
        rightButtVL.setMargin(false);

        if (mockupOnly)
            rightButtVL.addComponent(imRegisteredButt = new NativeButton(null)); // no handler
        else
            rightButtVL.addComponent(imRegisteredButt = new NativeButton(null, this));
        imRegisteredButt.addStyleName("loginbutton");
        imRegisteredButt.setEnabled(phase.isLoginButtonEnabled());

        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imRegisteredButt,
                phase.getLoginButtonIcon());
        rightButtVL.setComponentAlignment(imRegisteredButt, Alignment.MIDDLE_CENTER);

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

        rightButtVL.addComponent(lab = new HtmlLabel(phase.getLoginButtonSubText()));
        lab.addStyleName("m-text-align-center");
        lab.setEnabled(phase.isLoginButtonEnabled());
        rightButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        imRegisteredButt.setDescription(phase.getLoginButtonToolTip());
        lab.setDescription(phase.getLoginButtonToolTip());

        bottomHLayout.addComponent(rightButtVL);
        numButts++;

        checkQuickCACLoginTL();
    }

    // Guest signup button
    //-----------------------
    if (phase.isGuestButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout guestButtVL = new VerticalLayout();
        guestButtVL.setHeight("50px");
        guestButtVL.setMargin(false);

        if (mockupOnly)
            guestButtVL.addComponent(guestButt = new NativeButton(null));
        else
            guestButtVL.addComponent(guestButt = new NativeButton(null, this));
        guestButt.addStyleName("guestbutton");
        guestButt.setEnabled(phase.isGuestButtonEnabled());

        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(guestButt, phase.getGuestButtonIcon());
        guestButtVL.setComponentAlignment(guestButt, Alignment.MIDDLE_CENTER);

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

        guestButtVL.addComponent(lab = new HtmlLabel(phase.getGuestButtonSubText()));
        lab.addStyleName("m-text-align-center");
        guestButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        guestButt.setDescription(phase.getGuestButtonToolTip());
        lab.setDescription(phase.getGuestButtonToolTip());
        lab.setEnabled(phase.isGuestButtonEnabled());
        bottomHLayout.addComponent(guestButtVL);
        numButts++;
    }

    for (int i = 0; i < numButts; i++)
        if (spacers[i] != null)
            spacers[i].setWidth(BUTTON_SPACING[numButts]);

    bottomHLayout.addComponent(spacer = new Label()); // special spacer
    bottomHLayout.setExpandRatio(spacer, 1.0f);

    baseVLayout.addComponent(bottomHLayout);
    baseVLayout.setComponentAlignment(bottomHLayout, Alignment.TOP_CENTER);

    lab = new HtmlLabel(
            "<center>Each MMOWGLI game is independent.<br>&nbsp;You need a new account for every game.&nbsp;</center>");
    lab.setSizeUndefined();
    lab.addStyleName("m-margintop-20");
    lab.addStyleName("m-greyborder");
    lab.addStyleName("m-background-white");
    lab.addStyleName("m-opacity-75");
    baseVLayout.addComponent(lab);
    baseVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    String troubleUrl = GameLinks.getTL().getTroubleLink();
    Link lnk = new Link("Trouble signing in?", new ExternalResource(troubleUrl));
    baseVLayout.addComponent(lnk);
    lnk.setTargetName(PORTALTARGETWINDOWNAME);
    lnk.setTargetBorder(BorderStyle.DEFAULT);
    lnk.addStyleName("m-margin-top-20");
    baseVLayout.setComponentAlignment(lnk, Alignment.MIDDLE_CENTER);

    //checkUserLimits();  done from app entry point
}

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  ww  .j a v a  2 s  . com*/

    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.RegistrationPagePopupFirstA.java

License:Open Source License

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

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

    contentVLayout.setSpacing(true);//from w  ww .  j a va2s.  c om

    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.");

    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);

    HorizontalLayout 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.ja va  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.registrationlogin.RegistrationPagePopupSecond.java

License:Open Source License

public RegistrationPagePopupSecond(Button.ClickListener listener, Long uId) {
    super(listener);
    super.initGui();
    localUserId = uId;/* www.  java  2 s  . c  o  m*/
    setTitleString("Tell us about you");

    contentVLayout.setSpacing(true);
    Label sp;
    contentVLayout.addComponent(sp = new Label());
    sp.setHeight("20px");

    Label header = new HtmlLabel(
            "<center>Affiliation category and location are optional and are displayed to other game players.</center>"); // and help you</center>");
    header.addStyleName("m-dialog-label-noindent");
    contentVLayout.addComponent(header);
    contentVLayout.setComponentAlignment(header, Alignment.TOP_CENTER);

    HorizontalLayout horL = new HorizontalLayout();
    horL.setSpacing(false);
    horL.setWidth("100%");
    contentVLayout.addComponent(horL);

    horL.addComponent(sp = new Label());
    sp.setWidth("20px");

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

    horL.addComponent(formLay);
    horL.setExpandRatio(formLay, 1.0f);

    formLay.addComponent(affilCombo = new BoundAffiliationCombo("Affiliation:"));
    affilCombo.setValue(affilCombo.getItemIds().toArray()[0]); // Tried to get this to be editable....needs more work

    formLay.addComponent(locTf = new TextField("Location:"));
    locTf.setColumns(31);
    locTf.setInputPrompt("optional");
    locTf.addStyleName("m-noleftmargin");

    Label lab;
    contentVLayout.addComponent(lab = new HtmlLabel(warning));
    lab.addStyleName(labelStyle);

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

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

    NativeButton continueButt = new NativeButton(null);
    continueButt.setStyleName("m-continueButton");
    hl.addComponent(continueButt);
    continueButt.addClickListener(new JoinListener());
    continueButt.setClickShortcut(KeyCode.ENTER);

    hl.addComponent(lab = new Label());
    lab.setWidth("20px"); // don't run off the end
}