Example usage for com.vaadin.ui Label setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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  ww .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);// w  w  w. jav a  2s. co m

    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.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);//  w  w  w  .j av a 2 s. c o  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.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);/* w  w  w.  ja  v  a2 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.");

    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.j a  v  a2 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;//  w w w.j a va 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
}

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

License:Open Source License

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

    Game g = Game.getTL();/*from w w w.j a v  a2  s .  c o  m*/

    setTitleString(g.getSecondLoginPermissionPageTitle());

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

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

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

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

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

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

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

    continueButt.setClickShortcut(KeyCode.ENTER);
}

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

License:Open Source License

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    contentVLayout.addComponent(buttPan);

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

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

License:Open Source License

@SuppressWarnings("serial")
private EditAwardTypeDialog(AwardType awt, EditAwardResultListener lis) {
    Object sessKey = HSess.checkInit();
    listener = lis;//from w  w w. java 2  s  . c  o  m
    awardType = awt;

    setCaption("Edit Award Type");
    setModal(true);
    setWidth("450px");

    VerticalLayout vLay = new VerticalLayout();
    setContent(vLay);
    vLay.setMargin(true);
    vLay.setSpacing(true);
    vLay.addStyleName("m-greybackground");

    FormLayout formLay;
    vLay.addComponent(formLay = new FormLayout());
    formLay.setSizeFull();

    formLay.addComponent(
            nameTF = new MTextField("Award Title").withFullWidth().withNullRepresentation("required field"));
    nameTF.setRequired(true);
    nameTF.setRequiredError("Required field");
    nameTF.setSizeFull();

    formLay.addComponent(
            descTF = new MTextField("Description").withFullWidth().withNullRepresentation("required field"));
    descTF.setRequired(true);
    descTF.setRequiredError("Required field");

    Label sp;

    formLay.addComponent(hLay55 = new HorizontalLayout());
    hLay55.setWidth("100%");
    hLay55.setCaption("55x55 pixel icon");
    hLay55.setSpacing(true);
    hLay55.addComponent(lab55 = new HtmlLabel("<i>image name</i>"));
    hLay55.setComponentAlignment(lab55, Alignment.MIDDLE_CENTER);
    hLay55.addComponent(butt55 = new NativeButton("Choose 55x55 image"));
    hLay55.setComponentAlignment(butt55, Alignment.MIDDLE_CENTER);
    hLay55.addComponent(sp = new Label());
    hLay55.setExpandRatio(sp, 1.0f);
    hLay55.addComponent(image55 = new Image(null));
    image55.setWidth("55px");
    image55.setHeight("55px");
    image55.addStyleName("m-greyborder3");

    formLay.addComponent(hLay300 = new HorizontalLayout());
    hLay300.setWidth("100%");
    hLay300.setCaption("300x300 pixel icon");
    hLay300.setSpacing(true);
    hLay300.addComponent(lab300 = new HtmlLabel("<i>image name</i>"));
    hLay300.setComponentAlignment(lab300, Alignment.MIDDLE_CENTER);
    hLay300.addComponent(butt300 = new NativeButton("Choose 300x300 image"));
    hLay300.setComponentAlignment(butt300, Alignment.MIDDLE_CENTER);
    hLay300.addComponent(sp = new Label());
    hLay300.setExpandRatio(sp, 1.0f);
    hLay300.addComponent(image300 = new Image(null));
    image300.setWidth("55px");
    image300.setHeight("55px");
    image300.addStyleName("m-greyborder3");

    ClickListener chooseIconListener = new ClickListener() {
        boolean is55 = false;

        @Override
        public void buttonClick(ClickEvent event) {
            is55 = (event.getButton() == butt55);
            String txt = (is55 ? pix55text : pix300text);
            InstallImageResultListener lis = new InstallImageResultListener() {
                @Override
                public void doneTL(MediaImage mimg) {
                    Media m = null;
                    if (mimg != null)
                        m = mimg.media;

                    if (m != null) {
                        MediaLocator mediaLoc = Mmowgli2UI.getGlobals().getMediaLocator();
                        String handle = m.getHandle();
                        if (handle != null && handle.trim().length() <= 0)
                            handle = null;
                        if (is55) {
                            media55 = m;
                            if (handle == null) {
                                m.setHandle("55x55");
                                Media.updateTL(m);
                            }
                            lab55.setValue(m.getUrl());
                            image55.setSource(mediaLoc.locate(m));
                        } else {
                            media300 = m;
                            if (handle == null) {
                                m.setHandle("300x300");
                                Media.updateTL(m);
                            }
                            lab300.setValue(m.getUrl());
                            image300.setSource(mediaLoc.locate(m));
                        }
                    }
                }
            };
            InstallImageDialog.show(txt, lis, is55 ? pix55filter : pix300filter);
        }
    };

    butt55.addClickListener(chooseIconListener);
    butt300.addClickListener(chooseIconListener);

    HorizontalLayout buttHL = new HorizontalLayout();
    vLay.addComponent(buttHL);
    buttHL.setWidth("100%");

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

    buttHL.addComponent(new NativeButton("Cancel", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            awardType = null;
            doneHereTL();
        }
    }));

    buttHL.addComponent(new NativeButton("Close", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            String title = nameTF.getValue().trim();
            String description = descTF.getValue().trim();
            if (title.length() <= 0 || description.length() <= 0 || media300 == null || media55 == null) {
                Notification.show("All fields must be completed", Notification.Type.ERROR_MESSAGE);
                return;
            }

            HSess.init();

            boolean save = false;
            if (awardType == null) {
                awardType = new AwardType();
                save = true;
            }

            awardType.setName(nameTF.getValue().trim());
            awardType.setDescription(descTF.getValue().trim());
            awardType.setIcon300x300(media300);
            awardType.setIcon55x55(media55);

            if (save)
                HSess.get().save(awardType);
            else
                HSess.get().update(awardType);

            doneHereTL();
            HSess.close();
        }
    }));

    HSess.checkClose(sessKey);
}

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

License:Open Source License

private void setCheck(HorizontalLayout row, boolean show) {
    Component c = row.getComponent(1); // second
    Component check = row.getComponent(0);
    if (!show) { // want to hide
        if (c instanceof Label)
            return; // I'm already hiding
        check.setVisible(false);/*from ww w  . j  a  v  a2 s  .c om*/
        Label sp;
        row.addComponent(sp = new Label(), 1);
        sp.setWidth("12px");
    } else { // want to show
        if (!(c instanceof Label))
            return; //I'm already showing
        check.setVisible(true);
        row.removeComponent(c);
    }
}