private void search() { btnSearch.setEnabled(false); Enums.ClientType client_type = documentSearchComponent.getContactableType(); Long client_id = documentSearchComponent.getClient_id(); Date from = dtFrom.getDate(); Date to = dtTo.getDate(); if (client_id == null) { JOptionPane.showMessageDialog( null, "Select agent/customer", "Search", JOptionPane.WARNING_MESSAGE); btnSearch.setEnabled(true); return; } task = new AccountsHistoryTask( client_type, client_id, from, to, progressBar, Enums.SaleType.TKTSALES); task.addPropertyChangeListener(this); task.execute(); }
// End of variables declaration//GEN-END:variables @Override public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { int progress = (Integer) evt.getNewValue(); progressBar.setValue(progress); if (progress == 100) { try { report = task.get(); report.addFirstLine(); report.addLastLine(); lines = report.getLines(); populateTable(); } catch (InterruptedException | ExecutionException ex) { Logger.getLogger(TSalesInvoiceReportingFrame.class.getName()).log(Level.SEVERE, null, ex); } finally { btnSearch.setEnabled(true); } } } }