JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.swing.gauge
Class JCAbstractRange

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.swing.gauge.JCAbstractRange
All Implemented Interfaces:
ImageObserver, JCRange, MenuContainer, Serializable
Direct Known Subclasses:
JCCircularRange, JCLinearRange

public abstract class JCAbstractRange
extends JComponent
implements JCRange, Serializable

A range is also used to highlight some sub-portion of the scale by the use of color or an image. For example, on a tachometer gauge you could have a range showing the "red line" region of excessive revolutions per minute (rpm). A gauge can have zero or more ranges associated with it.
By default, the items in a gauge's legend are ranges.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Image image
          An image that may be used for range.
protected  double innerExtent
          The place to start drawing this range.
protected  double outerExtent
          The place to stop drawing this range.
protected static int rangeCounter
          Static counter for generated range names.
protected  String rangeName
          The name of the range which will appear in the legend.
protected  com.klg.jclass.swing.gauge.JCScale scale
          The scale associated with this range object.
protected  boolean scaleImage
          Boolean that determines if the image should be scaled when the range is resized.
protected  double startValue
          The scale value (not angle or position) at which to begin the range.
protected  double stopValue
          The scale value (not angle or position) at which to stop the range.
 
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
JCAbstractRange(Color foreground, com.klg.jclass.swing.gauge.JCScale scale, double innerExtent, double outerExtent, double startValue, double stopValue)
          Creates a range with the properties specified in the parameters.
 
Method Summary
 Image getImage()
          Gets the Image to be used to mark the range.
 double getInnerExtent()
          Specifies where the inner boundary of the range is.
 double getOuterExtent()
          Returns where the outer boundary of the range is.
 String getRangeName()
          Gets the name of this range.
 com.klg.jclass.swing.gauge.JCScale getScale()
          Returns the scale associated with this range.
 boolean getScaleImage()
          Scales the image in relation to the range dimensions.
 double getStartValue()
          Returns the scale value (not angle or position) at which to begin the range.
 double getStopValue()
          Returns the scale value (not angle or position) at which to stop the range.
 void redraw()
          Does nothing, overridden in JCLinearRange or JCCircularRange.
 void setImage(Image image)
          Sets the Image to be used to mark the range.
 void setInnerExtent(double innerExtent)
          Sets where the inner boundary of the range is.
 void setOuterExtent(double outerExtent)
          Sets where the outer boundary of the range is.
 void setRangeName(String rangeName)
          Sets the range's name.
 void setScaleImage(boolean scaleImage)
          Determines whether to scale the image according to the range dimensions.
 void setStartValue(double startValue)
          Sets the scale value (not angle or position) at which to begin the range.
 void setStopValue(double stopValue)
          Sets the scale value (not angle or position) at which to stop the range.
 
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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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
 
Methods inherited from interface com.klg.jclass.swing.gauge.JCRange
getForeground
 

Field Detail

scale

protected com.klg.jclass.swing.gauge.JCScale scale
The scale associated with this range object.


innerExtent

protected double innerExtent
The place to start drawing this range. Values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example for a circular scale, 0.8 means start drawing this range 80% of the radius' size away from the center.


outerExtent

protected double outerExtent
The place to stop drawing this range. Values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example for a linear scale with horizontal oriention, 0.9 means stop drawing this range 90% of the scale's height away from the top of the scale.


startValue

protected double startValue
The scale value (not angle or position) at which to begin the range.


stopValue

protected double stopValue
The scale value (not angle or position) at which to stop the range.


rangeName

protected String rangeName
The name of the range which will appear in the legend.


rangeCounter

protected static int rangeCounter
Static counter for generated range names.


image

protected Image image
An image that may be used for range.


scaleImage

protected boolean scaleImage
Boolean that determines if the image should be scaled when the range is resized. Default is true.

Constructor Detail

JCAbstractRange

public JCAbstractRange(Color foreground,
                       com.klg.jclass.swing.gauge.JCScale scale,
                       double innerExtent,
                       double outerExtent,
                       double startValue,
                       double stopValue)
