]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.template2d.ui/scl/Simantics/DrawingTemplate.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.modeling.template2d.ui / scl / Simantics / DrawingTemplate.scl
1 import "Simantics/Variables"\r
2 include "Simantics/Model"\r
3 import "Simantics/Misc"\r
4 import "Simantics/Library"\r
5 import "Simantics/Diagram"\r
6 import "Simantics/Flag"\r
7 //import "Simantics/DB"\r
8 //import "Simantics/Entity"\r
9 \r
10 // --- Entity types -------------------------------------------------\r
11 \r
12 type DrawingTemplate = Resource\r
13 type DrawingTemplateLibrary = Resource\r
14 type FlagTable = Resource\r
15 type VisualComposite = Resource\r
16 type FlagTypeVisual = Resource\r
17 type VisualFilter = Resource\r
18 type Monitor = Resource\r
19 type SVGImage = Resource\r
20 \r
21 importJava "org.simantics.modeling.template2d.ui.actions.NewDrawingTemplate" where\r
22     @JavaName createDrawingTemplate\r
23     """\r
24     Creates new Drawing Template under the given Drawing Template library instance. Returns the created Drawing Template.\r
25     """\r
26     createDrawingTemplate :: DrawingTemplateLibrary -> <WriteGraph> DrawingTemplate\r
27     \r
28     @JavaName getDrawingTemplateLibrary\r
29     """\r
30     Returns the Drawing Template library folder of the given Model instance.\r
31     """\r
32     drawingTemplateLibraryOf :: Model -> <ReadGraph> DrawingTemplateLibrary \r
33     \r
34 importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTable" where\r
35     @JavaName createFlagTable\r
36     """\r
37     Creates new Flag Table under the given Drawing Template instance. Returns the created Flag Table.\r
38     """\r
39     createFlagTable :: DrawingTemplate -> <WriteGraph> FlagTable\r
40     \r
41 importJava "org.simantics.modeling.template2d.ui.actions.NewScenegraph" where\r
42     @JavaName createVisualComposite\r
43     """\r
44     Creates new Visual Composite under the given Drawing Template instance. Returns the created Visual Composite.\r
45     """\r
46     createVisualComposite :: DrawingTemplate -> <WriteGraph> VisualComposite\r
47     \r
48 importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisual" where\r
49     @JavaName createNewFlagTypeVisual\r
50     """\r
51     Creates new FlagTypeVisual under the given Flag Table instance. Returns the created FlagTypeVisual\r
52     """\r
53     createFlagTypeVisual :: FlagTable -> <WriteGraph> FlagTypeVisual\r
54 \r
55 importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisualFilter" where\r
56     @JavaName createNewFilter\r
57     """\r
58     Creates new Filter under the given Flag Table instance. Returns the created Filter.\r
59     """\r
60     createFilter :: FlagTable -> <WriteGraph> VisualFilter\r
61 \r
62 importJava "org.simantics.modeling.template2d.ui.actions.NewMonitor" where\r
63     @JavaName createNewMonitor\r
64     """\r
65     Creates new Monitor under the given Flag Table instance. Returns the created Monitor.\r
66     """\r
67     createMonitor :: FlagTable -> <WriteGraph> Monitor\r
68     \r
69     @JavaName createNewMonitor\r
70     """\r
71     Creates new Monitor under the given Visual Composite instance. Returns the created Monitor.\r
72     """\r
73     createMonitorInComposite :: VisualComposite -> <WriteGraph> Monitor\r
74     \r
75 importJava "org.simantics.modeling.template2d.ui.actions.NewSVGImage" where\r
76     @JavaName createNewSVGImage\r
77     """\r
78     Creates new SVG image under the given Flag Table instance. Returns the created SVG Image.\r
79     """\r
80     createImageInTable :: FlagTable -> <WriteGraph> SVGImage\r
81     \r
82     @JavaName createNewSVGImage\r
83     """\r
84     Creates new SVG image under the given Visual Composite instance. Returns the created SVG Image.\r
85     """\r
86     createImageInComposite :: VisualComposite -> <WriteGraph> SVGImage\r
87 \r
88 importJava "org.simantics.modeling.template2d.ui.wizard.DrawingTemplateExporter" where\r
89     @JavaName doExport\r
90     """\r
91     Exports the given Drawing Template to the given File location\r
92     """\r
93     exportDrawingTemplate :: File -> DrawingTemplate -> <Proc> ()\r
94 \r
95 importJava "org.simantics.modeling.template2d.ui.actions.AssignDrawingTemplate" where\r
96     @Javaname assignTemplateToDiagram\r
97     """\r
98     Assigns the given Drawing Template to the given Diagram instance\r
99     """\r
100     assignTemplateToDiagrams :: [Diagram] -> DrawingTemplate -> <WriteGraph> ()\r
101 \r
102 assignTemplateToDiagram :: Diagram -> DrawingTemplate -> <WriteGraph> ()\r
103 assignTemplateToDiagram diagram template = assignTemplateToDiagrams [diagram] template\r
104 \r
105 importJava "org.simantics.modeling.ui.SCLLibrary" where\r
106     @JavaName createLibrary\r
107     """\r
108     Creates a new Library under the given Drawing Template parameter. Returns the created Library.\r
109     """\r
110     createLibraryInTemplate :: DrawingTemplate -> <Proc> Library\r
111 \r
112 importJava "org.simantics.modeling.ModelingUtils" where\r
113     importDrawingTemplate :: Model -> File -> <Proc> Resource\r
114 \r
115 setMonitorPropertyValue :: Monitor -> String -> String -> <WriteGraph> ()\r
116 setMonitorPropertyValue monitor property newValue = do\r
117     monitorUri = uriOf (toResource monitor)\r
118     completeUri = monitorUri + "#" + property + "#HasDisplayValue"\r
119     propertyVariable = variable completeUri\r
120     setValue propertyVariable newValue\r
121     \r
122 setFlagTablePropertyValue :: FlagTable -> String -> String -> <WriteGraph> ()\r
123 setFlagTablePropertyValue flagTable property newValue = do\r
124     flagTableUri = uriOf (toResource flagTable)\r
125     completeUri = flagTableUri + "#" + property + "#HasDisplayValue"\r
126     propertyVariable = variable completeUri\r
127     setValue propertyVariable newValue\r
128 \r
129 importJava "org.simantics.modeling.ui.SCLDiagramTemplate" where\r
130     templateComposite :: Variable -> <ReadGraph> Variable\r
131     templateDiagram :: Variable -> <ReadGraph> Variable\r
132     templateModel :: Variable -> <ReadGraph> Variable\r
133 \r
134 importJava "org.simantics.diagram.flag.IOTableUtil" where\r
135     bindFlagToTable :: Diagram -> Flag -> Double -> Double -> <WriteGraph> Boolean\r