Example usage for com.vaadin.ui TextArea TextArea

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

Introduction

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

Prototype

public TextArea(ValueChangeListener<String> valueChangeListener) 

Source Link

Document

Constructs a new TextArea with a value change listener.

Usage

From source file:com.etest.view.testbank.CellCaseWindow.java

Window modifyCaseWindow(CellCase cellCase) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);/*  w  w  w.  j av a  2s  . co m*/
    v.setSpacing(true);

    Window sub = new Window("MODIFY");
    sub.setWidth("400px");
    sub.setModal(true);
    sub.center();

    ComboBox actionDone = new ComboBox("Action: ");
    actionDone.setWidth("70%");
    actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    actionDone.setNullSelectionAllowed(false);
    actionDone.addItem("resolved");
    actionDone.addItem("clarified");
    actionDone.addItem("modified");
    actionDone.setImmediate(true);
    v.addComponent(actionDone);

    TextArea remarks = new TextArea("Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(3);
    v.addComponent(remarks);

    Button modify = new Button("UPDATE");
    modify.setWidth("70%");
    modify.setIcon(FontAwesome.EDIT);
    modify.addStyleName(ValoTheme.BUTTON_PRIMARY);
    modify.addStyleName(ValoTheme.BUTTON_SMALL);
    modify.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (actionDone.getValue() == null) {
            Notification.show("Add action!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        cellCase.setActionDone(actionDone.getValue().toString());
        cellCase.setRemarks(remarks.getValue().trim());
        boolean result = ccs.modifyCellCase(cellCase);
        if (result) {
            Notification.show("Case has been Modified!", Notification.Type.TRAY_NOTIFICATION);
            sub.close();
            close();
        }
    });
    v.addComponent(modify);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.testbank.cellitem.CellItemWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);//from w  w w.  j  a  v  a 2 s  .  c  om
    form.setSpacing(true);

    HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setWidth("100%");

    Button helpBtn = new Button("HELP");
    helpBtn.setWidthUndefined();
    helpBtn.setIcon(FontAwesome.TASKS);
    helpBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    helpBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    helpBtn.addClickListener((Button.ClickEvent event) -> {
        Window sub = new MultipleChoiceHelpViewer();
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
    });
    hlayout.addComponent(helpBtn);
    hlayout.setComponentAlignment(helpBtn, Alignment.MIDDLE_RIGHT);
    form.addComponent(hlayout);

    bloomsTaxonomy.setCaption("Blooms Class: ");
    bloomsTaxonomy.setWidth("30%");
    form.addComponent(bloomsTaxonomy);

    stem = new TextArea("Stem: ");
    stem.setWidth("100%");
    stem.setRows(5);
    stem.setWordwrap(true);
    form.addComponent(stem);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setCaption("Option A:");
    h1.setWidth("100%");
    h1.setSpacing(true);

    optionA = new CommonTextField("add option A", null);
    optionA.setWidth("500px");
    h1.addComponent(optionA);

    Button optionABtn = new CommonButton("OPTION A");
    optionABtn.setWidth("120px");
    optionABtn.addClickListener(updateOptionAndKeyListerner);
    h1.addComponent(optionABtn);
    h1.setComponentAlignment(optionABtn, Alignment.MIDDLE_RIGHT);
    optionABtn.setVisible(isEdit());
    form.addComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setCaption("Key A:");
    h2.setWidth("100%");
    h2.setSpacing(true);

    keyA = new CommonTextField("Enter a Key for Option A", null);
    keyA.setWidth("500px");
    h2.addComponent(keyA);

    Button keyABtn = new CommonButton("KEY A");
    keyABtn.setWidth("120px");
    keyABtn.addClickListener(updateOptionAndKeyListerner);
    h2.addComponent(keyABtn);
    h2.setComponentAlignment(keyABtn, Alignment.MIDDLE_RIGHT);
    keyABtn.setVisible(isEdit());
    form.addComponent(h2);

    HorizontalLayout h3 = new HorizontalLayout();
    h3.setCaption("Option B:");
    h3.setWidth("100%");
    h3.setSpacing(true);

    optionB = new CommonTextField("add option B", null);
    optionB.setWidth("500px");
    h3.addComponent(optionB);

    Button optionBBtn = new CommonButton("OPTION B");
    optionBBtn.setWidth("120px");
    optionBBtn.addClickListener(updateOptionAndKeyListerner);
    h3.addComponent(optionBBtn);
    h3.setComponentAlignment(optionBBtn, Alignment.MIDDLE_RIGHT);
    optionBBtn.setVisible(isEdit());
    form.addComponent(h3);

    HorizontalLayout h4 = new HorizontalLayout();
    h4.setCaption("Key B:");
    h4.setWidth("100%");
    h4.setSpacing(true);

    keyB = new CommonTextField("Enter a Key for Option B", null);
    keyB.setWidth("500px");
    h4.addComponent(keyB);

    Button keyBBtn = new CommonButton("KEY B");
    keyBBtn.setWidth("120px");
    keyBBtn.addClickListener(updateOptionAndKeyListerner);
    h4.addComponent(keyBBtn);
    h4.setComponentAlignment(keyBBtn, Alignment.MIDDLE_RIGHT);
    keyBBtn.setVisible(isEdit());
    form.addComponent(h4);

    HorizontalLayout h5 = new HorizontalLayout();
    h5.setCaption("Option C:");
    h5.setWidth("100%");
    h5.setSpacing(true);

    optionC = new CommonTextField("add option C", null);
    optionC.setWidth("500px");
    h5.addComponent(optionC);

    Button optionCBtn = new CommonButton("OPTION C");
    optionCBtn.setWidth("120px");
    optionCBtn.addClickListener(updateOptionAndKeyListerner);
    h5.addComponent(optionCBtn);
    h5.setComponentAlignment(optionCBtn, Alignment.TOP_RIGHT);
    optionCBtn.setVisible(isEdit());
    form.addComponent(h5);

    HorizontalLayout h6 = new HorizontalLayout();
    h6.setCaption("Key C:");
    h6.setWidth("100%");
    h6.setSpacing(true);

    keyC = new CommonTextField("Enter a Key for Option C", null);
    keyC.setWidth("500px");
    h6.addComponent(keyC);

    Button keyCBtn = new CommonButton("KEY C");
    keyCBtn.setWidth("120px");
    keyCBtn.addClickListener(updateOptionAndKeyListerner);
    h6.addComponent(keyCBtn);
    h6.setComponentAlignment(keyCBtn, Alignment.MIDDLE_RIGHT);
    keyCBtn.setVisible(isEdit());
    form.addComponent(h6);

    HorizontalLayout h7 = new HorizontalLayout();
    h7.setCaption("Option D:");
    h7.setWidth("100%");
    h7.setSpacing(true);

    optionD = new CommonTextField("add option D", null);
    optionD.setWidth("500px");
    h7.addComponent(optionD);

    Button optionDBtn = new CommonButton("OPTION D");
    optionDBtn.setWidth("120px");
    optionDBtn.addClickListener(updateOptionAndKeyListerner);
    h7.addComponent(optionDBtn);
    h7.setComponentAlignment(optionDBtn, Alignment.MIDDLE_RIGHT);
    optionDBtn.setVisible(isEdit());
    form.addComponent(h7);

    HorizontalLayout h8 = new HorizontalLayout();
    h8.setCaption("Key D:");
    h8.setWidth("100%");
    h8.setSpacing(true);

    keyD = new CommonTextField("Enter a Key for Option D", null);
    keyD.setWidth("500px");
    h8.addComponent(keyD);

    Button keyDBtn = new CommonButton("KEY D");
    keyDBtn.setWidth("120px");
    keyDBtn.addClickListener(updateOptionAndKeyListerner);
    h8.addComponent(keyDBtn);
    h8.setComponentAlignment(keyDBtn, Alignment.MIDDLE_RIGHT);
    keyDBtn.setVisible(isEdit());
    form.addComponent(h8);

    HorizontalLayout h = new HorizontalLayout();
    h.setWidth("100%");

    Button save = new Button("SAVE");
    save.setWidth("200px");
    save.setIcon(FontAwesome.SAVE);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addStyleName(ValoTheme.BUTTON_SMALL);
    save.addClickListener(buttonClickListener);

    Button remove = new Button("ARCHIVE/REMOVE ITEM?");
    remove.setWidth("200px");
    remove.setIcon(FontAwesome.ARCHIVE);
    remove.addStyleName(ValoTheme.BUTTON_PRIMARY);
    remove.addStyleName(ValoTheme.BUTTON_SMALL);
    remove.addClickListener(buttonClickListener);

    Button approve = new Button("APPROVE ITEM?");
    approve.setWidth("200px");
    approve.setIcon(FontAwesome.THUMBS_O_UP);
    approve.addStyleName(ValoTheme.BUTTON_PRIMARY);
    approve.addStyleName(ValoTheme.BUTTON_SMALL);
    approve.addClickListener(buttonClickListener);

    Button edit = new Button("UPDATE");
    edit.setWidth("200px");
    edit.setIcon(FontAwesome.SAVE);
    edit.addStyleName(ValoTheme.BUTTON_PRIMARY);
    edit.addStyleName(ValoTheme.BUTTON_SMALL);
    edit.addClickListener(buttonClickListener);

    if (getCellItemId() != 0) {
        CellItem ci = cis.getCellItemById(getCellItemId());
        bloomsTaxonomy.setValue(ci.getBloomsClassId());
        bloomsTaxonomy.addValueChangeListener((Property.ValueChangeEvent event) -> {
            isBloomsChanged = true;
        });

        stem.setValue(ci.getItem());
        stem.addTextChangeListener((FieldEvents.TextChangeEvent event) -> {
            if (!stem.getValue().trim().equals(event.getText().trim())) {
                isStemChanged = true;
            }
        });

        /**
         * OPTION A
         */
        optionA.setValue(ci.getOptionA());
        isOptionAKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionA());
        if (isOptionAKeyExist) {
            keyA.setValue(k.getItemKey(getCellItemId(), ci.getOptionA()));
        }
        keyA.setData(k.getItemKeyId(getCellItemId(), ci.getOptionA()));

        /**
         * OPTION B
         */
        optionB.setValue(ci.getOptionB());
        isOptionBKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionB());
        if (isOptionBKeyExist) {
            keyB.setValue(k.getItemKey(getCellItemId(), ci.getOptionB()));
        }
        keyB.setData(k.getItemKeyId(getCellItemId(), ci.getOptionB()));

        /**
         * OPTION C
         */
        optionC.setValue(ci.getOptionC());
        isOptionCKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionC());
        if (isOptionCKeyExist) {
            keyC.setValue(k.getItemKey(getCellItemId(), ci.getOptionC()));
        }
        keyC.setData(k.getItemKeyId(getCellItemId(), ci.getOptionC()));

        /**
         * OPTION D
         */
        optionD.setValue(ci.getOptionD());
        isOptionDKeyExist = k.isKeyExist(getCellItemId(), ci.getOptionD());
        if (isOptionDKeyExist) {
            keyD.setValue(k.getItemKey(getCellItemId(), ci.getOptionD()));
        }
        keyD.setData(k.getItemKeyId(getCellItemId(), ci.getOptionD()));

        h.addComponent(remove);
        h.setComponentAlignment(remove, Alignment.MIDDLE_RIGHT);

        h.addComponent(approve);
        h.setComponentAlignment(approve, Alignment.MIDDLE_RIGHT);

        h.addComponent(edit);
        h.setComponentAlignment(edit, Alignment.MIDDLE_RIGHT);
        form.addComponent(h);
    } else {
        h.addComponent(save);
        h.setComponentAlignment(save, Alignment.MIDDLE_RIGHT);
        form.addComponent(h);
    }

    return form;
}

From source file:com.etest.view.testbank.cellitem.CellItemWindow.java

Window modifyCellItemWindow(CellItem ci) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);//from  w  ww.j  a va 2 s.com
    v.setSpacing(true);

    Window sub = new Window("MODIFY");
    sub.setWidth("400px");
    sub.setModal(true);
    sub.center();

    ComboBox actionDone = new ComboBox("Action: ");
    actionDone.setWidth("70%");
    actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    actionDone.setNullSelectionAllowed(false);
    actionDone.addItem("resolved");
    actionDone.addItem("clarified");
    actionDone.addItem("modified");
    actionDone.setImmediate(true);
    v.addComponent(actionDone);

    TextArea remarks = new TextArea("Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(3);
    v.addComponent(remarks);

    Button modify = new Button("UPDATE");
    modify.setWidth("70%");
    modify.setIcon(FontAwesome.EDIT);
    modify.addStyleName(ValoTheme.BUTTON_PRIMARY);
    modify.addStyleName(ValoTheme.BUTTON_SMALL);
    modify.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (actionDone.getValue() == null) {
            Notification.show("Add action!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        ci.setRemarks(remarks.getValue().trim());
        ci.setActionDone(actionDone.getValue().toString());
        boolean result = cis.modifyCellItem(ci);
        if (result) {
            sub.close();
            close();
        }
    });
    v.addComponent(modify);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.testbank.cellitem.CellItemWindow.java

Window modifyKeyWindow(int itemKeyId, int cellItemId, String keyValue, String optionValue,
        boolean isOptionKeyExist) {
    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setMargin(true);//ww  w.  ja v a2 s. co m
    v.setSpacing(true);

    Window sub = new Window("MODIFY");
    sub.setWidth("400px");
    sub.setModal(true);
    sub.center();

    ComboBox actionDone = new ComboBox("Action: ");
    actionDone.setWidth("70%");
    actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    actionDone.setNullSelectionAllowed(false);
    actionDone.addItem("resolved");
    actionDone.addItem("clarified");
    actionDone.addItem("modified");
    actionDone.setImmediate(true);
    v.addComponent(actionDone);

    TextArea remarks = new TextArea("Remarks: ");
    remarks.setWidth("100%");
    remarks.setRows(3);
    v.addComponent(remarks);

    Button modify = new Button("UPDATE");
    modify.setWidth("70%");
    modify.setIcon(FontAwesome.EDIT);
    modify.addStyleName(ValoTheme.BUTTON_PRIMARY);
    modify.addStyleName(ValoTheme.BUTTON_SMALL);
    modify.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (actionDone.getValue() == null) {
            Notification.show("Add action!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        boolean result = k.modifyItemKey(itemKeyId, cellItemId, keyValue, optionValue, isOptionKeyExist,
                remarks.getValue().trim(), actionDone.getValue().toString());
        if (result) {
            Notification.show("Key SUCCESSFULLY modified", Notification.Type.TRAY_NOTIFICATION);
            sub.close();
        }
    });
    v.addComponent(modify);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java

private void addressGroup() {
    addressGroup = new VerticalComponentGroup();
    addressGroup.setSizeUndefined();/* w  ww  . j a v a 2  s. co  m*/

    addTab(addressGroup, "", FontAwesome.BOOK);

    tel = new TextField("");
    tel.setInputPrompt("");
    tel.setImmediate(false);
    tel.setWidth("-1px");
    tel.setHeight("-1px");
    tel.setNullRepresentation("");
    addressGroup.addComponent(tel);

    mobile = new TextField("");
    mobile.setInputPrompt("");
    mobile.setImmediate(false);
    mobile.setWidth("-1px");
    mobile.setHeight("-1px");
    mobile.setRequired(true);
    mobile.setNullRepresentation("");
    addressGroup.addComponent(mobile);

    email = new EmailField("");
    email.setInputPrompt("");
    email.setImmediate(false);
    email.setWidth("-1px");
    email.setHeight("-1px");
    email.setRequired(true);
    email.setNullRepresentation("");
    email.addTextChangeListener(new TextChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(TextChangeEvent event) {
            if (!isEdit) {
                if (event.getText() != null) {
                    if (event.getText().length() >= 13) {

                        userSqlContainer.addContainerFilter(new Equal(UserSchema.EMAIL, event.getText()));
                        if (userSqlContainer.size() > 0) {
                            disableDuplicateEmailForm();
                            Notification.show(
                                    "?? ??",
                                    Type.WARNING_MESSAGE);
                        } else {
                            enableDuplicateEmailForm();
                        }
                        userSqlContainer.removeAllContainerFilters();
                    }
                }
            }
        }
    });
    addressGroup.addComponent(email);

    Label currentLabel = new Label("");
    addressGroup.addComponent(currentLabel);

    currentAddress = new TextArea("");
    currentAddress.setInputPrompt("  ");
    currentAddress.setImmediate(false);
    currentAddress.setWidth("-1px");
    currentAddress.setHeight("-1px");
    currentAddress.setNullRepresentation("");
    addressGroup.addComponent(currentAddress);

    currentProvince = new NativeSelect("", new Province());
    //currentProvince.setInputPrompt("??");
    currentProvince.setItemCaptionPropertyId("name");
    currentProvince.setImmediate(true);
    currentProvince.setNullSelectionAllowed(false);
    currentProvince.setWidth("-1px");
    currentProvince.setHeight("-1px");
    //currentProvince.setFilteringMode(FilteringMode.CONTAINS);
    currentProvince.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                currentDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    addressGroup.addComponent(currentProvince);

    currentDistrict = new NativeSelect("");
    //currentDistrict.setInputPrompt("??");
    currentDistrict.setItemCaptionPropertyId("name");
    currentDistrict.setImmediate(true);
    currentDistrict.setNullSelectionAllowed(false);
    currentDistrict.setWidth("-1px");
    currentDistrict.setHeight("-1px");
    //currentDistrict.setFilteringMode(FilteringMode.CONTAINS);
    currentDistrict.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                currentCity.setContainerDataSource(
                        new City(Integer.parseInt(event.getProperty().getValue().toString())));
                currentPostcode.setContainerDataSource(
                        new Postcode(Integer.parseInt(event.getProperty().getValue().toString())));
            }
        }
    });
    addressGroup.addComponent(currentDistrict);

    currentCity = new NativeSelect("");
    //currentCity.setInputPrompt("??");
    currentCity.setItemCaptionPropertyId("name");
    currentCity.setImmediate(true);
    currentCity.setNullSelectionAllowed(false);
    currentCity.setWidth("-1px");
    currentCity.setHeight("-1px");
    //currentCity.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(currentCity);

    currentPostcode = new NativeSelect("");
    //currentPostcode.setInputPrompt("??");
    currentPostcode.setItemCaptionPropertyId("name");
    currentPostcode.setImmediate(true);
    currentPostcode.setNullSelectionAllowed(false);
    currentPostcode.setWidth("-1px");
    currentPostcode.setHeight("-1px");
    //currentPostcode.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(currentPostcode);

    isSameCurrentAddress = new CheckBox(
            "?");
    isSameCurrentAddress.setImmediate(true);
    isSameCurrentAddress.setWidth("-1px");
    isSameCurrentAddress.setHeight("-1px");
    isSameCurrentAddress.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                if ((boolean) event.getProperty().getValue()) {
                    censusAddress.setValue(currentAddress.getValue());
                    censusProvince.setValue(currentProvince.getValue());
                    censusDistrict.setValue(currentDistrict.getValue());
                    censusCity.setValue(currentCity.getValue());
                    censusPostcode.setValue(currentPostcode.getValue());
                } else {
                    censusAddress.setValue(null);
                    censusProvince.setValue(null);
                    censusDistrict.setValue(null);
                    censusCity.setValue(null);
                    censusPostcode.setValue(null);
                }
            }
        }
    });
    addressGroup.addComponent(isSameCurrentAddress);

    censusAddress = new TextArea("");
    censusAddress.setInputPrompt("  ");
    censusAddress.setImmediate(false);
    censusAddress.setWidth("-1px");
    censusAddress.setHeight("-1px");
    censusAddress.setNullRepresentation("");
    addressGroup.addComponent(censusAddress);

    censusProvince = new NativeSelect("",
            new Province());
    //censusProvince.setInputPrompt("??");
    censusProvince.setItemCaptionPropertyId("name");
    censusProvince.setImmediate(true);
    censusProvince.setNullSelectionAllowed(false);
    censusProvince.setWidth("-1px");
    censusProvince.setHeight("-1px");
    //censusProvince.setFilteringMode(FilteringMode.CONTAINS);
    censusProvince.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                censusDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    addressGroup.addComponent(censusProvince);

    censusDistrict = new NativeSelect("");
    //censusDistrict.setInputPrompt("??");
    censusDistrict.setItemCaptionPropertyId("name");
    censusDistrict.setImmediate(true);
    censusDistrict.setNullSelectionAllowed(false);
    censusDistrict.setWidth("-1px");
    censusDistrict.setHeight("-1px");
    //censusDistrict.setFilteringMode(FilteringMode.CONTAINS);
    censusDistrict.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                censusCity.setContainerDataSource(
                        new City(Integer.parseInt(event.getProperty().getValue().toString())));
                censusPostcode.setContainerDataSource(
                        new Postcode(Integer.parseInt(event.getProperty().getValue().toString())));
            }
        }
    });
    addressGroup.addComponent(censusDistrict);

    censusCity = new NativeSelect("");
    //censusCity.setInputPrompt("??");
    censusCity.setItemCaptionPropertyId("name");
    censusCity.setImmediate(true);
    censusCity.setNullSelectionAllowed(false);
    censusCity.setWidth("-1px");
    censusCity.setHeight("-1px");
    //censusCity.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(censusCity);

    censusPostcode = new NativeSelect(
            "");
    //censusPostcode.setInputPrompt("??");
    censusPostcode.setItemCaptionPropertyId("name");
    censusPostcode.setImmediate(true);
    censusPostcode.setNullSelectionAllowed(false);
    censusPostcode.setWidth("-1px");
    censusPostcode.setHeight("-1px");
    //censusPostcode.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(censusPostcode);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth("100%");
    addressGroup.addComponent(buttonLayout);

    licensessBack = new Button(FontAwesome.ARROW_LEFT);
    licensessBack.setWidth("100%");
    licensessBack.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(licenseeGroup);
        }
    });
    buttonLayout.addComponents(licensessBack);

    fatherNext = new Button(FontAwesome.SAVE);
    fatherNext.setWidth("100%");
    fatherNext.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            ConfirmDialog.show(UI.getCurrent(), "",
                    "?    ?",
                    "", "", new ConfirmDialog.Listener() {
                        private static final long serialVersionUID = 1L;

                        public void onClose(ConfirmDialog dialog) {
                            /*   ?
                             *  ? ?
                             *  ?  ?? */
                            if (dialog.isConfirmed()) {
                                isInsertParents = true;
                                setSelectedTab(fatherGroup);
                            } else {
                                isInsertParents = false;

                                finish.click();
                            }
                        }
                    });
        }
    });

    buttonLayout.addComponents(fatherNext);
}

