|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.graphics.components.TextStyle
public class TextStyle
A TextStyle encapsulates the set of display properties applicable to text within a graph. Properties include: font, visibility, color, justification, frame and shadow.
Graphs contain NoteModels, AxisModels, LegendModels etc. that contain TextStyles. For instance a Legend has value text and label text hence the LegendModel has a ValueTextStyle and LabelTextStyle whereby the display properties of text can be specified.
Note that null is not an acceptable parameter value for the properties of this class and will result in an IllegalArgumentException being thrown. Due to the nature of the way GraphStyles are applied to graphs and the ways that various pieces of text are used differently in a graph there is not a good set of common default text properties. Some defaults are chosen when a TextStyle object is constructed but most of these are overridden by the graph's constructor or when a GraphStyle is applied to a Graph. Since there is not an acceptable default this class does not support any "revert to default" via null parameters.
BarChart barChart = new BarChart(); barChart.getBarChartModel().getCategoryAxisModel().getLabelTextStyle().setColor(Color.blue.darker());
GraphStyle
,
ModelBase
Constructor Summary | |
---|---|
TextStyle()
A TextStyle encapsulates the set of display properties applicable to text used in graphs. |
|
TextStyle(java.awt.Font newFont,
java.awt.Color newColor,
int newJustification,
boolean newVisible)
Constructor allowing specification of Font, color, justification and visibility. |
Method Summary | |
---|---|
void |
apply(TextStyle 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 TextStyle . |
java.awt.Color |
getColor()
Get the color used to draw the text. |
java.awt.Font |
getFont()
Returns the font used to draw the text. |
int |
getJustification()
Returns the type of horizontal justification. |
java.awt.Font |
getRowSelectionFontStlye()
This method is for internal use only. |
java.awt.Color |
getRowSelectionTextColorStlye()
This method is for internal use only. |
ShadowStyle |
getShadowStyle()
Returns the text's drop shadow style. |
int |
hashCode()
Computes the hash code for this TextStyle . |
boolean |
isVisible()
Get whether or not the text is displayed. |
void |
setColor(java.awt.Color newColor)
Set the color used to draw the text. |
void |
setFont(java.awt.Font newFont)
Sets the font used when the text is drawn. |
void |
setJustification(int newJustification)
Set the text's horizontal justification. |
void |
setRowSelectionFontStyle(java.awt.Font newRowSelectionFont)
This method is for internal use only. |
void |
setRowSelectionTextColorStyle(java.awt.Color newRowSelectionColor)
This method is for internal use only. |
void |
setShadowStyle(ShadowStyle newShadow)
Set the text's drop shadow style. |
void |
setVisible(boolean newVisible)
Set whether or not the text is displayed. |
Methods inherited from class com.sas.graphics.components.ModelBase |
---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel |
Constructor Detail |
---|
public TextStyle()
public TextStyle(java.awt.Font newFont, java.awt.Color newColor, int newJustification, boolean newVisible)
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.
newFont
- the text font, null
is ignorednewColor
- the text color, null
is ignorednewJustification
- the text justification, invalid value are ignorednewVisible
- the text visibility, true means visibleMethod Detail |
---|
public void apply(TextStyle theOtherObject)
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 setFont(java.awt.Font newFont) throws java.lang.IllegalArgumentException
newFont
- the font to be used when drawing the text
java.lang.IllegalArgumentException
- if newFont is null.getFont()
public java.awt.Font getFont()
setFont(java.awt.Font)
public void setColor(java.awt.Color newColor) throws java.lang.IllegalArgumentException
newColor
- the color used to draw the text.
java.lang.IllegalArgumentException
- if newColor is null.getColor()
public java.awt.Color getColor()
setColor(java.awt.Color)
public void setJustification(int newJustification) throws java.lang.IllegalArgumentException
Valid values are javax.swing.SwingConstants.LEFT, javax.swing.SwingConstants.CENTER, javax.swing.SwingConstants.RIGHT
newJustification
- new Justification setting
java.lang.IllegalArgumentException
- if an invalid value is passed in.getJustification()
public int getJustification()
Valid values are: javax.swing.SwingConstants.LEFT, javax.swing.SwingConstants.CENTER, javax.swing.SwingConstants.RIGHT
setJustification(int)
public void setVisible(boolean newVisible)
newVisible
- true means text is displayedisVisible()
public boolean isVisible()
setVisible(boolean)
public void setShadowStyle(ShadowStyle newShadow) throws java.lang.IllegalArgumentException
newShadow
- the shadow attributes
java.lang.IllegalArgumentException
- if newShadow is null.getShadowStyle()
,
ShadowStyle.apply(com.sas.graphics.components.ShadowStyle)
public ShadowStyle getShadowStyle()
setShadowStyle(com.sas.graphics.components.ShadowStyle)
public java.awt.Font getRowSelectionFontStlye()
setFont(java.awt.Font)
public void setRowSelectionFontStyle(java.awt.Font newRowSelectionFont) throws java.lang.IllegalArgumentException
newRowSelectionFont
- the font to be used when drawing the text
java.lang.IllegalArgumentException
- if newRowSelectionFont is null.getFont()
public java.awt.Color getRowSelectionTextColorStlye()
setFont(java.awt.Font)
public void setRowSelectionTextColorStyle(java.awt.Color newRowSelectionColor) throws java.lang.IllegalArgumentException
newRowSelectionColor
- the color to be used when drawing the text
java.lang.IllegalArgumentException
- if newRowSelectionColor is null.getFont()
public boolean equals(java.lang.Object obj)
TextStyle
.
The result is true
if and only if the argument is not
null
and is a TextStyle
object that has the same
property values as this object.
equals
in class ModelBase
obj
- the object to test for equality with this
TextStyle
true
if the objects are the same;
false
otherwise.public int hashCode()
TextStyle
.
hashCode
in class ModelBase
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |