com.sas.graphics.components
Class ShadowStyle

com.sas.graphics.components.ShadowStyle

public class ShadowStyle

Encapsulates attributes that affect the appearance of shadows. Attributes of shadow softness, offset, color and visibility pertaining to a shadow are stored here. Any object that would like to utilise a shadow may use this class. Currently only TextStyle and FillStyle use a shadow.

Usage

Set a bar chart's category axis' label to have a light grey shadow.
 BarChart barChart = getMyBarChart();
 TextStyle axisLabel = ((barChart.getBarChartModel()).getCategoryAxisModel()).getLabelTextStyle();
 ShadowStyle style = axisLabel.getShadowStyle();
 style.setVisible(true);
 style.setColor(Color.lightGray);
 

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

Constructor Summary
ShadowStyle()
           
ShadowStyle(java.awt.Color colorIn)
           
ShadowStyle(java.awt.Color color, com.sas.measures.BaseLength offsetX, com.sas.measures.BaseLength offsetY, double softness)
           
 
Method Summary
 void apply(ShadowStyle 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 ShadowStyle.
 java.awt.Color getColor()
          Returns the color of the shadow.
 com.sas.measures.BaseLength getOffsetX()
          Returns the x offset used for the drop shadow.
 com.sas.measures.BaseLength getOffsetY()
          Returns the y offset used for placing drop shadows.
 double getSoftness()
          Returns the value of the 'fuzziness' used on drop shadows in the graph.
 int hashCode()
          Computes the hash code for this ShadowStyle.
 boolean isVisible()
          Return whether or not the drop shadows are drawn.
 void setColor(java.awt.Color newColor)
          Assigns the color used for the shadow The default value is Color.black.
 void setOffsetX(com.sas.measures.BaseLength newOffsetX)
          Set the x offset for the shadow.
 void setOffsetY(com.sas.measures.BaseLength newOffsetY)
          Set the y offset for the shadow.
 void setSoftness(double newSoftness)
          Sets the 'fuzziness' used on the drop shadows.
 void setVisible(boolean newVisible)
          Controls whether or not the shadow is drawn.
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Constructor Detail

ShadowStyle

public ShadowStyle()

ShadowStyle

public ShadowStyle(java.awt.Color colorIn)

ShadowStyle

public ShadowStyle(java.awt.Color color,
                   com.sas.measures.BaseLength offsetX,
                   com.sas.measures.BaseLength offsetY,
                   double softness)
Method Detail

apply

public void apply(ShadowStyle theOtherObject)
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:
theOtherObject - properties applied to this instance

isVisible

public boolean isVisible()
Return whether or not the drop shadows are drawn.

Returns:
if drop shadows are to be drawn.
See Also:
setVisible(boolean)

setVisible

public void setVisible(boolean newVisible)
Controls whether or not the shadow is drawn.

Parameters:
newVisible - true means shadow is displayed
See Also:
isVisible()

setColor

public void setColor(java.awt.Color newColor)
              throws java.lang.IllegalArgumentException
Assigns the color used for the shadow The default value is Color.black.

Parameters:
newColor - color for the shadow
Throws:
java.lang.IllegalArgumentException - if newColor is null.
See Also:
getColor()

getColor

public java.awt.Color getColor()
Returns the color of the shadow. The default value is Color.black.

Returns:
color of shadow
See Also:
setColor(java.awt.Color)

setSoftness

public void setSoftness(double newSoftness)
Sets the 'fuzziness' used on the drop shadows. The value must range from 0.0-1.0 with 1.0 being the same as NO fuzziness. Values outside of this range will be adjusted to be in the range of valid values.
 Ex. If 1.2 was specified the softness would be set to 1.0.
     If -.75 was specified the softness would be set to 0.0.
     If 0.5 was specified the softness would be set to 0.5.
 

Parameters:
newSoftness - range of 0.0-1.0 with 1.0 being the same as NO fuzziness.
See Also:
getSoftness()

getSoftness

public double getSoftness()
Returns the value of the 'fuzziness' used on drop shadows in the graph. Range of values is 0.0-1.0 with 1.0 the same as NO fuzziness.

Returns:
double in the range of 0.0-1.0 with 1.0 the same as NO fuzziness.
See Also:
setSoftness(double)

setOffsetX

public void setOffsetX(com.sas.measures.BaseLength newOffsetX)
                throws java.lang.IllegalArgumentException
Set the x offset for the shadow. The shadow will be shifted the specified amount horizontally from the base object. Positive values shift to the right. The default value is 2 pixels.

Parameters:
newOffsetX - BaseLength containing value for x shadow offset
Throws:
java.lang.IllegalArgumentException - if newOffsetX is null.
See Also:
getOffsetX()

getOffsetX

public com.sas.measures.BaseLength getOffsetX()
Returns the x offset used for the drop shadow.

Returns:
BaseLength containing the x offset for the shadow.
See Also:
setOffsetX(com.sas.measures.BaseLength)

setOffsetY

public void setOffsetY(com.sas.measures.BaseLength newOffsetY)
                throws java.lang.IllegalArgumentException
Set the y offset for the shadow. The shadow will be shifted the specified amount vertically from the base object. Positive values shift to the down. The default value is 2 pixels.

Parameters:
newOffsetY - BaseLength containing the y offset for the shadow
Throws:
java.lang.IllegalArgumentException - if newOffsetY is null.
See Also:
getOffsetY()

getOffsetY

public com.sas.measures.BaseLength getOffsetY()
Returns the y offset used for placing drop shadows.

Returns:
BaseLength containing the y offset for the shadow.
See Also:
setOffsetY(com.sas.measures.BaseLength)

equals

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

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

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

hashCode

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

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



Copyright © 2009 SAS Institute Inc. All Rights Reserved.