All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.eou.toolkit.gauge.BlockIndicator

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.JPanel
                                   |
                                   +----com.ibm.eou.toolkit.gauge.BaseGauge
                                           |
                                           +----com.ibm.eou.toolkit.gauge.BlockIndicator

public class BlockIndicator
extends BaseGauge
This gauge is composed of a horizontal or vertical array of rectangular blocks. The range of possible values is shown by tick marks. As the gauge value changes blocks are added or removed one by one.

One way to use this gauge is to specify a changeover point together with positive and negative colors. For positive values blocks are drawn in the positive color extending up or right from the changeover point. For negative values blocks are drawn in the negative color extending down or left from the changeover point.

Alternatively an array of colors can be provided, which are used for the blocks. If the number of blocks exceeds the number of colors provided the final color is used for the remaining blocks.


Constructor Index

 o BlockIndicator()
Create a block indicator with an initial value of 0 and a range of 0 to 100.
 o BlockIndicator(int, int, int)
Create a block indicator specifying the initial value, minimum and maximum values The remaining properties default to being 2 way, red represents negative blocks, green represents positive blocks and 10 blocks that are 16 by 16 pixels seperated by a 2 pixel interval.
 o BlockIndicator(int, int, int, int, Dimension, int, boolean, Color, Color, int)
Create a BlockIndicator specifying the number of blocks, the block dimensions, the spacing between blocks, the orientation, and the colors to use for negative and positive values.
 o BlockIndicator(int, int, int, int, Dimension, int, boolean, Color[])
Create a BlockIndicator specifying the number of blocks, the block dimensions, the spacing between blocks, the orientation, and the colors to use for the blocks.

Method Index

 o copyright()
 o gaugeModelChanged(GaugeModelChangeEvent)
This method can be overriden by extending classes which need to react to a change to one or more of the models settings.
 o getBlockColors()
Specify array of colors to color the blocks with, each color in the array is used as the color of an individual block.
 o getBlockHeight()
Return the height of the blocks.
 o getBlockSize()
Return the size of the blocks in the gauge, in pixels.
 o getBlockSpace()
Return the pixel interval between the blocks.
 o getBlockWidth()
Return the width of the blocks.
 o getChangeOver()
Return the value that the indicator colors change from positive to negative.
 o getImmediate()
'get' accessor method for immediate property.
 o getMinimumSize()
 o getNegativeColor()
Return the negative color.
 o getNumberOfBlocks()
Return the number of blocks in the gauge.
 o getPositiveColor()
Return the positive color.
 o getUpdateBounds(Dimension, int, int, int, int, int, int)
Return an array of one rectangle that defines the area of the gauge that will need to be updated as a result of the supplied next and current display values.
 o paintComponent(Graphics, Dimension, int, int, int)
Paint the gauge so that it represents the supplied value.
 o setBackground(Color)
Specify the color of the background.
 o setBlockColors(Color[])
Specify array of colors to color the blocks with, each color in the array is used as the color of an individual block.
 o setBlockHeight(int)
Specify the height of the blocks in pixels.
 o setBlockSize(Dimension)
Specify the size of the blocks in the gauge, in pixels.
 o setBlockSpace(int)
Rpecify the pixel interval between the blocks.
 o setBlockWidth(int)
Specify the width of the blocks in pixels.
 o setChangeOver(int)
Specify the value that the colors change from positive to negative.
 o setImmediate(boolean)
Specify if the changes to the value displayed by the gauge are shown immediately.
 o setNegativeColor(Color)
Set the coloring of the negative blocks.
 o setNumberOfBlocks(int)
Specify the number of blocks in the gauge.
 o setPositiveColor(Color)
Set the coloring of the positive blocks.

Constructors

 o BlockIndicator
 public BlockIndicator(int initialValue,
                       int minimum,
                       int maximum,
                       int blocks,
                       Dimension blockSize,
                       int spacing,
                       boolean horizontal,
                       Color blockColors[])
Create a BlockIndicator specifying the number of blocks, the block dimensions, the spacing between blocks, the orientation, and the colors to use for the blocks. If there are more blocks than colors, the last color is used for the remaining blocks.

 o BlockIndicator
 public BlockIndicator(int initialValue,
                       int minimum,
                       int maximum,
                       int blocks,
                       Dimension blockSize,
                       int spacing,
                       boolean horizontal,
                       Color positive,
                       Color negative,
                       int changeOver)
Create a BlockIndicator specifying the number of blocks, the block dimensions, the spacing between blocks, the orientation, and the colors to use for negative and positive values. The colors can be specified as null, in which case the defaults are green for positive values and red for negative values.

 o BlockIndicator
 public BlockIndicator(int initialValue,
                       int minimum,
                       int maximum)
