]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.graphviz/scl/Visualization/Graphviz/Graph.scl
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.graphviz / scl / Visualization / Graphviz / Graph.scl
1 import "Visualization/Graphviz/AbstractTypes"
2 import "Visualization/Graphviz/Property"
3 import "JavaBuiltin" as Java
4
5 importJava "org.simantics.graphviz.Graph" where
6     data Graph
7     @JavaName "<init>"
8     newPrimitiveGraph :: <Proc> Graph
9     setLabel :: Graph -> String -> <Proc> ()
10     setRankdir :: Graph -> String -> <Proc> ()
11     @JavaName set
12     setGenericProperty :: Graph -> String -> String -> <Proc> ()
13
14 instance IGraph Graph where
15     iGraph = Java.unsafeCoerce
16
17 applyGraphProperty :: Graph -> Property -> <Proc> ()
18 applyGraphProperty graph (Label str) = setLabel graph str
19 applyGraphProperty graph (Rankdir str) = setRankdir graph str
20 applyGraphProperty graph (GenericProperty property str) = setGenericProperty graph property str
21     
22 newGraph :: [Property] -> <Proc> Graph
23 newGraph properties = graph
24   where
25     graph = newPrimitiveGraph
26     for properties (applyGraphProperty graph)