Class ProgressCircle
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.swt.widgets.Canvas
-
- org.eclipse.nebula.widgets.progresscircle.ProgressCircle
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class ProgressCircle extends org.eclipse.swt.widgets.Canvas
Instances of this class represents a progress circle (also known as donuts), which represents a ratio. It can also represent a remaining time, like an egg cooker.- Styles:
- BORDER
- Events:
- (none)
-
-
Field Summary
Fields Modifier and Type Field Description private int
circleSize
private boolean
firstDisplay
private float
floatValue
private org.eclipse.swt.graphics.Color
highlightColor
static java.lang.String
INTEGER_PATTERN
private boolean
isTimer
private static int
MARGIN
private int
maximum
private int
minimum
static java.lang.String
PERCENTAGE_PATTERN
private boolean
showText
private java.lang.String
textPattern
private int
thickness
private int
value
-
Constructor Summary
Constructors Constructor Description ProgressCircle(org.eclipse.swt.widgets.Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
checkStyle(int style)
org.eclipse.swt.graphics.Point
computeSize(int wHint, int hHint, boolean changed)
private org.eclipse.swt.graphics.Font
createDefaultFont()
private org.eclipse.swt.graphics.Color
getAndDisposeColor(int r, int g, int b)
int
getCircleSize()
org.eclipse.swt.graphics.Color
getHighlightColor()
int
getMaximum()
Returns the maximum value which the receiver will allow.int
getMinimum()
Returns the minimum value which the receiver will allow.int
getSelection()
java.lang.String
getTextPattern()
int
getThickness()
boolean
isShowText()
private void
paintControl(org.eclipse.swt.events.PaintEvent e)
void
setBackground(org.eclipse.swt.graphics.Color color)
void
setCircleSize(int circleSize)
Set the size of the circlevoid
setFont(org.eclipse.swt.graphics.Font font)
void
setForeground(org.eclipse.swt.graphics.Color color)
void
setHighlightColor(org.eclipse.swt.graphics.Color highlightColor)
Set the highlight color of the circlevoid
setMaximum(int maximum)
Sets the maximum value that the receiver will allow.void
setMinimum(int minimum)
Sets the minimum value that the receiver will allow.void
setSelection(int selection)
Set the selection value of this widgetvoid
setShowText(boolean showPercentage)
Displays or not the textvoid
setTextPattern(java.lang.String textPattern)
Set the pattern used to display the valuevoid
setThickness(int thickness)
Set the thickness valueprivate void
startAnimation(int startValue)
void
startCountDown(java.time.LocalTime startTime)
-
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setIME
-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
PERCENTAGE_PATTERN
public static final java.lang.String PERCENTAGE_PATTERN
- See Also:
- Constant Field Values
-
INTEGER_PATTERN
public static final java.lang.String INTEGER_PATTERN
- See Also:
- Constant Field Values
-
value
private int value
-
circleSize
private int circleSize
-
thickness
private int thickness
-
showText
private boolean showText
-
highlightColor
private org.eclipse.swt.graphics.Color highlightColor
-
MARGIN
private static int MARGIN
-
firstDisplay
private boolean firstDisplay
-
maximum
private int maximum
-
minimum
private int minimum
-
textPattern
private java.lang.String textPattern
-
floatValue
private float floatValue
-
isTimer
private boolean isTimer
-
-
Constructor Detail
-
ProgressCircle
public ProgressCircle(org.eclipse.swt.widgets.Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to construct- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
- See Also:
Widget.getStyle()
-
-
Method Detail
-
checkStyle
private static int checkStyle(int style)
-
getAndDisposeColor
private org.eclipse.swt.graphics.Color getAndDisposeColor(int r, int g, int b)
-
createDefaultFont
private org.eclipse.swt.graphics.Font createDefaultFont()
-
paintControl
private void paintControl(org.eclipse.swt.events.PaintEvent e)
-
getMaximum
public int getMaximum()
Returns the maximum value which the receiver will allow.- Returns:
- the maximum
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMaximum
public void setMaximum(int maximum)
Sets the maximum value that the receiver will allow.- Parameters:
value
- the new maximum- Throws:
org.eclipse.swt.SWTException
-- ERROR_INVALID_ARGUMENT - If maximum is lower than the minimum value
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getMinimum
public int getMinimum()
Returns the minimum value which the receiver will allow.- Returns:
- the minimum
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setMinimum
public void setMinimum(int minimum)
Sets the minimum value that the receiver will allow.- Parameters:
value
- the new minimum- Throws:
org.eclipse.swt.SWTException
-- ERROR_INVALID_ARGUMENT - If minimum is greater than the maximum value
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSelection
public int getSelection()
- Returns:
- selection value
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setSelection
public void setSelection(int selection)
Set the selection value of this widget- Parameters:
value
- the new percentage value- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
startAnimation
private void startAnimation(int startValue)
-
getCircleSize
public int getCircleSize()
- Returns:
- the size of the circle
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setCircleSize
public void setCircleSize(int circleSize)
Set the size of the circle- Parameters:
circleSize
- the new size of the circle- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getThickness
public int getThickness()
- Returns:
- the thickness of the circle
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setThickness
public void setThickness(int thickness)
Set the thickness value- Parameters:
thickness
- the new value- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
isShowText
public boolean isShowText()
- Returns:
true
if the text is displayed, false otherwise- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setShowText
public void setShowText(boolean showPercentage)
Displays or not the text- Parameters:
showPercentage
- iftrue
, displays the percentage label- Throws:
org.eclipse.swt.SWTException
-- ERROR_INVALID_ARGUMENT - if the display mode is not percentage
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHighlightColor
public org.eclipse.swt.graphics.Color getHighlightColor()
- Returns:
- the highlight color
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHighlightColor
public void setHighlightColor(org.eclipse.swt.graphics.Color highlightColor)
Set the highlight color of the circle- Parameters:
highlightColor
- the new highlight color- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getTextPattern
public java.lang.String getTextPattern()
- Returns:
- the text pattern used to display the value
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setTextPattern
public void setTextPattern(java.lang.String textPattern)
Set the pattern used to display the value- Parameters:
textPattern
- the new text pattern used to display the value- Throws:
org.eclipse.swt.SWTException
-- ERROR_NULL_ARGUMENT - if the parameter is NULL
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
startCountDown
public void startCountDown(java.time.LocalTime startTime)
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
- Overrides:
computeSize
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.computeSize(int, int, boolean)
-
setForeground
public void setForeground(org.eclipse.swt.graphics.Color color)
- Overrides:
setForeground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setForeground(org.eclipse.swt.graphics.Color)
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)
- Overrides:
setFont
in classorg.eclipse.swt.widgets.Canvas
- See Also:
Canvas.setFont(org.eclipse.swt.graphics.Font)
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color color)
- Overrides:
setBackground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setBackground(org.eclipse.swt.graphics.Color)
-
-