From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java

private void fatherGroup() {
    fatherGroup = new VerticalComponentGroup();
    fatherGroup.setSizeUndefined();//ww  w  .j  a va 2 s  .c om

    addTab(fatherGroup, "", FontAwesome.MALE);

    fPeopleIdType = new OptionGroup("", new PeopleIdType());
    fPeopleIdType.setItemCaptionPropertyId("name");
    fPeopleIdType.setImmediate(true);
    fPeopleIdType.setNullSelectionAllowed(false);
    fPeopleIdType.setWidth("-1px");
    fPeopleIdType.setHeight("-1px");
    fatherGroup.addComponent(fPeopleIdType);

    fPeopleid = new TextField("");
    fPeopleid.setInputPrompt("");
    fPeopleid.setImmediate(false);
    fPeopleid.setWidth("-1px");
    fPeopleid.setHeight("-1px");
    fPeopleid.setNullRepresentation("");
    fPeopleid.addTextChangeListener(new TextChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(TextChangeEvent event) {
            if (event.getText() != null) {
                if (event.getText().length() >= 13) {
                    fSqlContainer.addContainerFilter(new Equal(FamilySchema.PEOPLE_ID, event.getText()));
                    if (fSqlContainer.size() > 0) {
                        Item item = fSqlContainer.getItem(fSqlContainer.getIdByIndex(0));
                        fatherBinder.setItemDataSource(item);
                        pkStore[0] = item.getItemProperty(FamilySchema.FAMILY_ID).getValue();
                        fatherBinder.setEnabled(false);
                        isDuplicateFather = true;
                    }
                    fSqlContainer.removeAllContainerFilters();
                }
            }
        }
    });
    fatherGroup.addComponent(fPeopleid);

    fPrename = new NativeSelect("", new Prename());
    //fPrename.setInputPrompt("??");
    fPrename.setValue("");
    fPrename.setItemCaptionPropertyId("name");
    fPrename.setImmediate(true);
    fPrename.setNullSelectionAllowed(false);
    fPrename.setRequired(true);
    fPrename.setWidth("-1px");
    fPrename.setHeight("-1px");
    //fPrename.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fPrename);

    fFirstname = new TextField("");
    fFirstname.setInputPrompt("");
    fFirstname.setImmediate(false);
    fFirstname.setRequired(true);
    fFirstname.setWidth("-1px");
    fFirstname.setHeight("-1px");
    fFirstname.setNullRepresentation("");
    fatherGroup.addComponent(fFirstname);

    fLastname = new TextField("?");
    fLastname.setInputPrompt("?");
    fLastname.setImmediate(false);
    fLastname.setRequired(true);
    fLastname.setWidth("-1px");
    fLastname.setHeight("-1px");
    fLastname.setNullRepresentation("");
    fatherGroup.addComponent(fLastname);

    fFirstnameNd = new TextField("?");
    fFirstnameNd.setInputPrompt("?");
    fFirstnameNd.setImmediate(false);
    fFirstnameNd.setWidth("-1px");
    fFirstnameNd.setHeight("-1px");
    fFirstnameNd.setNullRepresentation("");
    fatherGroup.addComponent(fFirstnameNd);

    fLastnameNd = new TextField("??");
    fLastnameNd.setInputPrompt("??");
    fLastnameNd.setImmediate(false);
    fLastnameNd.setWidth("-1px");
    fLastnameNd.setHeight("-1px");
    fLastnameNd.setNullRepresentation("");
    fatherGroup.addComponent(fLastnameNd);

    fGender = new OptionGroup("", new Gender());
    fGender.setItemCaptionPropertyId("name");
    fGender.setImmediate(true);
    fGender.setNullSelectionAllowed(false);
    fGender.setRequired(true);
    fGender.setWidth("-1px");
    fGender.setHeight("-1px");
    fatherGroup.addComponent(fGender);

    fReligion = new NativeSelect("", new Religion());
    //fReligion.setInputPrompt("??");
    fReligion.setItemCaptionPropertyId("name");
    fReligion.setImmediate(true);
    fReligion.setNullSelectionAllowed(false);
    fReligion.setRequired(true);
    fReligion.setWidth("-1px");
    fReligion.setHeight("-1px");
    //fReligion.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fReligion);

    fRace = new NativeSelect("", new Race());
    //fRace.setInputPrompt("??");
    fRace.setItemCaptionPropertyId("name");
    fRace.setImmediate(true);
    fRace.setNullSelectionAllowed(false);
    fRace.setRequired(true);
    fRace.setWidth("-1px");
    fRace.setHeight("-1px");
    //fRace.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fRace);

    fNationality = new NativeSelect("?", new Nationality());
    //fNationality.setInputPrompt("??");
    fNationality.setItemCaptionPropertyId("name");
    fNationality.setImmediate(true);
    fNationality.setNullSelectionAllowed(false);
    fNationality.setRequired(true);
    fNationality.setWidth("-1px");
    fNationality.setHeight("-1px");
    //fNationality.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fNationality);

    fBirthDate = new PopupDateField("   ?");
    fBirthDate.setInputPrompt("//");
    fBirthDate.setImmediate(false);
    fBirthDate.setWidth("-1px");
    fBirthDate.setHeight("-1px");
    fBirthDate.setDateFormat("dd/MM/yyyy");
    fBirthDate.setLocale(new Locale("th", "TH"));
    fatherGroup.addComponent(fBirthDate);

    fTel = new TextField("");
    fTel.setInputPrompt("");
    fTel.setImmediate(false);
    fTel.setWidth("-1px");
    fTel.setHeight("-1px");
    fTel.setNullRepresentation("");
    fatherGroup.addComponent(fTel);

    fMobile = new TextField("");
    fMobile.setInputPrompt("");
    fMobile.setImmediate(false);
    fMobile.setWidth("-1px");
    fMobile.setHeight("-1px");
    fMobile.setNullRepresentation("");
    fatherGroup.addComponent(fMobile);

    fEmail = new TextField("");
    fEmail.setInputPrompt("");
    fEmail.setImmediate(false);
    fEmail.setWidth("-1px");
    fEmail.setHeight("-1px");
    fEmail.setNullRepresentation("");
    fEmail.addValidator(new EmailValidator("?"));
    fatherGroup.addComponent(fEmail);

    fSalary = new NumberField("");
    fSalary.setInputPrompt("");
    fSalary.setImmediate(false);
    fSalary.setWidth("-1px");
    fSalary.setHeight("-1px");
    fSalary.setNullRepresentation("");
    fatherGroup.addComponent(fSalary);

    fAliveStatus = new NativeSelect("", new AliveStatus());
    //fAliveStatus.setInputPrompt("??");
    fAliveStatus.setItemCaptionPropertyId("name");
    fAliveStatus.setImmediate(true);
    fAliveStatus.setNullSelectionAllowed(false);
    fAliveStatus.setRequired(true);
    fAliveStatus.setWidth("-1px");
    fAliveStatus.setHeight("-1px");
    //fAliveStatus.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fAliveStatus);

    fOccupation = new NativeSelect("", new Occupation());
    //fOccupation.setInputPrompt("??");
    fOccupation.setItemCaptionPropertyId("name");
    fOccupation.setImmediate(true);
    fOccupation.setNullSelectionAllowed(false);
    fOccupation.setRequired(true);
    fOccupation.setWidth("-1px");
    fOccupation.setHeight("-1px");
    //fOccupation.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fOccupation);

    fJobAddress = new TextArea("");
    fJobAddress.setInputPrompt("  ");
    fJobAddress.setImmediate(false);
    fJobAddress.setWidth("-1px");
    fJobAddress.setHeight("-1px");
    fJobAddress.setNullRepresentation("");
    fatherGroup.addComponent(fJobAddress);

    fCurrentAddress = new TextArea("");
    fCurrentAddress.setInputPrompt("  ");
    fCurrentAddress.setImmediate(false);
    fCurrentAddress.setWidth("-1px");
    fCurrentAddress.setHeight("-1px");
    fCurrentAddress.setNullRepresentation("");
    fatherGroup.addComponent(fCurrentAddress);

    fCurrentProvinceId = new NativeSelect("", new Province());
    //fCurrentProvinceId.setInputPrompt("??");
    fCurrentProvinceId.setItemCaptionPropertyId("name");
    fCurrentProvinceId.setImmediate(true);
    fCurrentProvinceId.setNullSelectionAllowed(false);
    fCurrentProvinceId.setWidth("-1px");
    fCurrentProvinceId.setHeight("-1px");
    //fCurrentProvinceId.setFilteringMode(FilteringMode.CONTAINS);
    fCurrentProvinceId.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                fCurrentDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    fatherGroup.addComponent(fCurrentProvinceId);

    fCurrentDistrict = new NativeSelect("");
    //fCurrentDistrict.setInputPrompt("??");
    fCurrentDistrict.setItemCaptionPropertyId("name");
    fCurrentDistrict.setImmediate(true);
    fCurrentDistrict.setNullSelectionAllowed(false);
    fCurrentDistrict.setWidth("-1px");
    fCurrentDistrict.setHeight("-1px");
    //fCurrentDistrict.setFilteringMode(FilteringMode.CONTAINS);
    fCurrentDistrict.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                fCurrentCity.setContainerDataSource(
                        new City(Integer.parseInt(event.getProperty().getValue().toString())));
                fCurrentPostcode.setContainerDataSource(
                        new Postcode(Integer.parseInt(event.getProperty().getValue().toString())));
            }
        }
    });
    fatherGroup.addComponent(fCurrentDistrict);

    fCurrentCity = new NativeSelect("");
    //fCurrentCity.setInputPrompt("??");
    fCurrentCity.setItemCaptionPropertyId("name");
    fCurrentCity.setImmediate(true);
    fCurrentCity.setNullSelectionAllowed(false);
    fCurrentCity.setWidth("-1px");
    fCurrentCity.setHeight("-1px");
    //fCurrentCity.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fCurrentCity);

    fCurrentPostcode = new NativeSelect("");
    //fCurrentPostcode.setInputPrompt("??");
    fCurrentPostcode.setItemCaptionPropertyId("name");
    fCurrentPostcode.setImmediate(true);
    fCurrentPostcode.setNullSelectionAllowed(false);
    fCurrentPostcode.setWidth("-1px");
    fCurrentPostcode.setHeight("-1px");
    //fCurrentPostcode.setFilteringMode(FilteringMode.CONTAINS);
    fatherGroup.addComponent(fCurrentPostcode);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth("100%");
    fatherGroup.addComponent(buttonLayout);

    addressBack = new Button(FontAwesome.ARROW_LEFT);
    addressBack.setWidth("100%");
    addressBack.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(addressGroup);
        }
    });
    buttonLayout.addComponents(addressBack);

    motherNext = new Button(FontAwesome.ARROW_RIGHT);
    motherNext.setWidth("100%");
    motherNext.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(motherGroup);
        }
    });
    buttonLayout.addComponents(motherNext);
}

