Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Nebula ProgressCircle"
(Created page with "< Back to Nebula Main Page =Introduction= File:ProgressCircle.png __TOC__ This widget is a graphical presentation of a percentage value. Please notice that...") |
|||
Line 8: | Line 8: | ||
__TOC__ | __TOC__ | ||
− | This widget is a graphical presentation of a | + | This widget is a graphical presentation of a ratio. It can be considered as another vision of the progress bar. |
+ | ''Please notice that there is no interaction with the user''. | ||
=Usage= | =Usage= | ||
Line 14: | Line 15: | ||
The usage is very simple : | The usage is very simple : | ||
* You create a ProgressCircle widget | * You create a ProgressCircle widget | ||
− | * You set the | + | * You set the minimum, maximum and selection values with the methods '''setMinimum''', '''setMaximum''', '''setSelection''' |
− | * You set the graphical parameters of the widget: circle size, thickness, the color, the color of the highlighted part with the appropriate setter. | + | * You (eventually) set the graphical parameters of the widget: circle size, thickness, the color, the color of the highlighted part with the appropriate setter. |
− | * | + | * If you want to display the text, just use '''setShowText(true)'''. In this case, please fill the pattern with the '''setTextPattern''' method. 2 Constants are provided: '''PERCENTAGE_PATTERN''' and '''INTEGER_PATTERN'''. |
+ | When you set another value for this widget, an image is displayed to show the transition between the previous value and the new value. | ||
<code> | <code> | ||
Line 23: | Line 25: | ||
final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); | final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); | ||
circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); | circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); | ||
− | circle. | + | circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); |
+ | circle.setMinimum(-100); | ||
+ | circle.setMaximum(100); | ||
+ | circle.setSelection(52); | ||
circle.setThickness(10); | circle.setThickness(10); | ||
circle.setCircleSize(100); | circle.setCircleSize(100); | ||
− | circle. | + | circle.setShowText(true); |
+ | </nowiki></code> | ||
+ | |||
+ | You can use it also to display a countdown (like an egg cooker). | ||
+ | <code> | ||
+ | <nowiki> | ||
+ | final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); | ||
+ | circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); | ||
+ | circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); | ||
+ | circle.setThickness(10); | ||
+ | circle.setCircleSize(100); | ||
+ | circle.setShowText(true); | ||
+ | |||
+ | final LocalTime time = LocalTime.of(0, 2, 40); | ||
+ | circle.startCountDown(time); | ||
</nowiki></code> | </nowiki></code> | ||
Revision as of 17:34, 15 March 2018
Introduction
Contents
This widget is a graphical presentation of a ratio. It can be considered as another vision of the progress bar. Please notice that there is no interaction with the user.
Usage
The usage is very simple :
- You create a ProgressCircle widget
- You set the minimum, maximum and selection values with the methods setMinimum, setMaximum, setSelection
- You (eventually) set the graphical parameters of the widget: circle size, thickness, the color, the color of the highlighted part with the appropriate setter.
- If you want to display the text, just use setShowText(true). In this case, please fill the pattern with the setTextPattern method. 2 Constants are provided: PERCENTAGE_PATTERN and INTEGER_PATTERN.
When you set another value for this widget, an image is displayed to show the transition between the previous value and the new value.
final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); circle.setMinimum(-100); circle.setMaximum(100); circle.setSelection(52); circle.setThickness(10); circle.setCircleSize(100); circle.setShowText(true);
You can use it also to display a countdown (like an egg cooker).
final ProgressCircle circle = new ProgressCircle(shell, SWT.NONE); circle.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); circle.setTextPattern(ProgressCircle.INTEGER_PATTERN); circle.setThickness(10); circle.setCircleSize(100); circle.setShowText(true); final LocalTime time = LocalTime.of(0, 2, 40); circle.startCountDown(time);
Example
An example called ProgressCircleSnippet is located in the plugin org.eclipse.nebula.widgets.progresscircle.snippets.
This example is also available here : ProgressCircleSnippet.java