AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
CommonGraphvizDecorator.java
Go to the documentation of this file.
1package aud.util;
2
20public abstract class CommonGraphvizDecorator extends GraphvizDecorator {
21
22 protected String all_nodes_style = "shape=circle";
23 protected String all_edges_style = null;
24 protected String global_style = null; //"fontname=\"Helvetica\"";
25 protected String graph_style = "fontsize=24";
26 protected String graph_label = null;
27
28 protected String hilit_node_style = "style=filled,fillcolor=yellow,penwidth=2";
29 protected String hilit_edge_style = "color=red,penwidth=2";
30
31 protected String marked_node_style = "style=filled,fillcolor=lightgray,penwidth=1.5";
32 protected String marked_edge_style = "color=blue,penwidth=1.5";
33
38 public abstract void highlightNode(GraphvizDecorable object);
42 public abstract void highlightEdge(GraphvizDecorable object);
43
44 /* mark node {@code object} */
45 public abstract void markNode(GraphvizDecorable object);
47 public abstract void unmarkNode(GraphvizDecorable object);
49 public abstract void unmarkAllNodes();
50
51 /* mark edge {@code object} */
52 public abstract void markEdge(GraphvizDecorable object);
54 public abstract void unmarkEdge(GraphvizDecorable object);
56 public abstract void unmarkAllEdges();
57
59 public String getGraphLabel() { return graph_label; }
61 public void setGraphLabel(String text) { graph_label=text; }
62
67 public void clear() {
70 highlightNode(null);
71 highlightEdge(null);
72 setGraphLabel(null);
73 }
74
75 @Override public String getGraphDecoration(GraphvizDecorable object) {
76 if (graph_label!=null)
77 return "label=\""+graph_label+"\""+
78 (graph_style!=null ? ","+graph_style :"");
79 else
80 return graph_style;
81 }
82
83 @Override public String getAllNodesDecoration() { return all_nodes_style; }
84
85 @Override public String getAllEdgesDecoration() { return all_edges_style; }
86
87 @Override public String getGlobalStyle() { return global_style; }
88}
Interface for simple decorator with preset properties.
String getGlobalStyle()
get global style (returns same for all nodes/edges)
abstract void unmarkNode(GraphvizDecorable object)
unmark node object
String getGraphDecoration(GraphvizDecorable object)
get graph decoration (returns same for all nodes/edges)
String getAllNodesDecoration()
get standard decoration for all nodes (list head)
abstract void highlightNode(GraphvizDecorable object)
Set highlighted node.
String getAllEdgesDecoration()
get standard decoration for all edges (list head)
abstract void unmarkEdge(GraphvizDecorable object)
unmark edge object
abstract void unmarkAllEdges()
unmark all edges
void setGraphLabel(String text)
set label
abstract void markEdge(GraphvizDecorable object)
abstract void highlightEdge(GraphvizDecorable object)
Set highlighted edge.
void clear()
Clear all decorations.
abstract void unmarkAllNodes()
unmark all nodes
abstract void markNode(GraphvizDecorable object)
Decorator for items of Graphvizable objects.
Interface for decorating items of Graphvizable objects.