1 import "Simantics/Variables"
2 include "Simantics/Model"
3 import "Simantics/Misc"
4 import "Simantics/Library"
5 import "Simantics/Diagram"
6 import "Simantics/Flag"
7 //import "Simantics/DB"
8 //import "Simantics/Entity"
10 // --- Entity types -------------------------------------------------
12 type DrawingTemplate = Resource
13 type DrawingTemplateLibrary = Resource
14 type FlagTable = Resource
15 type VisualComposite = Resource
16 type FlagTypeVisual = Resource
17 type VisualFilter = Resource
18 type Monitor = Resource
19 type SVGImage = Resource
21 importJava "org.simantics.modeling.template2d.ui.actions.NewDrawingTemplate" where
22 @JavaName createDrawingTemplate
24 Creates new Drawing Template under the given Drawing Template library instance. Returns the created Drawing Template.
26 createDrawingTemplate :: DrawingTemplateLibrary -> <WriteGraph> DrawingTemplate
28 @JavaName getDrawingTemplateLibrary
30 Returns the Drawing Template library folder of the given Model instance.
32 drawingTemplateLibraryOf :: Model -> <ReadGraph> DrawingTemplateLibrary
34 importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTable" where
35 @JavaName createFlagTable
37 Creates new Flag Table under the given Drawing Template instance. Returns the created Flag Table.
39 createFlagTable :: DrawingTemplate -> <WriteGraph> FlagTable
41 importJava "org.simantics.modeling.template2d.ui.actions.NewScenegraph" where
42 @JavaName createVisualComposite
44 Creates new Visual Composite under the given Drawing Template instance. Returns the created Visual Composite.
46 createVisualComposite :: DrawingTemplate -> <WriteGraph> VisualComposite
48 importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisual" where
49 @JavaName createNewFlagTypeVisual
51 Creates new FlagTypeVisual under the given Flag Table instance. Returns the created FlagTypeVisual
53 createFlagTypeVisual :: FlagTable -> <WriteGraph> FlagTypeVisual
55 importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisualFilter" where
56 @JavaName createNewFilter
58 Creates new Filter under the given Flag Table instance. Returns the created Filter.
60 createFilter :: FlagTable -> <WriteGraph> VisualFilter
62 importJava "org.simantics.modeling.template2d.ui.actions.NewMonitor" where
63 @JavaName createNewMonitor
65 Creates new Monitor under the given Flag Table instance. Returns the created Monitor.
67 createMonitor :: FlagTable -> <WriteGraph> Monitor
69 @JavaName createNewMonitor
71 Creates new Monitor under the given Visual Composite instance. Returns the created Monitor.
73 createMonitorInComposite :: VisualComposite -> <WriteGraph> Monitor
75 importJava "org.simantics.modeling.template2d.ui.actions.NewSVGImage" where
76 @JavaName createNewSVGImage
78 Creates new SVG image under the given Flag Table instance. Returns the created SVG Image.
80 createImageInTable :: FlagTable -> <WriteGraph> SVGImage
82 @JavaName createNewSVGImage
84 Creates new SVG image under the given Visual Composite instance. Returns the created SVG Image.
86 createImageInComposite :: VisualComposite -> <WriteGraph> SVGImage
88 importJava "org.simantics.modeling.template2d.ui.wizard.DrawingTemplateExporter" where
91 Exports the given Drawing Template to the given File location
93 exportDrawingTemplate :: File -> DrawingTemplate -> <Proc> ()
95 importJava "org.simantics.modeling.template2d.ui.actions.AssignDrawingTemplate" where
96 @Javaname assignTemplateToDiagram
98 Assigns the given Drawing Template to the given Diagram instance
100 assignTemplateToDiagrams :: [Diagram] -> DrawingTemplate -> <WriteGraph> ()
102 assignTemplateToDiagram :: Diagram -> DrawingTemplate -> <WriteGraph> ()
103 assignTemplateToDiagram diagram template = assignTemplateToDiagrams [diagram] template
105 importJava "org.simantics.modeling.ui.SCLLibrary" where
106 @JavaName createLibrary
108 Creates a new Library under the given Drawing Template parameter. Returns the created Library.
110 createLibraryInTemplate :: DrawingTemplate -> <Proc> Library
112 importJava "org.simantics.modeling.ModelingUtils" where
113 importDrawingTemplate :: Model -> File -> <Proc> Resource
115 setMonitorPropertyValue :: Monitor -> String -> String -> <WriteGraph> ()
116 setMonitorPropertyValue monitor property newValue = do
117 monitorUri = uriOf monitor
118 completeUri = monitorUri + "#" + property + "#HasDisplayValue"
119 propertyVariable = variable completeUri
120 setValue propertyVariable newValue
122 setFlagTablePropertyValue :: FlagTable -> String -> String -> <WriteGraph> ()
123 setFlagTablePropertyValue flagTable property newValue = do
124 flagTableUri = uriOf flagTable
125 completeUri = flagTableUri + "#" + property + "#HasDisplayValue"
126 propertyVariable = variable completeUri
127 setValue propertyVariable newValue
129 importJava "org.simantics.modeling.ui.SCLDiagramTemplate" where
130 templateComposite :: Variable -> <ReadGraph> Variable
131 templateDiagram :: Variable -> <ReadGraph> Variable
132 templateModel :: Variable -> <ReadGraph> Variable
134 importJava "org.simantics.diagram.flag.IOTableUtil" where
135 bindFlagToTable :: Diagram -> Flag -> Double -> Double -> <WriteGraph> Boolean