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