|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.cosylab.gui.components.DialKnob
public class DialKnob
A visual component for displaying and manipulating a double ranged value. The value is set and displayed by a round dial knob GUI which can be rotated by the user via mouse drag.
Nested Class Summary | |
---|---|
protected class |
DialKnob.MouseHandler
Utiliy class that handles user mouse actions on the Dial knob. |
protected class |
DialKnob.Renderer
Utility class that rendering of the component |
protected class |
DialKnob.TiltHandler
An extension of Timer used for periodic tilting of the Dial Knob. |
protected class |
DialKnob.UserValueListener
Listens for changes in uservalue. |
protected class |
DialKnob.ValueListener
ValueListener handles events that occured due to externally
made changes to the RangedValue. |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected java.lang.String |
format
|
protected PrintfFormat |
formatter
|
protected DialKnob.MouseHandler |
mouseHandler
|
protected RangedValueController |
rangedValue
|
protected DialKnob.Renderer |
renderer
|
protected java.lang.String |
title
|
protected boolean |
titleVisible
|
protected java.lang.String |
units
|
protected RangedValueController |
userRangedValue
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DialKnob()
Creates a new DialKnob object with null title and 0 values. |
|
DialKnob(java.lang.String newLabel)
Constructs a new DialKnob object with the given title of the widget. |
|
DialKnob(java.lang.String newLabel,
double newUserValue,
double newValue)
Constructs DialKnob with the given title and given user and readback values. |
Method Summary | |
---|---|
void |
addSetListener(SetListener listener)
Adds a listener which receive event notifications when the user sets a new value. |
java.awt.Color |
getAlarmColor()
Returns the color which indicates the alarm state. |
long |
getAutoSynchronizeDelay()
Returns the time in milliseconds that specify the delay of the auto synchronization. |
AbstractCustomizerPanel |
getCustomizer()
Loads and returns the default Customizer for this displayer. |
java.lang.String |
getFormat()
Gets the C-style number display format string. |
double |
getGraphMax()
Gets the maximum value displayed. |
double |
getGraphMin()
Returns the minimum value displayed. |
double |
getHighAlarmLimit()
Returns the high alarm limit. |
double |
getHighWarningLimit()
Returns the high warning limit. |
double |
getLowAlarmLimit()
Returns the low alarm limit. |
double |
getLowWarningLimit()
Returns the low warning limit. |
double |
getMaximum()
A convenience method returns the user maximum value |
double |
getMinimum()
Convenience method returns the minimum user value. |
java.awt.Color |
getNormalColor()
Returns the color which indicates the normal state. |
java.awt.Color |
getOutOfBoundsColor()
Returns the color that indicates out of bound state. |
PopupManager |
getPopupManager()
Returns the popup manager employed by this widget. |
protected RangedValueController |
getRangedValue()
Returns the main ranged value. |
State |
getState()
Returns the current state of the component. |
java.lang.String |
getTitle()
Returns the title of the widget. |
java.lang.String |
getUnits()
Returns the displayed units. |
double |
getUserMax()
Returns the maximum value the user can set. |
double |
getUserMin()
Returns the minimum value the user can set. |
protected RangedValueController |
getUserRangedValue()
Returns the user ranged value. |
double |
getUserValue()
Return the value as set by the user. |
double |
getValue()
Returns the displayed value. |
RangedValuePolicy |
getValuePolicy()
Returns the value policy. |
java.awt.Color |
getWarningColor()
Returns the warning color. |
boolean |
isAutoSynchronize()
Returns true if auto synchronization is turn on. |
boolean |
isDragArea(java.awt.event.MouseEvent e)
If the event happened in the area where drag is enabled, this method should return true. |
boolean |
isDragEnabled()
Returns true if drag is enabled. |
boolean |
isDropEnabled()
Returns true if drop is enabled. |
boolean |
isEditable()
Returns whether the value can be edited by user. |
boolean |
isEnhanced()
Returns whether the component should be rendered enhanced. |
boolean |
isPopupEnabled()
Returns whether the user can trigger the component's popup menu through a mouse click. |
boolean |
isRangeColors()
Returns true if marker is colored when out of range. |
boolean |
isResizable()
Returns true if the component's text adjusts to the size of the component. |
boolean |
isTiltingEnabled()
Returns whether the component should indicate value out of bounds condition by visually tilting its border. |
boolean |
isTitleVisible()
Returns true if title is visible. |
boolean |
isUnitsVisible()
Returns true if units are visible. |
static void |
main(java.lang.String[] args)
Demonstration. |
protected void |
notifyListeners(double newValue)
Notifies all the listeners attached to user value. |
protected void |
paintComponent(java.awt.Graphics arg0)
Paints the Dial Knob component by utilizing the Renderer. |
void |
removeSetListener(SetListener listener)
Removes a listener from the list of listeners receiving event notifications when the user sets a new value. |
void |
repaint()
|
void |
setAlarmColor(java.awt.Color alarmColor)
Sets the color which indicates the alarm state. |
void |
setAutoSynchronize(boolean autoSynchronize)
Turns the autoSynchronization on/off. |
void |
setAutoSynchronizeDelay(long autoSynchronizeDelay)
Sets the autoSynchronization in miliseconds. |
void |
setBackground(java.awt.Color bg)
|
void |
setDragEnabled(boolean enabled)
Enables/disables mouse dragging. |
void |
setDropEnabled(boolean enabled)
Enable/disable the mouse drop. |
void |
setEditable(boolean b)
Sets the editable property. |
void |
setEnabled(boolean enabled)
Overriden to implement visual notification of enabled state. |
void |
setEnhanced(boolean b)
Sets the enhanced rendering of the widget. |
void |
setForeground(java.awt.Color fg)
|
void |
setFormat(java.lang.String newFormat)
Sets the C-style number display format string. |
void |
setGraphMax(double newMax)
Sets the maximum value displayed. |
void |
setGraphMin(double newMin)
Sets the minimum value displayed. |
void |
setHighAlarmLimit(double highAlarmLimit)
Sets the high alarm limit. |
void |
setHighWarningLimit(double highWarningLimit)
Sets the high warning limit. |
void |
setLowAlarmLimit(double lowAlarmLimit)
Sets the low alarm limit. |
void |
setLowWarningLimit(double lowWarningLimit)
Sets the low warning limit. |
void |
setMaximum(double value)
Sets all max values for this widget. |
void |
setMinimum(double value)
Sets all min values for this widget. |
void |
setNormalColor(java.awt.Color normalColor)
Sets the color which indicates the normal state. |
void |
setOutOfBoundsColor(java.awt.Color outOfBoundsColor)
Sets the color that indicates out of bound state. |
void |
setPopupEnabled(boolean b)
Enables or disables the popup capabilities of the component. |
void |
setRangeColors(boolean rangeColors)
Set whether the value marker is colored when out of range. |
void |
setResizable(boolean b)
Enables/disables text adjusting. |
void |
setState(State state)
Sets the state to the component. |
void |
setTiltingEnabled(boolean b)
Enables/disables the tilting. |
void |
setTitle(java.lang.String string)
Sets the title above the knob. |
void |
setTitleVisible(boolean b)
Toggles title's visibility. |
void |
setTransferHandler(javax.swing.TransferHandler newHandler)
|
void |
setUnits(java.lang.String newUnit)
Sets the displayed units. |
void |
setUnitsVisible(boolean b)
Sets the units visible/invisible. |
void |
setUserMax(double newMax)
Sets the maximum value the user can set. |
void |
setUserMin(double newMin)
Sets the minimum value the user can set. |
void |
setUserValue(double newUserValue)
Sets the user value. |
void |
setValue(double newValue)
Sets the value displayed |
void |
setValuePolicy(RangedValuePolicy p)
Sets the ValuePolicy. |
void |
setWarningColor(java.awt.Color warningColor)
Sets the color which idicates warning state. |
void |
synchronize()
Synchronizes the user value with the value; |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected DialKnob.MouseHandler mouseHandler
protected PrintfFormat formatter
protected RangedValueController userRangedValue
protected DialKnob.Renderer renderer
protected java.lang.String format
protected java.lang.String title
protected java.lang.String units
protected boolean titleVisible
protected RangedValueController rangedValue
Constructor Detail |
---|
public DialKnob()
public DialKnob(java.lang.String newLabel)
newLabel
- title of the widgetpublic DialKnob(java.lang.String newLabel, double newUserValue, double newValue)
newLabel
- title of the widgetnewUserValue
- user valuenewValue
- readback value (shadow)Method Detail |
---|
public AbstractCustomizerPanel getCustomizer()
Customizer
for this displayer.
Customizer
public void setEnhanced(boolean b)
b
- public boolean isEnhanced()
public void setFormat(java.lang.String newFormat)
newFormat
- C-style format string.public java.lang.String getFormat()
public void setUserMax(double newMax)
newMax
- maximum value the user can set.public void setGraphMax(double newMax)
newMax
- maximum for the knob scalepublic void setMaximum(double value)
value
- new maximum valuesetUserMax(double)
,
setGraphMax(double)
public double getUserMax()
public double getMaximum()
public double getGraphMax()
public void setUserMin(double newMin)
newMin
- minimum value the user can set.public void setGraphMin(double newMin)
newMin
- minimum for the knob scalepublic void setMinimum(double value)
value
- new minimum valuesetUserMin(double)
,
setGraphMin(double)
public double getMinimum()
public double getUserMin()
public double getGraphMin()
public boolean isPopupEnabled()
public PopupManager getPopupManager()
Synchronize
, Preferences...
, and
Capture Screen...
.
getPopupManager
in interface PopupManageable
PopupManageable.getPopupManager()
public void setResizable(boolean b)
b
- whether the text should adjust its side to the size of the
component.public boolean isResizable()
public void setState(State state)
setState
in interface StateOriginator
state
- to set.StateOriginator.setState(com.cosylab.application.state.State)
public State getState()
getState
in interface StateOriginator
StateOriginator.getState()
public void setTitle(java.lang.String string)
string
- new titlepublic java.lang.String getTitle()
public void setTitleVisible(boolean b)
b
- visibility of the titlepublic boolean isTitleVisible()
public void setUnits(java.lang.String newUnit)
newUnit
- units to be displayed on the value titlepublic java.lang.String getUnits()
public void setUserValue(double newUserValue)
newUserValue
- new value.public double getUserValue()
public void setValue(double newValue)
newValue
- value to be displayed on the title markerpublic double getValue()
public void addSetListener(SetListener listener)
listener
- listener to be addedpublic void setEditable(boolean b)
b
- editablepublic boolean isEditable()
public void setEnabled(boolean enabled)
setEnabled
in class javax.swing.JComponent
Component.setEnabled(boolean)
public void setPopupEnabled(boolean b)
b
- the component should bring up popup dialog on mouse click.public void setTiltingEnabled(boolean b)
b
- whether the component should tilt when value is out of bounds.public boolean isTiltingEnabled()
public void removeSetListener(SetListener listener)
listener
- listener to removepublic void repaint()
repaint
in class java.awt.Component
public void synchronize()
protected void notifyListeners(double newValue)
newValue
- new user valueprotected void paintComponent(java.awt.Graphics arg0)
paintComponent
in class javax.swing.JComponent
arg0
- Graphics of the DialKnob component.com.cosylab.gui.components.range.Tick
,
JComponent.paintComponent(java.awt.Graphics)
public void setValuePolicy(RangedValuePolicy p)
p
- new value policypublic RangedValuePolicy getValuePolicy()
protected RangedValueController getRangedValue()
protected RangedValueController getUserRangedValue()
public boolean isUnitsVisible()
public void setUnitsVisible(boolean b)
b
- units visiblepublic java.awt.Color getAlarmColor()
public void setAlarmColor(java.awt.Color alarmColor)
alarmColor
- The alarmColor to set.public double getHighAlarmLimit()
public void setHighAlarmLimit(double highAlarmLimit)
highAlarmLimit
- new high alarm limitpublic double getHighWarningLimit()
public void setHighWarningLimit(double highWarningLimit)
highWarningLimit
- new high warning limitpublic double getLowAlarmLimit()
public void setLowAlarmLimit(double lowAlarmLimit)
lowAlarmLimit
- new low alarm limitpublic double getLowWarningLimit()
public void setLowWarningLimit(double lowWarningLimit)
lowWarningLimit
- new low warning limitpublic java.awt.Color getNormalColor()
public void setNormalColor(java.awt.Color normalColor)
normalColor
- new normal colorpublic java.awt.Color getOutOfBoundsColor()
public void setOutOfBoundsColor(java.awt.Color outOfBoundsColor)
outOfBoundsColor
- new out of bounds colorpublic boolean isRangeColors()
public void setRangeColors(boolean rangeColors)
rangeColors
- color value markerpublic java.awt.Color getWarningColor()
public void setWarningColor(java.awt.Color warningColor)
warningColor
- The warningColor to set.public boolean isDragArea(java.awt.event.MouseEvent e)
CosyTransferHandler.MouseFilter
isDragArea
in interface CosyTransferHandler.MouseFilter
public void setTransferHandler(javax.swing.TransferHandler newHandler)
setTransferHandler
in class javax.swing.JComponent
public void setDragEnabled(boolean enabled)
enabled
- public boolean isDragEnabled()
public void setDropEnabled(boolean enabled)
enabled
- public boolean isDropEnabled()
public void setBackground(java.awt.Color bg)
setBackground
in class javax.swing.JComponent
public void setForeground(java.awt.Color fg)
setForeground
in class javax.swing.JComponent
public boolean isAutoSynchronize()
public void setAutoSynchronize(boolean autoSynchronize)
autoSynchronize
- setAutoSynchronizeDelay(long)
public long getAutoSynchronizeDelay()
public void setAutoSynchronizeDelay(long autoSynchronizeDelay)
autoSynchronizeDelay
- setAutoSynchronize(boolean)
public static void main(java.lang.String[] args)
args
- Command line arguments.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |