parent nodes: PrefuseDoku
Actions
We are in packages:
http://www.prefuse.org/doc/api/prefuse/action/package-summary.html and http://www.prefuse.org/doc/api/prefuse/action/assignment/package-summary.html
ActionList
This is a container for Actions that are executed in a chain.ActionList draw = new ActionList();
draw.add(nodeTextAction);
draw.add(nodeStrokeAction);
draw.add(nodeFillAction);
draw.add(edgeStrokesAction);
ColorActions
With ColorActions you can define of course the color for items.
// instantiate a colorAction for a specified group, what it is applied to and a default color
ColorAction colorAction = new ColorAction("group", VisualItem.FILLCOLOR, ColorLib.rgba(255,255,255,0));
// set color for the current focus group
colorAction.add("ingroup('_focus_')", ColorLib.rgba(198,229,229,230));
// set color for hover
colorAction.add("_hover", ColorLib.gray(220,230));
// set color for search results
colorAction.add("ingroup('_search_')", ColorLib.rgba(200,100,0,230));
// set color for highlighted nodes
colorAction.add("_highlight", ColorLib.rgb(255,200,125));SizeAction
With SizeActions you can define at what size items are displayed.
// sets the size to the specified group
SizeAction edgeSizeAction = new SizeAction("group");
// add a filter and a max value
edgeSizeAction.add(expression, 5);FontAction
// sets a group to current font for text that is displayed
FontAction fonts = new FontAction(NODES, FontLib.getFont("Tahoma", 10));ShapeAction
StrokeAction
You can create your own strokes.
The following example assigns a dotted stroke to the edges selected by the expression.BasicStroke basicStroke = new BasicStroke(
2f, // width
BasicStroke.CAP_BUTT, // end style
BasicStroke.JOIN_ROUND, // join style
1f, //limit for join
new float[]{5,15}, //dashes (visible, invisible)
0 //offset
);
StrokeAction edgeStrokeAction = new StrokeAction(EDGES);
edgeStrokeAction.add(expression, basicStroke);DataColorAction
// arguments are: group, field, dataType, colorField, int[] palette
// if you do not provide a palette a gray scaling is used
DataColorAction nodeDataColorAction = new DataColorAction(NODES, SIZE, Constants.NUMERICAL, VisualItem.FILLCOLOR, ColorLib.getInterpolatedPalette(ColorLib.rgb(200,0, 0), ColorLib.rgb(0,0, 200)));
A working example can be found at HelloWorldColoredNodes.
DataShapeAction
DataSizeAction
DataSizeAction dsa = new DataSizeAction("group", "field");
dsa.setMaximumSize(value);