Example usage for com.vaadin.ui VerticalLayout VerticalLayout

List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout

Introduction

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

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

From source file:ch.bfh.ti.soed.hs16.srs.view.views.LoginView.java

License:Open Source License

public LoginView(Navigator nav) {

    /* init objects */
    this.layout = new VerticalLayout();
    this.btn = new Button("Login");
    this.loginFld = new TextField("username");
    this.pwFld = new PasswordField("password");
    this.header = new Header();
    this.footer = new Footer("BFH", "Biel-Bienne", "Schweiz");

    /* add to css */
    this.layout.setPrimaryStyleName("rootLogin");
    this.btn.setStyleName("buttonLogin");

    /* add components to layout */
    this.layout.addComponent(this.header.getHeaderLayout());
    this.layout.addComponents(this.loginFld, this.pwFld, this.btn);
    this.layout.addComponent(this.footer.getFooterLayout());
    setCompositionRoot(layout);//from   w w  w. j a v  a 2  s . c  o  m

    /* event handling */
    this.btn.addClickListener((Button.ClickListener) clickEvent -> {
        // handle userlogin
        nav.navigateTo("RoomView");
    });
}

From source file:ch.bfh.ti.soed.hs16.srs.white.concept.AbstractTableView.java

License:Open Source License

@Override
public Component load() {
    VerticalLayout usersLayout = new VerticalLayout();
    List data = abstractTableController.getData();

    usersLayout.addComponent(createHeader());

    for (Object e : data) {
        Component itemView = createItemView(e);
        usersLayout.addComponent(itemView);
    }//from   w  w w .j  a  va  2s  . c  om

    usersLayout.setMargin(true);
    usersLayout.setSpacing(true);

    return usersLayout;
}

From source file:ch.bfh.ti.soed.hs16.srs.white.view.AdminView.java

License:Open Source License

@Override
public Component load() {
    HorizontalLayout layout = new HorizontalLayout();
    UsersView usersView = new UsersView(this);
    RoomsView roomsView = new RoomsView(this);

    usersView.loadController();//from w w  w . jav  a  2s .  co m
    roomsView.loadController();

    VerticalMenu menuLayout = new VerticalMenu();
    menuLayout.setStyleName("menu-container");

    CustomMenuItem item1 = new CustomMenuItem("Users", "users");
    item1.addClickListener(event -> changeContent(usersView));

    CustomMenuItem item2 = new CustomMenuItem("Rooms", null);
    item2.addClickListener(event -> changeContent(roomsView));

    menuLayout.addMenuItem(item1);
    menuLayout.addMenuItem(item2);

    changeableContent = new VerticalLayout();
    changeContent(usersView);
    changeableContent.setStyleName("changeable-container");
    changeableContent.setResponsive(true);

    layout.addComponents(menuLayout, changeableContent);

    return layout;
}

From source file:ch.bfh.ti.soed.hs16.srs.white.view.LogInView.java

License:Open Source License

@Override
public Component load() {
    final VerticalLayout formContainer = new VerticalLayout();
    formContainer.setStyleName("login-form");
    formContainer.setWidthUndefined();//from ww  w  .  java  2 s  .co  m

    fieldMail.setCaption("Type your mail here:");
    fieldMail.setStyleName("textfield-form");
    fieldMail.setTabIndex(1);
    fieldMail.focus();

    fieldPassword.setCaption("Type your password here:");
    fieldPassword.setTabIndex(2);
    fieldPassword.setStyleName("textfield-form");

    btnLogin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    btnLogin.setTabIndex(3);
    btnLogin.addClickListener(e -> {
        switch (logInController.login()) {
        case ADMIN:
            AbstractView adminView = new AdminView();
            ApplicationController appController = ApplicationController.getInstance();
            appController.loadView(adminView);
            break;
        case USER:
            // Load the user view here
        default:
            break;
        }
    });

    btnLogin.setStyleName("button-center");
    btnLogin.setTabIndex(4);
    btnLogin.setWidth("91px");

    btnRegister.addClickListener(e -> {
        RegistrationView rView = new RegistrationView(this);
        ApplicationController applicationController = ApplicationController.getInstance();
        applicationController.loadView(rView);
    });
    btnRegister.setStyleName("button-center");
    btnRegister.setWidth("91px");

    labelMessage.setStyleName("horizontal-center");
    labelMessage.setSizeUndefined();

    final HorizontalLayout layoutButtons = new HorizontalLayout();

    layoutButtons.addComponents(btnLogin, btnRegister);
    layoutButtons.setStyleName("horizontal-center");
    layoutButtons.setMargin(true);
    layoutButtons.setSpacing(true);

    formContainer.addComponents(fieldMail, fieldPassword, layoutButtons, labelMessage);
    formContainer.setMargin(true);
    formContainer.setSpacing(true);

    Responsive.makeResponsive(formContainer);

    return formContainer;
}

From source file:ch.bfh.ti.soed.hs16.srs.white.view.RegistrationView.java

License:Open Source License

@Override
public Component load() {
    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("registration-form");

    fieldFirstName.setStyleName("textfield-form");
    fieldLastName.setStyleName("textfield-form");
    fieldEmail.setStyleName("textfield-form");
    fieldConfirmEmail.setStyleName("textfield-form");
    fieldPassword.setStyleName("textfield-form");
    fieldConfirmPassword.setStyleName("textfield-form");

    btnSubmit.setStyleName("button-center");
    btnSubmit.setWidth("91px");
    btnSubmit.addClickListener(e -> registrationController.register());

    btnCancel.setStyleName("button-center");
    btnCancel.setWidth("91px");
    btnCancel.addClickListener(e -> registrationController.goBack(getLastView()));

    final HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.addComponents(btnSubmit, btnCancel);
    layoutButtons.setStyleName("horizontal-center");
    layoutButtons.setMargin(true);//w ww.j  a  v a2 s.  com
    layoutButtons.setSpacing(true);

    labelMessage.setStyleName("horizontal-center");
    labelMessage.setSizeUndefined();

    layout.addComponents(fieldFirstName, fieldLastName, fieldEmail, fieldConfirmEmail, fieldPassword,
            fieldConfirmPassword, layoutButtons, labelMessage);

    return layout;
}

From source file:ch.bfh.ti.soed.hs16.srs.white.view.TemplateLayout.java

License:Open Source License

@Override
public Controller loadController() {
    ApplicationController applicationController = ApplicationController.getInstance();
    this.body = new VerticalLayout();

    applicationController.setBody(this.body);

    return applicationController;
}

From source file:ch.vorburger.vaadin.designer.samplescreen.SampleFixedScreenComponent.java

License:Apache License

@AutoGenerated
private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);//from   w w  w . j a va2s.c o  m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    screenTitle = new Label();
    screenTitle.setImmediate(false);
    screenTitle.setWidth("-1px");
    screenTitle.setHeight("-1px");
    mainLayout.addComponent(screenTitle);

    // tabSheet
    tabSheet = buildTabSheet();
    mainLayout.addComponent(tabSheet);
    mainLayout.setExpandRatio(tabSheet, 1.0f);

    return mainLayout;
}

From source file:cirad.cgh.vcf2fasta.Vcf2fastaUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    config = initConfig();//from www  .  j  a va  2 s  . c  o  m

    Panel mainPanel = new Panel("Vcf2fasta");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    mainPanel.setContent(layout);

    vcf2fastaForm = new Vcf2fastaForm(this, config);
    vcf2fastaForm.setFormSubmitHandler(getSubmitClickListener(this));

    layout.addComponent(vcf2fastaForm);

    setTheme("tests-valo-reindeer");
    //setTheme("tests-valo-facebook");
    //setTheme("tests-valo-metro");

    setContent(mainPanel);
}

From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java

License:Open Source License

private void initComponents() {
    removeAllComponents();/*from w w  w .j a va 2s . c o  m*/

    fieldGroup = new BeanFieldGroup<Vcf2fastaInputBean>(Vcf2fastaInputBean.class);
    vcf2fastaInputBean = new Vcf2fastaInputBean(config);
    fieldGroup.setItemDataSource(vcf2fastaInputBean);

    FormLayout layout = new FormLayout();
    layout.setResponsive(true);
    layout.setMargin(true);
    layout.setWidth("100%");
    //layout.addStyleName("light");
    layout.setImmediate(true);
    addComponent(layout);

    Label section1;
    final ComboBox analysis_combo;
    final ComboBox accession_combo;
    Label section2;
    ComboBox contig_combo;
    TextField interval;
    Label section3;
    Component buttonLayout;
    Component progressLayout;

    section1 = new Label("Input");
    section1.addStyleName("h3 colored");
    layout.addComponent(section1);
    analysis_combo = getComboBox(ANALYSIS_CAPTION, ANALYSIS, getAnalysesList(), false);
    layout.addComponent(analysis_combo);
    accession_combo = getComboBox(ACCESSION_CAPTION, ACCESSION,
            getAccessionsList("Cassava 6.1 WGS Bredeson 61 accessions"), false);
    layout.addComponent(accession_combo);

    analysis_combo.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            accession_combo.setContainerDataSource(getAccessionsList((String) analysis_combo.getValue()));
            accession_combo.select(accession_combo.getContainerDataSource().getItemIds().iterator().next());
        }
    });

    section2 = new Label("Parameters");
    section2.addStyleName("h3 colored");
    layout.addComponent(section2);
    contig_combo = getComboBox(CONTIG_CAPTION, CONTIG, getContigsList(), true);
    layout.addComponent(contig_combo);
    interval = getTextField(INTERVAL_CAPTION, INTERVAL, vcf2fastaUI.getConfig().getString("defaultInterval"),
            20);
    layout.addComponent(interval);

    section3 = new Label("Result");
    section3.addStyleName("h3 colored");
    layout.addComponent(section3);
    resultLayout = new VerticalLayout();
    resultLayout.setSizeFull();
    resultLayout.setMargin(true);
    resultLayout.setSpacing(true);
    resultLayout.addStyleName("light");
    layout.addComponent(resultLayout);

    layout.addComponent(new Label(""));

    buttonLayout = getSubmitLayout();
    layout.addComponent(buttonLayout);
    progressLayout = getProgressLayout();
    layout.addComponent(progressLayout);

    initCommitHandler();
}

From source file:com.aaron.mbpet.views.users.UserEditor.java

License:Apache License

public UserEditor(Item personItem, String lableText, boolean mode) {
    this.editMode = mode;
    //       this.setModal(true);
    center();/*from   w ww  .j  a  va  2  s.co  m*/
    setResizable(true);
    setClosable(true);
    setModal(true);
    //      setSizeUndefined();
    setWidth(25, Unit.EM);

    this.currsessionuser = ((MbpetUI) UI.getCurrent()).getSessionUser();

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);

    this.personItem = personItem;
    editorForm = new Form();
    editorForm.setFormFieldFactory(this);
    editorForm.setBuffered(true);
    editorForm.setImmediate(true);
    editorForm.setItemDataSource(personItem,
            Arrays.asList("firstname", "lastname", "email", "username", "password", "organization"));

    //buttons        
    saveButton = new Button("Save", this);
    saveButton.setClickShortcut(KeyCode.ENTER);
    cancelButton = new Button("Cancel", this);
    saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setWidth("100%");
    buttons.addComponents(saveButton, cancelButton);
    buttons.setComponentAlignment(saveButton, Alignment.BOTTOM_LEFT);
    buttons.setComponentAlignment(cancelButton, Alignment.BOTTOM_RIGHT);

    //        editorForm.getFooter().addComponent(buttons);
    //        editorForm.getFooter().addComponent(cancelButton);

    layout.addComponent(new Label("<h3>" + lableText + "</h3>", ContentMode.HTML));
    layout.addComponent(editorForm);
    layout.setComponentAlignment(editorForm, Alignment.MIDDLE_CENTER);
    layout.addComponent(buttons);

    setContent(layout); //editorForm
    setCaption(buildCaption());
}