Example usage for com.vaadin.ui Label Label

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

Introduction

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

Prototype

public Label() 

Source Link

Document

Creates an empty Label.

Usage

From source file:com.anphat.cms.appparams.ui.SearchAppParamsForm.java

@AutoGenerated
private GridLayout buildGridLayout_1() {
    // common part: create layout
    gridLayout_1 = new GridLayout();
    gridLayout_1.setStyleName("custom-feildset");
    gridLayout_1/*from   ww w  .java2s.co  m*/
            .setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("appParam.fieldset.title.searchInfo")));
    gridLayout_1.setCaptionAsHtml(true);
    gridLayout_1.setImmediate(false);
    gridLayout_1.setWidth("100.0%");
    gridLayout_1.setHeight("-1px");
    gridLayout_1.setMargin(true);
    gridLayout_1.setSpacing(true);
    gridLayout_1.setColumns(4);
    gridLayout_1.setRows(4);

    // lblParamCode
    lblParamCode = new Label();
    lblParamCode.setImmediate(false);
    lblParamCode.setWidth("-1px");
    lblParamCode.setHeight("-1px");
    lblParamCode.setValue(BundleUtils.getString("lb.appParam.code"));
    gridLayout_1.addComponent(lblParamCode, 0, 0);

    txtParamCode = new TextField();
    txtParamCode.setImmediate(true);
    txtParamCode.setMaxLength(50);
    txtParamCode.setWidth("100.0%");
    txtParamCode.setHeight("-1px");
    gridLayout_1.addComponent(txtParamCode, 1, 0);
    // lblParamName
    lblParamName = new Label();
    lblParamName.setImmediate(false);
    lblParamName.setWidth("100%");
    lblParamName.setHeight("-1px");
    lblParamName.setValue(BundleUtils.getString("lb.appParam.name"));
    gridLayout_1.addComponent(lblParamName, 2, 0);

    txtParamName = new TextField();
    txtParamName.setImmediate(true);
    txtParamName.setMaxLength(200);
    txtParamName.setWidth("100.0%");
    txtParamName.setHeight("-1px");
    gridLayout_1.addComponent(txtParamName, 3, 0);

    // lblParamType
    lblParamType = new Label();
    lblParamType.setImmediate(false);
    lblParamType.setWidth("100%");
    lblParamType.setHeight("-1px");
    lblParamType.setValue(BundleUtils.getString("lb.appParam.type"));
    gridLayout_1.addComponent(lblParamType, 0, 1);

    txtParamType = new TextField();
    txtParamType.setImmediate(true);
    txtParamType.setMaxLength(100);
    txtParamType.setWidth("100.0%");
    txtParamType.setHeight("-1px");
    gridLayout_1.addComponent(txtParamType, 1, 1);
    // lblParamOrder
    lblParamOrder = new Label();
    lblParamOrder.setImmediate(false);
    lblParamOrder.setWidth("100%");
    lblParamOrder.setHeight("-1px");
    lblParamOrder.setValue(BundleUtils.getString("lb.appParam.order"));
    gridLayout_1.addComponent(lblParamOrder, 2, 1);

    // cboImplementer
    txtParamOrder = new TextField();
    txtParamOrder.setImmediate(true);
    txtParamOrder.setMaxLength(5);
    txtParamOrder.setWidth("100.0%");
    txtParamOrder.setHeight("-1px");
    gridLayout_1.addComponent(txtParamOrder, 3, 1);

    // lblStatus
    lblStatus = new Label();
    lblStatus.setImmediate(false);
    lblStatus.setWidth("100%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("lb.appParam.status"));
    gridLayout_1.addComponent(lblStatus, 0, 2);

    cboStatus = new ComboBox();
    cboStatus.setImmediate(true);
    cboStatus.setTextInputAllowed(false);
    cboStatus.setFilteringMode(FilteringMode.OFF);
    cboStatus.setWidth("100.0%");
    cboStatus.setHeight("-1px");
    gridLayout_1.addComponent(cboStatus, 1, 2);

    // lblToDate
    lblParamDesc = new Label();
    lblParamDesc.setImmediate(false);
    lblParamDesc.setWidth("100%");
    lblParamDesc.setHeight("-1px");
    lblParamDesc.setValue(BundleUtils.getString("lb.appParam.description"));
    gridLayout_1.addComponent(lblParamDesc, 2, 2);

    // pdfToDate
    txtParamDesc = new TextField();
    txtParamDesc.setImmediate(true);
    txtParamDesc.setMaxLength(300);
    txtParamDesc.setWidth("100.0%");
    txtParamDesc.setHeight("-1px");
    gridLayout_1.addComponent(txtParamDesc, 3, 2);

    // btnReset
    //        GridLayout button = new GridLayout(1, 1);
    //        button.setWidth("100%");
    //        button.setHeight("-1px");
    //        btnReset = new Button();
    //        btnReset.setStyleName("v-button-link");
    //        btnReset.setIcon(new ThemeResource("img/refresh-icon.png"));
    //        btnReset.setImmediate(true);
    //        btnReset.setHeight("-1px");
    //        btnReset.setDescription(Constants.BUTTON_REFRESH);
    //        button.addComponent(btnReset);
    //        button.setComponentAlignment(btnReset, Alignment.TOP_RIGHT);
    //        gridLayout_1.addComponent(button, 3, 3);
    return gridLayout_1;
}

From source file:com.anphat.list.controller.PopupAddPriceInfo.java

public PopupAddPriceInfo() {
    setCaption(BundleUtils.getString("dialog.PriceInfo.caption"));
    mainLayout.setImmediate(true);//from   ww  w. ja va  2  s .  c  o m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("main-popup");

    addPriceInfoLayout = new GridLayout();
    CommonUtils.setBasicAttributeLayout(addPriceInfoLayout, BundleUtils.getString("table.PriceInfo.caption"), true);
    addPriceInfoLayout.setColumns(4);
    addPriceInfoLayout.setRows(4);
    setWidth("80.0%");
    setHeight("-1px");
    setModal(true);
    lblCode = new Label();
    lblCode.setImmediate(false);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.PriceInfo.code"));
    addPriceInfoLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setImmediate(false);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    addPriceInfoLayout.addComponent(txtCode, 1, 0);
    lblName = new Label();
    lblName.setImmediate(false);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.PriceInfo.name"));
    addPriceInfoLayout.addComponent(lblName, 2, 0);

    txtName = new TextField();
    txtName.setImmediate(false);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    addPriceInfoLayout.addComponent(txtName, 3, 0);
    lblPrice = new Label();
    lblPrice.setImmediate(false);
    lblPrice.setWidth("100.0%");
    lblPrice.setHeight("-1px");
    lblPrice.setValue(BundleUtils.getString("label.PriceInfo.price"));
    addPriceInfoLayout.addComponent(lblPrice, 0, 1);

    txtPrice = new TextField();
    txtPrice.setImmediate(false);
    txtPrice.setWidth("100.0%");
    txtPrice.setHeight("-1px");
    addPriceInfoLayout.addComponent(txtPrice, 1, 1);

    lblTokenPrice = new Label();
    lblTokenPrice.setImmediate(false);
    lblTokenPrice.setWidth("100.0%");
    lblTokenPrice.setHeight("-1px");
    lblTokenPrice.setValue(BundleUtils.getString("label.PriceInfo.tokenPrice"));
    addPriceInfoLayout.addComponent(lblTokenPrice, 2, 1);

    txtTokenPrice = new TextField();
    txtTokenPrice.setImmediate(false);
    txtTokenPrice.setWidth("100.0%");
    txtTokenPrice.setHeight("-1px");
    addPriceInfoLayout.addComponent(txtTokenPrice, 3, 1);

    lblProvider = new Label();
    lblProvider.setImmediate(false);
    lblProvider.setWidth("100.0%");
    lblProvider.setHeight("-1px");
    lblProvider.setValue(BundleUtils.getString("label.PriceInfo.provider"));
    addPriceInfoLayout.addComponent(lblProvider, 0, 2);

    cbxProvider = new ComboBox();
    cbxProvider.setImmediate(false);
    cbxProvider.setWidth("100.0%");
    cbxProvider.setHeight("-1px");
    addPriceInfoLayout.addComponent(cbxProvider, 1, 2);

    lblType = new Label();
    lblType.setImmediate(false);
    lblType.setWidth("100.0%");
    lblType.setHeight("-1px");
    lblType.setValue(BundleUtils.getString("label.PriceInfo.type"));
    addPriceInfoLayout.addComponent(lblType, 2, 2);

    cbxType = new ComboBox();
    cbxType.setImmediate(false);
    cbxType.setWidth("100.0%");
    cbxType.setHeight("-1px");
    addPriceInfoLayout.addComponent(cbxType, 3, 2);

    lblStatus = new Label();
    lblStatus.setImmediate(false);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.PriceInfo.status"));
    addPriceInfoLayout.addComponent(lblStatus, 0, 3);

    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(false);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    addPriceInfoLayout.addComponent(cbxStatus, 1, 3);

    mainLayout.addComponent(addPriceInfoLayout);

    GridManyButton gridBtnPrint = CommonUtils.getCommonButtonDialog(this);
    mainLayout.addComponent(gridBtnPrint);
    btnSave = gridBtnPrint.getBtnCommon().get(0);
    btnClose = gridBtnPrint.getBtnCommon().get(1);
    setContent(mainLayout);
}

From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java

private void buildInfoLayout(boolean isCustInfo) {
    infoLayout = new GridLayout();
    infoLayout.setImmediate(true);/*from   w w w  .j a  va 2 s  .co  m*/
    //        infoLayout.setStyleName("custom-feildset");
    //        infoLayout.setCaptionAsHtml(true);
    infoLayout.setWidth("100.0%");
    infoLayout.setHeight("-1px");
    infoLayout.setMargin(true);
    infoLayout.setSpacing(true);
    infoLayout.setColumns(6);
    infoLayout.setRows(1);

    // lblCustCode
    Label lblCustCode = new Label();
    lblCustCode.addStyleName("v-label-bold");
    lblCustCode.setImmediate(true);
    lblCustCode.setWidth("100.0%");
    lblCustCode.setHeight("-1px");

    // tfCustCode
    txtCustCode = new Label();
    txtCustCode.setImmediate(true);
    txtCustCode.setWidth("100.0%");
    txtCustCode.setHeight("-1px");
    // lblCustCode
    Label lblCustName = new Label();
    lblCustName.addStyleName("v-label-bold");
    lblCustName.setImmediate(true);
    lblCustName.setWidth("100.0%");
    lblCustName.setHeight("-1px");

    // tfCustCode
    txtCustName = new Label();
    txtCustName.setImmediate(true);
    txtCustName.setWidth("100.0%");
    txtCustName.setHeight("-1px");

    if (isCustInfo) {
        //            infoLayout.setCaption(BundleUtils.getString("goods.list.panel.caption.customerinfo"));
        //            lblCustCode.setValue(BundleUtils.getString("goods.list.label.customercode"));
        lblCustName.setValue(BundleUtils.getString("goods.list.label.customername"));
    } else {
        //            infoLayout.setCaption(BundleUtils.getString("goods.list.panel.caption.staffInfo"));
        //            lblCustCode.setValue(BundleUtils.getString("lb.deptstaff.emp.code"));
        lblCustName.setValue(BundleUtils.getString("lb.deptstaff.emp.name"));
    }
    //        infoLayout.addComponent(lblCustCode, 0, 0);
    //        infoLayout.addComponent(txtCustCode, 1, 0);
    infoLayout.addComponent(lblCustName, 0, 0);
    infoLayout.addComponent(txtCustName, 1, 0, 5, 0);
}

From source file:com.anphat.list.ui.DialogAddMapStaffCustomer.java

private void buildSearchLayout(boolean isCustInfo) {
    // common part: create layout
    searchLayout = new GridLayout();
    searchLayout.setImmediate(true);/*from  www.  j  a  v  a  2s .  c om*/
    searchLayout.setStyleName("custom-feildset");
    searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("common.searchLabel")));
    searchLayout.setCaptionAsHtml(true);
    searchLayout.setWidth("100.0%");
    searchLayout.setHeight("-1px");
    searchLayout.setMargin(true);
    searchLayout.setSpacing(true);

    // lblCustCode
    Label lblCustCode = new Label();
    lblCustCode.setImmediate(true);
    lblCustCode.setWidth("100.0%");
    lblCustCode.setHeight("-1px");

    // tfCustCode
    txtStaffCode = new TextField();
    txtStaffCode.setImmediate(true);
    txtStaffCode.setWidth("100.0%");
    txtStaffCode.setHeight("-1px");

    // lblCustName
    Label lblCustName = new Label();
    lblCustName.setImmediate(true);
    lblCustName.setWidth("100.0%");
    lblCustName.setHeight("-1px");

    // tfCustName
    txtStaffName = new TextField();
    txtStaffName.setImmediate(true);
    txtStaffName.setWidth("100.0%");
    txtStaffName.setHeight("-1px");
    // lblCustCode
    Label lblEmail = new Label();
    lblEmail.setImmediate(true);
    lblEmail.setWidth("100.0%");
    lblEmail.setHeight("-1px");

    // tfCustCode
    txtEmail = new TextField();
    txtEmail.setImmediate(true);
    txtEmail.setWidth("100.0%");
    txtEmail.setHeight("-1px");

    // lblCustName
    Label lblTelephone = new Label();
    lblTelephone.setImmediate(true);
    lblTelephone.setWidth("100.0%");
    lblTelephone.setHeight("-1px");

    // tfCustName
    txtTelephone = new TextField();
    txtTelephone.setImmediate(true);
    txtTelephone.setWidth("100.0%");
    txtTelephone.setHeight("-1px");
    // lblCustName
    Label lblStaffType = new Label();
    lblStaffType.setImmediate(true);
    lblStaffType.setWidth("100.0%");
    lblStaffType.setHeight("-1px");

    // tfCustName
    cboStaffType = new ComboBox();
    cboStaffType.setImmediate(true);
    cboStaffType.setWidth("100.0%");
    cboStaffType.setHeight("-1px");

    if (isCustInfo) {
        lblCustCode.setValue(BundleUtils.getString("map.staff.customer.staffCode"));
        lblCustName.setValue(BundleUtils.getString("map.staff.customer.staffName"));
        lblEmail.setValue(BundleUtils.getString("goods.list.label.email"));
        lblTelephone.setValue(BundleUtils.getString("lb.deptstaff.common.phone"));
        lblStaffType.setValue(BundleUtils.getString("map.staff.customer.staffType"));
        searchLayout.setColumns(6);
        searchLayout.setRows(2);
        searchLayout.addComponent(lblCustCode, 0, 0);
        searchLayout.addComponent(txtStaffCode, 1, 0);
        searchLayout.addComponent(lblCustName, 2, 0);
        searchLayout.addComponent(txtStaffName, 3, 0);
        searchLayout.addComponent(lblEmail, 4, 0);
        searchLayout.addComponent(txtEmail, 5, 0);
        searchLayout.addComponent(lblStaffType, 0, 1);
        searchLayout.addComponent(cboStaffType, 1, 1);
        searchLayout.addComponent(lblTelephone, 2, 1);
        searchLayout.addComponent(txtTelephone, 3, 1);
    } else {
        lblCustCode.setValue(BundleUtils.getString("map.staff.customer.custCode"));
        lblCustName.setValue(BundleUtils.getString("map.staff.customer.custName"));
        lblEmail.setValue(BundleUtils.getString("goods.list.label.email"));
        lblTelephone.setValue(BundleUtils.getString("lb.deptstaff.common.phone"));
        searchLayout.setColumns(4);
        searchLayout.setRows(2);
        searchLayout.addComponent(lblCustCode, 0, 0);
        searchLayout.addComponent(txtStaffCode, 1, 0);
        searchLayout.addComponent(lblCustName, 2, 0);
        searchLayout.addComponent(txtStaffName, 3, 0);
        searchLayout.addComponent(lblEmail, 0, 1);
        searchLayout.addComponent(txtEmail, 1, 1);
        searchLayout.addComponent(lblTelephone, 2, 1);
        searchLayout.addComponent(txtTelephone, 3, 1);
    }
}

