com.sas.graphics.components
Class StrokeLineStyle

com.sas.graphics.components.StrokeLineStyle

public class StrokeLineStyle

Attributes that affect the appearance of lines. The StrokeLineStyle class encapsulates the set of user specifiable properties pertaining to chart lines. Attributes included are: color, visibility, line style (stroke).

Usage

 BarChart barChart = getMyBarChart();
 StrokeLineStyle axisLine = ((barChart.getBarChartModel()).getCategoryAxisModel()).getAxisLineStyle();
 axisLine.setColor(Color.blue.darker());
 

Behavior

This class comes with an apply() method which accepts as a parameter an object of the same class and applies the new settings to the object's attributes.

Since:
SAS 9.1
See Also:
GraphStyle, ModelBase

Field Summary
static java.lang.String RB_KEY
           
static ConstantCollection SASGRAPH_LINE
          SASGRAPH_LINE enables a set of static actions associated with the public SASGRAPH_LINE constants.
static int SASGRAPH_LINE_UNRECOGNIZED
          Invalid
static int SASGRAPH_LINE01
          produces SAS/Graph line style #1, SOLID
static int SASGRAPH_LINE02
          produces SAS/Graph line style #2, DASH1
static int SASGRAPH_LINE03
          produces SAS/Graph line style #3, DASH2
static int SASGRAPH_LINE04
          produces SAS/Graph line style #4, DASH3
static int SASGRAPH_LINE05
          produces SAS/Graph line style #5, DASH4
static int SASGRAPH_LINE06
          produces SAS/Graph line style #6, DASH5
static int SASGRAPH_LINE07
          produces SAS/Graph line style #7, DASH6
static int SASGRAPH_LINE08
          produces SAS/Graph line style #8, DASH3DASH1
static int SASGRAPH_LINE09
          produces SAS/Graph line style #9, DASH4DASH1
static int SASGRAPH_LINE10
          produces SAS/Graph line style #10, DASH5DASH1
static int SASGRAPH_LINE11
          produces SAS/Graph line style #11, DASH6DASH1
static int SASGRAPH_LINE12
          produces SAS/Graph line style #12, DASH5DASH3
static int SASGRAPH_LINE13
          produces SAS/Graph line style #13, DASH6DASH3
static int SASGRAPH_LINE14
          produces SAS/Graph line style #14, DASH3DASH1DASH1
static int SASGRAPH_LINE15
          produces SAS/Graph line style #15, DASH4DASH1DASH1
static int SASGRAPH_LINE16
          produces SAS/Graph line style #16, DASH5DASH1DASH1
static int SASGRAPH_LINE17
          produces SAS/Graph line style #17, DASH6DASH1DASH1
static int SASGRAPH_LINE18
          produces SAS/Graph line style #18, DASH5DASH3DASH3
static int SASGRAPH_LINE19
          produces SAS/Graph line style #19, DASH6DASH3DASH3
static int SASGRAPH_LINE20
          produces SAS/Graph line style #20, DASH2SPACE
static int SASGRAPH_LINE21
          produces SAS/Graph line style #21, DASH3SPACE
static int SASGRAPH_LINE22
          produces SAS/Graph line style #22, DASH4SPACE
static int SASGRAPH_LINE23
          produces SAS/Graph line style #23, DASH5SPACE
static int SASGRAPH_LINE24
          produces SAS/Graph line style #24, DASH6SPACE
static int SASGRAPH_LINE25
          produces SAS/Graph line style #25, DASH3DASH2
static int SASGRAPH_LINE26
          produces SAS/Graph line style #26, DASH4DASH2
static int SASGRAPH_LINE27
          produces SAS/Graph line style #27, DASH5DASH2
static int SASGRAPH_LINE28
          produces SAS/Graph line style #28, DASH6DASH2
static int SASGRAPH_LINE29
          produces SAS/Graph line style #29, DASH3DASH2DASH2
static int SASGRAPH_LINE30
          produces SAS/Graph line style #30, DASH4DASH2DASH2
static int SASGRAPH_LINE31
          produces SAS/Graph line style #31, DASH5DASH2DASH2
static int SASGRAPH_LINE32
          produces SAS/Graph line style #32, DASH6DASH2DASH2
static int SASGRAPH_LINE33
          produces SAS/Graph line style #33, DOT1
static int SASGRAPH_LINE34
          produces SAS/Graph line style #34, DOT1SPACE
static int SASGRAPH_LINE35
          produces SAS/Graph line style #35, DOT1SPACE2
