private FormDeletion getFormData(FormDeletion form) { form.setDeletionDate(inputDeletionDate.getValue()); form.setInformation(information.getValue()); form.setQuantity(inputGoodsQuantity.getValue()); form.setIdGoods((String) inputGoodsSelect.getValue()); form.setDeletionId(this.deletionId); form.setPrice(inputGoodsPrice.getValue()); return form; }
@Override public FormDeletion getFormData() { FormDeletion form = new FormDeletion(function); form.setDeletionDate(inputDeletionDate.getValue()); form.setInformation(information.getValue()); form.setQuantity(inputGoodsQuantity.getValue()); form.setIdGoods((String) inputGoodsSelect.getValue()); form.setDeletionId(this.deletionId); form.setPrice(inputGoodsPrice.getValue()); return form; }
@Override public void append(String suggestion) { setDirty(true); String value = (String) translated.getValue(); if (value == null) translated.setValue(suggestion); else { if (value.endsWith(" ")) // $NON-NLS-1$ translated.setValue(value + suggestion); else translated.setValue(value + " " + suggestion); // $NON-NLS-1$ } }
private void handleSubmit(ClickEvent event) { final String mnth = mnth_sel.getValue().toString(); final String day = day_sel.getValue().toString(); final String answer = ans_txt.getValue().toString().trim(); if (answer.isEmpty()) { info.setValue("Answer is empty"); } else if (!mnth.equals(emp.getBirth_month()) || !day.equals(emp.getBirth_day())) { info.setValue("Incorrect birth month and day for user"); } else if (!isAnswerCorrect()) { info.setValue("Incorrect answer to security question"); } else UI.getCurrent().setContent(new PasswordRec3View(emp)); }
@Override public FormData getFormData() { FormData data = new FormData(function); data.setAddress(inputAddress.getValue()); data.setEmployeeNum(inputEmployeeNum.getValue()); data.setName(inputName.getValue()); data.setPassword1(inputPassword1.getValue()); data.setPassword2(inputPassword2.getValue()); data.setPhoneNumber(inputPhoneNumber.getValue()); data.setRole((String) selectRole.getValue()); data.setSika(inputSika.getValue()); data.setTitle(inputTitle.getValue()); data.setUserName(inputUserName.getValue()); data.setEditMode(editMode); return data; }
private boolean isAnswerCorrect() { if (question_txt.getValue().equals(emp.getSecurity_q1())) { if (ans_txt.getValue().trim().equalsIgnoreCase(emp.getSecurity_ans1())) return true; } else if (question_txt.getValue().equals(emp.getSecurity_q2())) { if (ans_txt.getValue().trim().equalsIgnoreCase(emp.getSecurity_ans2())) return true; } else if (question_txt.getValue().equals(emp.getSecurity_q3())) { if (ans_txt.getValue().trim().equalsIgnoreCase(emp.getSecurity_ans3())) return true; } return false; }
protected void handleFormSubmit() { try { // Check for errors form.commit(); // will throw exception in case validation is false // Create task Task task = taskService.newTask(); task.setName(nameField.getValue().toString()); task.setDescription(descriptionArea.getValue().toString()); task.setDueDate((Date) dueDateField.getValue()); task.setPriority(priorityComboBox.getPriority()); task.setOwner(ExplorerApp.get().getLoggedInUser().getId()); taskService.saveTask(task); // close popup and navigate to new group close(); ExplorerApp.get().getViewManager().showTasksPage(task.getId()); } catch (InvalidValueException e) { // Do nothing: the Form component will render the errormsgs automatically setHeight(350, UNITS_PIXELS); } }
@Override public void buttonClick(ClickEvent event) { if (this.auctionTitle.getValue().equals("")) { this.notification = new Notification("Error!", "Tytuł jest wymagany!", Notification.Type.ERROR_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); return; } else if (this.auctionDescription.getValue().equals("")) { this.notification = new Notification("Error!", "Opis jest wymagany!", Notification.Type.ERROR_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); return; } else if (this.auctionPrice.getValue().equals("")) { this.notification = new Notification("Error!", "Cena jest wymagany!", Notification.Type.ERROR_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); return; } else if (!NumberUtils.isNumber(this.auctionPrice.getValue())) { this.auctionPrice.setValue(this.auctionPrice.getValue().replace(",", ".")); if (!NumberUtils.isNumber(this.auctionPrice.getValue())) { this.notification = new Notification("Error!", "Cena jest liczbą!", Notification.Type.ERROR_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); return; } } else if (NumberUtils.toFloat(this.auctionPrice.getValue()) <= 0.0) { this.notification = new Notification( "Error!", "Cena musi być większa niż 0!", Notification.Type.ERROR_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); return; } JSONObject msg = new JSONObject(); msg.put("login", (((MyUI) UI.getCurrent()).getUserLogin())); msg.put("pass", (((MyUI) UI.getCurrent()).getUserPass())); msg.put("title", auctionTitle.getValue()); msg.put("description", auctionDescription.getValue()); msg.put("price", auctionPrice.getValue()); msg.put("user_ID", (((MyUI) UI.getCurrent()).getUserId())); msg.put("auciton_ID", this.idAuction); try { Http_Put put = new Http_Put(this.httpGetURL, msg.toString()); responseString = put.getStrinResponse(); if (put.getStatusCode() == 201) { this.notification = new Notification( "OK", "Pomyślnie zaktualizowano aukcjię!", Notification.Type.WARNING_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); } else { this.notification = new Notification("Error!", responseString, Notification.Type.ERROR_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); } } catch (IOException e) { System.err.println("[ERROR] " + new Date() + ": " + e.getMessage()); this.notification = new Notification("Error!", "Problem z połączeniem!", Notification.Type.ERROR_MESSAGE); this.notification.setDelayMsec(5000); this.notification.show(Page.getCurrent()); } }
private ExperimentBean validateForm() { ExperimentBean newExp; if (select.getValue() == null) // new experiment { String expName = (String) expNameField.getValue(); String expSpecies = (String) speciesField.getValue(); String expSampleType = (String) sampleTypeField.getValue(); String expSampleProcessing = (String) sampleProcessingField.getValue(); String expInstrumentType = (String) instrumentTypeField.getValue(); String expFragMode = (String) fragModeField.getValue(); String expUploadedByName = (String) UploadedByNameField.getValue(); String expEmail = (String) emailField.getValue(); String expPublicationLink = (String) publicationLinkField.getValue(); String expDescription = (String) descriptionField.getValue(); if ((expName == null) || (expDescription == null) || (expSpecies == null) || (expSampleType == null) || (expSampleProcessing == null) || (expInstrumentType == null) || (expFragMode == null) || (expUploadedByName == null) || (expEmail == null) || expName.equals("") || expDescription.equals("") || expSpecies.equals("") || expSampleType.equals("") || expSampleProcessing.equals("") || expInstrumentType.equals("") || expFragMode.equals("") || expUploadedByName.equals("") || expEmail.equals("")) { // file didn't store in data base newExpForm.commit(); newExpForm.focus(); return null; } else { boolean checkName = false; for (ExperimentBean exp : expList.values()) { if (exp.getName().equalsIgnoreCase(expName)) { checkName = true; break; } } if (checkName) { expNameField.setValue("This Name is Not Available Please Choose Another Name "); expNameField.commit(); newExpForm.focus(); return null; } else { newExp = new ExperimentBean(); newExp.setName(expName); newExp.setSpecies(expSpecies); newExp.setSampleType(expSampleType); newExp.setSampleProcessing(expSampleProcessing); newExp.setInstrumentType(expInstrumentType); newExp.setFragMode(expFragMode); newExp.setUploadedByName(expUploadedByName); newExp.setEmail(expEmail); newExp.setPublicationLink(expPublicationLink); newExp.setExpId(-1); newExp.setDescription(expDescription); return newExp; } } } else // update old experiment { String str = select.getValue().toString(); String[] strArr = str.split("\t"); int id = (Integer.valueOf(strArr[0])); ExperimentBean exp = expList.get(id); return exp; } }
private void saveEnqDtl() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Saving Data... "); try { int count = 0; String[] split = lsProduct.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(","); for (String obj : split) { if (obj.trim().length() > 0) { for (SmsPurEnqDtlDM smsPurEnqDtlDM : listEnqDtls) { if (smsPurEnqDtlDM.getProductId().equals(Long.valueOf(obj.trim()))) { count++; break; } } if (tblSmsEnqDtl.getValue() != null) { count = 0; } if (count == 0) { SmsPurEnqDtlDM enqDtlObj = new SmsPurEnqDtlDM(); if (tblSmsEnqDtl.getValue() != null) { enqDtlObj = beanPurEnqDtlDM.getItem(tblSmsEnqDtl.getValue()).getBean(); listEnqDtls.remove(enqDtlObj); } if (lsProduct.getValue() != null) { enqDtlObj.setProductId(Long.valueOf(obj.trim())); enqDtlObj.setPordName( serviceProduct .getProductList( null, Long.valueOf(obj.trim()), null, null, null, null, null, "P") .get(0) .getProdname()); } if (cbUom.getValue() != null) { cbUom.setReadOnly(false); enqDtlObj.setProductUom(cbUom.getValue().toString()); cbUom.setReadOnly(true); } enqDtlObj.setRemarks(taEnqDtlRem.getValue().toString()); if (tfEnqQty.getValue() != null && tfEnqQty.getValue().trim().length() > 0) { enqDtlObj.setEnquiryQty(Long.valueOf(tfEnqQty.getValue())); } if (cbEnqDtlStatus.getValue() != null) { enqDtlObj.setEnqDtlStaus((cbEnqDtlStatus.getValue().toString())); } enqDtlObj.setLastUpdateddt(DateUtils.getcurrentdate()); enqDtlObj.setLastUpdatedby(username); listEnqDtls.add(enqDtlObj); loadPurDtl(); btnaddSpec.setCaption("Add"); count = 0; } else { lsProduct.setComponentError(new UserError("Product Already Exist..")); } } } enqDtlresetFields(); } catch (Exception e) { logger.info(e.getMessage()); } }
@Override protected void saveDetails() throws SaveException, FileNotFoundException, IOException { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Saving Data... "); try { SmsPurEnqHdrDM purEnqobj = new SmsPurEnqHdrDM(); if (tblMstScrSrchRslt.getValue() != null) { purEnqobj = beanPurEnqHdrDM.getItem(tblMstScrSrchRslt.getValue()).getBean(); purEnqobj.setEnquiryNo(tfEnqNo.getValue()); } purEnqobj.setEnquiryNo(tfEnqNo.getValue()); purEnqobj.setCompanyId(companyid); purEnqobj.setEnqRemark(taEnqRem.getValue().toString()); purEnqobj.setBranchId((Long) cbBranch.getValue()); purEnqobj.setDueDate((Date) dfDueDate.getValue()); purEnqobj.setEnquiryDate((Date) dfEnqDate.getValue()); purEnqobj.setEnquiryStatus(((String) cbEnqStatus.getValue())); purEnqobj.setPreparedBy(employeeId); purEnqobj.setReviewedBy(null); purEnqobj.setActionedBy(null); purEnqobj.setLastUpdateddt(DateUtils.getcurrentdate()); purEnqobj.setLastUpdatedby(username); serviceSmsPurEnqHdr.saveorUpdateSmsPurEnqHdrDetails(purEnqobj); enquiryId = purEnqobj.getEnquiryId(); String[] split = lsVendorName.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(","); for (String obj : split) { if (obj.trim().length() > 0) { EnquiryVendorDtlDM enqvendtl = new EnquiryVendorDtlDM(); enqvendtl.setEnqid(purEnqobj.getEnquiryId()); System.out.println("vendid" + Long.valueOf(obj.trim())); enqvendtl.setVendorid(Long.valueOf(obj.trim())); serviceEnquiryVendorDtl.save(enqvendtl); } } @SuppressWarnings("unchecked") Collection<SmsPurEnqDtlDM> itemIds = (Collection<SmsPurEnqDtlDM>) tblSmsEnqDtl.getVisibleItemIds(); for (SmsPurEnqDtlDM save : (Collection<SmsPurEnqDtlDM>) itemIds) { save.setEnquiryId(Long.valueOf(purEnqobj.getEnquiryId().toString())); serviceSmsPurEnqDtl.saveorUpdateSmsPurEnqDtlDetails(save); } comments.resetfields(); if (tblMstScrSrchRslt.getValue() == null) { try { SlnoGenDM slnoObj = serviceSlnogen.getSequenceNumber(companyid, branchId, moduleId, "SM_ENQRYNO").get(0); if (slnoObj.getAutoGenYN().equals("Y")) { serviceSlnogen.updateNextSequenceNumber(companyid, branchId, moduleId, "SM_ENQRYNO"); } } catch (Exception e) { } } tfEnqNo.setReadOnly(false); tfEnqNo.setValue(purEnqobj.getEnquiryNo()); tfEnqNo.setReadOnly(true); comments.saveEnquiry(purEnqobj.getEnquiryId(), purEnqobj.getEnquiryStatus()); loadSrchRslt(); enqDtlresetFields(); } catch (Exception e) { logger.info(e.getMessage()); } }
@Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible && content.getValue().toString().length() > 0) content.selectAll(); }