Skip to content

Commit 625964e

Browse files
NicoKiaructrueden
authored andcommitted
Adds swing ui which monitors scijava's tasks
Adds a circular progress bar component to the status bar which displays the overall progress of all registered tasks created via the scijava task service. When the user clicks on the circular progress bar, a frame containing a table summarizing each task progression is displayed. Each task is rendered in the table with a custom renderer, displaying a label with the name of the task and its status, a linear progress bar, and, if enabled, a label with an estimation of the remaining time until task completion. The estimation assumes a constant completion speed since the start of the task registration. Additionally, the second column of the table displays a clickable stop icon and which can be used to cancel the task. Before cancellation, a user confirmation dialog can be enabled or disabled.
1 parent 7bde4b2 commit 625964e

File tree

4 files changed

+610
-4
lines changed

4 files changed

+610
-4
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
<object-inspector.version>0.1</object-inspector.version>
110110
<scijava-plot.version>0.2.0</scijava-plot.version>
111111
<jfreesvg.version>3.2</jfreesvg.version>
112+
<scijava-common.version>2.88.0</scijava-common.version>
112113
</properties>
113114

114115
<repositories>

src/main/java/org/scijava/ui/swing/SwingStatusBar.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929

3030
package org.scijava.ui.swing;
3131

32-
import java.awt.BorderLayout;
33-
32+
import javax.swing.JComponent;
3433
import javax.swing.JLabel;
3534
import javax.swing.JPanel;
3635
import javax.swing.JProgressBar;
@@ -47,6 +46,10 @@
4746
import org.scijava.ui.StatusBar;
4847
import org.scijava.ui.UIService;
4948
import org.scijava.ui.awt.AWTInputEventDispatcher;
49+
import org.scijava.ui.swing.task.SwingTaskMonitorComponent;
50+
51+
import java.awt.BorderLayout;
52+
import java.awt.Dimension;
5053

5154
/**
5255
* Swing implementation of {@link StatusBar}.
@@ -72,14 +75,17 @@ public class SwingStatusBar extends JPanel implements StatusBar {
7275

7376
public SwingStatusBar(final Context context) {
7477
context.inject(this);
75-
7678
statusText = new JLabel(appService.getApp().getInfo(false));
7779
statusText.setBorder(new BevelBorder(BevelBorder.LOWERED));
7880
progressBar = new JProgressBar();
7981
progressBar.setVisible(false);
8082
setLayout(new BorderLayout());
8183
add(statusText, BorderLayout.CENTER);
82-
add(progressBar, BorderLayout.EAST);
84+
add(progressBar, BorderLayout.WEST);
85+
JComponent progress = new SwingTaskMonitorComponent(context, true, true,300, false).getComponent();
86+
int h = getPreferredSize().height;
87+
progress.setPreferredSize(new Dimension(h,h));
88+
add(progress, BorderLayout.EAST);
8389
}
8490

8591
// -- SwingStatusBar methods --

0 commit comments

Comments
 (0)