Example usage for com.vaadin.ui FormLayout addComponent

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

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:com.skysql.manager.ui.components.ChartControls.java

License:Open Source License

/**
 * Instantiates a new chart controls./*from w  w w  .ja  va  2 s.com*/
 */
public ChartControls() {

    setSpacing(true);

    final FormLayout form1 = new FormLayout();
    form1.setSpacing(false);
    form1.setMargin(false);
    addComponent(form1);

    selectInterval = new NativeSelect("Charts Time Span");
    selectInterval.setImmediate(true);
    selectInterval.setNullSelectionAllowed(false);

    selectInterval.addItem(INTERVAL_5_MIN);
    selectInterval.addItem(INTERVAL_10_MIN);
    selectInterval.addItem(INTERVAL_30_MIN);
    selectInterval.addItem(INTERVAL_1_HOUR);
    selectInterval.addItem(INTERVAL_6_HOURS);
    selectInterval.addItem(INTERVAL_12_HOURS);
    selectInterval.addItem(INTERVAL_1_DAY);
    selectInterval.addItem(INTERVAL_1_WEEK);
    selectInterval.addItem(INTERVAL_1_MONTH);

    selectInterval.setItemCaption(INTERVAL_5_MIN, "5 Minutes");
    selectInterval.setItemCaption(INTERVAL_10_MIN, "10 Minutes");
    selectInterval.setItemCaption(INTERVAL_30_MIN, "30 Minutes");
    selectInterval.setItemCaption(INTERVAL_1_HOUR, "1 Hour");
    selectInterval.setItemCaption(INTERVAL_6_HOURS, "6 Hours");
    selectInterval.setItemCaption(INTERVAL_12_HOURS, "12 Hours");
    selectInterval.setItemCaption(INTERVAL_1_DAY, "1 Day");
    selectInterval.setItemCaption(INTERVAL_1_WEEK, "1 Week");
    selectInterval.setItemCaption(INTERVAL_1_MONTH, "1 Month");

    form1.addComponent(selectInterval);

    final FormLayout form2 = new FormLayout();
    form2.setSpacing(false);
    form2.setMargin(false);
    addComponent(form2);

    selectTheme = new NativeSelect("Theme");
    selectTheme.setImmediate(true);
    selectTheme.setNullSelectionAllowed(false);

    for (Themes theme : Themes.values()) {
        selectTheme.addItem(theme.name());
    }
    form2.addComponent(selectTheme);

}

From source file:com.skysql.manager.ui.components.ParametersLayout.java

License:Open Source License

/**
 * Instantiates a new parameters layout.
 *
 * @param runningTask the running task//w  w w.j  av  a 2  s  .  c  om
 * @param nodeInfo the node info
 * @param commandEnum the command enum
 */
