|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.graphics.components.FillStyle
public class FillStyle
The FillStyle encapsulates display properties defining an area's fill by either a solid color, gradient colors or image. This class is used by graph models to define fills for data elements, axis walls, graph backgrounds and more.
The solid blend and gradient blend colors are only applicable with fill types that specify a blend. The blend color is applied to the area after it has already been filled with the fill colors and image. The transparency in the color allows for some interesting results.
The apply method is a convenience to allow the property setting of one FillStyle to be conveyed to another.
Set the GraphStyle's background fill to be a gradient fill from the bottom to the top going from green to yellow.
GraphStyle graphStyle = new GraphStyle(GraphStyle.STYLE_SCIENCE); graphStyle.setBackgroundFillStyle(new FillStyle(Color.green, Color.yellow, FillStyle.GRADIENT_FILL_BOTTOM_TO_TOP)); // Apply the GraphStyl to a barChart BarChart barChart = ...; barChart.applyGraphStyle(graphStyle);
Modify the GraphStyle's background fill to be a solid blue color:
FillStyle backgroundFillStyle = graphStyle.getBackgroundFillStyle(); backgroundFillStyle.setFillType(FILL_TYPE_SOLID_COLOR); backgroundFillStyle.setSolidFillColor(Color.blue);This class comes with an apply method to easily convey the property setting from one fill style to another.
To modify the GraphStyle's Background FillStyle to fill with a solid blue color using apply:
FillStyle fillStyle = new FillStyle(Color.green); graphStyle.getBackgroundFillStyle().apply(fillStyle); fillStyle.setSolidFillColor(Color.lightGray); graphStyle.getLegendBackgroundFillStyle().apply(fillStyle); fillStyle.setSolidFillColor(Color.gray); graphStyle.getWallFillStyle().apply(fillStyle); graphStyle.getFloorFillStyle().apply(fillStyle);Also, you can modify the GraphStyle's Background FillStyle to be a gradient filled and use the barChart's applyGraphStyle() method to see the results:
graphStyle.getBackgroundFillStyle().setFillType(FillStyle.FILL_TYPE_GRADIENT); graphStyle.getBackgroundFillStyle().setGradientFill(FillStyle.GRADIENT_FILL_DIAGONAL_UP); graphStyle.getBackgroundFillStyle().setGradientFillEndColor(Color.BLACK); graphStyle.getBackgroundFillStyle().setGradientFillBeginColor(Color.ORANGE); barChart.applyGraphStyle(graphStyle);
FillStyle
properties are bound properties.
GraphStyle
,
ModelBase
Field Summary | |
---|---|
static ConstantCollection |
FILL_TYPE
FILL_TYPE enables a set of static actions associated with the public FILL_TYPE_ constants. |
static int |
FILL_TYPE_GRADIENT
Fill as a gradient blend from gradient fill begin color to gradient fill end color following the direction specified by the gradient fill. |
static int |
FILL_TYPE_IMAGE
Fill with image. |
static int |
FILL_TYPE_IMAGE_COLOR_BLEND
Same as FILL_TYPE_IMAGE followed by the application of the solid blend color on top of the area. |
static int |
FILL_TYPE_IMAGE_GRADIENT_BLEND
Same as FILL_TYPE_IMAGE followed by the application of a gradient blend on top of the area using the gradient blend begin color and gradient blend end color. |
static int |
FILL_TYPE_SOLID_COLOR
Fill with solid color. |
static ConstantCollection |
GRADIENT_FILL
GRADIENT_FILL enables a set of static actions associated with the public GRADIENT_FILL_ constants. |
static int |
GRADIENT_FILL_BOTTOM_TO_TOP
Gradient fill from bottom to top using the gradient fill begin color and gradient fill end color. |
static int |
GRADIENT_FILL_DIAGONAL_DOWN
Gradient fill diagonally from top to bottom using the gradient fill begin color and gradient fill end color. |
static int |
GRADIENT_FILL_DIAGONAL_UP
Gradient fill diagonally from bottom to top using the gradient fill begin color and gradient fill end color. |
static int |
GRADIENT_FILL_FRONT_TO_BACK
Gradient fill from front to back using the gradient fill begin color and gradient fill end color. |
static int |
GRADIENT_FILL_LEFT_TO_RIGHT
Gradient fill from left to right using the gradient fill begin color and gradient fill end color. |
static ConstantCollection |
IMAGE_FILL
IMAGE_FILL enables a set of static actions associated with the public IMAGE_FILL_ constants. |
static int |
IMAGE_FILL_BOTTOM
Fill the area using the image color and then draw the image justified at the bottom of the area. |
static int |
IMAGE_FILL_BOTTOM_LEFT
Fill the area using the image color and then draw the image justified at the bottom left corner of the area. |
static int |
IMAGE_FILL_BOTTOM_RIGHT
Fill the area using the image color and then draw the image justified at the bottom right corner of the area. |
static int |
IMAGE_FILL_CENTER
Fill the area using the image color and then draw the image centered justified in the area. |
static int |
IMAGE_FILL_POINT
Fill the area using the image color and then draw the image anchored a the position specified by the x and y properties. |
static int |
IMAGE_FILL_STRETCH
Stretch the image to fill the area. |
static int |
IMAGE_FILL_TILE
Tile the image to fill the area. |
static int |
IMAGE_FILL_TOP
Fill the area using the image color and then draw the image top justified in the area. |
static int |
IMAGE_FILL_TOP_LEFT
Fill the area using the image color and then draw the image left justified in the area. |
static int |
IMAGE_FILL_TOP_RIGHT
Fill the area using the image color and then draw the image justified at the top right corner of the area. |
static java.lang.String |
RB_KEY
|
Constructor Summary | |
---|---|
FillStyle()
Constructs a solid white fill style. |
|
FillStyle(java.awt.Color solidColor)
Constructs a solid (FILL_TYPE_SOLID_COLOR) fill style of the specified color. |
|
FillStyle(java.awt.Color beginColor,
java.awt.Color endColor,
int gradientFill)
Constructs a gradient (FILL_TYPE_GRADIENT) fill style flowing from beginColor to endColor. |
|
FillStyle(javax.swing.ImageIcon imageIcon,
java.awt.Color imageFillColor,
int imageFill)
Constructs an image (FILL_TYPE_IMAGE) fill style using the specified image and matching imageColor. |
Method Summary | |
---|---|
void |
apply(FillStyle theOtherObject)
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 FillStyle . |
int |
getFillType()
Returns the type of fill. |
java.awt.Color |
getGradientBlendBeginColor()
Returns the begin color that is applied to the area after the image has been applied when the fill type is FillStyle.FILL_TYPE_IMAGE_GRADIENT_BLEND . |
java.awt.Color |
getGradientBlendEndColor()
Returns the end color that is applied to the area after the image has been applied when the fill type is FillStyle.FILL_TYPE_IMAGE_GRADIENT_BLEND . |
int |
getGradientFill()
Returns the gradient fill direction. |
java.awt.Color |
getGradientFillBeginColor()
Returns the gradient fill begin color used when the fill type is FillStyle.FILL_TYPE_GRADIENT . |
java.awt.Color |
getGradientFillEndColor()
Returns the gradient fill end color used when the fill type is FillStyle.FILL_TYPE_GRADIENT . |
int |
getImageFill()
Returns the image fill defining where to position the image and how the area is to be filled. |
java.awt.Color |
getImageFillColor()
Returns the image's background color. |
javax.swing.ImageIcon |
getImageIcon()
Returns the imageIcon used in this fill style. |
java.awt.Color |
getSolidBlendColor()
Returns the color that is applied to the area after the image has been applied when the fill type is FillStyle.FILL_TYPE_IMAGE_COLOR_BLEND . |
java.awt.Color |
getSolidFillColor()
Returns the color used when the fill type is FillStyle.FILL_TYPE_SOLID_COLOR . |
int |
getX()
Returns the "x" portion of the position coordinate used with an image fill when the image fill is FillStyle.IMAGE_FILL_POINT . |
int |
getY()
Returns the "y" portion of the position coordinate used with an image fill when the image fill is FillStyle.IMAGE_FILL_POINT . |
int |
hashCode()
Computes the hash code for this FillStyle . |
boolean |
isVisible()
Returns whether or not the fill is visible. |
void |
setFillType(int newFillType)
Sets the type of fill. |
void |
setGradientBlendBeginColor(java.awt.Color newColor)
Sets the begin color of the Gradient fill that is applied to the area after the image has been applied. |
void |
setGradientBlendEndColor(java.awt.Color newColor)
Sets the end color of a Gradient fill that is applied to the area after the image has been applied. |
void |
setGradientFill(int newGradientFill)
Sets the gradient fill direction. |
void |
setGradientFillBeginColor(java.awt.Color newColor)
Sets the gradient fill begin color used with FillStyle.FILL_TYPE_GRADIENT fills. |
void |
setGradientFillEndColor(java.awt.Color newColor)
Sets the gradient fill end color used with FillStyle.FILL_TYPE_GRADIENT fills. |
void |
setImageFill(int newImageFill)
Sets the image fill defining where to position the image and how the area is to be filled. |
void |
setImageFillColor(java.awt.Color newColor)
Sets the color that is filled in the area prior to the image being applied. |
void |
setImageIcon(javax.swing.ImageIcon newImageIcon)
Sets the image to be used in the fill area. |
void |
setSolidBlendColor(java.awt.Color newColor)
Sets the color that is applied to the area after the image has been applied. |
void |
setSolidFillColor(java.awt.Color newColor)
Sets the fill color used with FillStyle.FILL_TYPE_SOLID_COLOR fills. |
void |
setVisible(boolean newVisible)
Sets whether the fill is visible. |
void |
setX(int newX)
Sets the "x" portion of the position coordinate used with an image fill when the image fill is FillStyle.IMAGE_FILL_POINT . |
void |
setY(int newY)
Sets the "y" portion of the position coordinate used with an image fill when the image fill is FillStyle.IMAGE_FILL_POINT . |
Methods inherited from class com.sas.graphics.components.ModelBase |
---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel |
Field Detail |
---|
public static final java.lang.String RB_KEY
public static final int FILL_TYPE_SOLID_COLOR
setFillType(int)
,
setSolidFillColor(java.awt.Color)
,
Constant Field Valuespublic static final int FILL_TYPE_GRADIENT
setFillType(int)
,
setGradientFill(int)
,
setGradientFillBeginColor(java.awt.Color)
,
setGradientFillEndColor(java.awt.Color)
,
Constant Field Valuespublic static final int FILL_TYPE_IMAGE
setFillType(int)
,
setImageFill(int)
,
setImageIcon(javax.swing.ImageIcon)
,
setImageFillColor(java.awt.Color)
,
setX(int)
,
setY(int)
,
Constant Field Valuespublic static final int FILL_TYPE_IMAGE_COLOR_BLEND
setFillType(int)
,
setImageFill(int)
,
setImageIcon(javax.swing.ImageIcon)
,
setSolidBlendColor(java.awt.Color)
,
setX(int)
,
setY(int)
,
Constant Field Valuespublic static final int FILL_TYPE_IMAGE_GRADIENT_BLEND
setFillType(int)
,
setImageFill(int)
,
setImageIcon(javax.swing.ImageIcon)
,
setGradientFill(int)
,
setX(int)
,
setY(int)
,
Constant Field Valuespublic static final ConstantCollection FILL_TYPE
public static final int GRADIENT_FILL_LEFT_TO_RIGHT
gs.getBackgroundFillStyle().setFillType(FillStyle.FILL_TYPE_GRADIENT); gs.getBackgroundFillStyle().setGradientFill(FillStyle.GRADIENT_FILL_LEFT_TO_RIGHT);
setGradientFill(int)
,
Constant Field Valuespublic static final int GRADIENT_FILL_BOTTOM_TO_TOP
gs.getBackgroundFillStyle().setFillType(FillStyle.FILL_TYPE_GRADIENT); gs.getBackgroundFillStyle().setGradientFill(FillStyle.GRADIENT_FILL_BOTTOM_TO_TOP);for this to apply.
setGradientFill(int)
,
Constant Field Valuespublic static final int GRADIENT_FILL_FRONT_TO_BACK
gs.getBackgroundFillStyle().setFillType(FillStyle.FILL_TYPE_GRADIENT); gs.getBackgroundFillStyle().setGradientFill(FillStyle.GRADIENT_FILL_FRONT_TO_BACK);
setGradientFill(int)
,
Constant Field Valuespublic static final int GRADIENT_FILL_DIAGONAL_UP
gs.getBackgroundFillStyle().setFillType(FillStyle.FILL_TYPE_GRADIENT); gs.getBackgroundFillStyle().setGradientFill(FillStyle.GRADIENT_FILL_DIAGONAL_UP);
setGradientFill(int)
,
Constant Field Valuespublic static final int GRADIENT_FILL_DIAGONAL_DOWN
gs.getBackgroundFillStyle().setFillType(FillStyle.FILL_TYPE_GRADIENT); gs.getBackgroundFillStyle().setGradientFill(FillStyle.GRADIENT_FILL_DIAGONAL_DOWN);
setGradientFill(int)
,
Constant Field Valuespublic static final ConstantCollection GRADIENT_FILL
public static final int IMAGE_FILL_STRETCH
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_TILE
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_POINT
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_CENTER
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_TOP
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_TOP_LEFT
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_TOP_RIGHT
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_BOTTOM
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_BOTTOM_LEFT
setImageFill(int)
,
Constant Field Valuespublic static final int IMAGE_FILL_BOTTOM_RIGHT
setImageFill(int)
,
Constant Field Valuespublic static final ConstantCollection IMAGE_FILL
Constructor Detail |
---|
public FillStyle()
public FillStyle(java.awt.Color solidColor)
solidColor
- the solid fill colorsetSolidFillColor(java.awt.Color)
public FillStyle(java.awt.Color beginColor, java.awt.Color endColor, int gradientFill)
beginColor
- the color beginning at the left which is blended to the rightendColor
- the color beginning at the right which is blended to the leftgradientFill
- the gradient directionsetGradientFillBeginColor(java.awt.Color)
,
setGradientFillEndColor(java.awt.Color)
,
setGradientFill(int)
public FillStyle(javax.swing.ImageIcon imageIcon, java.awt.Color imageFillColor, int imageFill)
imageIcon
- the image icon to be usedimageFillColor
- a matching color for the imageimageFill
- the image placement and pattern policysetImageIcon(javax.swing.ImageIcon)
,
setImageFillColor(java.awt.Color)
,
setImageFill(int)
Method Detail |
---|
public void apply(FillStyle theOtherObject)
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.
theOtherObject
- properties applied to this instancepublic void setFillType(int newFillType) throws java.lang.IllegalArgumentException
newFillType
- the fill type desired
java.lang.IllegalArgumentException
- if an invalid value is passed in.getFillType()
public int getFillType()
setFillType(int)
public void setVisible(boolean newVisible)
newVisible
- true means visibleisVisible()
public boolean isVisible()
setVisible(boolean)
public void setSolidFillColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
FillStyle.FILL_TYPE_SOLID_COLOR
fills.
newColor
- the solid fill color
java.lang.IllegalArgumentException
- if newColor is null.getSolidFillColor()
public java.awt.Color getSolidFillColor()
FillStyle.FILL_TYPE_SOLID_COLOR
.
setSolidFillColor(java.awt.Color)
public void setGradientFill(int newGradientFill) throws java.lang.IllegalArgumentException
newGradientFill
- the gradient direction policy
java.lang.IllegalArgumentException
- if an invalid value is passed in.getGradientFill()
public int getGradientFill()
setGradientFill(int)
public void setGradientFillBeginColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
FillStyle.FILL_TYPE_GRADIENT
fills.
newColor
- the gradient fill begin color
java.lang.IllegalArgumentException
- if newColor is null.getGradientFillBeginColor()
,
setGradientFillEndColor(java.awt.Color)
public java.awt.Color getGradientFillBeginColor()
FillStyle.FILL_TYPE_GRADIENT
.
setGradientFillBeginColor(java.awt.Color)
,
getGradientFillEndColor()
public void setGradientFillEndColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
FillStyle.FILL_TYPE_GRADIENT
fills.
newColor
- the gradient fill end color
java.lang.IllegalArgumentException
- if newColor is null.getGradientFillEndColor()
,
setGradientFillBeginColor(java.awt.Color)
public java.awt.Color getGradientFillEndColor()
FillStyle.FILL_TYPE_GRADIENT
.
setGradientFillEndColor(java.awt.Color)
,
getGradientFillBeginColor()
public void setImageFill(int newImageFill) throws java.lang.IllegalArgumentException
This is only applicable when the fill
type is one of the folowing:
newImageFill
- the image treatment
java.lang.IllegalArgumentException
- thrown if an invalid value is passed in.setFillType(int)
,
getImageFill()
public int getImageFill()
setImageFill(int)
public void setImageFillColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
This is only applicable when the fill
type is one of the folowing:
newColor
- the image fill color
java.lang.IllegalArgumentException
- if newColor is null.getImageFillColor()
public java.awt.Color getImageFillColor()
setSolidFillColor(java.awt.Color)
public void setSolidBlendColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
FillStyle.FILL_TYPE_IMAGE_COLOR_BLEND
.
newColor
- the secondary solid fill color
java.lang.IllegalArgumentException
- if newColor is null.getSolidBlendColor()
public java.awt.Color getSolidBlendColor()
FillStyle.FILL_TYPE_IMAGE_COLOR_BLEND
.
setSolidBlendColor(java.awt.Color)
public void setGradientBlendBeginColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
FillStyle.FILL_TYPE_IMAGE_GRADIENT_BLEND
.
newColor
- the begin color for a secondary gradient fill
java.lang.IllegalArgumentException
- if newColor is null.getGradientBlendBeginColor()
public java.awt.Color getGradientBlendBeginColor()
FillStyle.FILL_TYPE_IMAGE_GRADIENT_BLEND
.
setGradientBlendBeginColor(java.awt.Color)
public void setGradientBlendEndColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
FillStyle.FILL_TYPE_IMAGE_GRADIENT_BLEND
.
newColor
- the end color for a secondary gradient fill
java.lang.IllegalArgumentException
- if newColor is null.getGradientBlendEndColor()
public java.awt.Color getGradientBlendEndColor()
FillStyle.FILL_TYPE_IMAGE_GRADIENT_BLEND
.
setGradientBlendEndColor(java.awt.Color)
public void setImageIcon(javax.swing.ImageIcon newImageIcon)
newImageIcon
- the image icon to be displayedsetFillType(int)
,
getImageIcon()
public javax.swing.ImageIcon getImageIcon()
setImageIcon(javax.swing.ImageIcon)
public void setX(int newX)
FillStyle.IMAGE_FILL_POINT
.
newX
- the "x" coordinate to anchor the imagesetImageFill(int)
,
getX()
public int getX()
FillStyle.IMAGE_FILL_POINT
.
setImageFill(int)
,
setX(int)
public void setY(int newY)
FillStyle.IMAGE_FILL_POINT
.
newY
- the "y" coordinate to anchor the imagesetImageFill(int)
,
getY()
public int getY()
FillStyle.IMAGE_FILL_POINT
.
setImageFill(int)
,
setY(int)
public boolean equals(java.lang.Object obj)
FillStyle
.
The result is true
if and only if the argument is not
null
and is a FillStyle
object that has the same
property values as this object.
equals
in class ModelBase
obj
- the object to test for equality with this
FillStyle
true
if the objects are the same;
false
otherwise.public int hashCode()
FillStyle
.
hashCode
in class ModelBase
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |