List of usage examples for com.vaadin.ui ComboBox ComboBox
public ComboBox()
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 . j a v a 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.PopupAddContractTemplateList.java
public PopupAddContractTemplateList() { setCaption(BundleUtils.getString("dialog.ContractTemplateList.caption")); mainLayout.setImmediate(true);//from w w w.j a v a 2s . 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 w ww . j a va 2 s.c o m*/ 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);// ww w . jav a2s .co 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(); }
From source file:com.anphat.list.ui.PopupAddServices.java
public PopupAddServices() { mainLayout.setImmediate(true);/* w w w . ja v a2s. c om*/ mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("main-popup"); addServicesLayout = new GridLayout(); addServicesLayout.setImmediate(false); addServicesLayout.setWidth("100.0%"); addServicesLayout.setHeight("-1px"); addServicesLayout.setMargin(true); addServicesLayout.setSpacing(true); addServicesLayout.setColumns(4); addServicesLayout.setRows(10); 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.Services.code")); addServicesLayout.addComponent(lblCode, 0, 0); txtCode = new TextField(); txtCode.setImmediate(false); txtCode.setWidth("100.0%"); txtCode.setHeight("-1px"); addServicesLayout.addComponent(txtCode, 1, 0); lblDescription = new Label(); lblDescription.setImmediate(false); lblDescription.setWidth("100.0%"); lblDescription.setHeight("-1px"); lblDescription.setValue(BundleUtils.getString("label.Services.description")); addServicesLayout.addComponent(lblDescription, 2, 0); txtDescription = new TextArea(); txtDescription.setImmediate(false); txtDescription.setWidth("100.0%"); txtDescription.setHeight("-1px"); addServicesLayout.addComponent(txtDescription, 3, 0); lblExpiryDate = new Label(); lblExpiryDate.setImmediate(false); lblExpiryDate.setWidth("100.0%"); lblExpiryDate.setHeight("-1px"); lblExpiryDate.setValue(BundleUtils.getString("label.Services.expiryDate")); addServicesLayout.addComponent(lblExpiryDate, 0, 1); popExpiryDate = new PopupDateField(); popExpiryDate.setImmediate(false); popExpiryDate.setWidth("100.0%"); popExpiryDate.setHeight("-1px"); addServicesLayout.addComponent(popExpiryDate, 1, 1); lblIssueDate = new Label(); lblIssueDate.setImmediate(false); lblIssueDate.setWidth("100.0%"); lblIssueDate.setHeight("-1px"); lblIssueDate.setValue(BundleUtils.getString("label.Services.issueDate")); addServicesLayout.addComponent(lblIssueDate, 2, 1); popIssueDate = new PopupDateField(); popIssueDate.setImmediate(false); popIssueDate.setWidth("100.0%"); popIssueDate.setHeight("-1px"); addServicesLayout.addComponent(popIssueDate, 3, 1); lblName = new Label(); lblName.setImmediate(false); lblName.setWidth("100.0%"); lblName.setHeight("-1px"); lblName.setValue(BundleUtils.getString("label.Services.name")); addServicesLayout.addComponent(lblName, 0, 2); txtName = new TextField(); txtName.setImmediate(false); txtName.setWidth("100.0%"); txtName.setHeight("-1px"); addServicesLayout.addComponent(txtName, 1, 2); lblServiceGroup = new Label(); lblServiceGroup.setImmediate(false); lblServiceGroup.setWidth("100.0%"); lblServiceGroup.setHeight("-1px"); lblServiceGroup.setValue(BundleUtils.getString("label.Services.serviceGroup")); addServicesLayout.addComponent(lblServiceGroup, 2, 2); txtServiceGroup = new TextField(); txtServiceGroup.setImmediate(false); txtServiceGroup.setWidth("100.0%"); txtServiceGroup.setHeight("-1px"); addServicesLayout.addComponent(txtServiceGroup, 3, 2); lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("label.Services.status")); addServicesLayout.addComponent(lblStatus, 0, 3); cbxStatus = new ComboBox(); cbxStatus.setImmediate(false); cbxStatus.setWidth("100.0%"); cbxStatus.setHeight("-1px"); addServicesLayout.addComponent(cbxStatus, 1, 3); lblType = new Label(); lblType.setImmediate(false); lblType.setWidth("100.0%"); lblType.setHeight("-1px"); lblType.setValue(BundleUtils.getString("label.Services.type")); addServicesLayout.addComponent(lblType, 2, 3); cbxType = new ComboBox(); cbxType.setImmediate(false); cbxType.setWidth("100.0%"); cbxType.setHeight("-1px"); addServicesLayout.addComponent(cbxType, 3, 3); mainLayout.addComponent(addServicesLayout); 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(); }
From source file:com.anphat.list.ui.PopupAddTaxAuthority.java
public PopupAddTaxAuthority() { mainLayout.setImmediate(true);/*from ww w . j av a 2 s . c om*/ mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("main-popup"); addTaxAuthorityLayout = new GridLayout(); addTaxAuthorityLayout.setImmediate(true); addTaxAuthorityLayout.setWidth("100.0%"); addTaxAuthorityLayout.setHeight("-1px"); addTaxAuthorityLayout.setMargin(true); addTaxAuthorityLayout.setSpacing(true); addTaxAuthorityLayout.setColumns(4); addTaxAuthorityLayout.setRows(3); setWidth("70.0%"); setHeight("-1px"); setModal(true); // lblId = new Label(); // lblId.setImmediate(true); // lblId.setWidth("100.0%"); // lblId.setHeight("-1px"); // lblId.setValue(BundleUtils.getString("label.TaxAuthority.id")); // addTaxAuthorityLayout.addComponent(lblId, 0, 0); // txtId = new TextField(); // txtId.setImmediate(true); // txtId.setWidth("100.0%"); // txtId.setHeight("-1px"); // addTaxAuthorityLayout.addComponent(txtId, 1, 0); lblMaCqt = new Label(); lblMaCqt.setImmediate(true); lblMaCqt.setWidth("100.0%"); lblMaCqt.setHeight("-1px"); lblMaCqt.setValue(BundleUtils.getString("label.TaxAuthority.maCqt")); addTaxAuthorityLayout.addComponent(lblMaCqt, 0, 0); txtMaCqt = new TextField(); txtMaCqt.setImmediate(true); txtMaCqt.setWidth("100.0%"); txtMaCqt.setHeight("-1px"); addTaxAuthorityLayout.addComponent(txtMaCqt, 1, 0); lblTenCqt = new Label(); lblTenCqt.setImmediate(true); lblTenCqt.setWidth("100.0%"); lblTenCqt.setHeight("-1px"); lblTenCqt.setValue(BundleUtils.getString("label.TaxAuthority.tenCqt")); addTaxAuthorityLayout.addComponent(lblTenCqt, 2, 0); txtTenCqt = new TextField(); txtTenCqt.setImmediate(true); txtTenCqt.setWidth("100.0%"); txtTenCqt.setHeight("-1px"); addTaxAuthorityLayout.addComponent(txtTenCqt, 3, 0); lblMaTinh = new Label(); lblMaTinh.setImmediate(true); lblMaTinh.setWidth("100.0%"); lblMaTinh.setHeight("-1px"); lblMaTinh.setValue(BundleUtils.getString("label.TaxAuthority.maTinh")); addTaxAuthorityLayout.addComponent(lblMaTinh, 0, 1); cboMaTinh = new ComboBox(); cboMaTinh.setImmediate(true); cboMaTinh.setWidth("100.0%"); cboMaTinh.setHeight("-1px"); addTaxAuthorityLayout.addComponent(cboMaTinh, 1, 1); lblMaQuanHuyen = new Label(); lblMaQuanHuyen.setImmediate(true); lblMaQuanHuyen.setWidth("100.0%"); lblMaQuanHuyen.setHeight("-1px"); lblMaQuanHuyen.setValue(BundleUtils.getString("label.TaxAuthority.maQuanHuyen")); addTaxAuthorityLayout.addComponent(lblMaQuanHuyen, 2, 1); txtMaQuanHuyen = new TextField(); txtMaQuanHuyen.setImmediate(true); txtMaQuanHuyen.setWidth("100.0%"); txtMaQuanHuyen.setHeight("-1px"); addTaxAuthorityLayout.addComponent(txtMaQuanHuyen, 3, 1); lblStatus = new Label(); lblStatus.setImmediate(true); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("label.TaxAuthority.status")); addTaxAuthorityLayout.addComponent(lblStatus, 0, 2); cboStatus = new ComboBox(); cboStatus.setImmediate(true); cboStatus.setWidth("100.0%"); cboStatus.setHeight("-1px"); addTaxAuthorityLayout.addComponent(cboStatus, 1, 2); mainLayout.addComponent(addTaxAuthorityLayout); 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); }
From source file:com.anphat.list.ui.RolesSearchPanel.java
public void buildSearchLayout() { searchLayout = new GridLayout(); searchLayout.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("caption.search.info"))); searchLayout.setCaptionAsHtml(true); searchLayout.setImmediate(false);/* w w w .ja v a 2s. com*/ searchLayout.setWidth("100.0%"); searchLayout.setHeight("-1px"); searchLayout.setMargin(true); searchLayout.setSpacing(true); searchLayout.setColumns(4); searchLayout.setRows(2); searchLayout.setStyleName("custom-feildset"); lblCode = new Label(); lblCode.setImmediate(false); lblCode.setWidth("100.0%"); lblCode.setHeight("-1px"); lblCode.setValue(BundleUtils.getString("label.Roles.code")); searchLayout.addComponent(lblCode, 0, 0); txtCode = new TextField(); txtCode.setImmediate(false); txtCode.setWidth("100.0%"); txtCode.setHeight("-1px"); searchLayout.addComponent(txtCode, 1, 0); lblName = new Label(); lblName.setImmediate(false); lblName.setWidth("100.0%"); lblName.setHeight("-1px"); lblName.setValue(BundleUtils.getString("label.Roles.name")); searchLayout.addComponent(lblName, 2, 0); txtName = new TextField(); txtName.setImmediate(false); txtName.setWidth("100.0%"); txtName.setHeight("-1px"); searchLayout.addComponent(txtName, 3, 0); lblDescription = new Label(); lblDescription.setImmediate(false); lblDescription.setWidth("100.0%"); lblDescription.setHeight("-1px"); lblDescription.setValue(BundleUtils.getString("label.Roles.description")); searchLayout.addComponent(lblDescription, 0, 1); txtDescription = new TextArea(); txtDescription.setImmediate(false); txtDescription.setWidth("100.0%"); txtDescription.setHeight("-1px"); searchLayout.addComponent(txtDescription, 1, 1); lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100.0%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("label.Roles.status")); searchLayout.addComponent(lblStatus, 2, 1); cbxStatus = new ComboBox(); cbxStatus.setImmediate(false); cbxStatus.setWidth("100.0%"); cbxStatus.setHeight("-1px"); searchLayout.addComponent(cbxStatus, 3, 1); }
From source file:com.cavisson.gui.dashboard.components.controls.Forms.java
License:Apache License
public Forms() { setSpacing(true);/*w w w .jav a2s . co m*/ setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Montly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }
From source file:com.cavisson.gui.dashboard.components.controls.Tables.java
License:Apache License
static void configure(Table table, boolean footer, boolean sized, boolean expandRatios, boolean stripes, boolean verticalLines, boolean horizontalLines, boolean borderless, boolean headers, boolean compact, boolean small, boolean rowIndex, boolean rowCaption, boolean rowIcon, boolean componentsInRows) { table.setSelectable(true);/*from w w w. j a v a2 s.c o m*/ table.setMultiSelect(true); table.setSortEnabled(true); table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setPageLength(6); table.addActionHandler(ValoThemeUI.getActionHandler()); table.setDragMode(TableDragMode.MULTIROW); table.setDropHandler(new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } @Override public void drop(DragAndDropEvent event) { Notification.show(event.getTransferable().toString()); } }); table.setColumnAlignment(ValoThemeUI.DESCRIPTION_PROPERTY, Align.RIGHT); table.setColumnAlignment(ValoThemeUI.INDEX_PROPERTY, Align.CENTER); table.removeContainerProperty("textfield"); table.removeGeneratedColumn("textfield"); table.removeContainerProperty("button"); table.removeGeneratedColumn("button"); table.removeContainerProperty("label"); table.removeGeneratedColumn("label"); table.removeContainerProperty("checkbox"); table.removeGeneratedColumn("checkbox"); table.removeContainerProperty("datefield"); table.removeGeneratedColumn("datefield"); table.removeContainerProperty("combobox"); table.removeGeneratedColumn("combobox"); table.removeContainerProperty("optiongroup"); table.removeGeneratedColumn("optiongroup"); table.removeContainerProperty("slider"); table.removeGeneratedColumn("slider"); table.removeContainerProperty("progress"); table.removeGeneratedColumn("progress"); if (componentsInRows) { table.addContainerProperty("textfield", TextField.class, null); table.addGeneratedColumn("textfield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { TextField tf = new TextField(); tf.setInputPrompt("Type here"); // tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("datefield", TextField.class, null); table.addGeneratedColumn("datefield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { DateField tf = new DateField(); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("combobox", TextField.class, null); table.addGeneratedColumn("combobox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ComboBox tf = new ComboBox(); tf.setInputPrompt("Select"); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("button", Button.class, null); table.addGeneratedColumn("button", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Button b = new Button("Button"); b.addStyleName("small"); return b; } }); table.addContainerProperty("label", TextField.class, null); table.addGeneratedColumn("label", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Label label = new Label("Label component"); label.setSizeUndefined(); label.addStyleName("bold"); return label; } }); table.addContainerProperty("checkbox", TextField.class, null); table.addGeneratedColumn("checkbox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { CheckBox cb = new CheckBox(null, true); return cb; } }); table.addContainerProperty("optiongroup", TextField.class, null); table.addGeneratedColumn("optiongroup", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { OptionGroup op = new OptionGroup(); op.addItem("Male"); op.addItem("Female"); op.addStyleName("horizontal"); return op; } }); table.addContainerProperty("slider", TextField.class, null); table.addGeneratedColumn("slider", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Slider s = new Slider(); s.setValue(30.0); return s; } }); table.addContainerProperty("progress", TextField.class, null); table.addGeneratedColumn("progress", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ProgressBar bar = new ProgressBar(); bar.setValue(0.7f); return bar; } }); } table.setFooterVisible(footer); if (footer) { table.setColumnFooter(ValoThemeUI.CAPTION_PROPERTY, "caption"); table.setColumnFooter(ValoThemeUI.DESCRIPTION_PROPERTY, "description"); table.setColumnFooter(ValoThemeUI.ICON_PROPERTY, "icon"); table.setColumnFooter(ValoThemeUI.INDEX_PROPERTY, "index"); } if (sized) { table.setWidth("400px"); table.setHeight("300px"); } else { table.setSizeUndefined(); } if (expandRatios) { if (!sized) { table.setWidth("100%"); } } table.setColumnExpandRatio(ValoThemeUI.CAPTION_PROPERTY, expandRatios ? 1.0f : 0); table.setColumnExpandRatio(ValoThemeUI.DESCRIPTION_PROPERTY, expandRatios ? 1.0f : 0); if (!stripes) { table.addStyleName("no-stripes"); } else { table.removeStyleName("no-stripes"); } if (!verticalLines) { table.addStyleName("no-vertical-lines"); } else { table.removeStyleName("no-vertical-lines"); } if (!horizontalLines) { table.addStyleName("no-horizontal-lines"); } else { table.removeStyleName("no-horizontal-lines"); } if (borderless) { table.addStyleName("borderless"); } else { table.removeStyleName("borderless"); } if (!headers) { table.addStyleName("no-header"); } else { table.removeStyleName("no-header"); } if (compact) { table.addStyleName("compact"); } else { table.removeStyleName("compact"); } if (small) { table.addStyleName("small"); } else { table.removeStyleName("small"); } if (!rowIndex && !rowCaption && rowIcon) { table.setRowHeaderMode(RowHeaderMode.HIDDEN); } if (rowIndex) { table.setRowHeaderMode(RowHeaderMode.INDEX); } if (rowCaption) { table.setRowHeaderMode(RowHeaderMode.PROPERTY); table.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); } else { table.setItemCaptionPropertyId(null); } if (rowIcon) { table.setRowHeaderMode(RowHeaderMode.ICON_ONLY); table.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); } else { table.setItemIconPropertyId(null); } }
From source file:com.cerebro.provevaadin.Mappa.java
public Mappa(User user) { Label ultimoLuogo = new Label(user.getUltimoLuogoPG()); ComboBox elencoLuoghi = new ComboBox(); elencoLuoghi.addItems("Luogo A", "Luogo B"); elencoLuoghi.addValueChangeListener((Property.ValueChangeEvent event) -> { System.out.println("Cambio luogo, vai a: " + elencoLuoghi.getValue().toString()); user.setUltimoLuogo(elencoLuoghi.getValue().toString()); });//from ww w.j ava 2 s . com addComponents(ultimoLuogo, elencoLuoghi); }