private void saveRemrak() { Remark remark = new Remark(); Timestamp currentTime = DateUtil.getCurrentTimeStamp(); String text = txtTextField.getText(); if (text != null && !text.isEmpty()) { remark.setText(text); remark.setDateTime(currentTime); remark.setCreatedBy(Application.getLoggedOnUser()); remark.setPnr(this.pnr); task = new RemarkTask(remark, pnr.getId(), busyLabel); task.addPropertyChangeListener(this); task.execute(); } }
@Override public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { int progress = (Integer) evt.getNewValue(); if (progress == 100) { try { Remarks remarks = task.get(); remarkslist = new ArrayList<>(); remarkslist = remarks.getList(); populateRemark(); } catch (InterruptedException | ExecutionException ex) { Logger.getLogger(ComponentRemark.class.getName()).log(Level.SEVERE, null, ex); } } } }
public void load() { task = new RemarkTask(null, pnr.getId(), busyLabel); task.addPropertyChangeListener(this); task.execute(); }