DESY ACOP Beans Home

com.cosylab.gui.components
Class LabelledGauger

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.cosylab.gui.components.AbstractDisplayerPanel
                      extended by com.cosylab.gui.components.LabelledGauger
All Implemented Interfaces:
StateOriginator, PopupManageable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
GaugerDisplayer

public class LabelledGauger
extends AbstractDisplayerPanel

LabelledGauger is an extension of AbstractDisplayerPanel which provides Gauger as the numerical value displayer.

Version:
1.0
See Also:
AbstractDisplayerPanel, Gauger, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
 
Fields inherited from class com.cosylab.gui.components.AbstractDisplayerPanel
DYNAMIC_LAYOUT, HORIZONTAL_LAYOUT, VERTICAL_LAYOUT
 
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
LabelledGauger()
          Creates new gauger displayer.
LabelledGauger(java.lang.String title)
          Creates new gauger displayer with the given title.
 
Method Summary
 AbstractCustomizerPanel getCustomizer()
          Loads the default com.cosylab.gui.components.customizer.Customizer for this displayer and returns it.
 java.lang.String getFormat()
           
protected  Gauger getGauger()
          Returns the Gauger displayer associated with this component.
 double getHighWarningLimit()
          Returns the upper warning limit.
 double getLowWarningLimit()
          Returns the lower warning limit.
 double getMaximum()
          Returns the maximum value shown by displayer.
 double getMinimum()
          Returns the minimum value shown by displayer.
 java.awt.Color getOutOfBoundsColor()
          Returns the value which indicates that the value is out of bounds.
 PopupManager getPopupManager()
          Returns popum manager for adding popup actions.
 int getScaleMode()
          Deprecated. use getValuePolicy()
 State getState()
          Returns the current state of the component.
 java.lang.String getUnits()
          Returns the string representing the units.
 double getValue()
          Returns the actual value on the displayer.
protected  javax.swing.JComponent getValueComponent()
          Should return the component to display the value of this displayer.
 java.awt.Font getValueLabelFont()
          Returns the font used to display value.
 RangedValuePolicy getValuePolicy()
          Returns the value policy.
 java.awt.Color getWarningColor()
          Returns the color which indicates the warning.
 boolean isEditable()
           
 boolean isLinearScale()
          Convenient method to see if linear scale is used.
 boolean isLogarithmicScale()
          Returns true if logarithmic scale is used.
 boolean isUnitsVisible()
          Returns true if units are visible.
protected  void layoutDisplayer()
          Lays out the displayer according to the set layout orientation.
static void main(java.lang.String[] args)
          Run test applet.
 void setFormat(java.lang.String value)
           
 void setHighWarningLimit(double value)
          Sets new upper warning limit.
 void setLinearScale()
          Convenient method to set linear scale.
 void setLogarithmicScale()
          Convenient method to set logarithmic scale.
 void setLogarithmicScale(boolean b)
          Switches between the logarithmic and linear scale.
 void setLowWarningLimit(double value)
          Sets new lower warning limit.
 void setMaximum(double value)
          Sets the maximum value used by the displayer.
 void setMinimum(double value)
          Sets the minimum value shown by the displayer.
 void setOutOfBoundsColor(java.awt.Color color)
          Sets the color which indicates that the value is out of bounds.
 void setPopupEnabled(boolean enabled)
          Enables or disables the popup menu.
 void setScaleMode(int policy)
          Deprecated. use setValuePolicy(RangedValuePolicy)
 void setState(State state)
          Sets the state to the component.
 void setTransferHandler(javax.swing.TransferHandler newHandler)
           
 void setUnits(java.lang.String u)
          Sets the units shown by this displayer.
 void setUnitsVisible(boolean b)
          Toggles the units visibility.
 void setValue(double d)
          Sets the value to the displayer.
 void setValue(double newMin, double newMax, double newValue)
          Sets new value and bounds to the displayer.
 void setValueLabelFont(java.awt.Font font)
          Sets the font used to display value.
 void setValuePolicy(RangedValuePolicy policy)
          Sets a new value policy.
 void setWarningColor(java.awt.Color color)
          Sets the warning color for the gauger.
 
Methods inherited from class com.cosylab.gui.components.AbstractDisplayerPanel
getLayoutOrientation, getTitle, getTitleComponent, getTitleMaximumFontSize, getTitleMinimumFontSize, internalSetEnabled, internalSetEnhanced, internalSetResizable, internalSetTitle, isDragEnabled, isDropEnabled, isEnhanced, isPopupEnabled, isResizable, isTitleVisible, layoutValue, layoutValueAndTitle, setBackground, setDragEnabled, setDropEnabled, setEnabled, setEnhanced, setForeground, setLayoutOrientation, setResizable, setTitle, setTitleMaximumFontSize, setTitleMinimumFontSize, setTitleVisible
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
 
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, 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
 

Constructor Detail

LabelledGauger

public LabelledGauger(java.lang.String title)
Creates new gauger displayer with the given title.


LabelledGauger

public LabelledGauger()
Creates new gauger displayer.

Method Detail

isEditable

public boolean isEditable()

setFormat

public void setFormat(java.lang.String value)

getFormat

public java.lang.String getFormat()

setLogarithmicScale

public void setLogarithmicScale(boolean b)
Switches between the logarithmic and linear scale.

Parameters:
b - true if scale should be logarithmic

isLogarithmicScale

public boolean isLogarithmicScale()
Returns true if logarithmic scale is used.

Returns:

setMaximum

public void setMaximum(double value)
Sets the maximum value used by the displayer.

Parameters:
value - new maximum

getMaximum

public double getMaximum()
Returns the maximum value shown by displayer.

Returns:
the maximum

setMinimum

public void setMinimum(double value)
Sets the minimum value shown by the displayer.

Parameters:
value - new minimum

getMinimum

public double getMinimum()
Returns the minimum value shown by displayer.

Returns:
the minimum

setScaleMode

public void setScaleMode(int policy)
Deprecated. use setValuePolicy(RangedValuePolicy)

Sets the scale mode for the gauger.

Parameters:
policy -
See Also:
Gauger.setScaleMode(int)

getScaleMode

public int getScaleMode()
Deprecated. use getValuePolicy()

Returns the scale mode of the gauger.

Returns:
the scale mode
See Also:
Gauger.getScaleMode()

setValuePolicy

public void setValuePolicy(RangedValuePolicy policy)
Sets a new value policy.

Parameters:
policy - new value policy

getValuePolicy

public RangedValuePolicy getValuePolicy()
Returns the value policy.

Returns:
value policy

setState

public void setState(State state)
Description copied from class: AbstractDisplayerPanel
Sets the state to the component.

Specified by:
setState in interface StateOriginator
Overrides:
setState in class AbstractDisplayerPanel
Parameters:
state - to set.
See Also:
StateOriginator.setState(com.cosylab.application.state.State)

getState

public State getState()
Description copied from class: AbstractDisplayerPanel
Returns the current state of the component.

Specified by:
getState in interface StateOriginator
Overrides:
getState in class AbstractDisplayerPanel
Returns:
current state.
See Also:
StateOriginator.getState()

setUnitsVisible

public void setUnitsVisible(boolean b)
Toggles the units visibility.

Parameters:
b - true if units are visible

isUnitsVisible

public boolean isUnitsVisible()
Returns true if units are visible.

Returns:
true if units are displayed.

getGauger

protected Gauger getGauger()
Returns the Gauger displayer associated with this component.

Returns:

getValueComponent

protected javax.swing.JComponent getValueComponent()
Description copied from class: AbstractDisplayerPanel
Should return the component to display the value of this displayer. This method is called inside the constructor to add the valueComponent to the AbstractDisplayerPanel. Subclasses should thus use lazy initialization inside this method.

Specified by:
getValueComponent in class AbstractDisplayerPanel
Returns:
the value component of the AbstractDisplayerPanel.