public ParametersLayout(final RunningTask runningTask, final NodeInfo nodeInfo, Commands.Command commandEnum) {
    this.runningTask = runningTask;

    addStyleName("parametersLayout");
    setSizeFull();
    setSpacing(true);
    setMargin(true);

    params = new HashMap<String, String>();
    runningTask.selectParameter(params);

    switch (commandEnum) {
    case backup:
        backupLevel = new OptionGroup("Backup Level");
        backupLevel.setImmediate(true);
        backupLevel.addItem(BackupRecord.BACKUP_TYPE_FULL);
        backupLevel.setItemCaption(BackupRecord.BACKUP_TYPE_FULL, "Full");
        backupLevel.addItem(BackupRecord.BACKUP_TYPE_INCREMENTAL);
        backupLevel.setItemCaption(BackupRecord.BACKUP_TYPE_INCREMENTAL, "Incremental");
        addComponent(backupLevel);
        setComponentAlignment(backupLevel, Alignment.MIDDLE_LEFT);
        backupLevel.addValueChangeListener(new ValueChangeListener() {
            private static final long serialVersionUID = 0x4C656F6E6172646FL;

            public void valueChange(ValueChangeEvent event) {
                String level = (String) event.getProperty().getValue();
                params.put(PARAM_BACKUP_TYPE, level);
                if (level.equals(BackupRecord.BACKUP_TYPE_INCREMENTAL)) {
                    addComponent(prevBackupsLayout);
                    selectPrevBackup.select(firstItem);
                } else {
                    params.remove(PARAM_BACKUP_PARENT);
                    if (getComponentIndex(prevBackupsLayout) != -1) {
                        removeComponent(prevBackupsLayout);
                    }
                }
            }
        });

        backupLevel.setValue(BackupRecord.BACKUP_TYPE_FULL);
        isParameterReady = true;

    case restore:
        VerticalLayout restoreLayout = new VerticalLayout();
        restoreLayout.setSpacing(true);

        if (commandEnum == Command.restore) {
            addComponent(restoreLayout);
            FormLayout formLayout = new FormLayout();
            //formLayout.setMargin(new MarginInfo(false, false, true, false));
            formLayout.setMargin(false);
            restoreLayout.addComponent(formLayout);

            final NativeSelect selectSystem;
            selectSystem = new NativeSelect("Backups from");
            selectSystem.setImmediate(true);
            selectSystem.setNullSelectionAllowed(false);
            SystemInfo systemInfo = VaadinSession.getCurrent().getAttribute(SystemInfo.class);
            for (SystemRecord systemRecord : systemInfo.getSystemsMap().values()) {
                if (!systemRecord.getID().equals(SystemInfo.SYSTEM_ROOT)) {
                    selectSystem.addItem(systemRecord.getID());
                    selectSystem.setItemCaption(systemRecord.getID(), systemRecord.getName());
                }
            }
            selectSystem.select(systemInfo.getCurrentID());
            formLayout.addComponent(selectSystem);
            selectSystem.addValueChangeListener(new ValueChangeListener() {
                private static final long serialVersionUID = 0x4C656F6E6172646FL;

                public void valueChange(ValueChangeEvent event) {
                    String systemID = (String) event.getProperty().getValue();
                    Backups backups = new Backups(systemID, null);
                    backupsList = backups.getBackupsList();
                    selectPrevBackup.removeAllItems();
                    firstItem = null;
                    if (backupsList != null && backupsList.size() > 0) {
                        Collection<BackupRecord> set = backupsList.values();
                        Iterator<BackupRecord> iter = set.iterator();
                        while (iter.hasNext()) {
                            BackupRecord backupRecord = iter.next();
                            String backupID = backupRecord.getID();
                            selectPrevBackup.addItem(backupID);
                            selectPrevBackup.setItemCaption(backupID,
                                    "ID: " + backupID + ", " + backupRecord.getStarted());
                            if (firstItem == null) {
                                firstItem = backupID;
                                selectPrevBackup.select(firstItem);
                            }
                        }
                        runningTask.getControlsLayout().enableControls(true, Controls.Run);
                    } else {
                        if (backupInfoLayout != null) {
                            displayBackupInfo(backupInfoLayout, new BackupRecord());
                        }
                        runningTask.getControlsLayout().enableControls(false, Controls.Run);
                    }
                }
            });
        }
        prevBackupsLayout = new HorizontalLayout();
        restoreLayout.addComponent(prevBackupsLayout);

        selectPrevBackup = (commandEnum == Command.backup) ? new ListSelect("Backups") : new ListSelect();
        selectPrevBackup.setImmediate(true);
        selectPrevBackup.setNullSelectionAllowed(false);
        selectPrevBackup.setRows(8); // Show a few items and a scrollbar if there are more
        selectPrevBackup.setWidth("20em");
        prevBackupsLayout.addComponent(selectPrevBackup);
        final Backups backups = new Backups(nodeInfo.getParentID(), null);
        //*** this is for when we only want backups from a specific node
        // backupsList = backups.getBackupsForNode(nodeInfo.getID());
        backupsList = backups.getBackupsList();
        if (backupsList != null && backupsList.size() > 0) {
            Collection<BackupRecord> set = backupsList.values();
            Iterator<BackupRecord> iter = set.iterator();
            while (iter.hasNext()) {
                BackupRecord backupRecord = iter.next();
                selectPrevBackup.addItem(backupRecord.getID());
                selectPrevBackup.setItemCaption(backupRecord.getID(),
                        "ID: " + backupRecord.getID() + ", " + backupRecord.getStarted());
                if (firstItem == null) {
                    firstItem = backupRecord.getID();
                }
            }

            backupInfoLayout = new VerticalLayout();
            backupInfoLayout.setSpacing(false);
            backupInfoLayout.setMargin(new MarginInfo(false, true, false, true));
            prevBackupsLayout.addComponent(backupInfoLayout);
            prevBackupsLayout.setComponentAlignment(backupInfoLayout, Alignment.MIDDLE_CENTER);

            selectPrevBackup.addValueChangeListener(new ValueChangeListener() {
                private static final long serialVersionUID = 0x4C656F6E6172646FL;

                public void valueChange(ValueChangeEvent event) {
                    String backupID = (String) event.getProperty().getValue();
                    if (backupID == null) {
                        isParameterReady = false;
                        runningTask.getControlsLayout().enableControls(isParameterReady, Controls.Run);
                        return;
                    }
                    BackupRecord backupRecord = backupsList.get(backupID);
                    displayBackupInfo(backupInfoLayout, backupRecord);
                    if (backupLevel != null) {
                        // we're doing a backup
                        params.put(PARAM_BACKUP_PARENT, backupRecord.getID());
                    } else {
                        // we're doing a restore
                        params.put(PARAM_BACKUP_ID, backupRecord.getID());
                    }
                    isParameterReady = true;
                    ScriptingControlsLayout controlsLayout = runningTask.getControlsLayout();
                    if (controlsLayout != null) {
                        controlsLayout.enableControls(isParameterReady, Controls.Run);
                    }
                }
            });

            // final DisplayBackupRecord displayRecord = new
            // DisplayBackupRecord(parameterLayout);

            if (commandEnum == Command.restore) {
                restoreLayout.addComponent(prevBackupsLayout);
                selectPrevBackup.select(firstItem);
            }

        } else {
            // no previous backups
            if (commandEnum == Command.backup) {
                backupLevel.setEnabled(false);
                isParameterReady = true;
            } else if (commandEnum == Command.restore) {
                //runningTask.getControlsLayout().enableControls(false, Controls.run);
            }
        }
        break;

    case connect:
        VerticalLayout connectLayout = new VerticalLayout();
        addComponent(connectLayout);

        final Validator validator = new Password2Validator(connectPassword);

        passwordOption.addItem(true);
        passwordOption.setItemCaption(true, "Authenticate with root user");
        passwordOption.addItem(false);
        passwordOption.setItemCaption(false, "Authenticate with SSH Key");
        passwordOption.setImmediate(true);
        passwordOption.addValueChangeListener(new Property.ValueChangeListener() {
            private static final long serialVersionUID = 0x4C656F6E6172646FL;

            @Override
            public void valueChange(ValueChangeEvent event) {
                usePassword = (Boolean) event.getProperty().getValue();
                if (usePassword) {
                    connectPassword2.addValidator(validator);
                } else {
                    connectPassword2.removeValidator(validator);
                }
                connectPassword.setVisible(usePassword);
                connectPassword.setRequired(usePassword);
                connectPassword2.setVisible(usePassword);
                connectPassword2.setRequired(usePassword);
                connectKey.setVisible(!usePassword);
                connectKey.setRequired(!usePassword);
                boolean isValid;
                if (runningTask.getControlsLayout() != null) {
                    if (usePassword) {
                        isValid = connectPassword.isValid();
                    } else {
                        isValid = connectKey.isValid();
                    }
                    if (isValid) {
                        connectParamsListener.valueChange(null);
                    } else {
                        form.setComponentError(null);
                        form.setValidationVisible(false);
                        runningTask.getControlsLayout().enableControls(false, Controls.Run);
                    }
                }
            }
        });
        connectLayout.addComponent(passwordOption);
        passwordOption.select(false);

        connectLayout.addComponent(form);
        form.setImmediate(true);
        form.setFooter(null);
        Layout layout = form.getLayout();

        form.addField("connectPassword", connectPassword);
        connectPassword.setImmediate(true);
        connectPassword.setRequiredError("Root Password is a required field");
        connectPassword.addValueChangeListener(connectParamsListener);

        form.addField("connectPassword2", connectPassword2);
        connectPassword2.setImmediate(true);
        connectPassword2.setRequiredError("Confirm Password is a required field");
        connectPassword2.addValueChangeListener(connectParamsListener);

        form.addField("connectKey", connectKey);
        connectKey.setStyleName("sshkey");
        connectKey.setColumns(41);
        connectKey.setImmediate(true);
        connectKey.setRequiredError("SSH Key is a required field");
        connectKey.addValueChangeListener(connectParamsListener);
        break;

    default:
        isParameterReady = true;
        break;

    }

}

From source file:com.snowy.NewUserSubWindow.java

public void build() {
    //setClosable(false);
    setModal(true);/*from  w  w w.  ja  v  a 2 s. com*/
    setResizable(false);
    setResponsive(true);
    setDraggable(false);
    FormLayout fl = new FormLayout();
    fl.setMargin(true);
    //fl.setSizeFull();
    fl.setSizeUndefined();
    fl.setSpacing(true);
    TextField uname = new TextField("Username");
    uname.setRequired(true);

    //uname.addValidator(null);
    fl.addComponent(uname);
    TextField email = new TextField("Email");

    email.setRequired(true);
    email.addValidator(new EmailValidator("A Valid Email is Required"));
    fl.addComponent(email);
    PasswordField pf1 = new PasswordField("Password");
    pf1.setRequired(true);
    pf1.addValidator(new StringLengthValidator("Password must be between 8 and 60 characters", 8, 60, false));
    fl.addComponent(pf1);

    PasswordField pf2 = new PasswordField("Confirm Password");
    pf2.setRequired(true);
    pf2.addValidator((Object value) -> {
        if (!pf2.getValue().equals(pf1.getValue())) {
            throw new InvalidValueException("Passwords Must Match");
        }
    });
    //pf2.setImmediate(true);
    fl.addComponent(pf2);
    Button b = new Button("Submit");

    b.addClickListener((Button.ClickEvent e) -> {

        if (uname.isValid() && email.isValid() && pf1.isValid() && pf2.isValid()) {

            String result = d.createUser(uname.getValue(), pf2.getValue(), email.getValue());
            if (result.equals("Creation Sucess")) {
                fl.removeAllComponents();
                fl.addComponent(new Label("User Created Sucessfully"));
                fl.addComponent(new Button("Close", (ee) -> {
                    this.close();
                }));

            } else {
                Notification.show(result);
            }
        } else {
            b.setComponentError(new UserError("Issues with required fields"));
        }
        //d.close();
    });
    fl.addComponent(b);
    setContent(fl);

}

