public Field createField(Item item, Object propertyId, Component uiContext) { String pid = (String) propertyId; PersistentClass entity = ConfigurationMapping.getConfigurationEntity(AddressType.class.getName()); if ("name".equals(pid)) { TextField textField = new TextField( FactoryI18nManager.getI18nManager() .getMessage(Messages.ADDRESS_TYPE_ABM_TABLE_AND_FORM_NAME)); textField.setNullRepresentation(""); textField.setRequired(true); textField.setMaxLength(ConfigurationMapping.getColumnSize("name", entity)); return textField; } else if ("comment".equals(pid)) { TextArea textArea = new TextArea( FactoryI18nManager.getI18nManager() .getMessage(Messages.ADDRESS_TYPE_ABM_TABLE_AND_FORM_COMMENT)); textArea.setWidth("250"); textArea.setHeight("50"); textArea.setNullRepresentation(""); textArea.setMaxLength(ConfigurationMapping.getColumnSize("comment", entity)); // textArea.setRequired(false); // textArea.setMaxLength(maxLength) // textArea.setHeight(height); // textArea.setWidth(width); // textArea.setEnabled(enabled); // textArea.setIcon(icon); return textArea; } return null; }
public CommentLayout() { comment = new TextArea(""); comment.setWidth("1300"); comment.setHeight("300"); comment.setNullRepresentation(""); comment.setMaxLength(254); addComponent(comment); }
@Override public void init() { final String WIDTH = "350px"; labelErrorQuantity = new Label() { { setVisible(false); addStyleName("form-error"); setContentMode(ContentMode.HTML); } }; labelErrorPrice = new Label() { { setVisible(false); addStyleName("form-error"); setContentMode(ContentMode.HTML); } }; labelGeneralError = new Label() { { setVisible(false); addStyleName("form-error"); setContentMode(ContentMode.HTML); } }; inputGoodsQuantity = new TextField("Jumlah") { { setWidth(function.FORM_WIDTH); setImmediate(true); } }; inputGoodsQuantity.addValueChangeListener(this); inputGoodsSelect = new ComboBox("Nama Barang") { { setImmediate(true); setWidth(function.FORM_WIDTH); } }; inputGoodsSelect.addValueChangeListener(this); inputGoodsPrice = new TextField("Harga Barang"); inputGoodsPrice.setImmediate(true); inputGoodsPrice.setWidth(function.FORM_WIDTH); inputDeletionDate = new DateField("Tanggal") { { setWidth(function.FORM_WIDTH); setImmediate(true); } }; inputDeletionDate.addValueChangeListener(this); information = new TextArea("Informasi"); information.setMaxLength(function.MAX_TEXTAREA_LENGTH); information.setWidth(function.FORM_WIDTH); labelPriceGuide = new Label(""); labelPriceGuide.setContentMode(ContentMode.HTML); labelSatuan = new Label("Satuan"); buttonReset = new Button("Reset"); buttonReset.addClickListener(this); buttonSubmit = new Button("Simpan"); buttonSubmit.addClickListener(this); buttonSubmit.addStyleName("primary"); buttonCancel = new Button("Batal"); buttonCancel.addClickListener(this); buttonUpdate = new Button("Simpan Perubahan"); buttonUpdate.addClickListener(this); buttonNext = new Button(">>"); buttonNext.addClickListener(this); buttonNext.setWidth("50px"); buttonNext.setEnabled(false); buttonPrev = new Button("<<"); buttonPrev.addClickListener(this); buttonPrev.setWidth("50px"); buttonPrev.setEnabled(false); buttonPrev.setDescription("Sebelumnya"); buttonAdd = new Button("Tambah"); buttonAdd.addClickListener(this); buttonAdd.setWidth("130px"); buttonAdd.setDescription("Tambah Input Baru"); buttonRemove = new Button(""); buttonRemove.setIcon(new ThemeResource("icons/image/icon-delete.png")); buttonRemove.addClickListener(this); buttonRemove.setDescription("Hapus Data"); construct(); }
@SuppressWarnings({"deprecation", "serial"}) private void updateComponents(final User user) { if (container != null) { container.removeAllComponents(); } container = new Panel(); root = new Panel(); root.setStyle(Reindeer.PANEL_LIGHT); container.setHeight("100%"); container.setStyle(Reindeer.PANEL_LIGHT); setCompositionRoot(container); // Create the Form newExpForm = new Form(); newExpForm.setCaption("New Experiment"); newExpForm.setWriteThrough(false); // we want explicit 'apply' newExpForm.setInvalidCommitted(false); // no invalid values in data model // Determines which properties are shown, and in which order: expNameField = new TextField("Experiment Name:"); expNameField.setStyle(Reindeer.TEXTFIELD_SMALL); expNameField.setRequired(true); expNameField.setRequiredError("EXPERIMENT NAME CAN NOT BE EMPTY!"); expNameField.setWidth("350px"); expNameField.setMaxLength(70); speciesField = new TextField("Species:"); speciesField.setStyle(Reindeer.TEXTFIELD_SMALL); speciesField.setRequired(true); speciesField.setRequiredError("EXPERIMENT SPECIES CAN NOT BE EMPTY!"); speciesField.setWidth("350px"); speciesField.setMaxLength(70); sampleTypeField = new TextField("Sample Type:"); sampleTypeField.setStyle(Reindeer.TEXTFIELD_SMALL); sampleTypeField.setRequired(true); sampleTypeField.setRequiredError("EXPERIMENT SAMPLE TYPE CAN NOT BE EMPTY!"); sampleTypeField.setWidth("350px"); sampleTypeField.setMaxLength(70); sampleProcessingField = new TextField("Sample Processing:"); sampleProcessingField.setStyle(Reindeer.TEXTFIELD_SMALL); sampleProcessingField.setRequired(true); sampleProcessingField.setRequiredError("EXPERIMENT SAMPLE PROCESSING CAN NOT BE EMPTY!"); sampleProcessingField.setWidth("350px"); sampleProcessingField.setMaxLength(70); instrumentTypeField = new TextField("Instrument Type:"); instrumentTypeField.setStyle(Reindeer.TEXTFIELD_SMALL); instrumentTypeField.setRequired(true); instrumentTypeField.setRequiredError("EXPERIMENT INSTURMENT TYPE CAN NOT BE EMPTY!"); instrumentTypeField.setWidth("350px"); instrumentTypeField.setMaxLength(70); fragModeField = new TextField("Frag Mode:"); fragModeField.setStyle(Reindeer.TEXTFIELD_SMALL); fragModeField.setRequired(true); fragModeField.setRequiredError("EXPERIMENT FRAG MODE CAN NOT BE EMPTY!"); fragModeField.setWidth("350px"); fragModeField.setMaxLength(70); UploadedByNameField = new TextField("Uploaded By:"); UploadedByNameField.setStyle(Reindeer.TEXTFIELD_SMALL); UploadedByNameField.setRequired(true); UploadedByNameField.setRequiredError("EXPERIMENT UPLOADED BY CAN NOT BE EMPTY!"); UploadedByNameField.setValue(user.getUsername()); UploadedByNameField.setEnabled(false); UploadedByNameField.setWidth("350px"); UploadedByNameField.setMaxLength(70); emailField = new TextField("Email:"); emailField.setStyle(Reindeer.TEXTFIELD_SMALL); emailField.setRequired(true); emailField.setValue(user.getEmail()); emailField.setEnabled(false); emailField.setRequiredError("EXPERIMENT EMAIL CAN NOT BE EMPTY!"); emailField.setWidth("350px"); emailField.setMaxLength(70); descriptionField = new TextArea("Description:"); descriptionField.setStyle(Reindeer.TEXTFIELD_SMALL); descriptionField.setRequired(true); descriptionField.setRequiredError("EXPERIMENT Description CAN NOT BE EMPTY!"); descriptionField.setWidth("350px"); descriptionField.setMaxLength(950); publicationLinkField = new TextField("Publication Link:"); publicationLinkField.setStyle(Reindeer.TEXTFIELD_SMALL); publicationLinkField.setWidth("350px"); publicationLinkField.setMaxLength(300); newExpForm.addField(Integer.valueOf(1), expNameField); newExpForm.addField(Integer.valueOf(2), descriptionField); newExpForm.addField(Integer.valueOf(3), speciesField); newExpForm.addField(Integer.valueOf(4), sampleTypeField); newExpForm.addField(Integer.valueOf(5), sampleProcessingField); newExpForm.addField(Integer.valueOf(6), instrumentTypeField); newExpForm.addField(Integer.valueOf(7), fragModeField); newExpForm.addField(Integer.valueOf(8), UploadedByNameField); newExpForm.addField(Integer.valueOf(9), emailField); newExpForm.addField(Integer.valueOf(10), publicationLinkField); // Add form to layout container.addComponent(newExpForm); Panel p = new Panel(); Label l = new Label( "<h4 style='color:blue'>Or Update Existing Experiments !</h4><h4 style='color:blue'>For New Experiment Please Leave Experiment ID Blank!</h4><h4 style='color:blue'><strong style='color:red'>* </strong> For New Experiment Please Remember to Upload Protein file first!</h4>"); l.setContentMode(Label.CONTENT_XHTML); p.addComponent(l); container.addComponent(p); // Create the Form Form existExpForm = new Form(); existExpForm.setCaption("Exist Experiments"); expList = eh.getExperiments(null); List<String> strExpList = new ArrayList<String>(); for (ExperimentBean exp : expList.values()) { if (user.getEmail().equalsIgnoreCase("*****@*****.**") || exp.getEmail().equalsIgnoreCase(user.getEmail())) { String str = exp.getExpId() + " " + exp.getName() + " ( " + exp.getUploadedByName() + " )"; strExpList.add(str); } } select = new Select("Experiment ID", strExpList); select.setImmediate(true); select.addListener( new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Object o = select.getValue(); if (o != null) { String str = select.getValue().toString(); String[] strArr = str.split("\t"); int id = (Integer.valueOf(strArr[0])); ExperimentBean expDet = expList.get(id); if (expDetails != null) { expDetails.removeAllComponents(); if (expDet.getProteinsNumber() == 0) { Label l = new Label("<h4 style='color:red'>1) Protein File is Missing</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } else { Label l = new Label("<h4 style='color:blue'>1) Protein File is Uploaded</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } if (expDet.getFractionsNumber() == 0) { Label l = new Label("<h4 style='color:red'>2) Fraction File is Missing</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } else { Label l = new Label("<h4 style='color:blue'>2) Fraction File Uploaded</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } // if (expDet.getFractionRange() == 0) { // Label l = new Label("<h4 style='color:red'>3) Fraction // Range File is Missing</h4>"); // l.setContentMode(Label.CONTENT_XHTML); // expDetails.addComponent(l); // } else { // Label l = new Label("<h4 style='color:blue'>3) // Fraction Range File Uploaded</h4>"); // l.setContentMode(Label.CONTENT_XHTML); // expDetails.addComponent(l); // } if (expDet.getPeptidesNumber() == 0) { Label l = new Label("<h4 style='color:red'>3) Peptides File is Missing</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } else { Label l = new Label("<h4 style='color:blue'>3) Peptides File Uploaded</h4>"); l.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(l); } } } else { expDetails.removeAllComponents(); Label labelDetails = new Label( "<h4 style='color:red;'>Please Select Experiment To Show the Details.</h4>"); labelDetails.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(labelDetails); } } }); select.setWidth("60%"); existExpForm.addField(Integer.valueOf(1), select); // Add form to layout VerticalLayout vlo = new VerticalLayout(); if (hslo != null) { vlo.removeComponent(hslo); } hslo = new HorizontalLayout(); hslo.setSizeFull(); hslo.addComponent(existExpForm); vlo.addComponent(hslo); if (removeExperimentLayout != null) { hslo.removeComponent(removeExperimentLayout); } removeExperimentLayout = this.getRemoveForm(user.getEmail()); hslo.addComponent(removeExperimentLayout); hslo.setComponentAlignment(removeExperimentForm, Alignment.MIDDLE_CENTER); vlo.addComponent(hslo); container.addComponent(vlo); // Create the Upload component. upload = new Upload(null, this); upload.setStyleName("small"); upload.setVisible(true); upload.setHeight("30px"); upload.setButtonCaption("ADD / EDIT EXPERIMENT !"); // ***************************************************** upload.addListener( new Upload.StartedListener() { @SuppressWarnings("static-access") @Override public void uploadStarted(StartedEvent event) { try { Thread.currentThread().sleep(1000); Thread t = new Thread( new Runnable() { @Override public void run() { pi.setVisible(true); } }); t.start(); t.join(); } catch (InterruptedException e) { } mainTabs.setReadOnly(true); subTabs.setReadOnly(true); } }); upload.addListener( new Upload.FinishedListener() { @Override public void uploadFinished(FinishedEvent event) { pi.setVisible(false); mainTabs.setReadOnly(false); subTabs.setReadOnly(false); file = new File(event.getFilename()); } }); // *********************************** upload.addListener((Upload.SucceededListener) this); upload.addListener((Upload.FailedListener) this); if (helpNote != null) { vlo.removeComponent(helpNote); } Label label = new Label( "<h4 style='color:red;'>Please upload proteins file first</h4><h4 style='color:red;'>Please upload proteins files in (.txt) format.</h4><h4 style='color:red;'>Upload fraction range file after upload protein fraction file.</h4><h4 style='color:red;'>Upload fraction range file in (.xlsx) format.</h4>"); label.setContentMode(Label.CONTENT_XHTML); helpNote = help.getHelpNote(label); helpNote.setMargin(false, true, true, true); vlo.addComponent(upload); vlo.addComponent(pi); vlo.addComponent(helpNote); vlo.setComponentAlignment(helpNote, Alignment.MIDDLE_RIGHT); expDetails = new Panel("Experiment Details"); Label labelDetails = new Label("<h4 style='color:red;'>Please Select Experiment To Show the Details.</h4>"); labelDetails.setContentMode(Label.CONTENT_XHTML); expDetails.addComponent(labelDetails); vlo.addComponent(expDetails); root.addComponent(vlo); container.addComponent(root); }
private void buildView() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Painting PurchaseEnquiry UI"); // Initialization for Purchase Enquire Details user input components tfEnqNo = new TextField("Enquiry No"); tfEnqNo.setMaxLength(40); tfEnqQty = new TextField(); tfEnqQty.setValue("0"); tfEnqQty.setWidth("90"); dfDueDate = new GERPPopupDateField("Due Date"); dfDueDate.setInputPrompt("Select Date"); dfEnqDate = new GERPPopupDateField("Enquiry Date"); dfEnqDate.setInputPrompt("Select Date"); taEnqDtlRem = new TextArea("Remarks"); taEnqDtlRem.setMaxLength(40); taEnqDtlRem.setWidth("150"); taEnqDtlRem.setHeight("50"); taEnqRem = new TextArea("Remarks"); taEnqRem.setHeight("50"); taEnqDtlRem.setMaxLength(100); cbBranch = new GERPComboBox("Branch Name"); cbBranch.setItemCaptionPropertyId("branchName"); loadBranchList(); try { ApprovalSchemaDM obj = serviceSmsPurEnqHdr.getReviewerId(companyid, appScreenId, branchId, roleId).get(0); if (obj.getApprLevel().equals("Approver")) { cbEnqStatus = new GERPComboBox("Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.RP_STATUS); } else { cbEnqStatus = new GERPComboBox( "Status", BASEConstants.T_SMS_P_ENQUIRY_HDR, BASEConstants.PE_STATUS_RV); } } catch (Exception e) { logger.info(e.getMessage()); } cbEnqStatus.setWidth("120"); cbEnqDtlStatus = new GERPComboBox("Status", BASEConstants.M_GENERIC_TABLE, BASEConstants.M_GENERIC_COLUMN); lsProduct = new ListSelect("Product Name"); lsProduct.setItemCaptionPropertyId("prodname"); lsProduct.setMultiSelect(true); loadProduct(); lsProduct.setImmediate(true); lsProduct.addValueChangeListener( new ValueChangeListener() { /** */ private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { String[] split = lsProduct .getValue() .toString() .replaceAll("\\[", "") .replaceAll("\\]", "") .split(","); for (String obj : split) { if (obj.trim().length() > 0) { cbUom.setReadOnly(false); cbUom.setValue( serviceProduct .getProductList( companyid, Long.valueOf(obj.trim()), null, null, null, null, null, "F") .get(0) .getUom()); cbUom.setReadOnly(true); } } } }); cbUom = new TextField(); cbUom.setWidth("77"); cbUom.setHeight("23"); lsVendorName = new ListSelect("Vendor Name "); lsVendorName.setMultiSelect(true); lsVendorName.setItemCaptionPropertyId("vendorName"); loadVendorList(); lsVendorName.setWidth("150"); lsVendorName.setHeight("75"); hlSearchLayout = new GERPAddEditHLayout(); assembleSearchLayout(); hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout)); resetFields(); loadSrchRslt(); loadPurDtl(); btnaddSpec.setStyleName("add"); btnaddSpec.addClickListener( new ClickListener() { // Click Listener for Add and Update private static final long serialVersionUID = 6551953728534136363L; @Override public void buttonClick(ClickEvent event) { if (dtlValidation()) { saveEnqDtl(); } } }); btndelete.setEnabled(false); // ClickListener for Enquire Detail Tale tblSmsEnqDtl.addItemClickListener( new ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(ItemClickEvent event) { if (tblSmsEnqDtl.isSelected(event.getItemId())) { tblSmsEnqDtl.setImmediate(true); btnaddSpec.setCaption("Add"); btnaddSpec.setStyleName("savebt"); btndelete.setEnabled(false); enqDtlresetFields(); } else { ((AbstractSelect) event.getSource()).select(event.getItemId()); btnaddSpec.setCaption("Update"); btnaddSpec.setStyleName("savebt"); btndelete.setEnabled(true); editSmsPurDetail(); } } }); btndelete.addClickListener( new ClickListener() { // Click Listener for Add and Update private static final long serialVersionUID = 6551953728534136363L; @Override public void buttonClick(ClickEvent event) { if (btndelete == event.getButton()) { deleteDetails(); } } }); }