|
||||||||||
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.StrokeAction
public class StrokeAction
Assignment Action that assigns Stroke
values to VisualItems.
The Stroke instance determines how lines and shape outlines are drawn,
including the base size of the line, the line endings and line join types,
and whether the line is solid or dashed. By default, a StrokeAction simply
sets each VisualItem to use a default 1-pixel wide solid line. Clients can
change this default value to achieve uniform Stroke assignment, or can add
any number of additional rules for Stroke assignment.
Rules are specified by a Predicate instance which, if returning true, will
trigger that rule, causing either the provided Stroke value or the result of
a delegate StrokeAction to be applied. Rules are evaluated in the order in
which they are added to the StrokeAction, so earlier rules will have
precedence over rules added later.
In addition, subclasses can simply override
getStroke(VisualItem)
to achieve custom Stroke assignment. In some
cases, this may be the simplest or most flexible approach.
Field Summary | |
---|---|
protected java.awt.BasicStroke |
defaultStroke
|
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 | |
---|---|
StrokeAction()
Create a new StrokeAction that processes all data groups. |
|
StrokeAction(java.lang.String group)
Create a new StrokeAction that processes the specified group. |
|
StrokeAction(java.lang.String group,
java.awt.BasicStroke defaultStroke)
Create a new StrokeAction that processes the specified group. |
Method Summary | |
---|---|
void |
add(Predicate p,
java.awt.BasicStroke stroke)
Add a mapping rule to this StrokeAction. |
void |
add(Predicate p,
StrokeAction f)
Add a mapping rule to this StrokeAction. |
void |
add(java.lang.String expr,
java.awt.BasicStroke stroke)
Add a mapping rule to this StrokeAction. |
void |
add(java.lang.String expr,
StrokeAction f)
Add a mapping rule to this StrokeAction. |
java.awt.BasicStroke |
getDefaultStroke()
Get the default BasicStroke assigned to items. |
java.awt.BasicStroke |
getStroke(VisualItem item)
Returns the stroke to use for a given VisualItem. |
void |
process(VisualItem item,
double frac)
Processes an individual item. |
void |
setDefaultStroke(java.awt.BasicStroke f)
Set the default BasicStroke 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.BasicStroke defaultStroke
Constructor Detail |
---|
public StrokeAction()
public StrokeAction(java.lang.String group)
group
- the data group to processpublic StrokeAction(java.lang.String group, java.awt.BasicStroke defaultStroke)
group
- the data group to processdefaultStroke
- the default Stroke to assignMethod Detail |
---|
public void setDefaultStroke(java.awt.BasicStroke f)
f
- the default BasicStroke to usepublic java.awt.BasicStroke getDefaultStroke()
public void add(Predicate p, java.awt.BasicStroke stroke)
p
- the rule Predicatestroke
- the BasicStrokepublic void add(java.lang.String expr, java.awt.BasicStroke stroke)
expr
- the expression String, should parse to a Predicate.stroke
- the BasicStroke
java.lang.RuntimeException
- if the expression does not parse correctly or
does not result in a Predicate instance.public void add(Predicate p, StrokeAction f)
p
- the rule Predicatef
- the delegate StrokeAction to usepublic void add(java.lang.String expr, StrokeAction f)
expr
- the expression String, should parse to a Predicate.f
- the delegate StrokeAction 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.BasicStroke getStroke(VisualItem item)
item
- the VisualItem for which to get the Stroke
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |