net.sourceforge.chart2d
Class VerticalTextListArea

java.lang.Object
  |
  +--net.sourceforge.chart2d.Area
        |
        +--net.sourceforge.chart2d.FontArea
              |
              +--net.sourceforge.chart2d.TextListArea
                    |
                    +--net.sourceforge.chart2d.VerticalTextListArea
Direct Known Subclasses:
LegendArea

class VerticalTextListArea
extends TextListArea

A set of text labels layed out vertially with bullets on either the left or right of the labels. The bullets can be layed out so that they are aligned with the center of each label, or aligned with the middle of the space between each label (vertically). It was designed to be used as a legend and for making a y axis in a chart program. Adjustments include bullets/no bullets, labels/no labels, bullet sizes, bullet colors, labels font color, size, style, and type; plus it allows for all the functionality of the the bordered area class including borders, spacing within borders, auto horizontal and vertical justification, auto sizing, and auto growing and shrinking of components.
Note: This class does not accept null values. Pass zero length arrays or empty strings instead.


Fields inherited from class net.sourceforge.chart2d.Area
BETWEEN, BOTTOM, CENTER, CENTERED, CONTINUOUS, DASHED, DOTTED, FLOAT, HEIGHT, HORIZONTAL, INTEGER, LABELSBOTTOM, LABELSLEFT, LEFT, LEFTBOTTOM, LEFTRIGHT, LEFTTOP, LESSER, MAX, MAXMODEL, MIN, RIGHT, RIGHTBOTTOM, RIGHTTOP, TOP, TOPBOTTOM, VERTICAL, WIDTH
 
Constructor Summary
(package private) VerticalTextListArea()
          Constructs a new vertical text list area with the following default values:
setLabelsExistence (true);
setBulletsExistence (true);
setBulletsSizeModel (new Dimension (9, 9));
setBulletsOutline (true);
setBetweenLabelsGapExistence (true);
setBetweenLabelsGapThicknessModel (3);
setBetweenBulletsGapExistence (true);
setBetweenBulletsGapThicknessModel (3);
setBetweenBulletsAndLabelsGapExistence (true);
setBetweenBulletsAndLabelsGapThicknessModel (3);
setBulletsAlignment (CENTERED);
setBulletsRelation (LEFT);
setAllowSelfSize (true);
resetVerticalTextListAreaModel (true);
 
Method Summary
(package private)  int getBetweenBulletsAndLabelsGapThicknessModel()
          Returns the model minimum thickness of the gap between the labels and the bullets.
(package private)  int getBetweenBulletsGapThicknessModel()
          Returns the model thickness of the minimum gap between bullets.
(package private)  int getBetweenLabelsGapThicknessModel()
          Returns the model thickness of the minimum gap between labels.
(package private)  java.awt.Color[] getBulletColors()
          Returns the colors of the bullets.
(package private)  java.awt.Rectangle[] getBullets(java.awt.Graphics2D g2D)
          Returns the bounds for each bullet.
(package private)  int getBulletsAlignment()
          Returns the vertical alignment of the bullets respective to the labels.
(package private)  boolean getBulletsOutline()
          Specifies whether the bullets should have a small outline.
(package private)  java.awt.Color getBulletsOutlineColor()
          Specifies the color of the bullets outline.
(package private)  java.awt.Dimension getBulletsSizeModel()
          Returns the model size (width and height) of the bullets.
(package private)  TextArea[] getLabels(java.awt.Graphics2D g2D)
          Returns the labels.
(package private)  boolean getLabelsExistence()
          Returns true if the labels of the text list exist; false otherwise.
(package private)  java.lang.String[] getLabelStrings()
          Returns the label strings of this text list.
 int getNumBullets()
          Returns the number of bullets this text list has.
(package private)  boolean getVerticalTextListAreaNeedsUpdate()
          Indicates whether some property of this class has changed.
(package private)  void paintComponent(java.awt.Graphics2D g2D)
          Paints all the components of this class.
(package private)  void resetVerticalTextListAreaModel(boolean reset)
          Resets the model for this class.
(package private)  void setAllowSelfSize(boolean allow)
          Allows this text list area to determine its minimum size and reset its own size.
(package private)  void setBetweenBulletsAndLabelsGapExistence(boolean existence)
          Specifies the existence of a minimum gap between the labels and the bullets.
(package private)  void setBetweenBulletsAndLabelsGapThicknessModel(int model)
          Specifies the model minimum thickness of the gap between the labels and the bullets.
(package private)  void setBetweenBulletsGapExistence(boolean existence)
          Specifies the existence of a minimum gap between each bullets.
(package private)  void setBetweenBulletsGapThicknessModel(int model)
          Specifies the model minimum thickness of the gap between each bullet.
(package private)  void setBetweenLabelsGapExistence(boolean existence)
          Specifies whether the minimum amount of space between each label, the gap, shall be enforced.
(package private)  void setBetweenLabelsGapThicknessModel(int model)
          Specifies the model minimum thickness of the gap between the labels.
(package private)  void setBulletColors(java.awt.Color[] colors)
          Specifies the colors of the bullets.
(package private)  void setBulletsAlignment(int alignment)
          The horizontal alignment of the bullets respective to the labels.
(package private)  void setBulletsOutline(boolean outline)
          Specifies whether the bullets should have a small outline.
(package private)  void setBulletsOutlineColor(java.awt.Color color)
          Specifies the color of the bullets outline.
(package private)  void setBulletsRelation(int relation)
          Specifies the horizontal relation of the bullets to the labels.
(package private)  void setBulletsSizeModel(java.awt.Dimension model)
          Specifies the model size (width and height) of the bullets.
(package private)  void setCustomSpaceMinHeight(boolean customize, int height)
          Allows for outside specification of the size of the text list.
(package private)  void setLabels(java.lang.String[] labels)
          Specifies the text for the labels.
(package private)  void setLabelsExistence(boolean existence)
          Specifies whether the labels exist.
(package private)  void updateVerticalTextListArea(java.awt.Graphics2D g2D)
          Updates all variables.
 
Methods inherited from class net.sourceforge.chart2d.FontArea
getFont, getFontAreaNeedsUpdate, getFontColor, getFontName, getFontPointModel, getFontStyle, resetFontAreaModel, setFontColor, setFontName, setFontPointModel, setFontStyle, updateFontArea
 
Methods inherited from class net.sourceforge.chart2d.Area
applyRatio, getAreaNeedsUpdate, getAutoSize, getBackgroundColor, getBackgroundExistence, getBorderColor, getBorderColor, getBorderExistence, getBorderExistence, getBorderThickness, getBorderThickness, getBorderThicknessModel, getBorderThicknessModel, getGapThickness, getGapThicknessModel, getJustifications, getRatio, getResetAreaModel, getSize, getSizeLocation, getSpaceSize, getSpaceSizeLocation, resetAreaModel, setAutoJustifys, setAutoSizes, setBackgroundColor, setBackgroundExistence, setBorderAssociations, setBorderColor, setBorderColors, setBorderCornerAssociations, setBorderExistence, setBorderExistences, setBorderThicknessModel, setBorderThicknessModels, setCustomRatio, setGapAssociations, setGapExistence, setGapExistences, setGapThicknessModel, setGapThicknessModels, setJustifications, setLockRatios, setSize, setSizeLocation, setSpaceSize, setSpaceSizeLocation, updateArea
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerticalTextListArea

VerticalTextListArea()
Constructs a new vertical text list area with the following default values:
setLabelsExistence (true);
setBulletsExistence (true);
setBulletsSizeModel (new Dimension (9, 9));
setBulletsOutline (true);
setBetweenLabelsGapExistence (true);
setBetweenLabelsGapThicknessModel (3);
setBetweenBulletsGapExistence (true);
setBetweenBulletsGapThicknessModel (3);
setBetweenBulletsAndLabelsGapExistence (true);
setBetweenBulletsAndLabelsGapThicknessModel (3);
setBulletsAlignment (CENTERED);
setBulletsRelation (LEFT);
setAllowSelfSize (true);
resetVerticalTextListAreaModel (true);
Method Detail

setAllowSelfSize

void setAllowSelfSize(boolean allow)
Allows this text list area to determine its minimum size and reset its own size. This is useful when you want the component to be able to figure out its minimum size, but not always to set itself to that miniumum size.
Overrides:
setAllowSelfSize in class TextListArea
Parameters:
allow - If true, then the component can reset its own minimum size. This is only relevant when auto minimum sizing is enabled.

setLabelsExistence

void setLabelsExistence(boolean existence)
Specifies whether the labels exist. If this is false, then the labels are not used in calculations or painting.
Overrides:
setLabelsExistence in class TextListArea
Parameters:
existence - The existence of these labels.

setLabels

void setLabels(java.lang.String[] labels)
Specifies the text for the labels. This value cannot be null; however, a zero or greater length array is fine.
Overrides:
setLabels in class TextListArea
Parameters:
labels - An array of the strings to be used for the labels.

setCustomSpaceMinHeight

void setCustomSpaceMinHeight(boolean customize,
                             int height)
Allows for outside specification of the size of the text list. This method was introduced as an afterthought. It's used by LLChartArea for feeding back the size of the graph area.
Parameters:
customize - True if you want to customize the space height.
height - The custom space height (if the boolean is true).

setBulletsSizeModel

void setBulletsSizeModel(java.awt.Dimension model)
Specifies the model size (width and height) of the bullets. A ratio based on maximum size / model size will be applied to this to find the actual bullet size -- when auto sizing the model maximum size is disabled. Otherwise, the actual size will be this size.
Overrides:
setBulletsSizeModel in class TextListArea
Parameters:
model - The model size of a bullet.

setBulletsAlignment

void setBulletsAlignment(int alignment)
The horizontal alignment of the bullets respective to the labels. The bullets can either be place in line with each label, or in in line with the middle of the space between each label. That is, bullets can be centered in the middle of the label, or placed between each label.
Overrides:
setBulletsAlignment in class TextListArea
Parameters:
alignment - The alignment for the bullets. Possible values are CENTERED and BETWEEN.

setBulletsRelation

void setBulletsRelation(int relation)
Specifies the horizontal relation of the bullets to the labels. The bullets can either be placed along the left of the labels or along the right.
Overrides:
setBulletsRelation in class TextListArea
Parameters:
relation - The horizontal relation of the bullets. Possible values are LEFT and RIGHT.

setBulletColors

void setBulletColors(java.awt.Color[] colors)
Specifies the colors of the bullets. Each bullet can have a different color so an array must be passed. The number of colors must be equal to the number of bullets. If the bullets alignment is between the labels and the lables do exist, then there should be one bullet less than the number of labels. If the bullets alignment is centered and the labels do exist, then there should be the same number of bullets as labels. Otherwise, choose any number of bullets. Number of bullets is set by setting the bullet colors. The number of bullets always equals the number of colors.
Overrides:
setBulletColors in class TextListArea
Parameters:
colors - An array filled with a color for each bullet. The first bullet from left to right gets the lowest order color in the array.

setBulletsOutline

void setBulletsOutline(boolean outline)
Specifies whether the bullets should have a small outline. Outline is 1 pixel on all sides, at all times, and is black. Outline is included in size of bullet.
Overrides:
setBulletsOutline in class TextListArea
Parameters:
outline - If true, then the outline will exist.

setBulletsOutlineColor

void setBulletsOutlineColor(java.awt.Color color)
Specifies the color of the bullets outline.
Overrides:
setBulletsOutlineColor in class TextListArea
Parameters:
color - The outline color.

setBetweenLabelsGapExistence

void setBetweenLabelsGapExistence(boolean existence)
Specifies whether the minimum amount of space between each label, the gap, shall be enforced. If the gap does not exist, then it will not be included in calculations.
Overrides:
setBetweenLabelsGapExistence in class TextListArea
Parameters:
existence - The existence of the gap. If true, then it exists.

setBetweenLabelsGapThicknessModel

void setBetweenLabelsGapThicknessModel(int model)
Specifies the model minimum thickness of the gap between the labels.
Overrides:
setBetweenLabelsGapThicknessModel in class TextListArea
Parameters:
model - The model minimum thickness of the gap. Note: The gap may end up being more depending on sizing properties.

setBetweenBulletsGapExistence

void setBetweenBulletsGapExistence(boolean existence)
Specifies the existence of a minimum gap between each bullets. If the gap doesn't exist, then it will not be included in calculations.
Overrides:
setBetweenBulletsGapExistence in class TextListArea
Parameters:
existence - The existence of the minimum gap. If true, then the gap does exist.

setBetweenBulletsGapThicknessModel

void setBetweenBulletsGapThicknessModel(int model)
Specifies the model minimum thickness of the gap between each bullet.
Overrides:
setBetweenBulletsGapThicknessModel in class TextListArea
Parameters:
model - The model minimum thickness of the gap. Note: The gap may end up being more depending on sizing properties.

setBetweenBulletsAndLabelsGapExistence

void setBetweenBulletsAndLabelsGapExistence(boolean existence)
Specifies the existence of a minimum gap between the labels and the bullets. If the gap doesn't exist, then it will not be included in calculations.
Overrides:
setBetweenBulletsAndLabelsGapExistence in class TextListArea
Parameters:
existence - The existence of the minimum gap. If true, then the gap does exist.

setBetweenBulletsAndLabelsGapThicknessModel

void setBetweenBulletsAndLabelsGapThicknessModel(int model)
Specifies the model minimum thickness of the gap between the labels and the bullets.
Overrides:
setBetweenBulletsAndLabelsGapThicknessModel in class TextListArea
Parameters:
model - The model minimum thickness of the gap. Note: The gap may end up being more depending on sizing properties.

getLabelStrings

java.lang.String[] getLabelStrings()
Returns the label strings of this text list.
Overrides:
getLabelStrings in class TextListArea
Returns:
The label strings.

getBetweenBulletsGapThicknessModel