static int SASGRAPH_LINE36
          produces SAS/Graph line style #36, DOT2
static int SASGRAPH_LINE37
          produces SAS/Graph line style #37, DOT3
static int SASGRAPH_LINE38
          produces SAS/Graph line style #38, DOT2DOT1
static int SASGRAPH_LINE39
          produces SAS/Graph line style #39, DOT3DOT1
static int SASGRAPH_LINE40
          produces SAS/Graph line style #40, DOT3DOT2
static int SASGRAPH_LINE41
          produces SAS/Graph line style #41, DASH3DOT1
static int SASGRAPH_LINE42
          produces SAS/Graph line style #42, DASH3DOT2
static int SASGRAPH_LINE43
          produces SAS/Graph line style #43, DASH3DOT3
static int SASGRAPH_LINE44
          produces SAS/Graph line style #44, DASH3DOT2DASH3DOT1
static int SASGRAPH_LINE45
          produces SAS/Graph line style #45, DASH3DOT3DASH3DOT1
static int SASGRAPH_LINE46
          produces SAS/Graph line style #46, DASH3DOT3DASH3DOT2
 
Constructor Summary
StrokeLineStyle()
           
StrokeLineStyle(java.awt.Color newColor)
          Constructor that takes a line color.
StrokeLineStyle(int newLineStyle, java.awt.Color newColor, com.sas.measures.BaseLength newThickness)
          Convienience constructor, same as StrokeLineStyle( int, Color, BaseLength, GraphConstance.AUTOMATIC ).
StrokeLineStyle(int newLineStyle, java.awt.Color newColor, com.sas.measures.BaseLength newThickness, int newVisibilityPolicy)
          Constructor that takes a SAS/Graph line style number, a line width and a color.
 
Method Summary
 void apply(StrokeLineStyle theOtherModel)
          Utility method to convey properties contained in "theOtherObject" to this object.
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this StrokeLineStyle.
 int getSASGraphLineStyle()
          Get line appearance settings.
static int getSASGraphLineStyle(java.awt.BasicStroke stroke)
          Takes a BasicStroke and returns a SAS/Graph line style number if the stroke corresponds to one.
 java.awt.BasicStroke getStroke()
          Returns the line appearance settings.
 int hashCode()
          Computes the hash code for this StrokeLineStyle.
static java.awt.BasicStroke newStroke(int lineStyle, com.sas.measures.BaseLength lineWidth)
          Takes a SAS/Graph line style number as well as a BaseLength and creates a BasicStroke.
static java.awt.BasicStroke newStroke(int lineStyle, float lineWidth)
          Takes a SAS/Graph line style number as well as a line width and creates a BasicStroke.
 void setSASGraphLineStyle(int newLineStyle)
          Sets the SAS/Graph line style.
 void setStroke(java.awt.BasicStroke newStroke)
          Set the stroke line style.
 void setThickness(com.sas.measures.BaseLength newThickness)
          Set thickness for the stroke.
 
Methods inherited from class com.sas.graphics.components.LineStyle
apply, getColor, getThickness, getVisibilityPolicy, setColor, setVisibilityPolicy
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

SASGRAPH_LINE_UNRECOGNIZED

public static final int SASGRAPH_LINE_UNRECOGNIZED
Invalid

See Also:
Constant Field Values

SASGRAPH_LINE01

public static final int SASGRAPH_LINE01
produces SAS/Graph line style #1, SOLID

See Also:
Constant Field Values

SASGRAPH_LINE02

public static final int SASGRAPH_LINE02
produces SAS/Graph line style #2, DASH1

See Also:
Constant Field Values

SASGRAPH_LINE03

public static final int SASGRAPH_LINE03
produces SAS/Graph line style #3, DASH2

See Also:
Constant Field Values

SASGRAPH_LINE04

public static final int SASGRAPH_LINE04
produces SAS/Graph line style #4, DASH3

See Also:
Constant Field Values

SASGRAPH_LINE05

public static final int SASGRAPH_LINE05
produces SAS/Graph line style #5, DASH4

See Also:
Constant Field Values

SASGRAPH_LINE06

public static final int SASGRAPH_LINE06
produces SAS/Graph line style #6, DASH5

See Also:
Constant Field Values

SASGRAPH_LINE07

public static final int SASGRAPH_LINE07
produces SAS/Graph line style #7, DASH6

See Also:
Constant Field Values

SASGRAPH_LINE08

public static final int SASGRAPH_LINE08
produces SAS/Graph line style #8, DASH3DASH1