From source file:com.anphat.list.ui.DialogCreateDepartment.java

@AutoGenerated
private GridLayout buildGridLayoutDepartInfo() {
    // common part: create layout
    gridLayoutDepartInfo = new GridLayout();
    gridLayoutDepartInfo.setStyleName("custom-feildset");
    gridLayoutDepartInfo/*  w w  w .j  a v  a2s .com*/
            .setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("department.fieldset.title.deptInfo")));
    gridLayoutDepartInfo.setCaptionAsHtml(true);
    gridLayoutDepartInfo.setImmediate(true);
    gridLayoutDepartInfo.setWidth("100.0%");
    gridLayoutDepartInfo.setHeight("-1px");
    gridLayoutDepartInfo.setMargin(true);
    gridLayoutDepartInfo.setSpacing(true);
    gridLayoutDepartInfo.setColumns(4);
    gridLayoutDepartInfo.setRows(7);

    // lblDepartmentCode
    lblDepartmentCode = new Label();
    lblDepartmentCode.setImmediate(true);
    lblDepartmentCode.setWidth("100.0%");
    lblDepartmentCode.setHeight("-1px");
    lblDepartmentCode.setValue(BundleUtils.getString("lb.deptstaff.dept.code"));
    gridLayoutDepartInfo.addComponent(lblDepartmentCode, 0, 0);

    // txtDepartmentCode
    txtDepartmentCode = new TextField();
    txtDepartmentCode.setImmediate(true);
    txtDepartmentCode.setWidth("100.0%");
    txtDepartmentCode.setHeight("-1px");
    txtDepartmentCode.setMaxLength(50);
    txtDepartmentCode.setRequired(true);
    txtDepartmentCode.addValidator(
            new RegexpValidator("^[a-zA-Z0-9-_]+$", BundleUtils.getString("lb.deptstaff.dept.code") + " "
                    + BundleUtils.getString("message.error.code.format")));
    gridLayoutDepartInfo.addComponent(txtDepartmentCode, 1, 0);

    // lblDepartmentName
    lblDepartmentName = new Label();
    lblDepartmentName.setImmediate(true);
    lblDepartmentName.setWidth("100.0%");
    lblDepartmentName.setHeight("-1px");
    lblDepartmentName.setValue(BundleUtils.getString("lb.deptstaff.dept.name"));
    gridLayoutDepartInfo.addComponent(lblDepartmentName, 2, 0);

    // txtDepartmentName
    txtDepartmentName = new TextField();
    txtDepartmentName.setImmediate(true);
    txtDepartmentName.setWidth("100.0%");
    txtDepartmentName.setHeight("-1px");
    txtDepartmentName.setMaxLength(100);
    txtDepartmentName.setRequired(true);
    gridLayoutDepartInfo.addComponent(txtDepartmentName, 3, 0);

    // lblSuperiorUnit
    //        lblSuperiorUnit = new Label();
    //        lblSuperiorUnit.setImmediate(true);
    //        lblSuperiorUnit.setWidth("100.0%");
    //        lblSuperiorUnit.setHeight("-1px");
    //        lblSuperiorUnit.setValue(BundleUtils.getString("lb.deptstaff.dept.level"));
    //        gridLayoutDepartInfo.addComponent(lblSuperiorUnit, 0, 1);

    // txtSuperiorUnit
    //        txtSuperiorUnit = new TextField();
    //        txtSuperiorUnit.setImmediate(true);
    //        txtSuperiorUnit.setWidth("100.0%");
    //        txtSuperiorUnit.setHeight("-1px");
    //        comboDeptTopLevel = new MappingCombobox(3, 1);
    //        comboDeptTopLevel.getNameCombo().setRequired(true);
    //        gridLayoutDepartInfo.addComponent(comboDeptTopLevel.getLayout(), 1, 1, 3, 1);

    // lblDescription
    lblDescription = new Label();
    lblDescription.setImmediate(true);
    lblDescription.setWidth("100.0%");
    lblDescription.setHeight("-1px");
    lblDescription.setValue(BundleUtils.getString("lb.deptstaff.desc"));
    gridLayoutDepartInfo.addComponent(lblDescription, 0, 1);

    // textArea_1
    textArea_1 = new TextArea();
    textArea_1.setImmediate(true);
    textArea_1.setWidth("100.0%");
    textArea_1.setHeight("-1px");
    textArea_1.setMaxLength(300);
    textArea_1.setStyleName("notRequireStyle");
    gridLayoutDepartInfo.addComponent(textArea_1, 1, 1, 3, 1);

    // lblStatus
    lblStatus = new Label();
    lblStatus.setImmediate(true);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("lb.deptstaff.common.status"));
    gridLayoutDepartInfo.addComponent(lblStatus, 0, 2);

    // cbxStatus
    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(true);
    cbxStatus.setTextInputAllowed(false);
    cbxStatus.setFilteringMode(FilteringMode.OFF);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    cbxStatus.setRequired(true);
    gridLayoutDepartInfo.addComponent(cbxStatus, 1, 2);

    // lblPhoneNumber
    lblPhoneNumber = new Label();
    lblPhoneNumber.setImmediate(true);
    lblPhoneNumber.setWidth("100.0%");
    lblPhoneNumber.setHeight("-1px");
    lblPhoneNumber.setValue(BundleUtils.getString("lb.deptstaff.common.phone"));
    gridLayoutDepartInfo.addComponent(lblPhoneNumber, 2, 2);

    // txtPhoneNumber
    txtPhoneNumber = new TextField();
    txtPhoneNumber.setImmediate(true);
    txtPhoneNumber.setInputPrompt(BundleUtils.getString("common.phone.format"));
    txtPhoneNumber.setWidth("100.0%");
    txtPhoneNumber.setHeight("-1px");
    txtPhoneNumber.setMaxLength(100);
    //message
    //          StringBuilder messageErrorOrder = new StringBuilder();
    //        messageErrorOrder.append(BundleUtils.getString("lb.deptstaff.common.phone"));
    //        messageErrorOrder.append(BundleUtils.getString(" "));
    //        messageErrorOrder.append(BundleUtils.getString("message.error.phoneformat"));
    //        txtPhoneNumber.addValidator(new RegexpValidator("^\\(?(\\d{3,4})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", messageErrorOrder.toString()));
    txtPhoneNumber.setStyleName("notRequireStyle");
    gridLayoutDepartInfo.addComponent(txtPhoneNumber, 3, 2);

    // lblFax
    //        lblFax = new Label();
    //        lblFax.setImmediate(true);
    //        lblFax.setWidth("100.0%");
    //        lblFax.setHeight("-1px");
    //        lblFax.setValue(BundleUtils.getString("lb.deptstaff.fax"));
    //        gridLayoutDepartInfo.addComponent(lblFax, 0, 4);

    // txtFax
    //        txtFax = new TextField();
    //        txtFax.setImmediate(true);
    //        txtFax.setWidth("100.0%");
    //        txtFax.setHeight("-1px");
    //        txtFax.setMaxLength(100);
    //message
    //        StringBuilder messageErrorFax = new StringBuilder();
    //        messageErrorFax.append(BundleUtils.getString("lb.deptstaff.fax"));
    //        messageErrorFax.append(BundleUtils.getString(" "));
    //        messageErrorFax.append(BundleUtils.getString("message.error.numberformat"));
    //        txtFax.addValidator(new RegexpValidator("[0-9]+", messageErrorFax.toString()));
    //        txtFax.setStyleName("notRequireStyle");
    //        gridLayoutDepartInfo.addComponent(txtFax, 1, 4);

    // lblEmail
    lblEmail = new Label();
    lblEmail.setImmediate(true);
    lblEmail.setWidth("100.0%");
    lblEmail.setHeight("-1px");
    lblEmail.setValue(BundleUtils.getString("lb.deptstaff.common.email"));
    gridLayoutDepartInfo.addComponent(lblEmail, 2, 3);

    // txtEmail
    txtEmail = new TextField();
    txtEmail.setImmediate(true);
    txtEmail.addValidator(new EmailValidator(BundleUtils.getString("common.error.email")));
    txtEmail.setRequiredError(BundleUtils.getString("common.error.email"));
    txtEmail.setInputPrompt(BundleUtils.getString("common.email.hint.format"));
    txtEmail.setWidth("100.0%");
    txtEmail.setHeight("-1px");
    txtEmail.setMaxLength(100);
    txtEmail.setStyleName("notRequireStyle");
    gridLayoutDepartInfo.addComponent(txtEmail, 3, 3);

    // lblAddress
    lblAddress = new Label();
    lblAddress.setImmediate(true);
    lblAddress.setWidth("100.0%");
    lblAddress.setHeight("-1px");
    lblAddress.setValue(BundleUtils.getString("lb.deptstaff.dept.addr"));
    gridLayoutDepartInfo.addComponent(lblAddress, 0, 4);

    // txtAddress
    txtAddress = new TextField();
    txtAddress.setImmediate(true);
    txtAddress.setWidth("100.0%");
    txtAddress.setHeight("-1px");
    txtAddress.setMaxLength(300);
    //        txtAddress.addValidator(new StringLengthValidator(BundleUtils.getString("common.error.length"), 0, 200, true));
    txtAddress.setRequired(true);
    txtAddress.setStyleName("notRequireStyle");
    gridLayoutDepartInfo.addComponent(txtAddress, 1, 4, 3, 4);

    // lblContact
    //        lblContact = new Label();
    //        lblContact.setImmediate(true);
    //        lblContact.setWidth("100.0%");
    //        lblContact.setHeight("-1px");
    //        lblContact.setValue(BundleUtils.getString("lb.deptstaff.contact.person"));
    //        gridLayoutDepartInfo.addComponent(lblContact, 0, 5);
    //
    //        // txtContact
    //        txtContact = new TextField();
    //        txtContact.setImmediate(true);
    //        txtContact.setWidth("100.0%");
    //        txtContact.setHeight("-1px");
    //        txtContact.setMaxLength(200);
    //        txtContact.setStyleName("notRequireStyle");
    //        gridLayoutDepartInfo.addComponent(txtContact, 1, 5, 3, 5);

    return gridLayoutDepartInfo;
}

From source file:com.anphat.list.ui.DialogCreateStaff.java

@AutoGenerated
private GridLayout buildGridLayoutDepartInfo() {
    // common part: create layout
    gridLayoutDepartInfo = new GridLayout();
    gridLayoutDepartInfo.setStyleName("custom-feildset");
    gridLayoutDepartInfo.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.title.emp.info")));
    gridLayoutDepartInfo.setCaptionAsHtml(true);
    gridLayoutDepartInfo.setImmediate(true);
    gridLayoutDepartInfo.setWidth("100.0%");
    gridLayoutDepartInfo.setHeight("-1px");
    gridLayoutDepartInfo.setMargin(true);
    gridLayoutDepartInfo.setSpacing(true);
    gridLayoutDepartInfo.setColumns(4);//from  w w w  . ja  va  2  s .  c  o  m
    gridLayoutDepartInfo.setRows(7);

    // lblDepartmentCode
    lblDepartmentCode = new Label();
    lblDepartmentCode.setImmediate(false);
    lblDepartmentCode.setWidth("100.0%");
    lblDepartmentCode.setHeight("-1px");
    lblDepartmentCode.setValue(BundleUtils.getString("lb.deptstaff.emp.code"));
    gridLayoutDepartInfo.addComponent(lblDepartmentCode, 0, 0);

    // txtStaffCode
    txtStaffCode = new TextField();
    txtStaffCode.setImmediate(true);
    txtStaffCode.setWidth("100.0%");
    txtStaffCode.setHeight("-1px");
    txtStaffCode.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER);
    txtStaffCode.addTextChangeListener(new FieldEvents.TextChangeListener() {

        @Override
        public void textChange(final FieldEvents.TextChangeEvent event) {
            String code = event.getText();
            if (code != null) {
                code = code.replaceAll(" ", "");
                if (!DataUtil.isStringNullOrEmpty(code)) {
                    txtStaffCode.setValue(code.toUpperCase());
                }
            }
        }
    });
    txtStaffCode.setMaxLength(50);
    txtStaffCode
            .addValidator(new RegexpValidator("^[a-zA-Z0-9-_]+$", BundleUtils.getString("lb.deptstaff.emp.code")
                    + " " + BundleUtils.getString("message.error.code.format")));
    txtStaffCode.setRequired(true);
    gridLayoutDepartInfo.addComponent(txtStaffCode, 1, 0);

    // lblDepartmentName
    lblDepartmentName = new Label();
    lblDepartmentName.setImmediate(false);
    lblDepartmentName.setWidth("100.0%");
    lblDepartmentName.setHeight("-1px");
    lblDepartmentName.setValue(BundleUtils.getString("lb.deptstaff.emp.name"));
    gridLayoutDepartInfo.addComponent(lblDepartmentName, 2, 0);

    // txtStaffName
    txtStaffName = new TextField();
    txtStaffName.setImmediate(true);
    txtStaffName.setWidth("100.0%");
    txtStaffName.setHeight("-1px");
    txtStaffName.setMaxLength(200);
    //        txtStaffName.addValidator(new StringLengthValidator(BundleUtils.getString("common.error.length"), 0, 200, true));
    txtStaffName.setRequired(true);
    gridLayoutDepartInfo.addComponent(txtStaffName, 3, 0);

    // lblSuperiorUnit
    lblSuperiorUnit = new Label();
    lblSuperiorUnit.setImmediate(false);
    lblSuperiorUnit.setWidth("100.0%");
    lblSuperiorUnit.setHeight("-1px");
    lblSuperiorUnit.setValue(BundleUtils.getString("lb.deptstaff.emp.dept"));
    gridLayoutDepartInfo.addComponent(lblSuperiorUnit, 0, 1);

    // txtSuperiorUnit
    txtSuperiorUnit = new TextField();
    txtSuperiorUnit.setImmediate(true);
    txtSuperiorUnit.setWidth("100.0%");
    txtSuperiorUnit.setHeight("-1px");
    comboDeptTopLevel = new MappingCombobox(3, 1);
    //        comboDeptTopLevel.getNameCombo().setRequired(true);
    gridLayoutDepartInfo.addComponent(comboDeptTopLevel.getLayout(), 1, 1, 3, 1);

    //        // lblStock
    //        lblStock = new Label();
    //        lblStock.setImmediate(false);
    //        lblStock.setWidth("100.0%");
    //        lblStock.setHeight("-1px");
    //        lblStock.setVisible(false);
    //        lblStock.setValue(BundleUtils.getString("lb.deptstaff.emp.stock"));
    //        gridLayoutDepartInfo.addComponent(lblStock, 0, 2);
    //
    //        // txtSuperiorUnit
    //        comboStock = new MappingCombobox(3, 1);
    ////        comboDeptTopLevel.getNameCombo().setRequired(true);
    //        comboStock.setVisible(false);
    //        gridLayoutDepartInfo.addComponent(comboStock.getLayout(), 1, 2,3 ,2);

    // lblSuperiorUnit
    lblStaffType = new Label();
    lblStaffType.setImmediate(false);
    lblStaffType.setWidth("100.0%");
    lblStaffType.setHeight("-1px");
    lblStaffType.setValue(BundleUtils.getString("lb.deptstaff.emp.type"));
    //        gridLayoutDepartInfo.addComponent(lblStaffType, 0, 3);
    gridLayoutDepartInfo.addComponent(lblStaffType, 0, 2);

    // txtSuperiorUnit
    cbxStaffType = new ComboBox();
    cbxStaffType.setImmediate(true);
    cbxStaffType.setRequired(true);
    cbxStaffType.setTextInputAllowed(false);
    cbxStaffType.setFilteringMode(FilteringMode.OFF);
    cbxStaffType.setWidth("100.0%");
    cbxStaffType.setHeight("-1px");
    //        cbxStaffType.setStyleName("notRequireStyle");
    //        gridLayoutDepartInfo.addComponent(cbxStaffType, 1, 3);
    gridLayoutDepartInfo.addComponent(cbxStaffType, 1, 2);

    // lblDescription
    lblDescription = new Label();
    lblDescription.setImmediate(false);
    lblDescription.setWidth("100.0%");
    lblDescription.setHeight("-1px");
    lblDescription.setValue(BundleUtils.getString("lb.deptstaff.common.phone"));
    //        gridLayoutDepartInfo.addComponent(lblDescription, 0, 4);
    gridLayoutDepartInfo.addComponent(lblDescription, 0, 3);

    // textArea_1
    txtPhoneNumber = new TextField();
    txtPhoneNumber.setImmediate(true);
    txtPhoneNumber.setWidth("100.0%");
    txtPhoneNumber.setHeight("-1px");
    txtPhoneNumber.setMaxLength(100);
    StringBuilder messageErrorOrder = new StringBuilder();
    messageErrorOrder.append(BundleUtils.getString("lb.deptstaff.common.phone"));
    messageErrorOrder.append(BundleUtils.getString(" "));
    messageErrorOrder.append(BundleUtils.getString("message.error.phoneformat"));
    txtPhoneNumber.addValidator(new RegexpValidator("^\\(?(\\d{3,4})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$",
            messageErrorOrder.toString()));
    txtPhoneNumber.setInputPrompt(BundleUtils.getString("common.phone.format"));
    txtPhoneNumber.setStyleName("notRequireStyle");
    //        gridLayoutDepartInfo.addComponent(txtPhoneNumber, 1, 4);
    gridLayoutDepartInfo.addComponent(txtPhoneNumber, 1, 3);

    // lblStatus
    lblStatus = new Label();
    lblStatus.setImmediate(false);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("lb.deptstaff.common.status"));
    //        gridLayoutDepartInfo.addComponent(lblStatus, 2, 3);
    gridLayoutDepartInfo.addComponent(lblStatus, 2, 2);

    // cbxStatus
    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(true);
    cbxStatus.setTextInputAllowed(false);
    cbxStatus.setFilteringMode(FilteringMode.OFF);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    cbxStatus.setRequired(true);
    //        gridLayoutDepartInfo.addComponent(cbxStatus, 3, 3);
    gridLayoutDepartInfo.addComponent(cbxStatus, 3, 2);

    // lblPhoneNumber
    lblPhoneNumber = new Label();
    lblPhoneNumber.setImmediate(false);
    lblPhoneNumber.setWidth("100.0%");
    lblPhoneNumber.setHeight("-1px");
    lblPhoneNumber.setValue(BundleUtils.getString("lb.deptstaff.common.email"));
    //        gridLayoutDepartInfo.addComponent(lblPhoneNumber, 2, 4);
    gridLayoutDepartInfo.addComponent(lblPhoneNumber, 2, 3);

    // txtEmail
    txtEmail = new TextField();
    txtEmail.setImmediate(true);
    txtEmail.addValidator(new EmailValidator(BundleUtils.getString("common.error.email")));
    txtEmail.setRequiredError(BundleUtils.getString("common.error.email"));
    txtEmail.setInputPrompt(BundleUtils.getString("common.email.hint.format"));
    txtEmail.setWidth("100.0%");
    txtEmail.setHeight("-1px");
    txtEmail.setMaxLength(100);
    txtEmail.setStyleName("notRequireStyle");
    //        gridLayoutDepartInfo.addComponent(txtEmail, 3, 4);
    gridLayoutDepartInfo.addComponent(txtEmail, 3, 3);

    // lblFax
    lblFax = new Label();
    lblFax.setImmediate(false);
    lblFax.setWidth("100.0%");
    lblFax.setHeight("-1px");
    lblFax.setValue(BundleUtils.getString("lb.deptstaff.emp.birthDate"));
    //        gridLayoutDepartInfo.addComponent(lblFax, 0, 5);
    gridLayoutDepartInfo.addComponent(lblFax, 0, 4);

    // pdfBirthDate
    pdfBirthDate = new PopupDateField();
    pdfBirthDate.setLocale(mlocale);
    pdfBirthDate.setImmediate(true);
    pdfBirthDate.setWidth("100.0%");
    pdfBirthDate.setHeight("-1px");
    pdfBirthDate.setStyleName("notRequireStyle");
    pdfBirthDate.setDateFormat("dd/MM/yyyy");
    CommonUtils.addDateValidator(pdfBirthDate);
    //        gridLayoutDepartInfo.addComponent(pdfBirthDate, 1, 5);
    gridLayoutDepartInfo.addComponent(pdfBirthDate, 1, 4);
    //        
    //        lblVofficeAcc = new Label();
    //        lblVofficeAcc.setImmediate(false);
    //        lblVofficeAcc.setWidth("100.0%");
    //        lblVofficeAcc.setHeight("-1px");
    //        lblVofficeAcc.setValue("Ti khon V-Office");
    //        gridLayoutDepartInfo.addComponent(lblVofficeAcc,2,4);

    //        txtVofficeAcc = new TextField();
    //        txtVofficeAcc.setImmediate(true);
    //        txtVofficeAcc.setWidth("100.0%");
    //        txtVofficeAcc.setHeight("-1px");
    //        txtVofficeAcc.setMaxLength(100);
    //        gridLayoutDepartInfo.addComponent(txtVofficeAcc,3,4);
    //

    //        lblTtnsAcc = new Label();
    //        lblTtnsAcc.setImmediate(false);
    //        lblTtnsAcc.setWidth("100.0%");
    //        lblTtnsAcc.setHeight("-1px");
    //        lblTtnsAcc.setValue("Ti khon TTNS");
    //        gridLayoutDepartInfo.addComponent(lblTtnsAcc,0,5);
    //
    //        txtTtnsAcc = new TextField();
    //        txtTtnsAcc.setImmediate(true);
    //        txtTtnsAcc.setWidth("100.0%");
    //        txtTtnsAcc.setHeight("-1px");
    //        txtTtnsAcc.setMaxLength(100);
    //        gridLayoutDepartInfo.addComponent(txtTtnsAcc,1,5);
    //        //
    //        
    //        lblVofficeAcc = new Label();
    //        lblVofficeAcc.setImmediate(false);
    //        lblVofficeAcc.setWidth("100.0%");
    //        lblVofficeAcc.setHeight("-1px");
    //        lblVofficeAcc.setValue("Ti khon khc");
    //        gridLayoutDepartInfo.addComponent(lblVofficeAcc,2,5);
    //        //
    //        txtOtherAcc = new TextField();
    //        txtOtherAcc.setImmediate(true);
    //        txtOtherAcc.setWidth("100.0%");
    //        txtOtherAcc.setHeight("-1px");
    //        txtOtherAcc.setMaxLength(100);
    //        gridLayoutDepartInfo.addComponent(txtOtherAcc,3,5);

    return gridLayoutDepartInfo;
}

From source file:com.anphat.list.ui.PopupAddCategoryList.java

public PopupAddCategoryList() {
    mainLayout.setImmediate(true);/*from   ww w .  ja v  a  2s  .c o  m*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("main-popup");

    addCategoryListLayout = new GridLayout();
    addCategoryListLayout.setImmediate(true);
    addCategoryListLayout.setWidth("100.0%");
    addCategoryListLayout.setHeight("-1px");
    addCategoryListLayout.setMargin(true);
    addCategoryListLayout.setSpacing(true);
    addCategoryListLayout.setColumns(4);
    addCategoryListLayout.setRows(4);
    setWidth("70.0%");
    setHeight("-1px");
    setModal(true);
    lblCode = new Label();
    lblCode.setImmediate(true);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.CategoryList.code"));
    addCategoryListLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setRequired(true);
    txtCode.setImmediate(true);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    addCategoryListLayout.addComponent(txtCode, 1, 0);
    lblName = new Label();
    lblName.setImmediate(true);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.CategoryList.name"));
    addCategoryListLayout.addComponent(lblName, 2, 0);

    txtName = new TextField();
    txtName.setRequired(true);
    txtName.setImmediate(true);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    addCategoryListLayout.addComponent(txtName, 3, 0);
    lblReceivedDate = new Label();
    lblReceivedDate.setImmediate(true);
    lblReceivedDate.setWidth("100.0%");
    lblReceivedDate.setHeight("-1px");
    lblReceivedDate.setValue(BundleUtils.getString("label.CategoryList.receivedDate"));
    addCategoryListLayout.addComponent(lblReceivedDate, 0, 1);

    txtReceivedDate = new DateField();
    txtReceivedDate.setRequired(true);
    txtReceivedDate.setImmediate(true);
    txtReceivedDate.setWidth("100.0%");
    txtReceivedDate.setHeight("-1px");
    addCategoryListLayout.addComponent(txtReceivedDate, 1, 1);
    lblEndDate = new Label();
    lblEndDate.setImmediate(true);
    lblEndDate.setWidth("100.0%");
    lblEndDate.setHeight("-1px");
    lblEndDate.setValue(BundleUtils.getString("label.CategoryList.endDate"));
    addCategoryListLayout.addComponent(lblEndDate, 2, 1);

    txtEndDate = new DateField();
    txtEndDate.setRequired(true);
    txtEndDate.setImmediate(true);
    txtEndDate.setWidth("100.0%");
    txtEndDate.setHeight("-1px");
    addCategoryListLayout.addComponent(txtEndDate, 3, 1);
    lblDescription = new Label();
    lblDescription.setImmediate(true);
    lblDescription.setWidth("100.0%");
    lblDescription.setHeight("-1px");
    lblDescription.setValue(BundleUtils.getString("label.CategoryList.description"));
    addCategoryListLayout.addComponent(lblDescription, 0, 2);

    txtDescription = new TextField();
    txtDescription.setImmediate(true);
    txtDescription.setWidth("100.0%");
    txtDescription.setHeight("-1px");
    addCategoryListLayout.addComponent(txtDescription, 1, 2);
    lblCreator = new Label();
    lblCreator.setImmediate(true);
    lblCreator.setWidth("100.0%");
    lblCreator.setHeight("-1px");
    lblCreator.setValue(BundleUtils.getString("label.CategoryList.creator"));
    addCategoryListLayout.addComponent(lblCreator, 2, 2);

    txtCreator = new TextField();
    txtCreator.setRequired(true);
    txtCreator.setImmediate(true);
    txtCreator.setWidth("100.0%");
    txtCreator.setHeight("-1px");
    addCategoryListLayout.addComponent(txtCreator, 3, 2);

    lblService = new Label();
    lblService.setImmediate(true);
    lblService.setWidth("100.0%");
    lblService.setHeight("-1px");
    lblService.setValue(BundleUtils.getString("customerStatusForm.service"));
    addCategoryListLayout.addComponent(lblService, 0, 3);

    cboService = CommonUtils.buildComboBox();
    cboService.setRequired(true);
    cboService.setImmediate(true);
    cboService.setWidth("100.0%");
    cboService.setHeight("-1px");
    AppParamsDTO appParams = new AppParamsDTO();
    appParams.setStatus(Constants.ACTIVE);
    appParams.setParType(Constants.APP_PARAMS.SERVICE_TYPE);
    List<AppParamsDTO> lstServices = WSAppParams.getListAppParamsDTO(appParams, 0, 1000, Constants.ASC,
            Constants.APP_PARAMS.PAR_ORDER);
    ComboComponent comboUtils = new ComboComponent();
    String serviceDefault = Constants.NULL;
    if (!DataUtil.isListNullOrEmpty(lstServices)) {
        serviceDefault = lstServices.get(0).getParCode();
    }
    comboUtils.fillDataCombo(cboService, Constants.NULL, serviceDefault, lstServices,
            Constants.APP_PARAMS.SERVICE_TYPE);
    addCategoryListLayout.addComponent(cboService, 1, 3);

    mainLayout.addComponent(addCategoryListLayout);

    GridManyButton gridBtnPrint = new GridManyButton(
            new String[] { Constants.BUTTON_SAVE, Constants.BUTTON_CLOSE });
    mainLayout.addComponent(gridBtnPrint);
    btnSave = gridBtnPrint.getBtnCommon().get(0);
    btnClose = gridBtnPrint.getBtnCommon().get(1);
    setContent(mainLayout);
    //        setCaption(CAPTION);
}

From source file:com.anphat.list.ui.PopupAddContractTemplateList.java

public PopupAddContractTemplateList() {
    setCaption(BundleUtils.getString("dialog.ContractTemplateList.caption"));
    mainLayout.setImmediate(true);// w w  w  . ja v a  2  s .  co  m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("main-popup");

    addContractTemplateListLayout = new GridLayout();
    CommonUtils.setBasicAttributeLayout(addContractTemplateListLayout,
            BundleUtils.getString("dialog.ContractTemplateList.caption"), true);
    addContractTemplateListLayout.setColumns(4);
    addContractTemplateListLayout.setRows(4);
    setWidth("80.0%");
    setHeight("-1px");
    setModal(true);
    lblCode = new Label();
    lblCode.setImmediate(true);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.ContractTemplateList.code"));
    addContractTemplateListLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setImmediate(true);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    txtCode.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT);
    txtCode.setTextChangeTimeout(10);
    addContractTemplateListLayout.addComponent(txtCode, 1, 0);

    lblName = new Label();
    lblName.setImmediate(true);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.ContractTemplateList.name"));
    addContractTemplateListLayout.addComponent(lblName, 2, 0);

    txtName = new TextField();
    txtName.setImmediate(true);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    txtName.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.TIMEOUT);
    txtName.setTextChangeTimeout(10);
    addContractTemplateListLayout.addComponent(txtName, 3, 0);

    lblPathFile = new Label();
    lblPathFile.setImmediate(true);
    lblPathFile.setWidth("100.0%");
    lblPathFile.setHeight("-1px");
    lblPathFile.setValue(BundleUtils.getString("label.ContractTemplateList.pathFile"));
    uFile = new Upload();
    uFile.setButtonCaption("Ti file");
    uFile.addStyleName("upload-hide");
    uFile.setReceiver(new Upload.Receiver() {
        @Override
        public OutputStream receiveUpload(String filename, String mimeType) {
            if (DataUtil.isStringNullOrEmpty(filename)) {
                CommonUtils.showMessage("err.choosefileBeforeUpload");
                uFile.interruptUpload();
                isUploadSuccess = false;
                return new NullOutputStream();
            }
            String code = txtCode.getValue();
            String name = txtName.getValue();
            if (DataUtil.isStringNullOrEmpty(code)) {
                txtCode.focus();
                CommonUtils.showMessageRequired("label.ContractTemplateList.code");
                uFile.interruptUpload();
                isUploadSuccess = false;
                return new NullOutputStream();
            }
            if (DataUtil.isStringNullOrEmpty(name)) {
                txtName.focus();
                CommonUtils.showMessageRequired("label.ContractTemplateList.name");
                isUploadSuccess = false;
                uFile.interruptUpload();
                return new NullOutputStream();
            }
            long contentLength = uFile.getUploadSize();
            if (contentLength > Constants.FILE_SIZE_IMPORT && contentLength != -1) {
                CommonUtils.showContentLengthValid();
                isUploadSuccess = false;
                uFile.interruptUpload();
                return new NullOutputStream();
            }

            fileNameUploaded = filename;
            FileOutputStream fos = null; // Output stream to write to
            File file = new File(Constants.PATH_TEMPLATE + filename);
            try {
                if (Constants.FORMATFILE.WORD_DOCX.equals(mimeType)) {
                    // Open the file for writing.
                    fos = new FileOutputStream(file);
                    isUploadSuccess = true;
                } else {
                    fileNameUploaded = null;
                    isUploadSuccess = false;
                    uFile.interruptUpload();
                    CommonUtils.showErrorMessage("err.only.docx.file");
                    return new NullOutputStream();
                }
            } catch (final java.io.FileNotFoundException e) {
                fileNameUploaded = null;
                CommonUtils.showErrorMessage("common.message.invalidfileformat");
                isUploadSuccess = false;
                uFile.interruptUpload();
                return new NullOutputStream();
            }
            return fos; // Return the output stream to write to
        }
    });
    uFile.addSucceededListener(e -> {
        if (isUploadSuccess) {
            CommonUtils.showMessage("Ti file thnh cng.");
        }
    });
    //        addContractTemplateListLayout.addComponent(uFile, 0, 1, 1, 1);
    lblService = new Label();
    lblService.setImmediate(true);
    lblService.setWidth("100.0%");
    lblService.setHeight("-1px");
    lblService.setValue(BundleUtils.getString("label.ContractTemplateList.service"));
    addContractTemplateListLayout.addComponent(lblService, 0, 1);

    cboService = new ComboBox();
    cboService.setImmediate(true);
    cboService.setWidth("100.0%");
    cboService.setHeight("-1px");
    addContractTemplateListLayout.addComponent(cboService, 1, 1);

    lblType = new Label();
    lblType.setImmediate(true);
    lblType.setWidth("100.0%");
    lblType.setHeight("-1px");
    lblType.setValue(BundleUtils.getString("label.ContractTemplateList.type"));
    addContractTemplateListLayout.addComponent(lblType, 2, 1);

    cboType = new ComboBox();
    cboType.setImmediate(true);
    cboType.setWidth("100.0%");
    cboType.setHeight("-1px");
    addContractTemplateListLayout.addComponent(cboType, 3, 1);

    lblCreatedDate = new Label();
    lblCreatedDate.setImmediate(true);
    lblCreatedDate.setWidth("100.0%");
    lblCreatedDate.setHeight("-1px");
    lblCreatedDate.setValue(BundleUtils.getString("label.ContractTemplateList.createdDate"));
    //        addContractTemplateListLayout.addComponent(lblCreatedDate, 0, 2);

    popCreatedDate = new PopupDateField();
    popCreatedDate.setImmediate(true);
    popCreatedDate.setWidth("100.0%");
    popCreatedDate.setHeight("-1px");
    //        addContractTemplateListLayout.addComponent(popCreatedDate, 1, 2);
    lblLastUpdatedDate = new Label();
    lblLastUpdatedDate.setImmediate(true);
    lblLastUpdatedDate.setWidth("100.0%");
    lblLastUpdatedDate.setHeight("-1px");
    lblLastUpdatedDate.setValue(BundleUtils.getString("label.ContractTemplateList.lastUpdatedDate"));
    //        addContractTemplateListLayout.addComponent(lblLastUpdatedDate, 2, 2);

    popLastUpdatedDate = new PopupDateField();
    popLastUpdatedDate.setImmediate(true);
    popLastUpdatedDate.setWidth("100.0%");
    popLastUpdatedDate.setHeight("-1px");
    //        addContractTemplateListLayout.addComponent(popLastUpdatedDate, 3, 2);

    lblProvider = new Label();
    lblProvider.setImmediate(true);
    lblProvider.setWidth("100.0%");
    lblProvider.setHeight("-1px");
    lblProvider.setValue(BundleUtils.getString("label.ContractTemplateList.provider"));
    addContractTemplateListLayout.addComponent(lblProvider, 0, 2);

    cboProvider = new ComboBox();
    cboProvider.setImmediate(true);
    cboProvider.setWidth("100.0%");
    cboProvider.setHeight("-1px");
    addContractTemplateListLayout.addComponent(cboProvider, 1, 2);

    lblStatus = new Label();
    lblStatus.setImmediate(true);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.ContractTemplateList.status"));
    addContractTemplateListLayout.addComponent(lblStatus, 2, 2);

    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(true);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    addContractTemplateListLayout.addComponent(cbxStatus, 3, 2);

    mainLayout.addComponent(addContractTemplateListLayout);
    mainLayout.addComponent(uFile);
    GridManyButton gridBtnPrint = new GridManyButton(
            new String[] { Constants.BUTTON_SAVE, Constants.BUTTON_CLOSE });
    mainLayout.addComponent(gridBtnPrint);
    btnSave = gridBtnPrint.getBtnCommon().get(0);

    btnClose = gridBtnPrint.getBtnCommon().get(1);
    btnClose.addClickListener(e -> {
        close();
    });
    setContent(mainLayout);
}

From source file:com.anphat.list.ui.PopupAddObjects.java

public PopupAddObjects() {
    mainLayout.setImmediate(true);//from ww  w .java 2  s  . com
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("main-popup");

    addObjectsLayout = new GridLayout();
    addObjectsLayout.setImmediate(true);
    addObjectsLayout.setWidth("100.0%");
    addObjectsLayout.setHeight("-1px");
    addObjectsLayout.setMargin(true);
    addObjectsLayout.setSpacing(true);
    addObjectsLayout.setColumns(4);
    addObjectsLayout.setRows(3);
    setWidth("70.0%");
    setHeight("-1px");
    setModal(true);
    lblCode = new Label();
    lblCode.setImmediate(true);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.Objects.code"));
    addObjectsLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setImmediate(true);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    addObjectsLayout.addComponent(txtCode, 1, 0);
    lblName = new Label();
    lblName.setImmediate(true);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.Objects.name"));
    addObjectsLayout.addComponent(lblName, 2, 0);

    txtName = new TextField();
    txtName.setImmediate(true);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    addObjectsLayout.addComponent(txtName, 3, 0);
    lblUrl = new Label();
    lblUrl.setImmediate(true);
    lblUrl.setWidth("100.0%");
    lblUrl.setHeight("-1px");
    lblUrl.setValue(BundleUtils.getString("label.Objects.url"));
    addObjectsLayout.addComponent(lblUrl, 0, 1);

    txtUrl = new TextField();
    txtUrl.setImmediate(true);
    txtUrl.setWidth("100.0%");
    txtUrl.setHeight("-1px");
    addObjectsLayout.addComponent(txtUrl, 1, 1);
    lblDescription = new Label();
    lblDescription.setImmediate(true);
    lblDescription.setWidth("100.0%");
    lblDescription.setHeight("-1px");
    lblDescription.setValue(BundleUtils.getString("label.Objects.description"));
    addObjectsLayout.addComponent(lblDescription, 2, 1);

    txtDescription = new TextArea();
    txtDescription.setImmediate(true);
    txtDescription.setWidth("100.0%");
    txtDescription.setHeight("-1px");
    addObjectsLayout.addComponent(txtDescription, 3, 1);
    lblObjectType = new Label();
    lblObjectType.setImmediate(true);
    lblObjectType.setWidth("100.0%");
    lblObjectType.setHeight("-1px");
    lblObjectType.setValue(BundleUtils.getString("label.Objects.objectType"));
    addObjectsLayout.addComponent(lblObjectType, 0, 2);

    txtObjectType = new TextField();
    txtObjectType.setImmediate(true);
    txtObjectType.setWidth("100.0%");
    txtObjectType.setHeight("-1px");
    addObjectsLayout.addComponent(txtObjectType, 1, 2);
    lblStatus = new Label();
    lblStatus.setImmediate(true);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.Objects.status"));
    addObjectsLayout.addComponent(lblStatus, 2, 2);

    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(true);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    addObjectsLayout.addComponent(cbxStatus, 3, 2);

    mainLayout.addComponent(addObjectsLayout);

    GridManyButton gridBtnPrint = new GridManyButton(new String[]{BundleUtils.getString("btn.ok"), BundleUtils.getString("btn.close")});
    mainLayout.addComponent(gridBtnPrint);
    btnSave = gridBtnPrint.getBtnCommon().get(0);
    btnClose = gridBtnPrint.getBtnCommon().get(1);
    setContent(mainLayout);
}

From source file:com.anphat.list.ui.PopupAddRoles.java

public PopupAddRoles() {
    mainLayout.setImmediate(true);/*from   w w  w  . j a v  a  2  s  .c o m*/
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("main-popup");

    addRolesLayout = new GridLayout();
    addRolesLayout.setImmediate(false);
    addRolesLayout.setWidth("100.0%");
    addRolesLayout.setHeight("-1px");
    addRolesLayout.setMargin(true);
    addRolesLayout.setSpacing(true);
    addRolesLayout.setColumns(4);
    addRolesLayout.setRows(2);
    setWidth("70.0%");
    setHeight("-1px");
    setModal(true);
    lblCode = new Label();
    lblCode.setImmediate(false);
    lblCode.setWidth("100.0%");
    lblCode.setHeight("-1px");
    lblCode.setValue(BundleUtils.getString("label.Roles.code"));
    addRolesLayout.addComponent(lblCode, 0, 0);

    txtCode = new TextField();
    txtCode.setImmediate(false);
    txtCode.setWidth("100.0%");
    txtCode.setHeight("-1px");
    addRolesLayout.addComponent(txtCode, 1, 0);
    lblName = new Label();
    lblName.setImmediate(false);
    lblName.setWidth("100.0%");
    lblName.setHeight("-1px");
    lblName.setValue(BundleUtils.getString("label.Roles.name"));
    addRolesLayout.addComponent(lblName, 2, 0);

    txtName = new TextField();
    txtName.setImmediate(false);
    txtName.setWidth("100.0%");
    txtName.setHeight("-1px");
    addRolesLayout.addComponent(txtName, 3, 0);
    lblDescription = new Label();
    lblDescription.setImmediate(false);
    lblDescription.setWidth("100.0%");
    lblDescription.setHeight("-1px");
    lblDescription.setValue(BundleUtils.getString("label.Roles.description"));
    addRolesLayout.addComponent(lblDescription, 0, 1);

    txtDescription = new TextArea();
    txtDescription.setImmediate(false);
    txtDescription.setWidth("100.0%");
    txtDescription.setHeight("-1px");
    addRolesLayout.addComponent(txtDescription, 1, 1);
    lblStatus = new Label();
    lblStatus.setImmediate(false);
    lblStatus.setWidth("100.0%");
    lblStatus.setHeight("-1px");
    lblStatus.setValue(BundleUtils.getString("label.Roles.status"));
    addRolesLayout.addComponent(lblStatus, 2, 1);

    cbxStatus = new ComboBox();
    cbxStatus.setImmediate(false);
    cbxStatus.setWidth("100.0%");
    cbxStatus.setHeight("-1px");
    addRolesLayout.addComponent(cbxStatus, 3, 1);

    mainLayout.addComponent(addRolesLayout);

    GridManyButton gridBtnPrint = new GridManyButton(new String[]{Constants.BUTTON_SAVE, Constants.BUTTON_CLOSE});
    mainLayout.addComponent(gridBtnPrint);
    btnSave = gridBtnPrint.getBtnCommon().get(0);
    btnClose = gridBtnPrint.getBtnCommon().get(1);
    setContent(mainLayout);
    txtCode.focus();
}