Create a block indicator specifying the initial value, minimum and maximum values The remaining properties default to being 2 way, red represents negative blocks, green represents positive blocks and 10 blocks that are 16 by 16 pixels seperated by a 2 pixel interval.

 o BlockIndicator
 public BlockIndicator()
Create a block indicator with an initial value of 0 and a range of 0 to 100. The remaining properties default to being 2 way, red represents negative blocks, green represents positive blocks and 10 blocks that are 16 by 20 pixels seperated by a 2 pixel interval.

Methods

 o copyright
 public static String copyright()
 o getNumberOfBlocks
 public int getNumberOfBlocks()
Return the number of blocks in the gauge.

 o setNumberOfBlocks
 public void setNumberOfBlocks(int numberOfBlocks)
Specify the number of blocks in the gauge.

 o getBlockSize
 public Dimension getBlockSize()
Return the size of the blocks in the gauge, in pixels.

 o setBlockSize
 public void setBlockSize(Dimension blockSize)
Specify the size of the blocks in the gauge, in pixels. Null is ignored.

 o setBlockHeight
 public void setBlockHeight(int blockHeight)
Specify the height of the blocks in pixels. Constrained to greater than zero.

 o getBlockHeight
 public int getBlockHeight()
Return the height of the blocks.

 o setBlockWidth
 public void setBlockWidth(int blockWidth)
Specify the width of the blocks in pixels. Constrained to greater than zero.

 o getBlockWidth
 public int getBlockWidth()
Return the width of the blocks.

 o getBlockSpace
 public int getBlockSpace()
Return the pixel interval between the blocks.

 o setBlockSpace
 public void setBlockSpace(int interval)
Rpecify the pixel interval between the blocks.

 o setImmediate
 public void setImmediate(boolean immediate)
Specify if the changes to the value displayed by the gauge are shown immediately.

 o getImmediate
 public boolean getImmediate()
'get' accessor method for immediate property.

 o setBlockColors
 public void setBlockColors(Color colors[])
Specify array of colors to color the blocks with, each color in the array is used as the color of an individual block. If there This automatically disables the positive and negative colors. Null is ignored, the previous fill is used.

See Also:
setPositiveColor, setNegativeColor
 o getBlockColors
 public Color[] getBlockColors()
Specify array of colors to color the blocks with, each color in the array is used as the color of an individual block.

 o setPositiveColor
 public void setPositiveColor(Color positiveColor)
Set the coloring of the positive blocks. The use of the positive and negative colors is enabled. Any array of colors previously used to color the blocks is set to null. Null is ignored.

See Also:
SetBlockColors
 o getPositiveColor
 public Color getPositiveColor()
Return the positive color.

 o setNegativeColor
 public void setNegativeColor(Color negativeColor)
Set the coloring of the negative blocks. The use of the positive and negative colors is enabled. Any array of colors previously used to color the blocks is set to null. Null is ignored.

See Also:
SetBlockColors
 o getNegativeColor
 public Color getNegativeColor()
Return the negative color.

 o setChangeOver
 public void setChangeOver(int changeOver)
Specify the value that the colors change from positive to negative.

 o getChangeOver
 public int getChangeOver()
Return the value that the indicator colors change from positive to negative.

 o setBackground
 public void setBackground(Color color)
Specify the color of the background.

Overrides:
setBackground in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent
 o getUpdateBounds
 protected Rectangle[] getUpdateBounds(Dimension size,
                                       int nextDisplayValue,
                                       int nextDisplayMinimum,
                                       int nextDisplayMaximum,
                                       int currentDisplayValue,
                                       int currentDisplayMinimum,
                                       int currentDisplayMaximum)
Return an array of one rectangle that defines the area of the gauge that will need to be updated as a result of the supplied next and current display values. This area is used to generate a paint request which will have a clipping region set that matches the update region. Paint processing is optimized to only paint gauge artefacts that intersect this region.

Overrides:
getUpdateBounds in class BaseGauge
 o paintComponent
 public void paintComponent(Graphics g,
                            Dimension s,
                            int value,
                            int minimum,
                            int maximum)
Paint the gauge so that it represents the supplied value.

Overrides:
paintComponent in class BaseGauge
 o gaugeModelChanged
 protected void gaugeModelChanged(GaugeModelChangeEvent e)
This method can be overriden by extending classes which need to react to a change to one or more of the models settings.

Overrides:
gaugeModelChanged in class BaseGauge

All Packages  Class Hierarchy  This Package  Previous  Next  Index