use of javax.swing.SwingWorker.StateValue in project com.revolsys.open by revolsys.
the class BackgroundTaskTableModel method updateCounts.
private void updateCounts() {
this.pendingCount = 0;
this.runningCount = 0;
this.doneCount = 0;
for (final BackgroundTask task : this.tasks) {
final StateValue taskStatus = task.getTaskStatus();
if (taskStatus == StateValue.PENDING) {
this.pendingCount++;
} else if (taskStatus == StateValue.STARTED) {
this.runningCount++;
} else if (!task.isTaskClosed()) {
this.doneCount++;
}
}
if (this.runningCount == 0) {
this.timer.stop();
} else {
this.timer.start();
}
firePropertyChange("pendingCount", -1, this.pendingCount);
firePropertyChange("runningCount", -1, this.runningCount);
firePropertyChange("doneCount", -1, this.doneCount);
}
use of javax.swing.SwingWorker.StateValue in project com.revolsys.open by revolsys.
the class BackgroundTaskTableModel method addHighlighter.
private static void addHighlighter(final BaseJTable table, final BackgroundTaskTableModel model, final StateValue state, final Color background, final Color foreground) {
final HighlightPredicate predicate = (renderer, adapter) -> {
final int rowIndex = adapter.convertRowIndexToModel(adapter.row);
final BackgroundTask task = model.tasks.get(rowIndex);
return task.getTaskStatus() == state;
};
final ColorHighlighter highlighter = new ColorHighlighter(predicate, background, foreground, foreground, background);
table.addHighlighter(highlighter);
}
Aggregations