Creates a range with the properties specified in the parameters.

Parameters:
foreground - the color of this range
scale - the associated scale
innerExtent - The place to start drawing this range; values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example, for a circular scale, 0.8 means start drawing this range 80% of the radius' size away from the center.
outerExtent - The place to stop drawing this range. Values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example for vertical linear scale, 0.9 means stop drawing this range 90% of the scale's width away from the left of the scale.
startValue - the scale value (not angle or position) at which to begin the range
stopValue - the scale value (not angle or position) at which to end the range
Method Detail

getScale

public com.klg.jclass.swing.gauge.JCScale getScale()
Returns the scale associated with this range.

Specified by:
getScale in interface JCRange
Returns:
the scale for the JCAbstractRange component

getInnerExtent

public double getInnerExtent()
Specifies where the inner boundary of the range is. Values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example, for circular scale, 0.8 means start drawing this range 80% of the radius' size away from the center.

Specified by:
getInnerExtent in interface JCRange
Returns:
the inner extent

setInnerExtent

public void setInnerExtent(double innerExtent)
Sets where the inner boundary of the range is. Values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example for horizontal linear scale, 0.9 means start drawing this range 90% of the scale's height away from the top of the scale.

Specified by:
setInnerExtent in interface JCRange
Parameters:
innerExtent - the inner extent of the range

getOuterExtent

public double getOuterExtent()
Returns where the outer boundary of the range is. Values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example, for circular scale, 0.8 means stop drawing this range 80% of the radius' size away from the center.

Specified by:
getOuterExtent in interface JCRange
Returns:
the outer extent

setOuterExtent

public void setOuterExtent(double outerExtent)
Sets where the outer boundary of the range is. Values are ratios based on the scale's radius, width, or height (depending on the scale's type and orientation). For example for vertical linear scale, 0.9 means stop drawing this range 90% of the scale's width away from the left of the scale.

Specified by:
setOuterExtent in interface JCRange
Parameters:
outerExtent - the outer extent of the range

getStartValue

public double getStartValue()
Returns the scale value (not angle or position) at which to begin the range.

Specified by:
getStartValue in interface JCRange
Returns:
the range's start value

setStartValue

public void setStartValue(double startValue)
Sets the scale value (not angle or position) at which to begin the range.

Specified by:
setStartValue in interface JCRange
Parameters:
startValue - the start value for the range

getStopValue

public double getStopValue()
Returns the scale value (not angle or position) at which to stop the range.

Specified by:
getStopValue in interface JCRange
Returns:
the range's stop value

setStopValue

public void setStopValue(double stopValue)
Sets the scale value (not angle or position) at which to stop the range.

Specified by:
setStopValue in interface JCRange
Parameters:
stopValue - the stop value for the range

getRangeName

public String getRangeName()
Gets the name of this range. This is the name which will appear in the legend. If no name is supplied, a name of the form "Range <x>" will be automatically generated.

Specified by:
getRangeName in interface JCRange
Returns:
the range's name

setRangeName

public void setRangeName(String rangeName)
Sets the range's name. This is the name which will appear in the legend.

Specified by:
setRangeName in interface JCRange
Parameters:
rangeName - the name to appear in the legend

getImage

public Image getImage()
Gets the Image to be used to mark the range.

Returns:
the image that is used to mark the range

setImage

public void setImage(Image image)
Sets the Image to be used to mark the range.

Parameters:
image - the Image to be used to mark the range

getScaleImage

public boolean getScaleImage()
Scales the image in relation to the range dimensions.

Returns:
true if the image is to be scaled to the size of the bounding box of the range; otherwise, center the image based on its length and width

setScaleImage

public void setScaleImage(boolean scaleImage)
Determines whether to scale the image according to the range dimensions.

Parameters:
scaleImage - true if the image is to be scaled to the size of the bounding box of the range; otherwise, center the image based on its length and width

redraw

public void redraw()
Does nothing, overridden in JCLinearRange or JCCircularRange.


Copyright © 2004 Quest Software Inc..
All rights reserved.