com.sas.graphics.components
Class ContentsModel

com.sas.graphics.components.ContentsModel
Direct Known Subclasses:
AxisModel, GraphMatrixAxisModel, LegendModel, PieChartSubgroupModel

public class ContentsModel

The ContentsModel class stores common axis appearance preferences for graph axis and graph matrix axis.

This class stores the visibility of the axis, value and label appearance properties and the label string.

Usage

Modify a axis's label appearance and set the new label value.
 AxisModel myAxisModel = new AxisModel();
 myAxisModel.setLabel("My Axis Title");
 myAxisModel.getLabelTextStyle().setColor(Color.red);
 myAxisModel.getLabelTextStyle().setFont(new Font("SansSerif", Font.BOLD, 24);
 

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:
ModelBase, AxisModel, GraphMatrixAxisModel, TextStyle

Constructor Summary
ContentsModel()
           
 
Method Summary
 void apply(ContentsModel 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 ContentsModel.
 java.lang.String getLabel()
          Returns the Axis label.
 TextStyle getLabelTextStyle()
          Return the text attributes for the axis label.
 TextStyle getValueTextStyle()
          Return the text attributes for the axis value.
 int hashCode()
          Computes the hash code for this AxisModel.
 boolean isVisible()
          Returns if the axis is visible or not.
 void setLabel(java.lang.String aLabel)
          Sets a new String label for the axis.
 void setLabelTextStyle(TextStyle labelTextStyle)
          Set the text attributes for the axis label.
 void setValueTextStyle(TextStyle valueTextStyle)
          Set the text attributes for the axis values.
 void setVisible(boolean visible)
          Sets whether the axis is visible or not.
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Constructor Detail

ContentsModel

public ContentsModel()
Method Detail

apply

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

getLabel

public java.lang.String getLabel()
Returns the Axis label.

Returns:
String object for axis label.
See Also:
setLabel(java.lang.String)

setLabel

public void setLabel(java.lang.String aLabel)
Sets a new String label for the axis.

Parameters:
aLabel - String set new axis label
See Also:
getLabel()

setLabelTextStyle

public void setLabelTextStyle(TextStyle labelTextStyle)
                       throws java.lang.IllegalArgumentException
Set the text attributes for the axis label.

Parameters:
labelTextStyle - the new repository for the label's text attributes
Throws:
java.lang.IllegalArgumentException - if labelTextStyle is null.
See Also:
getLabelTextStyle(), TextStyle.apply(com.sas.graphics.components.TextStyle)

getLabelTextStyle

public TextStyle getLabelTextStyle()
Return the text attributes for the axis label.

Returns:
the axis label text attributes
See Also:
setLabelTextStyle(com.sas.graphics.components.TextStyle)

setValueTextStyle

public void setValueTextStyle(TextStyle valueTextStyle)
                       throws java.lang.IllegalArgumentException
Set the text attributes for the axis values.

Parameters:
valueTextStyle - the new repository for the axis' values attributes
Throws:
java.lang.IllegalArgumentException - if valueTextStyle is null.
See Also:
getValueTextStyle(), TextStyle.apply(com.sas.graphics.components.TextStyle)

getValueTextStyle

public TextStyle getValueTextStyle()
Return the text attributes for the axis value.

Returns:
the axis value text attributes
See Also:
setValueTextStyle(com.sas.graphics.components.TextStyle)

isVisible

public boolean isVisible()
Returns if the axis is visible or not.

Returns:
boolean which denotes if axis is visible or not.
See Also:
setVisible(boolean)

setVisible

public void setVisible(boolean visible)
Sets whether the axis is visible or not.

Parameters:
visible - boolean set axis visibility
See Also:
isVisible()

equals

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

The result is true if and only if the argument is not null and is a ContentsModel 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 ContentsModel
Returns:
true if the objects are the same; false otherwise.

hashCode

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

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



Copyright © 2009 SAS Institute Inc. All Rights Reserved.