gov.sns.tools.apputils
Class ScaleControl

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--gov.sns.tools.apputils.ScaleControl
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public class ScaleControl
extends javax.swing.JPanel
implements javax.swing.SwingConstants

ScaleControl is a class that displays a GUI component for displaying a value with two sliders and a text field. One slider sets the coarse resolution of the control. The second slider is a continuous control and allows setting of the value. The text field allows the user to set the value directly and read the value as it is being adjusted.

See Also:
Serialized Form

Nested Class Summary
protected  class ScaleControl.ScaleChangeMonitor
          Internal listener class for scale changes
protected  class ScaleControl.ValueChangeMonitor
          Internal listener class for changes to the value from the value slider
protected  class ScaleControl.ValueTextMonitor
          Internal listener for text field changes to the value
 
Field Summary
protected  javax.swing.event.ChangeListener changeProxy
           
protected  int lowerScale
           
protected  MessageCenter messageCenter
          event broadcast
protected  int orientation
           
protected  int scale
          state
protected  javax.swing.JSlider scaleSlider
           
protected  java.lang.String title
          properties
protected  boolean updatingViews
           
protected  int upperScale
           
protected  double value
           
protected  javax.swing.JTextField valueField
          GUI components
protected  javax.swing.JSlider valueSlider
           
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ScaleControl()
          Creates a new instance of ScaleControl
ScaleControl(java.lang.String aTitle, int aLowerScale, int anUpperScale)
          Creates a new instance of ScaleControl
ScaleControl(java.lang.String aTitle, int anOrientation, int aLowerScale, int anUpperScale)
          Creates a new instance of ScaleControl
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Add a listener of value changes
 double getScale()
          Get the scale selected by the user
 double getValue()
          get the value
 boolean getValueIsAdjusting()
          Returns true if the value slider is changing and false if it is resting.
 void initView()
          initialize the view for the control
protected  boolean isValueInMaxRange(double aValue)
          Test if the specified value is in the maximum range possible
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Remove a listener of value changes
protected  void setScale(double newScale)
          Set the specified scale for the scale slider
 void setValue(double newValue)
          set the value
protected  void updateScaleSlider()
          Update the ScaleSlider to account for scale changes
protected  void updateValueField()
          Update the value field
protected  void updateValueSlider()
          Update the value slider
protected  double valueFromField()
          Get the value from the valueField control
protected  double valueFromSlider()
          Get the value from the valueSlider control
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Field Detail

messageCenter

protected MessageCenter messageCenter
event broadcast


changeProxy

protected javax.swing.event.ChangeListener changeProxy

title

protected java.lang.String title
properties


orientation

protected int orientation

lowerScale

protected int lowerScale

upperScale

protected int upperScale

scale

protected int scale
state


value

protected double value

updatingViews

protected volatile boolean updatingViews

valueField

protected javax.swing.JTextField valueField
GUI components


scaleSlider

protected javax.swing.JSlider scaleSlider

valueSlider

protected javax.swing.JSlider valueSlider
Constructor Detail

ScaleControl

public ScaleControl()
Creates a new instance of ScaleControl


ScaleControl

public ScaleControl(java.lang.String aTitle,
                    int aLowerScale,
                    int anUpperScale)
Creates a new instance of ScaleControl


ScaleControl

public ScaleControl(java.lang.String aTitle,
                    int anOrientation,
                    int aLowerScale,
                    int anUpperScale)
Creates a new instance of ScaleControl

Method Detail

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Add a listener of value changes


removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Remove a listener of value changes


getValue

public double getValue()
get the value


setValue

public void setValue(double newValue)
set the value


getValueIsAdjusting

public boolean getValueIsAdjusting()
Returns true if the value slider is changing and false if it is resting.


initView

public void initView()
initialize the view for the control


getScale

public double getScale()
Get the scale selected by the user


setScale

protected void setScale(double newScale)
Set the specified scale for the scale slider


valueFromSlider

protected double valueFromSlider()
Get the value from the valueSlider control


updateScaleSlider

protected void updateScaleSlider()
Update the ScaleSlider to account for scale changes


isValueInMaxRange

protected boolean isValueInMaxRange(double aValue)
Test if the specified value is in the maximum range possible


updateValueSlider

protected void updateValueSlider()
Update the value slider


valueFromField

protected double valueFromField()
Get the value from the valueField control


updateValueField

protected void updateValueField()
Update the value field