Example usage for com.vaadin.ui FormLayout FormLayout

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

Introduction

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

Prototype

public FormLayout() 

Source Link

Usage

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private VerticalLayout getUDContainer(String strUID) {

    if (bee == null)
        bee = new UserDetailsBackEnd();

    hm = bee.getUD(strUID);/*from w  w w  .  java2s .c  o m*/

    String strProf = hm.get("Profile Type");

    VerticalLayout cAgentInfo = new VerticalLayout();
    cAgentInfo.setMargin(new MarginInfo(true, false, true, false));
    cAgentInfo.setStyleName("c_details_test");
    cAgentInfo.setSizeUndefined();

    FormLayout cBasic = new FormLayout();

    // cBasic.setSpacing(true);
    Label lbB = new Label();
    lbB.setCaption("General");
    lbB.setStyleName("label_search_user u_d_t");

    cBasic.addComponent(lbB);
    String cap = "First Name";
    TextField tF = new TextField(cap);
    tFFN = tF;
    tFFN.setRequired(true);
    tF.setValue(hm.get(cap));

    addDatum("Username", hm.get("Username"), cBasic);
    addDatum("Profile", strProf, cBasic);
    addDatum("Account Status", hm.get("Status"), cBasic);
    addDatum("First Name", hm.get("First Name"), cBasic);

    tF = new TextField("Middle Name");
    addDatum("Middle Name", hm.get("Middle Name"), cBasic);
    addDatum("Last Name", hm.get("Last Name"), cBasic);
    addDatum("Gender", hm.get("Gender"), cBasic);
    addDatum("Occupation", hm.get("Occupation"), cBasic);
    addDatum("Date of Birth", hm.get("Date of Birth"), cBasic);
    addDatum("Country", hm.get("Country"), cBasic);
    addDatum("State", hm.get("State"), cBasic);
    addDatum("Local Government", hm.get("Local Government"), cBasic);

    VerticalLayout cC = new VerticalLayout();

    HorizontalLayout cBAndCAndAcc = new HorizontalLayout();
    cBAndCAndAcc.addComponent(cBasic);
    cBAndCAndAcc.addComponent(cC);

    FormLayout cCompany = new FormLayout();
    // Label lbC = new Label("Company");
    Label lbC = new Label();
    lbC.setCaption("Identification");
    lbC.setStyleName("label_search_user lb_frm_add_user u_d_t");

    combo = new ComboBox("ID Type");

    combo.addItem("Passport Number");
    combo.addItem("National Registration Identification Number");
    combo.addItem("Drivers License Number");
    combo.addItem("Identification Card");
    combo.addItem("Employer Identification Number");
    combo.select("Passport Number");
    comboIDType = combo;
    comboIDType.setRequired(true);

    cCompany.addComponent(lbC);
    addDatum("ID Type", hm.get("ID Type"), cCompany);
    addDatum("ID No.", hm.get("ID No."), cCompany);
    addDatum("Issuer", hm.get("Issuer"), cCompany);
    addDatum("Issue Date", hm.get("Issue Date"), cCompany);
    addDatum("Expiry Date", hm.get("Expiry Date"), cCompany);
    cC.addComponent(cCompany);

    FormLayout pC = new FormLayout();
    lbC = new Label();
    lbC.setCaption("Primary Contacts");
    lbC.setStyleName("label_search_user u_d_t");
    pC.addComponent(lbC);
    addDatum("Mobile Phone No.", hm.get("P-Mobile Phone No."), pC);
    addDatum("Alt. Phone No.", hm.get("P-Alt. Phone No."), pC);
    addDatum("Email Address", hm.get("Email"), pC);
    cC.addComponent(pC);

    FormLayout sC = new FormLayout();
    lbC = new Label();
    lbC.setCaption("Secondary Contacts");
    lbC.setStyleName("label_search_user lb_frm_add_user u_d_t");
    sC.addComponent(lbC);
    addDatum("Mobile Phone No.", hm.get("S-Mobile Phone No."), sC);
    addDatum("Alt. Phone No.", hm.get("S-Alt. Phone No."), sC);
    addDatum("Email Address", hm.get("Email"), sC);
    cC.addComponent(sC);

    FormLayout physicalC = new FormLayout();
    lbC = new Label();
    lbC.setCaption("Physical Address");
    lbC.setStyleName("label_search_user lb_frm_add_user u_d_t");
    physicalC.addComponent(lbC);
    StringBuilder sbAddr = new StringBuilder();

    String strp = hm.get("Postal Code");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : "P.O.Box " + strp + ", ");
    strp = hm.get("Street");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", ");
    strp = hm.get("Province");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", ");

    strp = hm.get("State");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", ");

    strp = hm.get("Country");
    sbAddr.append((strp == null || strp.trim().isEmpty()) ? "." : strp);

    Label lb = new Label();
    lbC.setContentMode(ContentMode.HTML);

    lb.setStyleName("label_ud");
    lb.setCaption(sbAddr.toString());

    physicalC.addComponent(lb);

    cC.addComponent(physicalC);
    cC.addComponent(cBtnEditCancel);

    cC.setMargin(new MarginInfo(false, true, false, true));
    cAgentInfo.addComponent(cBAndCAndAcc);

    return cAgentInfo;
}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private HorizontalLayout getADC() {

    // Notification.show(strTbName);

    VerticalLayout cAgentInfo = new VerticalLayout();
    cAgentInfo.setMargin(new MarginInfo(true, true, true, true));
    cAgentInfo.setStyleName("c_details_test");

    // VerticalLayout cAcc = new VerticalLayout();
    Label lbAcc = new Label();

    lbAcc.setCaption("Account");
    lbAcc.setStyleName("label_search_user lb_frm_add_user u_d_t");

    // lbC.setCaption("Identification");
    // lbC.setStyleName("label_search_user lb_frm_add_user u_d_t");
    // lbAcc.setStyleName("lb_frm_add_user");

    ComboBox comboHierarchy = null;/*ww w.  java  2 s  .  c o m*/

    comboHierarchy = new ComboBox("Profile");

    final FormLayout cLBody = new FormLayout();
    cLBody.addComponent(lbAcc);
    // cLBody.setSpacing(true);

    comboHierarchy.addItem(1);
    comboHierarchy.setItemCaption(1, "MATS_ADMIN_USER_PROFILE");
    comboHierarchy.select(1);
    comboProfile = comboHierarchy;
    comboProfile.setRequired(true);
    // cAcc.addComponent(comboHierarchy);

    addDatum("Profile", hm.get("Profile Type"), cLBody);

    TextField tF = new TextField("Username");
    tF.setValue("Livepwndz");
    tFUN = tF;
    tFUN.setRequired(true); // cLBody.addComponent(tF);

    addDatum("Username", hm.get("Username"), cLBody);

    tF = new TextField("MSISDN");
    tF.setValue("+256774191152");
    tFMSISDN = tF;
    tFMSISDN.setRequired(true); // cLBody.addComponent(tF);

    addDatum("MSISDN", hm.get("MSISDN"), cLBody);

    tF = new TextField("PIN"); // / cLBody.addComponent(tF);

    tF = new TextField("Email");
    tFAccEmail = tF;
    tFAccEmail.setRequired(true);
    tFAccEmail.setValue("ppounds1@gmail.com"); //
    // cLBody.addComponent(tF);
    addDatum("Email", hm.get("Email"), cLBody);

    combo = new ComboBox("Bank Domain");
    combo.addItem("Stanbic Bank");
    combo.select("Stanbic Bank");
    comboBDomain = combo; //
    // cLBody.addComponent(combo);
    addDatum("Bank Domain", hm.get("Bank"), cLBody);

    combo = new ComboBox("Bank Code ID");
    combo.addItem("001");
    combo.select("001");
    comboBID = combo; // cLBody.addComponent(combo);
    addDatum("Bank Code ID", hm.get("Bank Code"), cLBody);

    tF = new TextField("Bank Account");
    tF.setValue("00232333452315");
    tFBAcc = tF; // tFBAcc.setValidationVisible(true); //
    tFBAcc.addValidator(new NoNull()); // cLBody.addComponent(tF);
    addDatum("Bank Account", hm.get("Bank Account"), cLBody);

    combo.addItem(1);
    combo.setItemCaption(1, "US Dollars");
    combo.select(1);
    comboCur = combo; // cLBody.addComponent(combo);

    addDatum("Currency", hm.get("Currency"), cLBody);

    tF = new TextField("Clearing Number");
    tF.setValue("00212");
    tFClrNo = tF; // cLBody.addComponent(tF);
    addDatum("Clearing No. ", hm.get("Clearing No."), cLBody);

    String strNameCap = "Username";

    tF = new TextField(strNameCap);

    HorizontalLayout cAccBody = new HorizontalLayout();
    cAccBody.addComponent(cLBody);
    cLBody.addComponent(cBtnEditCancel);

    cLBody.setStyleName("c_body_visible");

    // cAcc.addComponent(cAccBody);
    cAgentInfo.addComponent(cLBody);

    // cBAndCAndAcc.addComponent(cAcc);
    HorizontalLayout c = new HorizontalLayout();
    c.addComponent(cAgentInfo);

    return c;

}

From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java

private HorizontalLayout getPC() {

    VerticalLayout cAgentInfo = new VerticalLayout();
    final HorizontalLayout cPlaceholder = new HorizontalLayout();
    cAgentInfo.setMargin(new MarginInfo(true, true, true, true));
    cAgentInfo.setStyleName("c_details_test");

    final VerticalLayout cLBody = new VerticalLayout();

    cLBody.setStyleName("c_body_visible");
    tb = new Table("Linked child accounts");
    // addLinksTable();

    final VerticalLayout cAllProf = new VerticalLayout();

    HorizontalLayout cProfActions = new HorizontalLayout();
    final FormLayout cProfName = new FormLayout();

    cProfName.setStyleName("frm_profile_name");
    cProfName.setSizeUndefined();// ww w .j a  va2 s  .c  o m

    final Label lbProf = new Label();
    final TextField tFProf = new TextField();

    lbProf.setCaption("Profile Name: ");
    lbProf.setValue("Certified Authorized User.");

    tFProf.setCaption(lbProf.getCaption());
    cProfName.addComponent(lbProf);

    final Button btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.setStyleName("btn_link");
    btnEdit.setDescription("Edit profile name");

    final Button btnCancel = new Button();
    btnCancel.setIcon(FontAwesome.UNDO);
    btnCancel.setStyleName("btn_link");
    btnCancel.setDescription("Cancel Profile name editting.");

    Button btnAdd = new Button("+");
    // btnAdd.setIcon(FontAwesome.EDIT);
    btnAdd.setStyleName("btn_link");
    btnAdd.setDescription("Set new profile");

    Button btnRemove = new Button("-");
    // btnRemove.setIcon(FontAwesome.EDIT);
    btnRemove.setStyleName("btn_link");
    btnRemove.setDescription("Remove current profile");

    // cProf.addComponent(cProfName);
    cProfActions.addComponent(btnEdit);
    cProfActions.addComponent(btnCancel);
    cProfActions.addComponent(btnAdd);
    cProfActions.addComponent(btnRemove);

    btnCancel.setVisible(false);

    cAllProf.addComponent(cProfName);
    cAllProf.addComponent(cProfActions);
    cAllProf.setComponentAlignment(cProfActions, Alignment.TOP_CENTER);

    cLBody.addComponent(cAllProf);

    // cLBody.addComponent(tb);

    tb.setSelectable(true);

    cAgentInfo.addComponent(cLBody);

    btnLink = new Button("Add New Link");
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.setDescription("Link new account.");

    // cLBody.addComponent(btnLink);
    // cLBody.setComponentAlignment(btnLink, Alignment.TOP_LEFT);
    btnLink.addClickListener(new LinkClickHandler());

    cPlaceholder.setVisible(false);
    addLinkUserContainer();
    cPlaceholder.setWidth("100%");

    cLBody.addComponent(cPlaceholder);
    cLBody.setComponentAlignment(cPlaceholder, Alignment.TOP_CENTER);
    HorizontalLayout c = new HorizontalLayout();
    c.addComponent(cAgentInfo);

    btnEdit.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8427226211153164650L;

        @Override
        public void buttonClick(ClickEvent event) {

            if (btnEdit.getIcon().equals(FontAwesome.EDIT)) {

                tFProf.setValue(lbProf.getValue());
                tFProf.selectAll();
                cProfName.replaceComponent(lbProf, tFProf);
                btnEdit.setIcon(FontAwesome.SAVE);
                btnCancel.setVisible(true);
                return;

            } else if (btnEdit.getIcon().equals(FontAwesome.SAVE)) {

                lbProf.setValue(tFProf.getValue());
                cProfName.replaceComponent(tFProf, lbProf);
                btnEdit.setIcon(FontAwesome.EDIT);
                btnCancel.setVisible(false);

                return;
            }
            lbProf.setValue(tFProf.getValue());
            cProfName.replaceComponent(tFProf, lbProf);
            btnEdit.setIcon(FontAwesome.EDIT);
            btnCancel.setVisible(false);

        }
    });

    btnCancel.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -2870045546205986347L;

        @Override
        public void buttonClick(ClickEvent event) {
            cProfName.replaceComponent(tFProf, lbProf);
            btnEdit.setIcon(FontAwesome.EDIT);
            btnCancel.setVisible(false);

        }
    });

    btnAdd.addClickListener(new AddProfileHandler(cAllProf, cPlaceholder));

    btnRemove.addClickListener(new RemoveProfileHandler(pop));

    return c;

}