See Also:
Constant Field Values

SASGRAPH_LINE09

public static final int SASGRAPH_LINE09
produces SAS/Graph line style #9, DASH4DASH1

See Also:
Constant Field Values

SASGRAPH_LINE10

public static final int SASGRAPH_LINE10
produces SAS/Graph line style #10, DASH5DASH1

See Also:
Constant Field Values

SASGRAPH_LINE11

public static final int SASGRAPH_LINE11
produces SAS/Graph line style #11, DASH6DASH1

See Also:
Constant Field Values

SASGRAPH_LINE12

public static final int SASGRAPH_LINE12
produces SAS/Graph line style #12, DASH5DASH3

See Also:
Constant Field Values

SASGRAPH_LINE13

public static final int SASGRAPH_LINE13
produces SAS/Graph line style #13, DASH6DASH3

See Also:
Constant Field Values

SASGRAPH_LINE14

public static final int SASGRAPH_LINE14
produces SAS/Graph line style #14, DASH3DASH1DASH1

See Also:
Constant Field Values

SASGRAPH_LINE15

public static final int SASGRAPH_LINE15
produces SAS/Graph line style #15, DASH4DASH1DASH1

See Also:
Constant Field Values

SASGRAPH_LINE16

public static final int SASGRAPH_LINE16
produces SAS/Graph line style #16, DASH5DASH1DASH1

See Also:
Constant Field Values

SASGRAPH_LINE17

public static final int SASGRAPH_LINE17
produces SAS/Graph line style #17, DASH6DASH1DASH1

See Also:
Constant Field Values

SASGRAPH_LINE18

public static final int SASGRAPH_LINE18
produces SAS/Graph line style #18, DASH5DASH3DASH3

See Also:
Constant Field Values

SASGRAPH_LINE19

public static final int SASGRAPH_LINE19
produces SAS/Graph line style #19, DASH6DASH3DASH3

See Also:
Constant Field Values

SASGRAPH_LINE20

public static final int SASGRAPH_LINE20
produces SAS/Graph line style #20, DASH2SPACE

See Also:
Constant Field Values

SASGRAPH_LINE21

public static final int SASGRAPH_LINE21
produces SAS/Graph line style #21, DASH3SPACE

See Also:
Constant Field Values

SASGRAPH_LINE22

public static final int SASGRAPH_LINE22
produces SAS/Graph line style #22, DASH4SPACE

See Also:
Constant Field Values

SASGRAPH_LINE23

public static final int SASGRAPH_LINE23
produces SAS/Graph line style #23, DASH5SPACE

See Also:
Constant Field Values

SASGRAPH_LINE24

public static final int SASGRAPH_LINE24
produces SAS/Graph line style #24, DASH6SPACE

See Also:
Constant Field Values

SASGRAPH_LINE25

public static final int SASGRAPH_LINE25
produces SAS/Graph line style #25, DASH3DASH2

See Also:
Constant Field Values

SASGRAPH_LINE26

public static final int SASGRAPH_LINE26
produces SAS/Graph line style #26, DASH4DASH2

See Also:
Constant Field Values

SASGRAPH_LINE27

public static final int SASGRAPH_LINE27
produces SAS/Graph line style #27, DASH5DASH2

See Also:
Constant Field Values

SASGRAPH_LINE28

public static final int SASGRAPH_LINE28
produces SAS/Graph line style #28, DASH6DASH2

See Also:
Constant Field Values

SASGRAPH_LINE29

public static final int SASGRAPH_LINE29
produces SAS/Graph line style #29, DASH3DASH2DASH2

See Also:
Constant Field Values

SASGRAPH_LINE30

public static final int SASGRAPH_LINE30
produces SAS/Graph line style #30, DASH4DASH2DASH2

See Also:
Constant Field Values

SASGRAPH_LINE31

public static final int SASGRAPH_LINE31
produces SAS/Graph line style #31, DASH5DASH2DASH2

See Also:
Constant Field Values

SASGRAPH_LINE32

public static final int SASGRAPH_LINE32
produces SAS/Graph line style #32, DASH6DASH2DASH2

See Also:
Constant Field Values

SASGRAPH_LINE33

public static final int SASGRAPH_LINE33
produces SAS/Graph line style #33, DOT1

See Also:
Constant Field Values

SASGRAPH_LINE34

public static final int SASGRAPH_LINE34
produces SAS/Graph line style #34, DOT1SPACE

See Also:
Constant Field Values

SASGRAPH_LINE35

public static final int SASGRAPH_LINE35
produces SAS/Graph line style #35, DOT1SPACE2

See Also:
Constant Field Values

SASGRAPH_LINE36

public static final int SASGRAPH_LINE36
produces SAS/Graph line style #36, DOT2

See Also:
Constant Field Values

SASGRAPH_LINE37

public static final int SASGRAPH_LINE37
produces SAS/Graph line style #37, DOT3

See Also:
Constant Field Values

SASGRAPH_LINE38

public static final int SASGRAPH_LINE38
produces SAS/Graph line style #38, DOT2DOT1

See Also:
Constant Field Values

SASGRAPH_LINE39

public static final int SASGRAPH_LINE39
produces SAS/Graph line style #39, DOT3DOT1

See Also:
Constant Field Values

SASGRAPH_LINE40

public static final int SASGRAPH_LINE40
produces SAS/Graph line style #40, DOT3DOT2

See Also:
Constant Field Values

SASGRAPH_LINE41

public static final int SASGRAPH_LINE41
produces SAS/Graph line style #41, DASH3DOT1

See Also:
Constant Field Values

SASGRAPH_LINE42

public static final int SASGRAPH_LINE42
produces SAS/Graph line style #42, DASH3DOT2

See Also:
Constant Field Values

SASGRAPH_LINE43

public static final int SASGRAPH_LINE43
produces SAS/Graph line style #43, DASH3DOT3

See Also:
Constant Field Values

SASGRAPH_LINE44

public static final int SASGRAPH_LINE44
produces SAS/Graph line style #44, DASH3DOT2DASH3DOT1

See Also:
Constant Field Values

SASGRAPH_LINE45

public static final int SASGRAPH_LINE45
produces SAS/Graph line style #45, DASH3DOT3DASH3DOT1

See Also:
Constant Field Values

SASGRAPH_LINE46

public static final int SASGRAPH_LINE46
produces SAS/Graph line style #46, DASH3DOT3DASH3DOT2

See Also:
Constant Field Values

SASGRAPH_LINE

public static final ConstantCollection SASGRAPH_LINE
SASGRAPH_LINE enables a set of static actions associated with the public SASGRAPH_LINE constants. These actions include: (1) validation (2) translation between constant value and string value (3) translation between constant value and JSP string value (4) translation between constant value and localized string value (5) generation of constant int or string arrays

Constructor Detail

StrokeLineStyle

public StrokeLineStyle()

StrokeLineStyle

public StrokeLineStyle(java.awt.Color newColor)
Constructor that takes a line color.

Parameters:
newColor - color of the line
See Also:
LineStyle.getColor()

StrokeLineStyle

public StrokeLineStyle(int newLineStyle,
                       java.awt.Color newColor,
                       com.sas.measures.BaseLength newThickness,
                       int newVisibilityPolicy)
Constructor that takes a SAS/Graph line style number, a line width and a color. The SAS/Graph line style number and line width are used to create the Stroke. The valid values are listed here and correspond to SAS/Graph line styles 1-46. If an unrecognized parameter is passed in for lineStyle, a simple call of 'new BasicStroke(lineWidth)' is performed.

Also, lineWidth must be greater than or equal to 0.0f. If lineWidth is set to 0.0f, the stroke is rendered as the thinnest possible line for the target device and the antialias hint setting. If lineWidth is set to less than 0.0f, then 0.0f is used. lineStyle valid parameters of type 'public static final int' are:

Parameters:
newLineStyle - SAS/Graph line style 1-46 to be created
newThickness - thickness of the line
newColor - color of the line
newVisibilityPolicy - how the line visibility is determined
See Also:
getSASGraphLineStyle(), LineStyle.getColor(), LineStyle.getThickness(), LineStyle.getVisibilityPolicy()

StrokeLineStyle

public StrokeLineStyle(int newLineStyle,
                       java.awt.Color newColor,
                       com.sas.measures.BaseLength newThickness)
Convienience constructor, same as StrokeLineStyle( int, Color, BaseLength, GraphConstance.AUTOMATIC ).

Parameters:
newLineStyle - SAS/Graph line style 1-46 to be created
newThickness - thickness of the line
newColor - color of the line
See Also:
getSASGraphLineStyle(), LineStyle.getColor(), LineStyle.getThickness()
Method Detail

apply

public void apply(StrokeLineStyle theOtherModel)
Utility method to convey properties contained in "theOtherObject" to this object.

