JIDE 3.5.15

com.jidesoft.gauge
Class Bullet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.jidesoft.gauge.AbstractGauge<BulletAxis>
                  extended by com.jidesoft.gauge.Bullet
All Implemented Interfaces:
ResizableComponent, GaugeModelListener, ImageObserver, MenuContainer, Serializable, EventListener

public class Bullet
extends AbstractGauge<BulletAxis>

A Bullet Chart class

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String DEFAULT_INDICATOR_NAME
           
static int INDICATOR_Z_ORDER
          Any Drawables with a Z order less than this value will be painted before the indicators; any Drawables with a Z order greater than this value will be painted after the indicators.
static String PROPERTY_BULLET_BACKGROUND
           
static String PROPERTY_BULLET_FOREGROUND
           
 
Fields inherited from class com.jidesoft.gauge.AbstractGauge
DEFAULT_NEEDLE_NAME, PROPERTY_BACKGROUND_PAINT, PROPERTY_RESIZE_FONTS
 
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
Bullet()
           
Bullet(Dimension d)
           
 
Method Summary
 void addAxis(BulletAxis axis)
          Add the specified axis to the Bullet.
 void addDrawable(Drawable drawable)
          Adds a Drawable object to the dial
 Bullet addIndicator(String indicatorName, IndicatorStyle style)
          You can clear an individual style by setting it to null.
protected  double calculatePixelCoordinate(BulletAxis axis, double value)
           
protected  Point2D calculatePixelPoint2D(BulletAxis axis, double value)
           
 List<String> containingShapes(Point p)
          Discovers the values that were rendered at the supplied pixel location
 BulletAxis getAxis()
          Returns the axis for the Bullet.
 double getBreadthProportion()
          Returns the breadth of the bullet as a proportion of its length
 Paint getBulletBackground()
          Returns the background paint to use for the bullet area
 Border getBulletBorder()
          returns the Border that is used for the bullet area
 double getBulletBreadth()
          Returns the breadth of the bullet in pixels
 IndicatorStyle getIndicatorStyle(String indicatorName)
           
 double getMidX()
          midX is the x coordinate at the centre of the bullet part of the display (ie.
 double getMidY()
          midY is the y coordinate at the centre of the bullet part of the display (ie.
 Orientation getOrientation()
          Returns the orientation of the Bullet (horizontal or vertical)
 Insets2D getProportionalInsets()
          Returns the current proportional insets
 IndicatorRenderer getRenderer()
          Returns the default indicator renderer (used when no value-specific renderer is defined)
 IndicatorRenderer getRenderer(String valueName)
          Returns the renderer specified for the given value tag
 int getXEnd()
           
 int getXStart()
           
 int getYEnd()
          yEnd is the y coordinate at the top of the component after taking account of any border inset
 int getYStart()
          yStart is the y coordinate at the bottom of the component after taking account of any border inset
protected  void paintAxis(Graphics2D g, BulletAxis axis)
           
protected  Rectangle2D paintBulletBackground(Graphics2D g2d)
           
protected  void paintBulletBorder(Graphics2D g2d)
           
protected  void paintComponent(Graphics g)
           
 void removeDrawable(Drawable drawable)
          Removes the specified Drawable from the dial
 void removeDrawables()
          Removes all Drawables from the dial
 void removeIndicator(String indicatorName)
           
 void removeIndicators()
           
 void removeStyles()
           
 Shape renderedAs(String valueName)
          Returns the shape that was rendered for the supplied value
 void setAxis(BulletAxis axis)
          Set the axis for the bullet.
 void setBreadthProportion(double breadthProportion)
          Set the breadth of the bullet as a proportion of its length; by default 0.1
 void setBulletBackground(Paint bulletBackground)
          Specify the background paint to use for the bullet area
 void setBulletBorder(Border bulletBorder)
          Specify the Border to use for the bullet area
 void setIndicatorStyle(IndicatorStyle style)
          Sets the style for the default value.
 void setIndicatorStyle(String indicatorName, IndicatorStyle style)
          You can clear an individual style by setting it to null.
 void setOrientation(Orientation orientation)
          Specify the orientation of the bullet
 void setProportionalInsets(Insets2D insets2D)
          Specify proportional insets that improve scalability of the component
 void setRenderer(IndicatorRenderer renderer)
          Specify the default IndicatorRenderer
 void setRenderer(String valueName, IndicatorRenderer renderer)
          Specify the renderer for the given value tag
 void setValue(String indicatorName, Positionable pos, boolean fireUpdate)
          Set the value of the specified indicator on the primary axis
 void update()
           
 
Methods inherited from class com.jidesoft.gauge.AbstractGauge
createPositionable, drawRotatedStringIfWithinBounds, drawStringIfWithinBounds, gaugeChanged, getAncestorBackground, getBackgroundPaint, getFontComparisonSize, getFontSizeRatio, getModel, getValue, getValue, isAllowTickLabelOverlap, isResizeFonts, isShadowVisible, longestTickLabel, setAllowTickLabelOverlap, setBackgroundPaint, setFontComparisonSize, setFontSizeRatio, setModel, setResizeFonts, setShadowVisible, setValue, setValue, setValue, setValue, setValue, setValue, tickLabelFontForAxis
 
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, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, 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
 
Methods inherited from interface com.jidesoft.chart.ResizableComponent
addComponentListener
 

Field Detail

INDICATOR_Z_ORDER

public static final int INDICATOR_Z_ORDER
Any Drawables with a Z order less than this value will be painted before the indicators; any Drawables with a Z order greater than this value will be painted after the indicators.

See Also:
Constant Field Values

DEFAULT_INDICATOR_NAME

public static final String DEFAULT_INDICATOR_NAME
See Also:
Constant Field Values

PROPERTY_BULLET_FOREGROUND

public static final String PROPERTY_BULLET_FOREGROUND
See Also:
Constant Field Values

PROPERTY_BULLET_BACKGROUND

public static final String PROPERTY_BULLET_BACKGROUND
See Also:
Constant Field Values
Constructor Detail

Bullet

public Bullet()

Bullet

public Bullet(Dimension d)
Method Detail

getAxis

public BulletAxis getAxis()
Returns the axis for the Bullet. If the bullet has more than one axis, this method returns the first one.

Returns:
the axis for the Bullet

setAxis

public void setAxis(BulletAxis axis)
Set the axis for the bullet. If the axis already contains one or more axes, these are first removed.

Parameters:
axis - the axis to set for the bullet.

addAxis

public void addAxis(BulletAxis axis)
Add the specified axis to the Bullet. If you have already specified an axis using setAxis(), this method enables you to add a second one.

Parameters:
axis - the axis to add to the bullet.

getProportionalInsets

public Insets2D getProportionalInsets()
Returns the current proportional insets

Returns:
the current insets

setProportionalInsets

public void setProportionalInsets(Insets2D insets2D)
Specify proportional insets that improve scalability of the component

Parameters:
insets2D - the insets

getOrientation

public Orientation getOrientation()
Returns the orientation of the Bullet (horizontal or vertical)

Returns:
the orientation of the Bullet

setOrientation

public void setOrientation(Orientation orientation)
Specify the orientation of the bullet

Parameters:
orientation - the orientation of the bullet chart (horizontal or vertical)

getRenderer

public IndicatorRenderer getRenderer()
Returns the default indicator renderer (used when no value-specific renderer is defined)

Returns:
the default indicator renderer

setRenderer

public void setRenderer(IndicatorRenderer renderer)
Specify the default IndicatorRenderer

Parameters:
renderer - the renderer that will be used unless a value-specific one is set

getRenderer

public IndicatorRenderer getRenderer(String valueName)
Returns the renderer specified for the given value tag

Parameters:
valueName - the name of the value
Returns:
the renderer specified for the value

setRenderer

public void setRenderer(String valueName,
                        IndicatorRenderer renderer)
Specify the renderer for the given value tag

Parameters:
valueName - the name of the value
renderer - the renderer to use for the value

addDrawable

public void addDrawable(Drawable drawable)
Adds a Drawable object to the dial

Parameters:
drawable - the Drawable to add
See Also:
DialIntervalMarker, DialLabel

removeDrawable

public void removeDrawable(Drawable drawable)
Removes the specified Drawable from the dial

Parameters:
drawable - the drawable to remove

removeDrawables

public void removeDrawables()
Removes all Drawables from the dial


getBulletBackground

public Paint getBulletBackground()
Returns the background paint to use for the bullet area

Returns:
the background paint to use for the bullet area

setBulletBackground

public void setBulletBackground(Paint bulletBackground)
Specify the background paint to use for the bullet area

Parameters:
bulletBackground - the background to use for the bullet area

getBulletBorder

public Border getBulletBorder()
returns the Border that is used for the bullet area

Returns:
the Border for the bullet

setBulletBorder

public void setBulletBorder(Border bulletBorder)
Specify the Border to use for the bullet area

Parameters:
bulletBorder - the Border to use for the bullet area

renderedAs

public Shape renderedAs(String valueName)
Returns the shape that was rendered for the supplied value

Parameters:
valueName - the name of the value in which we are interested
Returns:
the Shape outline that was used to render the value (or null if none found)

containingShapes

public List<String> containingShapes(Point p)
Discovers the values that were rendered at the supplied pixel location

Parameters:
p - the pixel location of interest (usually the cursor position)
Returns:
a List of values (usually none or one, but can be more) rendered at the supplied pixel position

getXEnd

public int getXEnd()

getXStart

public int getXStart()

getYEnd

public int getYEnd()
yEnd is the y coordinate at the top of the component after taking account of any border inset

Returns:
the y coordinate at the top of the component after taking account of any border inset

getYStart

public int getYStart()
yStart is the y coordinate at the bottom of the component after taking account of any border inset

Returns:
the y coordinate at the bottom of the component after taking account of any border inset

getMidY

public double getMidY()
midY is the y coordinate at the centre of the bullet part of the display (ie. not the centre of the component)

Returns:
the y coordinate at the centre of the bullet part of the display

getMidX

public double getMidX()
midX is the x coordinate at the centre of the bullet part of the display (ie. not the centre of the component)

Returns:
the x coordinate at the centre of the bullet part of the display

setValue

public void setValue(String indicatorName,
                     Positionable pos,
                     boolean fireUpdate)
Set the value of the specified indicator on the primary axis

Specified by:
setValue in class AbstractGauge<BulletAxis>
Parameters:
indicatorName - the indicator whose value we are setting
pos - a Positionable object that carries the value of the indicator (and possibly other information too)
fireUpdate - specify whether an update event should be fired on the model

addIndicator

public Bullet addIndicator(String indicatorName,
                           IndicatorStyle style)
You can clear an individual style by setting it to null. In this case a default style will be used.

Parameters:
indicatorName - the name of the value for which the style is being specified
style - the style to assign to the value rendering

removeIndicator

public void removeIndicator(String indicatorName)

removeIndicators

public void removeIndicators()

setIndicatorStyle

public void setIndicatorStyle(IndicatorStyle style)
Sets the style for the default value. Use this if you are displaying only one value.

Parameters:
style - the style for the default bullet value

setIndicatorStyle

public void setIndicatorStyle(String indicatorName,
                              IndicatorStyle style)
You can clear an individual style by setting it to null. In this case a default style will be used.

Parameters:
indicatorName - the name of the value for which the style is being specified
style - the style to assign to the value rendering

getIndicatorStyle

public IndicatorStyle getIndicatorStyle(String indicatorName)

removeStyles

public void removeStyles()

calculatePixelCoordinate

protected double calculatePixelCoordinate(BulletAxis axis,
                                          double value)

calculatePixelPoint2D

protected Point2D calculatePixelPoint2D(BulletAxis axis,
                                        double value)
Specified by:
calculatePixelPoint2D in class AbstractGauge<BulletAxis>

update

public void update()

getBulletBreadth

public double getBulletBreadth()
Returns the breadth of the bullet in pixels

Returns:
the breadth of the bullet in pixels

getBreadthProportion

public double getBreadthProportion()
Returns the breadth of the bullet as a proportion of its length

Returns:
the breadth of the bulelt as a proportion of its length

setBreadthProportion

public void setBreadthProportion(double breadthProportion)
Set the breadth of the bullet as a proportion of its length; by default 0.1

Parameters:
breadthProportion - the breadth of the bullet as a proportion of its length

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

paintBulletBackground

protected Rectangle2D paintBulletBackground(Graphics2D g2d)

paintBulletBorder

protected void paintBulletBorder(Graphics2D g2d)

paintAxis

protected void paintAxis(Graphics2D g,
                         BulletAxis axis)

JIDE 3.5.15