From source file:com.terralcode.frontend.vista.widgets.alumno.AlumnoVista.java

private FormLayout buildLayout() {
    mainLayout = new FormLayout();
    mainLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    mainLayout.setMargin(new MarginInfo(true, false, false, false));

    buildDatosAlumno();//from   w w  w . j  a v a  2s  .c om

    tabDatos = new TabSheet();
    mainLayout.addComponent(tabDatos);

    buildDatosAlumnoExtras();
    buildEmpresaTab();
    buildDireccion();
    buildEstudiosTab();
    buildAyudasTab();

    return mainLayout;
}

From source file:com.terralcode.frontend.vista.widgets.alumno.DireccionVista.java

private FormLayout buildLayout() {
    mainLayout = new FormLayout();
    mainLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    mainLayout.setMargin(new MarginInfo(true, false, false, false));

    buildDireccion();//w w  w  .j  a  v a  2s .  c  o m

    return mainLayout;
}

From source file:com.terralcode.frontend.vista.widgets.empresa.EmpresaVista.java

private FormLayout buildLayout() {
    mainLayout = new FormLayout();
    mainLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    mainLayout.setMargin(new MarginInfo(true, false, false, false));

    //        buildAlumnoHeader();
    //        buildCustomerSpecies();
    //        buildCustomerAddresses();
    //        buildCustomerContacts();
    //        buildSales();
    //        buildAppointments();

    return mainLayout;
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private FormLayout buildAppointmentLayout() {
    rootLayout = new FormLayout();

    rootLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    rootLayout.setMargin(new MarginInfo(true, false, false, false));

    buildAppointmentHeader();/* ww w  .  j a  va 2 s. com*/
    buildAppointmentContent();
    buildAppointmentStatus();

    return rootLayout;
}

From source file:com.terralcode.gestion.frontend.view.widgets.customer.CustomerView.java

private FormLayout buildLayout() {
    mainLayout = new FormLayout();
    mainLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    mainLayout.setMargin(new MarginInfo(true, false, false, false));

    buildCustomerHeader();/*ww w.ja  v a2s . c  o m*/
    buildCustomerSpecies();
    buildCustomerAddresses();
    buildCustomerContacts();
    buildSales();
    buildAppointments();

    return mainLayout;
}

From source file:com.terralcode.gestion.frontend.view.widgets.example.crudtestform.CrudExampleForm.java

private void openProductWindow(Item beanItem, String caption) {
    Window window = new Window(caption);
    window.setModal(true);/*from ww  w .  j  a  v a 2s  .  co  m*/
    FormLayout layout = new FormLayout();
    layout.setMargin(true);
    window.setContent(layout);
    fieldGroup = new BeanFieldGroup<TestProduct>(TestProduct.class);
    fieldGroup.setItemDataSource(beanItem);
    for (Object propertyId : fieldGroup.getUnboundPropertyIds()) {
        layout.addComponent(fieldGroup.buildAndBind(propertyId));
    }
    layout.addComponent(createOkButton(window));
    getUI().addWindow(window);
}

From source file:com.trender.user.component.wizard.SetupStepWizardStudy.java

@Override
public Component getContent() {
    try {/*from   ww w . j a v  a  2 s. c  o  m*/
        content = new VerticalLayout();
        content.setSizeFull();
        content.setMargin(true);

        form = new FormLayout();
        form.addStyleName("light");

        mainText = new Label(" ");
        mainText.setStyleName("h2");
        form.addComponent(mainText);

        List<Question> question = questionService.getAll();
        questionField = new TextField[question.size()];

        for (int i = 0; i < question.size(); i++) {
            questionField[i] = new TextField(question.get(i).getValue());
            questionField[i].setWidth(95, Unit.PERCENTAGE);
            form.addComponent(questionField[i]);
        }

        content.addComponent(form);
    } catch (ServiceException ex) {
        Logger.getLogger(SetupStepWizardStudy.class.getName()).log(Level.SEVERE, null, ex);
    }
    return content;
}