getValue

public double getValue()
Returns the actual value on the displayer.

Returns:
the value

setValue

public void setValue(double d)
Sets the value to the displayer.

Parameters:
d - new value

layoutDisplayer

protected void layoutDisplayer()
Description copied from class: AbstractDisplayerPanel
Lays out the displayer according to the set layout orientation.

Overrides:
layoutDisplayer in class AbstractDisplayerPanel

getUnits

public java.lang.String getUnits()
Returns the string representing the units.

Returns:
the units

setUnits

public void setUnits(java.lang.String u)
Sets the units shown by this displayer.

Parameters:
u - new units

getCustomizer

public AbstractCustomizerPanel getCustomizer()
Description copied from class: AbstractDisplayerPanel
Loads the default com.cosylab.gui.components.customizer.Customizer for this displayer and returns it.

Overrides:
getCustomizer in class AbstractDisplayerPanel
Returns:
the Customizer intance for this displayer

getPopupManager

public PopupManager getPopupManager()
Description copied from class: AbstractDisplayerPanel
Returns popum manager for adding popup actions.

Specified by:
getPopupManager in interface PopupManageable
Overrides:
getPopupManager in class AbstractDisplayerPanel
Returns:
returns popup manager, which manages popup menu
See Also:
PopupManageable.getPopupManager()

setPopupEnabled

public void setPopupEnabled(boolean enabled)
Description copied from class: AbstractDisplayerPanel
Enables or disables the popup menu.

Overrides:
setPopupEnabled in class AbstractDisplayerPanel
Parameters:
enabled - true if enable or false if disableds

getValueLabelFont

public java.awt.Font getValueLabelFont()
Returns the font used to display value.

Returns:
the value font

setValueLabelFont

public void setValueLabelFont(java.awt.Font font)
Sets the font used to display value.

Parameters:
font - new font

setLogarithmicScale

public void setLogarithmicScale()
Convenient method to set logarithmic scale.


setLinearScale

public void setLinearScale()
Convenient method to set linear scale.


isLinearScale

public boolean isLinearScale()
Convenient method to see if linear scale is used.

Returns:

setOutOfBoundsColor

public void setOutOfBoundsColor(java.awt.Color color)
Sets the color which indicates that the value is out of bounds.

Parameters:
color - new out of bounds color

getOutOfBoundsColor

public java.awt.Color getOutOfBoundsColor()
Returns the value which indicates that the value is out of bounds.

Returns:
the out of bounds color

getWarningColor

public java.awt.Color getWarningColor()
Returns the color which indicates the warning.

Returns:
the warning color

setWarningColor

public void setWarningColor(java.awt.Color color)
Sets the warning color for the gauger.

Parameters:
color - new warning color

setHighWarningLimit

public void setHighWarningLimit(double value)
Sets new upper warning limit. At this value the needle will change its color to the set warning color. The limit should be given in percentage of the current span of the gauger.

Parameters:
value - new warning limit

getHighWarningLimit

public double getHighWarningLimit()
Returns the upper warning limit.

Returns:
upper warning limit

setLowWarningLimit

public void setLowWarningLimit(double value)
Sets new lower warning limit. At this value the needle will change its color to the set warning color. The limit should be given in percentage of the current span of the gauger.

Parameters:
value - new warning limit

getLowWarningLimit

public double getLowWarningLimit()
Returns the lower warning limit.

Returns:
upper warning limit

setValue

public void setValue(double newMin,
                     double newMax,
                     double newValue)
Sets new value and bounds to the displayer.

Parameters:
newMin - new minimum
newMax - new maximum
newValue - new maximum

setTransferHandler

public void setTransferHandler(javax.swing.TransferHandler newHandler)
Overrides:
setTransferHandler in class AbstractDisplayerPanel

main

public static void main(java.lang.String[] args)
Run test applet.

Parameters:
args - command line parameters


Copyright © 2010. All Rights Reserved.