List of usage examples for com.vaadin.ui HorizontalLayout setExpandRatio
public void setExpandRatio(Component component, float ratio)
This method is used to control how excess space in layout is distributed among components.
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. ja 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 ww .j ava 2 s. c o 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(" ")); 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(" ")); 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();/*from w w w. ja v a 2 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> You need a new account for every game. </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);/* ww w.java2 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(" ")); ; 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 w w . j av a 2s.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(" ")); ; 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 av a 2s . 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;/*from w ww . j av a 2s . 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();/* w w w. java 2 s . co 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);//w w w .j ava 2s . c om contentVLayout.setMargin(true); contentVLayout.addStyleName("m-role-page"); Label lab; contentVLayout.addComponent(lab = new HtmlLabel( " 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.DefineAwardsDialog.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public DefineAwardsDialog() { setCaption("Define Player Award Types"); setModal(true);//from w w w .ja v a 2 s. com setSizeUndefined(); setWidth("700px"); setHeight("400px"); VerticalLayout vLay = new VerticalLayout(); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeFull(); setContent(vLay); vLay.addComponent(new HtmlLabel("<b>This dialog is not yet functional</b>")); Panel p = new Panel(); p.setWidth("99%"); p.setHeight("100%"); vLay.addComponent(p); vLay.setExpandRatio(p, 1.0f); gridLayout = new GridLayout(); gridLayout.addStyleName("m-headgrid"); gridLayout.setWidth("100%"); p.setContent(gridLayout); fillPanelTL(); HorizontalLayout buttPan = new HorizontalLayout(); buttPan.setWidth("100%"); buttPan.setSpacing(true); NativeButton addButt = new NativeButton("Add new type", new AddListener()); NativeButton delButt = new NativeButton("Delete type", new DelListener()); NativeButton saveButt = new NativeButton("Save", new SaveListener()); NativeButton cancelButt = new NativeButton("Cancel", new CancelListener()); buttPan.addComponent(addButt); buttPan.addComponent(delButt); Label lab; buttPan.addComponent(lab = new Label()); buttPan.setExpandRatio(lab, 1.0f); buttPan.addComponent(cancelButt); buttPan.addComponent(saveButt); vLay.addComponent(buttPan); //temp saveButt.setEnabled(false); delButt.setEnabled(false); }