com.sas.graphics.components
Class AdvancedTextStyle

java.lang.Object
  |
  +--com.sas.graphics.components.ModelBase
        |
        +--com.sas.graphics.components.TextStyle
              |
              +--com.sas.graphics.components.AdvancedTextStyle

public class AdvancedTextStyle
extends TextStyle

The AdvancedTextStyle extends TextStyle to support rotatable text in graphs. Properties include: baseline angle, font, visibility, color, justification, frame and shadow.

Graphs contain various models that use AdvancedTextStyle such as the AxisModel which contains a value text that may be rotated. The axis' value text can be rotated via the AxisModel's valueTextStyle baselineAngle property. The angle is in degrees where 0 degrees would be considered at 3:00 on an analog clock. The angle will be pivited about the text's anchor whose loction may vary based upon what is displaying the text. The angle value is specified in degrees and is normalized to the 0-360 range when set.

Usage

To adjust the angle of the BarChart's category axis values to appear at a 45 degree angle (upward sloping from left to right):
 BarChart barChart = new BarChart();
 AdvancedTextStyle axisValue = barChart.getBarChartModel().getCategoryAxisModel().getValueTextStyle();
 axisValue.setJustifiction(javax.swing.SwingConstants.RIGHT);
 axisValue.setBaselineAngle(45.0);
 

Behavior

This apply() method is a convenience to convey the properties from one TextStyle to another.

Since:
SAS 9.1
See Also:
TextStyle, GraphStyle, ModelBase

Constructor Summary
AdvancedTextStyle()
          A AdvancedTextStyle encapsulates the set of display properties applicable to text used in graphs that support some baseline angle specification.
AdvancedTextStyle(Font newFont, Color newColor, int newJustification, boolean newVisible, double newBaselineAngle)
          Constructor allowing specification of Font, color, justification and visibility.
 
Method Summary
 void apply(AdvancedTextStyle theOtherObject)
          Utility method to convey properties contained in "theOtherObject" to this object.
 boolean equals(Object obj)
          Determines whether another object is equal to this AdvancedTextStyle.
 double getBaselineAngle()
          Get the baseline angle for the text.
 int hashCode()
          Computes the hash code for this AdvancedTextStyle.
 void setBaselineAngle(double newAngle)
          Set the baseline angle for the text.
 
Methods inherited from class com.sas.graphics.components.TextStyle
apply, getColor, getFont, getJustification, getShadowStyle, isVisible, setColor, setFont, setJustification, setShadowStyle, setVisible
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdvancedTextStyle

public AdvancedTextStyle()
A AdvancedTextStyle encapsulates the set of display properties applicable to text used in graphs that support some baseline angle specification. The default font is a 12 point "TimesRoman" font. The default color is SystemColor.textText. The default visibility is true (means it is visible). The default justification is javax.swing.SwingConstants.CENTER. The default frameLineStyle is [color=java.awt.SystemColor.windowBorder; thickness=1 pixel; visibility=false] The default shadowStyle is the ShadowStyle defaults. The default baseline angle is 0 degrees.

AdvancedTextStyle

public AdvancedTextStyle(Font newFont,
                         Color newColor,
                         int newJustification,
                         boolean newVisible,
                         double newBaselineAngle)
Constructor allowing specification of Font, color, justification and visibility. If newFont is null then it is ignored, the default font is ("TimesRoman",PLAIN,12). If newColor is null then it is ignored, the default color is SystemColor.textText. If newJustification is invalid then it is ignored, the default color is javax.swing.SwingConstants.CENTER. If newVisible is true then the text will be visible when displayed.

Parameters:
newFont - the text font, null is ignored
newColor - the text color, null is ignored
newJustification - the text justification, invalid value are ignored
newVisible - the text visibility, true means visible
Method Detail

apply

public final void apply(AdvancedTextStyle 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

setBaselineAngle

public final void setBaselineAngle(double newAngle)
Set the baseline angle for the text. The angle is in degrees where 0 degrees would be considered at 3:00 on an analog clock. The angle will be pivited about the text's anchor whose loction may vary based upon what is displaying the text. The angle value is specified in degrees and is normalized to 0-360 when set.

Parameters:
newAngle - angle for text baseline
See Also:
getBaselineAngle()

getBaselineAngle

public final double getBaselineAngle()
Get the baseline angle for the text. The angle value is specified in degrees and is normalized to the 0-360 range when set.

Returns:
double baseline angle setting
See Also:
setBaselineAngle(double)

equals

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

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

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

hashCode

public int hashCode()
Computes the hash code for this AdvancedTextStyle.
Overrides:
hashCode in class TextStyle
Returns:
a hash code value for this object.




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 02:01:34