From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java

private void motherGroup() {
    motherGroup = new VerticalComponentGroup();
    motherGroup.setSizeUndefined();// w  w  w  .  java  2s. c  o m

    addTab(motherGroup, "", FontAwesome.FEMALE);

    mPeopleIdType = new OptionGroup("", new PeopleIdType());
    mPeopleIdType.setItemCaptionPropertyId("name");
    mPeopleIdType.setImmediate(true);
    mPeopleIdType.setNullSelectionAllowed(false);
    mPeopleIdType.setWidth("-1px");
    mPeopleIdType.setHeight("-1px");
    motherGroup.addComponent(mPeopleIdType);

    mPeopleid = new TextField("");
    mPeopleid.setInputPrompt("");
    mPeopleid.setImmediate(false);
    mPeopleid.setWidth("-1px");
    mPeopleid.setHeight("-1px");
    mPeopleid.setNullRepresentation("");
    mPeopleid.addTextChangeListener(new TextChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(TextChangeEvent event) {
            if (event.getText() != null) {
                if (event.getText().length() >= 13) {
                    fSqlContainer.addContainerFilter(new Equal(FamilySchema.PEOPLE_ID, event.getText()));
                    if (fSqlContainer.size() > 0) {
                        Item item = fSqlContainer.getItem(fSqlContainer.getIdByIndex(0));
                        motherBinder.setItemDataSource(item);
                        pkStore[1] = item.getItemProperty(FamilySchema.FAMILY_ID).getValue();
                        motherBinder.setEnabled(false);
                        isDuplicateMother = true;
                    }
                    fSqlContainer.removeAllContainerFilters();
                }
            }
        }
    });
    motherGroup.addComponent(mPeopleid);

    mPrename = new NativeSelect("", new Prename());
    //mPrename.setInputPrompt("??");
    mPrename.setItemCaptionPropertyId("name");
    mPrename.setImmediate(true);
    mPrename.setNullSelectionAllowed(false);
    mPrename.setRequired(true);
    mPrename.setWidth("-1px");
    mPrename.setHeight("-1px");
    //mPrename.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mPrename);

    mFirstname = new TextField("");
    mFirstname.setInputPrompt("");
    mFirstname.setImmediate(false);
    mFirstname.setRequired(true);
    mFirstname.setWidth("-1px");
    mFirstname.setHeight("-1px");
    mFirstname.setNullRepresentation("");
    motherGroup.addComponent(mFirstname);

    mLastname = new TextField("?");
    mLastname.setInputPrompt("?");
    mLastname.setImmediate(false);
    mLastname.setRequired(true);
    mLastname.setWidth("-1px");
    mLastname.setHeight("-1px");
    mLastname.setNullRepresentation("");
    motherGroup.addComponent(mLastname);

    mFirstnameNd = new TextField("?");
    mFirstnameNd.setInputPrompt("?");
    mFirstnameNd.setImmediate(false);
    mFirstnameNd.setWidth("-1px");
    mFirstnameNd.setHeight("-1px");
    mFirstnameNd.setNullRepresentation("");
    motherGroup.addComponent(mFirstnameNd);

    mLastnameNd = new TextField("??");
    mLastnameNd.setInputPrompt("??");
    mLastnameNd.setImmediate(false);
    mLastnameNd.setWidth("-1px");
    mLastnameNd.setHeight("-1px");
    mLastnameNd.setNullRepresentation("");
    motherGroup.addComponent(mLastnameNd);

    mGender = new OptionGroup("", new Gender());
    mGender.setItemCaptionPropertyId("name");
    mGender.setImmediate(true);
    mGender.setNullSelectionAllowed(false);
    mGender.setRequired(true);
    mGender.setWidth("-1px");
    mGender.setHeight("-1px");
    motherGroup.addComponent(mGender);

    mReligion = new NativeSelect("", new Religion());
    //mReligion.setInputPrompt("??");
    mReligion.setItemCaptionPropertyId("name");
    mReligion.setImmediate(true);
    mReligion.setNullSelectionAllowed(false);
    mReligion.setRequired(true);
    mReligion.setWidth("-1px");
    mReligion.setHeight("-1px");
    //mReligion.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mReligion);

    mRace = new NativeSelect("", new Race());
    //mRace.setInputPrompt("??");
    mRace.setItemCaptionPropertyId("name");
    mRace.setImmediate(true);
    mRace.setNullSelectionAllowed(false);
    mRace.setRequired(true);
    mRace.setWidth("-1px");
    mRace.setHeight("-1px");
    //mRace.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mRace);

    mNationality = new NativeSelect("?", new Nationality());
    //mNationality.setInputPrompt("??");
    mNationality.setItemCaptionPropertyId("name");
    mNationality.setImmediate(true);
    mNationality.setNullSelectionAllowed(false);
    mNationality.setRequired(true);
    mNationality.setWidth("-1px");
    mNationality.setHeight("-1px");
    //mNationality.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mNationality);

    mBirthDate = new PopupDateField("   ?");
    mBirthDate.setInputPrompt("//");
    mBirthDate.setImmediate(false);
    mBirthDate.setWidth("-1px");
    mBirthDate.setHeight("-1px");
    mBirthDate.setDateFormat("dd/MM/yyyy");
    mBirthDate.setLocale(new Locale("th", "TH"));
    motherGroup.addComponent(mBirthDate);

    mTel = new TextField("");
    mTel.setInputPrompt("");
    mTel.setImmediate(false);
    mTel.setWidth("-1px");
    mTel.setHeight("-1px");
    mTel.setNullRepresentation("");
    motherGroup.addComponent(mTel);

    mMobile = new TextField("");
    mMobile.setInputPrompt("");
    mMobile.setImmediate(false);
    mMobile.setWidth("-1px");
    mMobile.setHeight("-1px");
    mMobile.setNullRepresentation("");
    motherGroup.addComponent(mMobile);

    mEmail = new TextField("");
    mEmail.setInputPrompt("");
    mEmail.setImmediate(false);
    mEmail.setWidth("-1px");
    mEmail.setHeight("-1px");
    mEmail.setNullRepresentation("");
    mEmail.addValidator(new EmailValidator("?"));
    motherGroup.addComponent(mEmail);

    mSalary = new NumberField("");
    mSalary.setInputPrompt("");
    mSalary.setImmediate(false);
    mSalary.setWidth("-1px");
    mSalary.setHeight("-1px");
    mSalary.setNullRepresentation("");
    motherGroup.addComponent(mSalary);

    mAliveStatus = new NativeSelect("", new AliveStatus());
    //mAliveStatus.setInputPrompt("??");
    mAliveStatus.setItemCaptionPropertyId("name");
    mAliveStatus.setImmediate(true);
    mAliveStatus.setNullSelectionAllowed(false);
    mAliveStatus.setRequired(true);
    mAliveStatus.setWidth("-1px");
    mAliveStatus.setHeight("-1px");
    //mAliveStatus.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mAliveStatus);

    mOccupation = new NativeSelect("", new Occupation());
    //mOccupation.setInputPrompt("??");
    mOccupation.setItemCaptionPropertyId("name");
    mOccupation.setImmediate(true);
    mOccupation.setNullSelectionAllowed(false);
    mOccupation.setRequired(true);
    mOccupation.setWidth("-1px");
    mOccupation.setHeight("-1px");
    //mOccupation.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mOccupation);

    mJobAddress = new TextArea("");
    mJobAddress.setInputPrompt("  ");
    mJobAddress.setImmediate(false);
    mJobAddress.setWidth("-1px");
    mJobAddress.setHeight("-1px");
    mJobAddress.setNullRepresentation("");
    motherGroup.addComponent(mJobAddress);

    mCurrentAddress = new TextArea("");
    mCurrentAddress.setInputPrompt("  ");
    mCurrentAddress.setImmediate(false);
    mCurrentAddress.setWidth("-1px");
    mCurrentAddress.setHeight("-1px");
    mCurrentAddress.setNullRepresentation("");
    motherGroup.addComponent(mCurrentAddress);

    mCurrentProvinceId = new NativeSelect("", new Province());
    //mCurrentProvinceId.setInputPrompt("??");
    mCurrentProvinceId.setItemCaptionPropertyId("name");
    mCurrentProvinceId.setImmediate(true);
    mCurrentProvinceId.setNullSelectionAllowed(false);
    mCurrentProvinceId.setWidth("-1px");
    mCurrentProvinceId.setHeight("-1px");
    //mCurrentProvinceId.setFilteringMode(FilteringMode.CONTAINS);
    mCurrentProvinceId.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                mCurrentDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    motherGroup.addComponent(mCurrentProvinceId);

    mCurrentDistrict = new NativeSelect("");
    //mCurrentDistrict.setInputPrompt("??");
    mCurrentDistrict.setItemCaptionPropertyId("name");
    mCurrentDistrict.setImmediate(true);
    mCurrentDistrict.setNullSelectionAllowed(false);
    mCurrentDistrict.setWidth("-1px");
    mCurrentDistrict.setHeight("-1px");
    //mCurrentDistrict.setFilteringMode(FilteringMode.CONTAINS);
    mCurrentDistrict.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                mCurrentCity.setContainerDataSource(
                        new City(Integer.parseInt(event.getProperty().getValue().toString())));
                mCurrentPostcode.setContainerDataSource(
                        new Postcode(Integer.parseInt(event.getProperty().getValue().toString())));
            }
        }
    });
    motherGroup.addComponent(mCurrentDistrict);

    mCurrentCity = new NativeSelect("");
    //mCurrentCity.setInputPrompt("??");
    mCurrentCity.setItemCaptionPropertyId("name");
    mCurrentCity.setImmediate(true);
    mCurrentCity.setNullSelectionAllowed(false);
    mCurrentCity.setWidth("-1px");
    mCurrentCity.setHeight("-1px");
    //mCurrentCity.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mCurrentCity);

    mCurrentPostcode = new NativeSelect("");
    //mCurrentPostcode.setInputPrompt("??");
    mCurrentPostcode.setItemCaptionPropertyId("name");
    mCurrentPostcode.setImmediate(true);
    mCurrentPostcode.setNullSelectionAllowed(false);
    mCurrentPostcode.setWidth("-1px");
    mCurrentPostcode.setHeight("-1px");
    //mCurrentPostcode.setFilteringMode(FilteringMode.CONTAINS);
    motherGroup.addComponent(mCurrentPostcode);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth("100%");
    motherGroup.addComponent(buttonLayout);

    fatherBack = new Button(FontAwesome.ARROW_LEFT);
    fatherBack.setWidth("100%");
    fatherBack.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(fatherGroup);
        }
    });
    buttonLayout.addComponents(fatherBack);

    spouseNext = new Button(FontAwesome.ARROW_RIGHT);
    spouseNext.setWidth("100%");
    spouseNext.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(spouseGroup);
        }
    });
    buttonLayout.addComponents(spouseNext);
}

From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java

private void spouseGroup() {
    spouseGroup = new VerticalComponentGroup();
    spouseGroup.setSizeUndefined();/* w ww  . j a v a  2s. c o m*/

    addTab(spouseGroup, "", FontAwesome.USER);

    sPeopleIdType = new OptionGroup("", new PeopleIdType());
    sPeopleIdType.setItemCaptionPropertyId("name");
    sPeopleIdType.setImmediate(true);
    sPeopleIdType.setNullSelectionAllowed(false);
    sPeopleIdType.setWidth("-1px");
    sPeopleIdType.setHeight("-1px");
    spouseGroup.addComponent(sPeopleIdType);

    sPeopleid = new TextField("");
    sPeopleid.setInputPrompt("");
    sPeopleid.setImmediate(false);
    sPeopleid.setWidth("-1px");
    sPeopleid.setHeight("-1px");
    sPeopleid.setNullRepresentation("");
    //sPeopleid.addValidator(new StringLengthValidator("?", 13, 20, true));
    sPeopleid.addTextChangeListener(new TextChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(TextChangeEvent event) {
            if (event.getText() != null) {
                if (event.getText().length() >= 13) {
                    fSqlContainer.addContainerFilter(new Equal(FamilySchema.PEOPLE_ID, event.getText()));
                    if (fSqlContainer.size() > 0) {
                        Item item = fSqlContainer.getItem(fSqlContainer.getIdByIndex(0));
                        spouseBinder.setItemDataSource(item);
                        pkStore[2] = item.getItemProperty(FamilySchema.FAMILY_ID).getValue();
                        spouseBinder.setEnabled(false);
                        isDuplicateSpouse = true;
                    }
                    fSqlContainer.removeAllContainerFilters();
                }
            }
        }
    });
    spouseGroup.addComponent(sPeopleid);

    sPrename = new NativeSelect("", new Prename());
    //sPrename.setInputPrompt("??");
    sPrename.setItemCaptionPropertyId("name");
    sPrename.setImmediate(true);
    sPrename.setNullSelectionAllowed(false);
    sPrename.setRequired(true);
    sPrename.setWidth("-1px");
    sPrename.setHeight("-1px");
    //sPrename.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sPrename);

    sFirstname = new TextField("");
    sFirstname.setInputPrompt("");
    sFirstname.setImmediate(false);
    sFirstname.setRequired(true);
    sFirstname.setWidth("-1px");
    sFirstname.setHeight("-1px");
    sFirstname.setNullRepresentation("");
    spouseGroup.addComponent(sFirstname);

    sLastname = new TextField("?");
    sLastname.setInputPrompt("?");
    sLastname.setImmediate(false);
    sLastname.setRequired(true);
    sLastname.setWidth("-1px");
    sLastname.setHeight("-1px");
    sLastname.setNullRepresentation("");
    spouseGroup.addComponent(sLastname);

    sFirstnameNd = new TextField("?");
    sFirstnameNd.setInputPrompt("?");
    sFirstnameNd.setImmediate(false);
    sFirstnameNd.setWidth("-1px");
    sFirstnameNd.setHeight("-1px");
    sFirstnameNd.setNullRepresentation("");
    spouseGroup.addComponent(sFirstnameNd);

    sLastnameNd = new TextField("??");
    sLastnameNd.setInputPrompt("??");
    sLastnameNd.setImmediate(false);
    sLastnameNd.setWidth("-1px");
    sLastnameNd.setHeight("-1px");
    sLastnameNd.setNullRepresentation("");
    spouseGroup.addComponent(sLastnameNd);

    sGender = new OptionGroup("", new Gender());
    sGender.setItemCaptionPropertyId("name");
    sGender.setImmediate(true);
    sGender.setNullSelectionAllowed(false);
    sGender.setRequired(true);
    sGender.setWidth("-1px");
    sGender.setHeight("-1px");
    spouseGroup.addComponent(sGender);

    sReligion = new NativeSelect("", new Religion());
    //sReligion.setInputPrompt("??");
    sReligion.setItemCaptionPropertyId("name");
    sReligion.setImmediate(true);
    sReligion.setNullSelectionAllowed(false);
    sReligion.setRequired(true);
    sReligion.setWidth("-1px");
    sReligion.setHeight("-1px");
    //sReligion.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sReligion);

    sRace = new NativeSelect("", new Race());
    //sRace.setInputPrompt("??");
    sRace.setItemCaptionPropertyId("name");
    sRace.setImmediate(true);
    sRace.setNullSelectionAllowed(false);
    sRace.setRequired(true);
    sRace.setWidth("-1px");
    sRace.setHeight("-1px");
    //sRace.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sRace);

    sNationality = new NativeSelect("?", new Nationality());
    //sNationality.setInputPrompt("??");
    sNationality.setItemCaptionPropertyId("name");
    sNationality.setImmediate(true);
    sNationality.setNullSelectionAllowed(false);
    sNationality.setRequired(true);
    sNationality.setWidth("-1px");
    sNationality.setHeight("-1px");
    //sNationality.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sNationality);

    sBirthDate = new PopupDateField("   ?");
    sBirthDate.setInputPrompt("//");
    sBirthDate.setImmediate(false);
    sBirthDate.setWidth("-1px");
    sBirthDate.setHeight("-1px");
    sBirthDate.setDateFormat("dd/MM/yyyy");
    sBirthDate.setLocale(new Locale("th", "TH"));
    spouseGroup.addComponent(sBirthDate);

    sTel = new TextField("");
    sTel.setInputPrompt("");
    sTel.setImmediate(false);
    sTel.setWidth("-1px");
    sTel.setHeight("-1px");
    sTel.setNullRepresentation("");
    spouseGroup.addComponent(sTel);

    sMobile = new TextField("");
    sMobile.setInputPrompt("");
    sMobile.setImmediate(false);
    sMobile.setWidth("-1px");
    sMobile.setHeight("-1px");
    sMobile.setNullRepresentation("");
    spouseGroup.addComponent(sMobile);

    sEmail = new TextField("");
    sEmail.setInputPrompt("");
    sEmail.setImmediate(false);
    sEmail.setWidth("-1px");
    sEmail.setHeight("-1px");
    sEmail.setNullRepresentation("");
    sEmail.addValidator(new EmailValidator("?"));
    spouseGroup.addComponent(sEmail);

    sSalary = new NumberField("");
    sSalary.setInputPrompt("");
    sSalary.setImmediate(false);
    sSalary.setWidth("-1px");
    sSalary.setHeight("-1px");
    sSalary.setNullRepresentation("");
    spouseGroup.addComponent(sSalary);

    sAliveStatus = new NativeSelect("", new AliveStatus());
    //sAliveStatus.setInputPrompt("??");
    sAliveStatus.setItemCaptionPropertyId("name");
    sAliveStatus.setImmediate(true);
    sAliveStatus.setNullSelectionAllowed(false);
    sAliveStatus.setRequired(true);
    sAliveStatus.setWidth("-1px");
    sAliveStatus.setHeight("-1px");
    //sAliveStatus.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sAliveStatus);

    sOccupation = new NativeSelect("", new Occupation());
    //sOccupation.setInputPrompt("??");
    sOccupation.setItemCaptionPropertyId("name");
    sOccupation.setImmediate(true);
    sOccupation.setNullSelectionAllowed(false);
    sOccupation.setRequired(true);
    sOccupation.setWidth("-1px");
    sOccupation.setHeight("-1px");
    //sOccupation.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sOccupation);

    sJobAddress = new TextArea("");
    sJobAddress.setInputPrompt("  ");
    sJobAddress.setImmediate(false);
    sJobAddress.setWidth("-1px");
    sJobAddress.setHeight("-1px");
    sJobAddress.setNullRepresentation("");
    spouseGroup.addComponent(sJobAddress);

    sCurrentAddress = new TextArea("");
    sCurrentAddress.setInputPrompt("  ");
    sCurrentAddress.setImmediate(false);
    sCurrentAddress.setWidth("-1px");
    sCurrentAddress.setHeight("-1px");
    sCurrentAddress.setNullRepresentation("");
    spouseGroup.addComponent(sCurrentAddress);

    sCurrentProvinceId = new NativeSelect("", new Province());
    //sCurrentProvinceId.setInputPrompt("??");
    sCurrentProvinceId.setItemCaptionPropertyId("name");
    sCurrentProvinceId.setImmediate(true);
    sCurrentProvinceId.setNullSelectionAllowed(false);
    sCurrentProvinceId.setWidth("-1px");
    sCurrentProvinceId.setHeight("-1px");
    //sCurrentProvinceId.setFilteringMode(FilteringMode.CONTAINS);
    sCurrentProvinceId.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                sCurrentDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    spouseGroup.addComponent(sCurrentProvinceId);

    sCurrentDistrict = new NativeSelect("", new Blood());
    //sCurrentDistrict.setInputPrompt("??");
    sCurrentDistrict.setItemCaptionPropertyId("name");
    sCurrentDistrict.setImmediate(true);
    sCurrentDistrict.setNullSelectionAllowed(false);
    sCurrentDistrict.setWidth("-1px");
    sCurrentDistrict.setHeight("-1px");
    //sCurrentDistrict.setFilteringMode(FilteringMode.CONTAINS);
    sCurrentDistrict.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                sCurrentCity.setContainerDataSource(
                        new City(Integer.parseInt(event.getProperty().getValue().toString())));
                sCurrentPostcode.setContainerDataSource(
                        new Postcode(Integer.parseInt(event.getProperty().getValue().toString())));
            }
        }
    });
    spouseGroup.addComponent(sCurrentDistrict);

    sCurrentCity = new NativeSelect("");
    //sCurrentCity.setInputPrompt("??");
    sCurrentCity.setItemCaptionPropertyId("name");
    sCurrentCity.setImmediate(true);
    sCurrentCity.setNullSelectionAllowed(false);
    sCurrentCity.setWidth("-1px");
    sCurrentCity.setHeight("-1px");
    //sCurrentCity.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sCurrentCity);

    sCurrentPostcode = new NativeSelect("");
    //sCurrentPostcode.setInputPrompt("??");
    sCurrentPostcode.setItemCaptionPropertyId("name");
    sCurrentPostcode.setImmediate(true);
    sCurrentPostcode.setNullSelectionAllowed(false);
    sCurrentPostcode.setWidth("-1px");
    sCurrentPostcode.setHeight("-1px");
    //sCurrentPostcode.setFilteringMode(FilteringMode.CONTAINS);
    spouseGroup.addComponent(sCurrentPostcode);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth("100%");
    spouseGroup.addComponent(buttonLayout);

    motherBack = new Button(FontAwesome.ARROW_LEFT);
    motherBack.setWidth("100%");
    motherBack.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(motherGroup);
        }
    });
    buttonLayout.addComponents(motherBack);

    finish = new Button("?", FontAwesome.SAVE);
    finish.setWidth("100%");
    buttonLayout.addComponents(finish);

    print = new Button("", FontAwesome.PRINT);
    print.setVisible(false);
    print.setWidth("100%");
    buttonLayout.addComponents(print);
}