Note: Contained "models" (i.e. properties that are subclasses of ModelBase) will in turn be called on to convey their properties to the like contained models in the other object. In that respect this can be considered a "tree" type copy.

Also Note: This is a deep copy. Thus after the copy, mutable properties will not be shared by the two instances.

Parameters:
theOtherModel - properties to apply to this instance

setStroke

public void setStroke(java.awt.BasicStroke newStroke)
Set the stroke line style. Currently only BasicStroke is supported. Future implementations may allow for a generalized implementation. If this property is null then the SASGraphLine property is used to define how the line should look.

Parameters:
newStroke - a BasicStroke containing line pattern attributes.
Throws:
an - IllegalArgumentException is thrown if newStroke is non-null and not an instance of BasicStroke
See Also:
getStroke()

getStroke

public java.awt.BasicStroke getStroke()
Returns the line appearance settings.

Returns:
line pattern attributes in a java.awt.Stroke object
See Also:
setStroke(java.awt.BasicStroke)

setThickness

public void setThickness(com.sas.measures.BaseLength newThickness)
                  throws java.lang.IllegalArgumentException
Set thickness for the stroke. Note: Since BasicStroke is immutable, a new stroke is created with all the properties except thickness from the old one. If you have a pointer to the old BasicStroke, it will be invalid now.

Overrides:
setThickness in class LineStyle
Parameters:
newThickness - BaseLength containing line thickness.
Throws:
java.lang.IllegalArgumentException - if newThickness is null.
See Also:
LineStyle.getThickness()

setSASGraphLineStyle

public void setSASGraphLineStyle(int newLineStyle)
Sets the SAS/Graph line style. Note: this property is ignored if the stroke property is non-null. lineStyle valid parameters of type 'public static final int' are:

Parameters:
newLineStyle - identifies the type of SAS/Graph line style to use
Throws:
an - IllegalArgumentException is thrown if newLineStyle is not a valid SAS/Graph line style
See Also:
getSASGraphLineStyle(), setStroke(java.awt.BasicStroke)

getSASGraphLineStyle

public int getSASGraphLineStyle()
Get line appearance settings.

Returns:
line pattern attributes in a java.awt.Stroke object
See Also:
setSASGraphLineStyle(int)

newStroke

public static java.awt.BasicStroke newStroke(int lineStyle,
                                             com.sas.measures.BaseLength lineWidth)
Takes a SAS/Graph line style number as well as a BaseLength and creates a BasicStroke. The valid values are listed here and correspond to SAS/Graph line styles 1-46. If an unrecognized parameter is passed in for lineStyle then SASGRAPH_LINE01 is used. If a null lineWidth is pasxed in then a lineWidth of 0 is used.

If a lineWidth is set to 0, the stroke is rendered as the thinnest possible line for the target device and the antialias hint setting. lineStyle valid parameters of type 'public static final int' are:

Parameters:
lineStyle - SAS/Graph line style 1-46 to be created
lineWidth - specified line width
See Also:
getStroke()

newStroke

public static java.awt.BasicStroke newStroke(int lineStyle,
                                             float lineWidth)
Takes a SAS/Graph line style number as well as a line width and creates a BasicStroke. The valid values are listed here and correspond to SAS/Graph line styles 1-46. If an unrecognized parameter is passed in for lineStyle then SASGRAPH_LINE01 is used.

If lineWidth is set to 0, the stroke is rendered as the thinnest possible line for the target device and the antialias hint setting. If lineWidth is set to less than 0, then 0 is used. lineStyle valid parameters of type 'public static final int' are:

Parameters:
lineStyle - SAS/Graph line style 1-46 to be created
lineWidth - specified line width
See Also:
getStroke()

getSASGraphLineStyle

public static int getSASGraphLineStyle(java.awt.BasicStroke stroke)
Takes a BasicStroke and returns a SAS/Graph line style number if the stroke corresponds to one. Otherwise return SASGRAPH_LINE_UNRECOGNIZED. The valid values are listed here and correspond to SAS/Graph line styles 1-46.

Parameters:
stroke - SAS/Graph line style 1-46 that was created
See Also:
getStroke()

equals

public boolean equals(java.lang.Object obj)
Determines whether another object is equal to this StrokeLineStyle.

The result is true if and only if the argument is not null and is a StrokeLineStyle object that has the same property values as this object.

Overrides:
equals in class LineStyle
Parameters:
obj - the object to test for equality with this StrokeLineStyle
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Computes the hash code for this StrokeLineStyle.

Overrides:
hashCode in class LineStyle
Returns:
a hash code value for this object.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.