public class Oscilloscope
extends org.eclipse.swt.widgets.Canvas
Modifier and Type | Class and Description |
---|---|
class |
Oscilloscope.IntegerFiFoCircularStack
The stack can hold a limited number of values but will never overflow.
|
Modifier and Type | Field and Description |
---|---|
static int |
BASE_CENTER
The base of the line is positioned at the center of the widget.
|
static int |
CURSOR_START_DEFAULT
The default cursor starting position.
|
static int |
DEFAULT_HEIGHT
The default comfortable widget height.
|
static int |
DEFAULT_WIDTH
The default comfortable widget width.
|
static int[] |
HEARTBEAT
This set of values will draw a figure that is similar to the heart beat
that you see on hospital monitors.
|
static int |
LINE_WIDTH_DEFAULT
The default line width.
|
static int |
PROGRESSION_DEFAULT
The default tail fade percentage
|
static int |
STEADYPOSITION_75PERCENT
Steady position @ 75% of graph.
|
static int |
TAILFADE_DEFAULT
The default amount of tail fading in percentages (25).
|
static int |
TAILFADE_NONE
No tailfade.
|
static int |
TAILFADE_PERCENTAGE
The default tail fade percentage
|
static int |
TAILSIZE_DEFAULT
The default tail size is 75% of the width.
|
static int |
TAILSIZE_FILL
Will draw a tail from the left border but is only valid if the boolean in
#setSteady(boolean, int) was set to true, will default to
TAILSIZE_MAX otherwise. |
static int |
TAILSIZE_MAX
Will draw a maximum tail.
|
Constructor and Description |
---|
Oscilloscope(org.eclipse.swt.widgets.Composite parent,
int style)
Creates a scope with one channel.
|
Oscilloscope(int channels,
org.eclipse.swt.widgets.Composite parent,
int style)
Creates a scope with
channels channels. |
Oscilloscope(int channels,
OscilloscopeDispatcher dispatcher,
org.eclipse.swt.widgets.Composite parent,
int style)
Creates a new scope with
channels channels and adds attaches
it to the supplied dispatcher . |
Modifier and Type | Method and Description |
---|---|
void |
addStackListener(int channel,
OscilloscopeStackAdapter listener)
Adds a new stack listener to the collection of stack listeners.
|
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed) |
protected void |
controlMoved(org.eclipse.swt.widgets.Event e) |
protected void |
controlResized(org.eclipse.swt.widgets.Event e) |
int |
getBase(int channel)
This method can be called outside of the UI thread.
|
int |
getBaseOffset(int channel)
Gets the relative location where the line is drawn in the widget.
|
int |
getChannels()
This method can be called outside of the UI thread.
|
OscilloscopeDispatcher |
getDispatcher(int channel)
This method can be called outside of the UI thread.
|
org.eclipse.swt.graphics.Color |
getForeground(int channel)
This method can be called outside of the UI thread.
|
org.eclipse.swt.graphics.Color |
getGridBackground()
Returns the background color of the oscilloscope.
|
org.eclipse.swt.graphics.Color |
getGridForeground()
Returns the color of the grid.
|
int |
getGridLineWidth() |
int |
getGridSquareSize() |
int |
getLineWidth(int channel)
This method can be called outside of the UI thread.
|
int |
getProgression(int channel)
This method can be called outside of the UI thread.
|
int |
getTailFade(int channel)
Gets the percentage of tail that must be faded out.
|
int |
getTailSize(int channel)
Returns the size of the tail.
|
boolean |
isAntiAlias(int channel)
This method can be called outside of the UI thread.
|
boolean |
isConnect(int channel)
This method can be called outside of the UI thread.
|
boolean |
isFade(int channel)
This method can be called outside of the UI thread.
|
boolean |
isPercentage(int channel)
This method can be called outside of the UI thread.
|
boolean |
isSteady(int channel)
This method can be called outside of the UI thread.
|
boolean |
needsRedraw() |
protected void |
paintControl(org.eclipse.swt.widgets.Event e) |
void |
removeStackListener(int channel,
OscilloscopeStackAdapter listener)
Removes a stack listener from the collection of stack listeners.
|
void |
setAntialias(int channel,
boolean antialias)
Sets if the line must be anti-aliased which uses more processing power in
return of a smoother image.
|
void |
setBaseOffset(int channel,
int baseOffset)
Gets the relative location where the line is drawn in the widget, the
default is
BASE_CENTER which is in the middle of the scope. |
void |
setConnect(int channel,
boolean connectHeadAndTail)
Connects head and tail only if tail size is
TAILSIZE_MAX and no
fading. |
void |
setDispatcher(int channel,
OscilloscopeDispatcher dispatcher)
Sets the dispatcher that is associated with the supplied channel.
|
void |
setFade(int channel,
boolean fade)
Sets fade mode so that a percentage of the tail will be faded out at the
costs of extra CPU utilization (no beauty without pain or as the Dutch
say: "Wie mooi wil gaan moet pijn doorstaan").
|
void |
setForeground(int channel,
org.eclipse.swt.graphics.Color color)
Sets the foreground color for the supplied channel.
|
void |
setGridBackground(org.eclipse.swt.graphics.Color gridBackground)
Sets the oscilloscope's background color to the color specified
by the argument, or to the default system color for the control
if the argument is null.
|
void |
setGridForeground(org.eclipse.swt.graphics.Color gridForeground)
Sets the color of the grid to the color specified by the argument, or to the default system color for the control
if the argument is null.
|
void |
setGridLineWidth(int gridLineWidth)
Set the with of the lines size of the square displayed in the grid
|
void |
setGridSquareSize(int size)
Set the size of the square displayed in the grid
|
void |
setLineWidth(int channel,
int lineWidth)
Sets the line width.
|
void |
setPercentage(int channel,
boolean percentage)
If set to true then the values are treated as percentages of the
available space rather than absolute values.
|
void |
setProgression(int channel,
int progression)
The number of internal steps that must be made before drawing.
|
void |
setSteady(int channel,
boolean steady,
int steadyPosition)
If steady is true the graph will draw on a steady position instead of
advancing.
|
void |
setTailFade(int channel,
int tailFade)
Sets the percentage of tail that must be faded out.
|
void |
setTailSize(int channel,
int size)
The tail size defaults to TAILSIZE_DEFAULT which is 75% of the width.
|
void |
setValue(int channel,
int value)
Sets a value to be drawn relative to the center of the channel.
|
void |
setValues(int channel,
int[] values)
Sets a bunch of values that will be drawn.
|
protected void |
widgetDisposed(org.eclipse.swt.widgets.Event e) |
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
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, 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, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public static final int BASE_CENTER
#setBaseOffset(int)
,
Constant Field Valuespublic static final int CURSOR_START_DEFAULT
public static final int DEFAULT_HEIGHT
public static final int DEFAULT_WIDTH
public static final int[] HEARTBEAT
public static final int LINE_WIDTH_DEFAULT
public static final int PROGRESSION_DEFAULT
public static final int STEADYPOSITION_75PERCENT
public static final int TAILFADE_DEFAULT
public static final int TAILFADE_NONE
public static final int TAILFADE_PERCENTAGE
public static final int TAILSIZE_DEFAULT
public static final int TAILSIZE_FILL
#setSteady(boolean, int)
was set to true, will default to
TAILSIZE_MAX
otherwise.public static final int TAILSIZE_MAX
public Oscilloscope(org.eclipse.swt.widgets.Composite parent, int style)
parent
- style
- public Oscilloscope(int channels, org.eclipse.swt.widgets.Composite parent, int style)
channels
channels.channels
- parent
- style
- public Oscilloscope(int channels, OscilloscopeDispatcher dispatcher, org.eclipse.swt.widgets.Composite parent, int style)
channels
channels and adds attaches
it to the supplied dispatcher
.channels
- dispatcher
- may be nullparent
- style
- public void addStackListener(int channel, OscilloscopeStackAdapter listener)
listener
- public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class org.eclipse.swt.widgets.Control
protected void controlMoved(org.eclipse.swt.widgets.Event e)
protected void controlResized(org.eclipse.swt.widgets.Event e)
public int getBase(int channel)
public int getBaseOffset(int channel)
public int getChannels()
public OscilloscopeDispatcher getDispatcher(int channel)
channel
- public org.eclipse.swt.graphics.Color getForeground(int channel)
channel
- public int getLineWidth(int channel)
#setLineWidth(int)
public int getProgression(int channel)
#setProgression(int)
public int getTailFade(int channel)
#setFade(boolean)
public int getTailSize(int channel)
#setTailSize(int)
,
TAILSIZE_DEFAULT
,
TAILSIZE_FILL
,
TAILSIZE_MAX
public boolean isConnect(int channel)
TAILSIZE_MAX
no fading graph.public boolean isFade(int channel)
#setFade(boolean)
public boolean isPercentage(int channel)
#setPercentage(boolean)
public boolean isSteady(int channel)
Oscilloscope#setSteady(boolean, int)
public boolean isAntiAlias(int channel)
setAntialias(int, boolean)
public boolean needsRedraw()
protected void paintControl(org.eclipse.swt.widgets.Event e)
public void removeStackListener(int channel, OscilloscopeStackAdapter listener)
listener
- public void setBaseOffset(int channel, int baseOffset)
BASE_CENTER
which is in the middle of the scope.
This method can be called outside of the UI thread.baseOffset
- must be between 100 and -100, exceeding values are rounded to
the closest allowable value.public void setConnect(int channel, boolean connectHeadAndTail)
TAILSIZE_MAX
and no
fading. This method can be called outside of the UI thread.connectHeadAndTail
- public void setAntialias(int channel, boolean antialias)
channel
- antialias
- public void setDispatcher(int channel, OscilloscopeDispatcher dispatcher)
channel
- dispatcher
- public void setFade(int channel, boolean fade)
GC.drawPolygon(int[])
routine which does not support
alpha blending.
In addition to this, set the percentage of tail that must be faded out
#setTailFade(int)
.
This method can be called outside of the UI thread.
fade
- true or false#setTailFade(int)
public void setForeground(int channel, org.eclipse.swt.graphics.Color color)
channel
- color
- public void setLineWidth(int channel, int lineWidth)
lineWidth
- public void setPercentage(int channel, boolean percentage)
percentage
- true if percentagespublic void setProgression(int channel, int progression)
progression
- public void setSteady(int channel, boolean steady, int steadyPosition)
steady
- steadyPosition
- public void setTailFade(int channel, int tailFade)
tailFade
- public void setTailSize(int channel, int size)
size
- the size of the tail#getTailSize()
,
TAILSIZE_DEFAULT
,
TAILSIZE_FILL
,
TAILSIZE_MAX
public void setValue(int channel, int value)
channel
- value
- which is an absolute value or a percentageisPercentage(int)
,
setBaseOffset(int, int)
public void setValues(int channel, int[] values)
setValue(int, int)
for details.
This method can be called outside of the UI thread.channel
- values
- setValue(int, int)
protected void widgetDisposed(org.eclipse.swt.widgets.Event e)
public int getGridSquareSize()
org.eclipse.swt.SWTException
- public void setGridSquareSize(int size)
size
- the new sizeorg.eclipse.swt.SWTException
- public int getGridLineWidth()
org.eclipse.swt.SWTException
- public void setGridLineWidth(int gridLineWidth)
gridLineWidth
- the new sizeorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getGridBackground()
org.eclipse.swt.SWTException
- public void setGridBackground(org.eclipse.swt.graphics.Color gridBackground)
color
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getGridForeground()
org.eclipse.swt.SWTException
- public void setGridForeground(org.eclipse.swt.graphics.Color gridForeground)
color
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
-