From source file:com.klwork.explorer.ui.business.social.DiscussPopupWindow.java

License:Apache License

public VerticalLayout initMainLayout(final SocialUserWeibo userWeibo) {
    return new VerticalLayout() {
        {/*  www .  ja v  a2 s.co  m*/
            setSizeFull();
            setSpacing(true);
            setMargin(new MarginInfo(true, true, false, true));

            Label descriptionField = new Label();
            descriptionField.addStyleName("wb_text");
            descriptionField.setContentMode(ContentMode.HTML);
            descriptionField.setValue(
                    "@" + userWeibo.getUserScreenName() + ":" + mainPage.textTranslate(userWeibo.getText()));
            addComponent(descriptionField);

            addComponent(new HorizontalLayout() {// ?,?
                {
                    setWidth("100%");

                    //
                    Label inputFontField = initInputFontField();
                    addComponent(inputFontField);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(inputFontField, Alignment.MIDDLE_RIGHT);
                    setExpandRatio(inputFontField, 0.2f);
                }
            });

            // ?
            weiboContentTA = new TextArea("");
            weiboContentTA.setWidth("100%");
            weiboContentTA.setColumns(25);
            weiboContentTA.focus();
            addComponent(weiboContentTA);
            scheduleEventFieldGroup.bind(weiboContentTA, "content");

            // ?
            addComponent(new HorizontalLayout() {
                {
                    setSpacing(true);
                    // setSizeFull();
                    // setMargin(true);
                    CheckBox simuField = CommonFieldHandler.createCheckBox("");
                    simuField.addValueChangeListener(new Property.ValueChangeListener() {

                        private static final long serialVersionUID = -7104996493482558021L;

                        @Override
                        public void valueChange(ValueChangeEvent event) {
                            Object value = event.getProperty().getValue();
                        }

                    });
                    addComponent(simuField);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(simuField, Alignment.MIDDLE_LEFT);

                    Label commentLable = new Label();
                    commentLable.setContentMode(ContentMode.HTML);
                    commentLable.setValue("????");

                    addComponent(commentLable);
                    // setExpandRatio(image, 1.0f);
                    setComponentAlignment(commentLable, Alignment.MIDDLE_LEFT);

                    Image image = initFaceComponet();//
                    addComponent(image);
                }
            });

            // 
            HorizontalLayout buttonLayout = new HorizontalLayout() {
                {
                    setSpacing(true);
                    setSizeFull();
                    // setMargin(true);
                    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                    addComponent(okButton);
                    setComponentAlignment(okButton, Alignment.TOP_RIGHT);

                    okButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            BinderHandler.commit(scheduleEventFieldGroup);
                            int ret = socialService.discussWeibo(weiboForwardSend);
                            if (ret == 1) {
                                Notification.show("??", Notification.Type.HUMANIZED_MESSAGE);
                            }
                            close();
                        }
                    });
                    setExpandRatio(okButton, 1.0f);

                    Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL));
                    addComponent(cancleButton);
                    setComponentAlignment(cancleButton, Alignment.TOP_RIGHT);

                    cancleButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            close();
                        }
                    });
                }
            };
            addComponent(buttonLayout);
            setExpandRatio(buttonLayout, 1f);

        }
    };
}