From source file:com.squadd.chat.ChatController.java

public FormLayout createPhotoLayout(Embedded image) {
    FormLayout photoLayout = new FormLayout();
    photoLayout.addComponent(image);
    photoLayout.setWidth("50px");
    photoLayout.setHeight("50px");

    UserInfoBean use = man.get(userTo.getId(), UserInfo.class, UserInfoBean.class);

    MouseEvents.ClickListener showUserButtonListener = new MouseEvents.ClickListener() {
        @Override//from w w  w .  j a  v  a2s. com
        public void click(MouseEvents.ClickEvent event) {
            if (use != null) {
                System.out.println(use.getId());
                view.setAnotherUser(use);
                UI.getCurrent().getNavigator().navigateTo(UserPageView.NAME);
            }
        }
    };
    //if(use!=null){
    //photoLayout.addClickListener(showUserButtonListener);}

    return photoLayout;
}

From source file:com.squadd.chat.UserInfoFace.java

public Panel getUserPanel() {
    Panel contactPanel = new Panel();
    FormLayout contactLine = new FormLayout();
    contactPanel.addClickListener(upd);/*from w  w  w  .ja  v  a 2 s.  c  o  m*/
    Label nameLabel = new Label(user.getName());
    nameLabel.setStyleName("userPanel");
    contactLine.addComponent(nameLabel);
    contactPanel.setContent(contactLine);
    contactPanel.setId(user.getId().toString());
    return contactPanel;
    //contactsContent.addComponent(look);
    //contactsPanel.setContent(contactsContent);
}

From source file:com.squadd.chat.UserInfoFace.java

public Panel getUserPanel(Integer userId) {
    Panel contactPanel = new Panel();
    FormLayout contactLine = new FormLayout();
    user = new UserInfoBean();
    user.setId(userId);/*from   www .  j  a va  2  s .c o  m*/
    user.setName("id" + userId);
    contactPanel.addClickListener(upd);
    Label nameLabel = new Label(user.getName());
    nameLabel.setStyleName("userPanel");
    contactLine.addComponent(nameLabel);
    contactPanel.setContent(contactLine);
    contactPanel.setId(userId.toString());
    return contactPanel;
    //contactsContent.addComponent(look);
    //contactsPanel.setContent(contactsContent);
}

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);// ww w.j a v  a  2  s  .  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;//from  w w  w . ja va2 s  . com

    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();/* w  w  w . ja  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.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 .  java 2s.com*/
    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);
}