int getBetweenBulletsGapThicknessModel()
Returns the model thickness of the minimum gap between bullets.
Overrides:
getBetweenBulletsGapThicknessModel in class TextListArea
Returns:
The model thickness.

getBetweenLabelsGapThicknessModel

int getBetweenLabelsGapThicknessModel()
Returns the model thickness of the minimum gap between labels.
Overrides:
getBetweenLabelsGapThicknessModel in class TextListArea
Returns:
The model thickness.

getBetweenBulletsAndLabelsGapThicknessModel

int getBetweenBulletsAndLabelsGapThicknessModel()
Returns the model minimum thickness of the gap between the labels and the bullets.
Overrides:
getBetweenBulletsAndLabelsGapThicknessModel in class TextListArea
Returns:
The model minimum thickness of the gap.

getBullets

java.awt.Rectangle[] getBullets(java.awt.Graphics2D g2D)
Returns the bounds for each bullet. This is useful if other components need to be aligned exactly with the bullet's location or should be the exact same size.
Overrides:
getBullets in class TextListArea
Parameters:
g2D - The graphics context used for calculations.
Returns:
The array of rectangles which bound each bullet.

getNumBullets

public int getNumBullets()
Returns the number of bullets this text list has. Calculates it each time.
Returns:
The number of bullets of this text list.

getBulletsSizeModel

java.awt.Dimension getBulletsSizeModel()
Returns the model size (width and height) of the bullets.
Overrides:
getBulletsSizeModel in class TextListArea
Returns:
The model size of a bullet.

getBulletColors

java.awt.Color[] getBulletColors()
Returns the colors of the bullets. Each bullet can have a different color so an array must be passed. The number of colors must be equal to the number of bullets. If the bullets alignment is between the labels and the lables do exist, then there should be one bullet less than the number of labels. If the bullets alignment is centered and the labels do exist, then there should be the same number of bullets as labels. Otherwise, choose any number of bullets. Number of bullets is set by setting the bullet colors. The number of bullets always equals the number of colors.
Returns:
Color[] An array filled with a color for each bullet. The first bullet from left to right gets the lowest order color in the array.

getBulletsAlignment

int getBulletsAlignment()
Returns the vertical alignment of the bullets respective to the labels. The bullets can either be place in line with each label, or in in line with the middle of the space between each label. That is, bullets can be centered in the middle of the label, or placed between each label. Possible values are CENTERED and BETWEEN.
Overrides:
getBulletsAlignment in class TextListArea
Returns:
int The alignment for the bullets [CENTERED or BETWEEN].

getBulletsOutline

boolean getBulletsOutline()
Specifies whether the bullets should have a small outline. Outline is 1 pixel on all sides, at all times, and is black. Outline is included in size of bullet.
Overrides:
getBulletsOutline in class TextListArea
Returns:
outline If true, then the outline will exist.

getBulletsOutlineColor

java.awt.Color getBulletsOutlineColor()
Specifies the color of the bullets outline.
Overrides:
getBulletsOutlineColor in class TextListArea
Returns:
color The outline color.

getLabelsExistence

boolean getLabelsExistence()
Returns true if the labels of the text list exist; false otherwise.
Overrides:
getLabelsExistence in class TextListArea
Returns:
True if exists.

getLabels

TextArea[] getLabels(java.awt.Graphics2D g2D)
Returns the labels. This is useful if other components need to be aligned exactly with the label's location or should be the exact same size.
Overrides:
getLabels in class TextListArea
Parameters:
g2D - The graphics context used for calculations.
Returns:
The array of TextArea's which are the labels.

resetVerticalTextListAreaModel

void resetVerticalTextListAreaModel(boolean reset)
Resets the model for this class. The model is used for shrinking and growing of its components based on the maximum size of this class. If this method is called, then the next time the maximum size is set, this classes model maximum size will be made equal to the new maximum size. Effectively what this does is ensure that whenever this objects maximum size is equal to the one given, then all of the components will take on their default model sizes. Note: This is only useful when auto model max sizing is disabled.
Parameters:
reset - True causes the max model size to be set upon the next max sizing.

getVerticalTextListAreaNeedsUpdate

boolean getVerticalTextListAreaNeedsUpdate()
Indicates whether some property of this class has changed.
Returns:
True if some property has changed.

updateVerticalTextListArea

void updateVerticalTextListArea(java.awt.Graphics2D g2D)
Updates all variables. First updates the variables of its parent class, then updates its own variables.
Parameters:
g2D - The graphics context used for calculations.

paintComponent

void paintComponent(java.awt.Graphics2D g2D)
Paints all the components of this class. First all variables are updated.
Overrides:
paintComponent in class FontArea
Parameters:
g2D - The graphics context for calculations and painting.