Example usage for com.vaadin.ui Alignment TOP_CENTER

List of usage examples for com.vaadin.ui Alignment TOP_CENTER

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment TOP_CENTER.

Prototype

Alignment TOP_CENTER

To view the source code for com.vaadin.ui Alignment TOP_CENTER.

Click Source Link

Usage

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

License:Open Source License

@HibernateSessionThreadLocalConstructor
public RegistrationPagePopupFirstB(ClickListener listener, Long uId) {
    super(listener);
    super.initGui();
    localUserId = uId;/*from  w  w w.ja v  a 2 s  .c o m*/

    setTitleString("The following is not revealed to other players.", true); //smaller

    contentVLayout.setSpacing(true);

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

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

    formLay.addComponent(firstNameTf = new TextField("First name *"));
    firstNameTf.setColumns(27); // sets width
    firstNameTf.setInputPrompt("optional");
    // firstNameTf.setRequired(true);
    // firstNameTf.setRequiredError("We really need a location.");

    formLay.addComponent(lastNameTf = new TextField("Last name *"));
    lastNameTf.setColumns(27); // sets width
    lastNameTf.setInputPrompt("optional");
    // lastNameTf(true);
    // lastNameTf("We really need a location.");

    contentVLayout.addComponent(lab = new Label("* private information (encrypted in database)"));
    lab.addStyleName("m-dialog-text");
    lab.setWidth(null); // makes it undefined so it's not 100%
    contentVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

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

    HorizontalLayout hl;
    contentVLayout.addComponent(hl = new HorizontalLayout());
    hl.setMargin(false);

    hl.addComponent(lab = new Label());
    lab.setWidth("50px");
    hl.addComponent(lab = new Label("Choose an avatar image:"));
    lab.addStyleName("m-dialog-text"); //"m-dialog-label");

    chooser = new AvatarPanel(null); // no initselected
    chooser.setWidth("500px"); //"470px"); // doesn't work well w/ relative width 470=min for displaying 4 across of size below
    //  chooser.setHeight("130px"); // 125 enough for mac to show complete image plus bottom scrollbar, IE 7 will ALWAYS show vert scroller
    // todo, check commented-out line on windows...works well on new macs.
    chooser.initGui();
    contentVLayout.addComponent(chooser);
    contentVLayout.setComponentAlignment(chooser, Alignment.TOP_CENTER);
    chooser.setSelectedAvatarIdx(0); // choose the first one just so something is chosen

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

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

    continueButt = new NativeButton(null);
    continueButt.setStyleName("m-continueButton");
    //NativeButton continueButt = new NativeButton();
    hl.addComponent(continueButt);
    //app.globs().mediaLocator().decorateDialogContinueButton(continueButt);
    continueButt.addClickListener(new MyContinueListener());
    continueButt.setClickShortcut(KeyCode.ENTER);

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

    // if this is a cac-based registration, initialize the tf's with the cac card.
    // then, if the cac values are require to be used, mark the tf's as read-only
    CACData cData = Mmowgli2UI.getGlobals().getCACInfo();
    if (CACManager.isCacPresent(cData)) {
        Game g = Game.getTL();
        boolean force = g.isEnforceCACdataRegistration();

        String s;
        if ((s = CACManager.getFirstName(cData)) != null) {
            firstNameTf.setValue(s);
            firstNameTf.setReadOnly(force);
        }
        if ((s = CACManager.getLastName(cData)) != null) {
            lastNameTf.setValue(s);
            lastNameTf.setReadOnly(force);
        }
        /*
        if((s = CACManager.getEmail(cData))!=null) {
          emailTf.setValue(s);
          emailTf.setReadOnly(force);
        }
        */
    }

    firstNameTf.focus(); // should do it
    FocusHack.focus(firstNameTf); // this does
}

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

License:Open Source License

public RegistrationPagePopupSecond(Button.ClickListener listener, Long uId) {
    super(listener);
    super.initGui();
    localUserId = uId;//from ww w  . ja  va 2 s.c  om
    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.userprofile.UserProfileMyIdeasPanel2.java

License:Open Source License

public void showAllMyIdeas() {
    if (lastTable != null) {
        getRightLayout().removeComponent(lastTable);
        lastTable = null;/*from www .j a va2  s . com*/
    }
    if (allIdeasTab == null) {
        allIdeasTab = createAllIdeasTable();
    }
    getRightLayout().setSizeUndefined(); // if layout is full size, content goes in center, we want top
    getRightLayout().addComponent(allIdeasTab);
    getRightLayout().setComponentAlignment(allIdeasTab, Alignment.TOP_CENTER);
    allIdeasTab.setHeight("720px");
    allIdeasTab.setWidth("670px");
    lastTable = allIdeasTab;
}

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

License:Open Source License

private void showFavoritesOrBuilds2(Component c) {
    //getRightLayout().setSizeUndefined();  // if layout is full size, content goes in center, we want top
    getRightLayout().addComponent(c);//  w  w  w.  j av  a2  s  .  com
    getRightLayout().setComponentAlignment(c, Alignment.TOP_CENTER);
    c.setWidth("670px");
    c.setHeight("720px");
    lastTable = c;
}

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

License:Open Source License

public void showProfile() {
    if (lastTable != null) {
        getRightLayout().removeComponent(lastTable);
        lastTable = null;/*from   ww w.j a v a 2  s . c om*/
    }
    if (profile == null)
        profile = createProfileTL();
    getRightLayout().setSizeUndefined(); // if layout is full size, content goes in center, we want top
    getRightLayout().addComponent(profile);
    getRightLayout().setComponentAlignment(profile, Alignment.TOP_CENTER);

    lastTable = profile;
}

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

License:Open Source License

private Component createTable(HbnContainer<Card> cntnr, Object nullComponent) {
    Collection<?> ids = cntnr.getItemIds();
    if (ids.size() <= 0) {
        if (nullComponent instanceof String) {
            VerticalLayout vl = new VerticalLayout();
            vl.setWidth("670px");
            Label lab;//from  w  w  w  .  j  a  va2s  .co  m
            vl.addComponent(lab = new Label((String) nullComponent));
            lab.addStyleName("m-userprofile-tabpanel-font");
            lab.setSizeUndefined(); // prevents 100% w
            vl.setComponentAlignment(lab, Alignment.TOP_CENTER);
            vl.addComponent(lab = new Label());
            vl.setExpandRatio(lab, 1.0f);
            return vl;
        }
        return buildNoIdeasYet();
    }
    Table tab = new CardTableSimple(null, cntnr);
    tab.setPageLength(40);
    tab.addStyleName("m-greyborder");
    return tab;
}

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

License:Open Source License

@Override
public void initGui() {
    setWidth("960px");
    setHeight("750px"); // must fill the background
    setSpacing(false);//from   w  ww  . ja va2s . c o m

    leftLay = new VerticalLayout();
    leftLay.addStyleName("m-userprofiletabpanel-left");
    leftLay.setWidth("245px");// plus 45 padding 
    leftLay.setMargin(false);

    Label sp;
    leftLay.addComponent(sp = new Label());
    sp.setHeight("45px");

    leftLabel = new HtmlLabel("placeholder");
    leftLay.addComponent(leftLabel);

    leftAddedVL = new VerticalLayout();
    leftLay.addComponent(leftAddedVL);
    leftAddedVL.setWidth("100%");

    leftLay.addComponent(sp = new Label());
    sp.setHeight("1px");
    leftLay.setExpandRatio(sp, 1.0f); // bottom filler

    rightLay = new VerticalLayout();
    rightLay.setSizeUndefined(); // will expand with content

    rightLay.addStyleName("m-tabpanel-right");
    rightLay.addStyleName("m-userprofile-tabpanel-font");

    addComponent(leftLay);

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

    addComponent(rightLay);
    setComponentAlignment(rightLay, Alignment.TOP_CENTER); //del if no help
    this.setExpandRatio(rightLay, 1.0f);
}

From source file:edu.nps.moves.mmowgliMobile.ui.SigninPopover.java

License:Open Source License

public SigninPopover() {
    setWidth("300px");
    setHeight("350px");
    setClosable(false); // else it can be closed by clicking anywhere outside it

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);//from  w  ww  .  ja v  a 2s  .c  o m
    layout.setMargin(true);
    layout.addComponent(nameTF = new TextField("Player name"));
    nameTF.setWidth("100%");
    layout.addComponent(pwTF = new PasswordField("Password"));
    pwTF.setWidth("100%");

    Label lab;
    layout.addComponent(lab = new Label());
    lab.setHeight("25px");

    layout.addComponent(submitButt = new Button("Sign in", new SubmitListener()));
    submitButt.setSizeUndefined();

    layout.addComponent(errorLab = new HtmlLabel(""));
    layout.setComponentAlignment(errorLab, Alignment.TOP_CENTER);
    // Decorate with navigation view
    NavigationView content = new NavigationView(layout);
    content.setCaption("Sign in");
    setContent(content);
    // Have a close button
    /*
    Button close = new Button(null, this);
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    content.setRightComponent(close); 
    */
}

From source file:edu.nps.moves.security.PasswordResetUI.java

License:Open Source License

private void handleChangeTL(User user) {
    this.user = user;
    Game g = Game.getTL();/*from  w  w  w  . j av  a 2s . c o  m*/

    String brand = g.getCurrentMove().getTitle();
    Page.getCurrent().setTitle("Password reset for " + brand + " mmowgli");

    HorizontalLayout hLay = new HorizontalLayout();
    hLay.setMargin(true);
    hLay.setWidth("100%");
    setContent(hLay);

    GameLinks gl = GameLinks.getTL();
    String blog = gl.getBlogLink();
    Label lab;
    hLay.addComponent(lab = new Label());
    hLay.setExpandRatio(lab, 0.5f);

    VerticalLayout vl = new VerticalLayout();
    hLay.addComponent(vl);
    vl.setWidth(bannerWidthPx);

    hLay.addComponent(lab = new Label());
    hLay.setExpandRatio(lab, 0.5f);

    vl.addStyleName("m-greyborder");
    vl.setMargin(true);
    vl.setSpacing(true);

    vl.addComponent(lab = new HtmlLabel(""));
    lab.addStyleName("m-font-21-bold");
    lab.setSizeUndefined();
    vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);
    StringBuilder sb = new StringBuilder();
    sb.append(thanksHdr1);
    sb.append(blog);
    sb.append(thanksHdr2);
    sb.append(brand);
    sb.append(thanksHdr3);
    lab.setValue(sb.toString());

    vl.addComponent(lab = new HtmlLabel(""));
    lab.setHeight("15px");
    vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    FormLayout fLay = new FormLayout();
    fLay.setSizeUndefined();
    fLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield)
    vl.addComponent(fLay);
    vl.setComponentAlignment(fLay, Alignment.MIDDLE_CENTER);

    newPw = new PasswordField("New Password");
    newPw.setWidth("99%");
    fLay.addComponent(newPw);

    newPw2 = new PasswordField("Again, please");
    newPw2.setWidth("99%");
    fLay.addComponent(newPw2);

    HorizontalLayout buttLay = new HorizontalLayout();
    buttLay.setSpacing(true);
    vl.addComponent(buttLay);
    vl.setComponentAlignment(buttLay, Alignment.TOP_CENTER);

    NativeButton cancelButt = new NativeButton();
    cancelButt.setStyleName("m-cancelButton");
    buttLay.addComponent(cancelButt);
    buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT);

    saveButt = new NativeButton();
    saveButt.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    saveButt.setStyleName("m-continueButton"); //m-saveChangesButton");
    buttLay.addComponent(saveButt);
    buttLay.setComponentAlignment(saveButt, Alignment.BOTTOM_RIGHT);

    cancelButt.addClickListener(this);
    saveButt.addClickListener(this);
}

From source file:edu.vserver.exercises.videoMcq.QuestionForm.java

License:Apache License

/**
 * Builds UI components and the layout for them.
 *//*from www.  j a v a  2  s.com*/
private void doLayout() {

    VerticalLayout questionUI = new VerticalLayout();

    HorizontalLayout mainButtons = new HorizontalLayout();
    //mainButtons.setMargin(true);
    mainButtons.setSpacing(true);
    this.newQuestionBtn.setWidth(100, Unit.PIXELS);
    this.cancelButton.setWidth(100, Unit.PIXELS);
    this.saveButton.setWidth(100, Unit.PIXELS);
    mainButtons.addComponents(this.newQuestionBtn, this.cancelButton, this.saveButton);
    questionUI.addComponent(mainButtons);
    this.initTextFields();
    this.inputLayout.setSpacing(true);
    this.inputLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    VerticalLayout questionLayout = new VerticalLayout();

    this.timeLayout.setMargin(new MarginInfo(true, false, true, false));
    this.timeLayout.addComponents(new Label("<strong>Time:</strong>", ContentMode.HTML), this.timeLabel,
            new Label("<strong> / </strong>", ContentMode.HTML), this.durationLabel);
    this.timeLayout.setSpacing(true);
    questionLayout.addComponents(this.timeLayout, this.questionField);

    VerticalLayout correctAnswers = new VerticalLayout();
    correctAnswers.addComponents(this.answerField, this.answerDescriptionField);

    VerticalLayout wrongAnswers = new VerticalLayout();
    wrongAnswers.setCaption("Incorrect answer choices");
    HorizontalLayout wrongAnswerButtons = new HorizontalLayout();
    wrongAnswerButtons.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    wrongAnswerButtons.setSpacing(true);
    wrongAnswerButtons.setMargin(true);
    wrongAnswerButtons.addComponents(this.addIncorrectAnswer, this.clearIncorrectAnswers);

    Panel wrongAswersScroller = new Panel();
    wrongAswersScroller.setSizeUndefined();
    wrongAswersScroller.setHeight(100, Unit.PIXELS);
    wrongAswersScroller.setWidth(215, Unit.PIXELS);
    wrongAswersScroller.addStyleName("borderless");

    wrongAswersScroller.setContent(this.wrongAnswersLayout);
    wrongAnswers.addComponents(wrongAnswerButtons, wrongAswersScroller);

    this.inputLayout.addComponents(questionLayout, correctAnswers, wrongAnswers);
    questionUI.addComponent(this.inputLayout);
    this.setCompositionRoot(questionUI);
}