|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object prefuse.activity.Activity prefuse.action.Action prefuse.action.GroupAction prefuse.action.ItemAction prefuse.action.EncoderAction prefuse.action.assignment.FontAction
public class FontAction
Assignment Action that assigns font values to VisualItems. By default, a FontAction simply sets each VisualItem to use a default 10 point sans-serif font (10 point sans-serif). Clients can change this default value to achieve uniform font assignment, or can add any number of additional rules for font assignment. Rules are specified by a Predicate instance which, if returning true, will trigger that rule, causing either the provided font value or the result of a delegate FontAction to be applied. Rules are evaluated in the order in which they are added to the FontAction, so earlier rules will have precedence over rules added later.
In addition, subclasses can simply override getFont(VisualItem)
to achieve custom font assignment. In some cases, this may be the simplest
or most flexible approach.
Field Summary | |
---|---|
protected java.awt.Font |
defaultFont
|
Fields inherited from class prefuse.action.ItemAction |
---|
m_predicate |
Fields inherited from class prefuse.action.GroupAction |
---|
m_group |
Fields inherited from class prefuse.action.Action |
---|
m_vis |
Fields inherited from class prefuse.activity.Activity |
---|
DEFAULT_STEP_TIME, INFINITY |
Constructor Summary | |
---|---|
FontAction()
Create a new FontAction that processes all data groups. |
|
FontAction(java.lang.String group)
Create a new FontAction that processes the specified group. |
|
FontAction(java.lang.String group,
java.awt.Font defaultFont)
Create a new FontAction that processes the specified group. |
Method Summary | |
---|---|
void |
add(Predicate p,
java.awt.Font font)
Add a font mapping rule to this FontAction. |
void |
add(Predicate p,
FontAction f)
Add a font mapping rule to this FontAction. |
void |
add(java.lang.String expr,
java.awt.Font font)
Add a font mapping rule to this FontAction. |
void |
add(java.lang.String expr,
FontAction f)
Add a font mapping rule to this FontAction. |
java.awt.Font |
getDefaultFont()
Get the default font assigned to items. |
java.awt.Font |
getFont(VisualItem item)
Returns the Font to use for a given VisualItem. |
void |
process(VisualItem item,
double frac)
Processes an individual item. |
void |
setDefaultFont(java.awt.Font f)
Set the default font to be assigned to items. |
Methods inherited from class prefuse.action.EncoderAction |
---|
add, clear, finish, lookup, remove, run, setup, setVisualization |
Methods inherited from class prefuse.action.ItemAction |
---|
getFilterPredicate, setFilterPredicate |
Methods inherited from class prefuse.action.GroupAction |
---|
getGroup, setGroup |
Methods inherited from class prefuse.action.Action |
---|
getVisualization, run |
Methods inherited from class prefuse.activity.Activity |
---|
addActivityListener, alwaysRunAfter, cancel, fireActivityCancelled, fireActivityFinished, fireActivityScheduled, fireActivityStarted, fireActivityStepped, getDuration, getNextTime, getPace, getPacingFunction, getStartTime, getStepTime, getStopTime, isEnabled, isRunning, isScheduled, removeActivityListener, run, runAfter, runAt, setDuration, setEnabled, setPacingFunction, setStartTime, setStepTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.Font defaultFont
Constructor Detail |
---|
public FontAction()
public FontAction(java.lang.String group)
group
- the data group to processpublic FontAction(java.lang.String group, java.awt.Font defaultFont)
group
- the data group to processdefaultFont
- the default Font to assignMethod Detail |
---|
public void setDefaultFont(java.awt.Font f)
f
- the default font to usepublic java.awt.Font getDefaultFont()
public void add(Predicate p, java.awt.Font font)
p
- the rule Predicatefont
- the fontpublic void add(java.lang.String expr, java.awt.Font font)
expr
- the expression String, should parse to a Predicate.font
- the font
java.lang.RuntimeException
- if the expression does not parse correctly or
does not result in a Predicate instance.public void add(Predicate p, FontAction f)
p
- the rule Predicatef
- the delegate FontAction to usepublic void add(java.lang.String expr, FontAction f)
expr
- the expression String, should parse to a Predicate.f
- the delegate FontAction to use
java.lang.RuntimeException
- if the expression does not parse correctly or
does not result in a Predicate instance.public void process(VisualItem item, double frac)
ItemAction
process
in class ItemAction
item
- the VisualItem to processfrac
- the fraction of elapsed duration timeItemAction.process(prefuse.visual.VisualItem, double)
public java.awt.Font getFont(VisualItem item)
item
- the VisualItem for which to get the Font
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |