-
Notifications
You must be signed in to change notification settings - Fork 32
InfiniteProgressPanel
This widget is dedicated to long task operations, widely inspired by work of Romain Guy.
An Infinite Progress Panel is attached to a composite. In fact, the panel is a transparent window (shell) located on another window.
The first thing to do is to get a panel :
final InfiniteProgressPanel panel = InfiniteProgressPanel.getInfiniteProgressPanelFor(shell);
Then you can "customize" it :
panel.setText("Please wait...");
panel.setTextColor(shell.getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
panel.setTextFont(new Font(shell.getDisplay(), "Lucida Sans", 18, SWT.BOLD));
To start and stop the panel, simply use the start and stop methods :
panel.start();
... // Long time operation
panel.stop();
Et voilà !
You can customize the panel (there is a setter for each value) :
- alpha : alpha value of the panel (between 0 and 255)
- bars count : number of bars
- default color : color of the bars
- FPS : number of frames per second
- line width : thickness of the bars
- selection color : color of the highlighted bar
- text, text color and text font
An animation is available at https://github.com/lcaron/opal/blob/wiki/wink/infinite.swf?raw=true
An example (SnippetInfiniteProgressPanel) is provided in the directory src/test/java/org/mihalis/opal/InfinitePanel.
This example is also available here : https://github.com/lcaron/opal/blob/master/src/test/java/org/mihalis/opal/infinitePanel/SnippetInfiniteProgressPanel.java