List of usage examples for com.vaadin.ui Alignment TOP_CENTER
Alignment TOP_CENTER
To view the source code for com.vaadin.ui Alignment TOP_CENTER.
Click Source Link
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
@SuppressWarnings("serial") @HibernateOpened/* ww w. j a va 2s . c om*/ @HibernateRead @HibernateClosed public void initGuiTL() { VerticalLayout outerVl = this; outerVl.setWidth("100%"); outerVl.setSpacing(true); cardMarkingPanel = makeCardMarkingPanelTL(); Card c = Card.getTL(cardId); MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); User me = globs.getUserTL(); if (c.isHidden() && !me.isAdministrator() && !me.isGameMaster()) { // This case should only come into play when a non-gm user is showing this page // by explicitly using the url. Not too frequent an occurance. Label lab = new Label("This card is not active"); lab.addStyleName("m-cardlarge-hidden-label"); outerVl.setHeight("300px"); outerVl.addComponent(lab); outerVl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); return; } loadMarkingPanel_oobTL(c); // won't have Roles lazily update w/out above loadMarkingPanel_oob(DBGet.getCard(cardId)); markingRadioGroup.addValueChangeListener(markingListener = new MarkingChangeListener()); // Top part topHL = new HorizontalLayout(); addComponent(topHL); topHL.setWidth("95%"); setComponentAlignment(topHL, Alignment.TOP_CENTER); // Card columns listsHL = new HorizontalLayout(); addComponent(listsHL); listsHL.setSpacing(true); setComponentAlignment(listsHL, Alignment.TOP_CENTER); addChildListsTL(); chainButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); AppEvent evt = new AppEvent(CARDCHAINPOPUPCLICK, CardChainPage.this, cardId); Mmowgli2UI.getGlobals().getController().miscEventTL(evt); HSess.close(); return; } }); }
From source file:edu.nps.moves.mmowgli.modules.cards.PlayAnIdeaPage2.java
License:Open Source License
@Override public void initGui() { setSpacing(true);/*from w w w . j ava2s . com*/ Label lab = new Label(); lab.setWidth(CALLTOACTION_HOR_OFFSET_STR); addComponent(lab); MovePhase phase = MovePhase.getCurrentMovePhaseTL(); String playTitle = phase.getPlayACardTitle(); if (playTitle != null && playTitle.length() > 0) { addComponent(lab = new Label(playTitle)); setComponentAlignment(lab, Alignment.TOP_CENTER); lab.addStyleName("m-calltoaction-playprompt"); } AbsoluteLayout mainAbsL = new AbsoluteLayout(); mainAbsL.setWidth(PAIP_WIDTH); mainAbsL.setHeight("675px"); addComponent(mainAbsL); // do this at the bottom so z order is top: mainAbsL.addComponent(topHL = new HorizontalLayout(),"top:0px;left:0px"); topHL = new HorizontalLayout(); topHL.addComponent(leftAbsL = new AbsoluteLayout()); topHL.addComponent(rightAbsL = new AbsoluteLayout()); leftAbsL.setWidth(PAIP_HALFWIDTH); rightAbsL.setWidth(PAIP_HALFWIDTH); leftAbsL.setHeight(PAIP_TOP_HEIGHT); rightAbsL.setHeight(PAIP_TOP_HEIGHT); GameLinks gl = GameLinks.getTL(); final String howToPlayLink = gl.getHowToPlayLink(); if (howToPlayLink != null && howToPlayLink.length() > 0) { howToPlayButt = new NativeButton(null); BrowserWindowOpener bwo = new BrowserWindowOpener(howToPlayLink); bwo.setWindowName(MmowgliConstants.PORTALTARGETWINDOWNAME); bwo.extend(howToPlayButt); } else if (mockupOnly) howToPlayButt = new NativeButton(null); else howToPlayButt = new IDNativeButton(null, HOWTOPLAYCLICK); leftAbsL.addComponent(howToPlayButt, HOWTO_POS); leftType = CardType.getCurrentPositiveIdeaCardTypeTL(); leftAbsL.addComponent(poshdr = CardSummaryListHeader.newCardSummaryListHeader(leftType, mockupOnly, null), POS_POS); poshdr.initGui(); poshdr.addNewCardListener(newCardListener); if (mockupOnly) gotoDashboardButt = new NativeButton(null); else gotoDashboardButt = new IDNativeButton(null, IDEADASHBOARDCLICK); rightAbsL.addComponent(gotoDashboardButt, GOTO_POS); rightType = CardType.getCurrentNegativeIdeaCardTypeTL(); rightAbsL.addComponent(neghdr = CardSummaryListHeader.newCardSummaryListHeader(rightType, mockupOnly, null), NEG_POS); neghdr.initGui(); neghdr.addNewCardListener(newCardListener); howToPlayButt.setStyleName("m-howToPlayButton"); gotoDashboardButt.setStyleName("m-gotoIdeaDashboardButton"); // end of top gui VerticalLayout bottomVLay = new VerticalLayout(); mainAbsL.addComponent(bottomVLay, "top:200px;left:0px"); mainAbsL.addComponent(topHL, "top:0px;left:0px"); // doing this at the bottom so z order is top: HorizontalLayout hLay = buildLabelPopupRow(leftType.getTitle(), topNewCardLabel = new Label("new card played")); bottomVLay.addComponent(hLay); bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT); User me = Mmowgli2UI.getGlobals().getUserTL(); topholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly, "top"); bottomVLay.addComponent(topholder); ; topholder.initGui(); bottomVLay.addComponent(lab = new Label()); lab.setHeight("10px"); hLay = buildLabelPopupRow(rightType.getTitle(), bottomNewCardLabel = new Label("new card played")); bottomVLay.addComponent(hLay); bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT); bottomholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly, "bottom"); bottomVLay.addComponent(bottomholder); bottomholder.initGui(); MCacheManager cMgr = AppMaster.instance().getMcache(); if (mockupOnly) { addCardsTL(topholder, cMgr.getPositiveIdeaCardsCurrentMove()); addCardsTL(bottomholder, cMgr.getNegativeIdeaCardsCurrentMove()); } else { Game g = Game.getTL(); if (g.isShowPriorMovesCards() || me.isAdministrator()) { addCardsTL(topholder, cMgr.getAllPositiveIdeaCards()); addCardsTL(bottomholder, cMgr.getAllNegativeIdeaCards()); } else if (!g.isShowPriorMovesCards()) { addCardsTL(topholder, cMgr.getPositiveUnhiddenIdeaCardsCurrentMove()); addCardsTL(bottomholder, cMgr.getNegativeUnhiddenIdeaCardsCurrentMove()); } } }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.EventMonitorPanel.java
License:Open Source License
@Override public void initGui() { setWidth("950px"); addStyleName("m-greyborder"); addStyleName("m-background-lightgrey"); addStyleName("m-marginleft-25"); setMargin(true);/*from ww w . ja va 2 s . c o m*/ setSpacing(false); buildTopInfo(this); pan = new Panel(); addComponent(pan); pan.setWidth("99%"); pan.setHeight(PANEL_HEIGHT); vLay = new VerticalLayout(); vLay.setMargin(true); pan.setContent(vLay); setComponentAlignment(pan, Alignment.TOP_CENTER); pan.addStyleName("m-greyborder"); NativeButton moreButt = new NativeButton("Get another page of prior events", this); addComponent(moreButt); setComponentAlignment(moreButt, Alignment.TOP_RIGHT); Label lab; addComponent(lab = new Label()); lab.setHeight("10px"); addComponent(new Label("Broadcast message to game masters")); messageTA = new TextArea(); messageTA.setRows(2); messageTA.setWidth("100%"); addComponent(messageTA); NativeButton sendButt = new NativeButton("Send", new SendListener()); addComponent(sendButt); loadEvents(); }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.UserAdminPanel.java
License:Open Source License
private void addTableToLayout(Object selectedUserId) { tableContainer.addComponent(table);/* w w w. j a va2s . co m*/ tableContainer.setComponentAlignment(table, Alignment.TOP_CENTER); table.setValue(selectedUserId); tableContainer.setExpandRatio(table, 1.0f); }
From source file:edu.nps.moves.mmowgli.modules.maps.OpenLayersMap.java
License:Open Source License
public void initGuiTL() { setSpacing(true);// ww w. j av a 2 s . co m setSizeUndefined(); setWidth("100%"); addStyleName("m-marginleft-20"); Label lab; addComponent(lab = new HtmlLabel(title)); lab.setWidth(null); setComponentAlignment(lab, Alignment.MIDDLE_CENTER); CssLayout cssLay = new CssLayout(); cssLay.addStyleName("m-greybackground"); cssLay.addStyleName("m-darkgreyborder"); cssLay.setWidth("960px"); cssLay.setHeight("600px"); cssLay.setId("mmowgliMap"); addComponent(cssLay); setComponentAlignment(cssLay, Alignment.TOP_CENTER); /* See http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example This requires the "http://openlayers.org/api/OpenLayers.js" file to be loaded: see the annotation in Mmowgli2UI.java. */ /* One example layer: String js = "var m_map = new OpenLayers.Map('mmowgliMap');"+ "var m_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\","+ "\"http://vmap0.tiles.osgeo.org/wms/vmap0\", {layers: 'basic'} );"+ "m_map.addLayer(m_wms);"+ "m_map.zoomToMaxExtent();"; */ String jsOSM = "mMap = new OpenLayers.Map('mmowgliMap');" + // "shadeLayer = new OpenLayers.Layer.WMS("+ // "\"Shaded Relief\"," + // "\"http://ims.cr.usgs.gov:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3\","+ // "{layers: HR-NED.IMAGE, reaspect: false, transparent: true, visibility: false}); "+ "var osLay = new OpenLayers.Layer.OSM();" + "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");" + // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");" + // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);" + "var zoom = 15;" + " mMap.addLayer(osLay);" + //" mMap.addLayer(shadeLayer);"+ //" mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ " mMap.setCenter(position, zoom );"; /* String worldWind = "mMap = new OpenLayers.Map('mmowgliMap', {'maxResolution': .28125, tileSize: new OpenLayers.Size(512, 512)});"+ "var osLay = new OpenLayers.Layer.OSM();"+ "var ol_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\", \"http://vmap0.tiles.osgeo.org/wms/vmap0?\", {layers: 'basic'} );"+ // "var ww = new OpenLayers.Layer.WorldWind( \"Bathy\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx?\", 36, 4,{T:\"bmng.topo.bathy.200406\"});"+ // "var ww2 = new OpenLayers.Layer.WorldWind( \"LANDSAT\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx\", 2.25, 4,{T:\"105\"});"+ "mMap.addLayers([osLay]); //,ol_wms]);"+ //, ww, ww2]);"+ // "mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");"+ // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");"+ // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);"+ "var zoom = 15;"+ //"mMap.setCenter(new OpenLayers.LonLat(-71.4, 42.3), 6);"+ " mMap.setCenter(position, zoom );"+ ""; */ JavaScript.getCurrent().execute(jsOSM); }
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) {//from w w w. ja va2s .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.PasswordResetPopup.java
License:Open Source License
@SuppressWarnings("serial") public PasswordResetPopup(Button.ClickListener listener, String uname) { setCaption("Password Reset"); VerticalLayout vLay = new VerticalLayout(); vLay.setSpacing(true);/* w w w. j a va 2 s . co m*/ vLay.setMargin(true); setContent(vLay); vLay.addComponent(new HtmlLabel( "<center>Please fill in your player name and/or email address<br/>to initiate a password reset.</center>")); // Use an actual form widget here for data binding and error display. FormLayout formLay = new FormLayout(); formLay.setSizeUndefined(); formLay.setSpacing(true); formLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield) vLay.addComponent(formLay); vLay.setComponentAlignment(formLay, Alignment.TOP_CENTER); formLay.addComponent(userIDTf = new TextField("Player name:")); userIDTf.addStyleName("m-dialog-textfield"); userIDTf.setWidth("85%"); userIDTf.setTabIndex(100); // Help out a little here userIDTf.setValue(uname == null ? "" : uname); formLay.addComponent(emailTf = new TextField("Email:")); emailTf.addStyleName("m-dialog-textfield"); emailTf.setWidth("85%"); emailTf.setTabIndex(101); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setMargin(false); hl.setWidth("100%"); vLay.addComponent(hl); Label lab; hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); Button cancelButt = new Button("Cancel"); hl.addComponent(cancelButt); cancelButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { getUI().setScrollTop(0); getUI().removeWindow(PasswordResetPopup.this); } }); cancelButt.setClickShortcut(ShortcutAction.KeyCode.ESCAPE); Button continueButt = new Button("Continue"); hl.addComponent(continueButt); continueButt.addClickListener(PasswordResetPopup.this); continueButt.setClickShortcut(ShortcutAction.KeyCode.ENTER); emailTf.focus(); }
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.j a 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);//from www . ja va 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."); 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 .java2s. 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(" ")); ; 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 }