From source file:com.klwork.explorer.ui.business.social.SaveToNotePopupWindow.java

License:Apache License

public VerticalLayout initMainLayout(final SocialUserWeibo userWeibo) {
    return new VerticalLayout() {
        {/*  ww w  .ja  v a2s .  co  m*/
            setSizeFull();
            setSpacing(true);
            setMargin(new MarginInfo(true, true, false, true));

            Label descriptionField = new Label();
            descriptionField.addStyleName("wb_text");
            descriptionField.setContentMode(ContentMode.HTML);
            descriptionField.setValue("");
            addComponent(descriptionField);
            // ?
            weiboContentTA = new TextArea("");
            weiboContentTA.setWidth("100%");
            weiboContentTA.setColumns(25);
            weiboContentTA.focus();
            addComponent(weiboContentTA);
            scheduleEventFieldGroup.bind(weiboContentTA, "content");

            if (hasOrginWeibo) {// 
                weiboContentTA.setValue("//@" + userWeibo.getUserScreenName() + ": " + userWeibo.getText());
            } else {
                weiboContentTA.setValue(userWeibo.getText());
                //+ mainPage.textTranslate(userWeibo.getText()));
            }

            //,
            addComponent(new VerticalLayout() {
                {
                    setSpacing(true);

                    TextField titleField = CommonFieldHandler.createTextField("");
                    scheduleEventFieldGroup.bind(titleField, "title");

                    //???
                    if (userWeibo.getText() != null && userWeibo.getText().length() > 10) {
                        titleField.setValue(userWeibo.getText().substring(0, 10));
                    }
                    addComponent(titleField);
                    // setSizeFull();
                    // setMargin(true);
                    SocialUserAccount noteAccount = socialUserAccountService
                            .findSocialUserByType(socialUserAccount.getOwnUser(), DictDef.dictInt("evernote"));
                    if (noteAccount != null) {
                        noteEntity.setUserAccountId(noteAccount.getId());
                    }

                    Map<String, String> map = socialEvernoteService.queryNotebook(noteAccount);
                    ComboBox noteMap = CommonFieldHandler.createComBox("", map, "");
                    addComponent(noteMap);
                    setComponentAlignment(noteMap, Alignment.MIDDLE_LEFT);
                }
            });

            // 
            HorizontalLayout buttonLayout = new HorizontalLayout() {
                {
                    setSpacing(true);
                    setSizeFull();
                    // setMargin(true);
                    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                    addComponent(okButton);
                    setComponentAlignment(okButton, Alignment.TOP_RIGHT);

                    okButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            BinderHandler.commit(scheduleEventFieldGroup);
                            //?
                            int ret = socialEvernoteService.saveWeiboToNotes(noteEntity);
                            if (ret == 1) {
                                Notification.show("??", Notification.Type.HUMANIZED_MESSAGE);
                            } else {
                                Notification.show("??!", Notification.Type.HUMANIZED_MESSAGE);
                            }
                            close();
                        }
                    });
                    setExpandRatio(okButton, 1.0f);

                    Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL));
                    addComponent(cancleButton);
                    setComponentAlignment(cancleButton, Alignment.TOP_RIGHT);

                    cancleButton.addClickListener(new ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            close();
                        }
                    });
                }
            };
            addComponent(buttonLayout);
            setExpandRatio(buttonLayout, 1f);

        }
    };
}