]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - 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
diff --git a/bundles/org.simantics.modeling.template2d.ui/scl/Simantics/DrawingTemplate.scl b/bundles/org.simantics.modeling.template2d.ui/scl/Simantics/DrawingTemplate.scl
new file mode 100644 (file)
index 0000000..bdffc3e
--- /dev/null
@@ -0,0 +1,135 @@
+import "Simantics/Variables"\r
+include "Simantics/Model"\r
+import "Simantics/Misc"\r
+import "Simantics/Library"\r
+import "Simantics/Diagram"\r
+import "Simantics/Flag"\r
+//import "Simantics/DB"\r
+//import "Simantics/Entity"\r
+\r
+// --- Entity types -------------------------------------------------\r
+\r
+type DrawingTemplate = Resource\r
+type DrawingTemplateLibrary = Resource\r
+type FlagTable = Resource\r
+type VisualComposite = Resource\r
+type FlagTypeVisual = Resource\r
+type VisualFilter = Resource\r
+type Monitor = Resource\r
+type SVGImage = Resource\r
+\r
+importJava "org.simantics.modeling.template2d.ui.actions.NewDrawingTemplate" where\r
+    @JavaName createDrawingTemplate\r
+    """\r
+    Creates new Drawing Template under the given Drawing Template library instance. Returns the created Drawing Template.\r
+    """\r
+    createDrawingTemplate :: DrawingTemplateLibrary -> <WriteGraph> DrawingTemplate\r
+    \r
+    @JavaName getDrawingTemplateLibrary\r
+    """\r
+    Returns the Drawing Template library folder of the given Model instance.\r
+    """\r
+    drawingTemplateLibraryOf :: Model -> <ReadGraph> DrawingTemplateLibrary \r
+    \r
+importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTable" where\r
+    @JavaName createFlagTable\r
+    """\r
+    Creates new Flag Table under the given Drawing Template instance. Returns the created Flag Table.\r
+    """\r
+    createFlagTable :: DrawingTemplate -> <WriteGraph> FlagTable\r
+    \r
+importJava "org.simantics.modeling.template2d.ui.actions.NewScenegraph" where\r
+    @JavaName createVisualComposite\r
+    """\r
+    Creates new Visual Composite under the given Drawing Template instance. Returns the created Visual Composite.\r
+    """\r
+    createVisualComposite :: DrawingTemplate -> <WriteGraph> VisualComposite\r
+    \r
+importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisual" where\r
+    @JavaName createNewFlagTypeVisual\r
+    """\r
+    Creates new FlagTypeVisual under the given Flag Table instance. Returns the created FlagTypeVisual\r
+    """\r
+    createFlagTypeVisual :: FlagTable -> <WriteGraph> FlagTypeVisual\r
+\r
+importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisualFilter" where\r
+    @JavaName createNewFilter\r
+    """\r
+    Creates new Filter under the given Flag Table instance. Returns the created Filter.\r
+    """\r
+    createFilter :: FlagTable -> <WriteGraph> VisualFilter\r
+\r
+importJava "org.simantics.modeling.template2d.ui.actions.NewMonitor" where\r
+    @JavaName createNewMonitor\r
+    """\r
+    Creates new Monitor under the given Flag Table instance. Returns the created Monitor.\r
+    """\r
+    createMonitor :: FlagTable -> <WriteGraph> Monitor\r
+    \r
+    @JavaName createNewMonitor\r
+    """\r
+    Creates new Monitor under the given Visual Composite instance. Returns the created Monitor.\r
+    """\r
+    createMonitorInComposite :: VisualComposite -> <WriteGraph> Monitor\r
+    \r
+importJava "org.simantics.modeling.template2d.ui.actions.NewSVGImage" where\r
+    @JavaName createNewSVGImage\r
+    """\r
+    Creates new SVG image under the given Flag Table instance. Returns the created SVG Image.\r
+    """\r
+    createImageInTable :: FlagTable -> <WriteGraph> SVGImage\r
+    \r
+    @JavaName createNewSVGImage\r
+    """\r
+    Creates new SVG image under the given Visual Composite instance. Returns the created SVG Image.\r
+    """\r
+    createImageInComposite :: VisualComposite -> <WriteGraph> SVGImage\r
+\r
+importJava "org.simantics.modeling.template2d.ui.wizard.DrawingTemplateExporter" where\r
+    @JavaName doExport\r
+    """\r
+    Exports the given Drawing Template to the given File location\r
+    """\r
+    exportDrawingTemplate :: File -> DrawingTemplate -> <Proc> ()\r
+\r
+importJava "org.simantics.modeling.template2d.ui.actions.AssignDrawingTemplate" where\r
+    @Javaname assignTemplateToDiagram\r
+    """\r
+    Assigns the given Drawing Template to the given Diagram instance\r
+    """\r
+    assignTemplateToDiagrams :: [Diagram] -> DrawingTemplate -> <WriteGraph> ()\r
+\r
+assignTemplateToDiagram :: Diagram -> DrawingTemplate -> <WriteGraph> ()\r
+assignTemplateToDiagram diagram template = assignTemplateToDiagrams [diagram] template\r
+\r
+importJava "org.simantics.modeling.ui.SCLLibrary" where\r
+    @JavaName createLibrary\r
+    """\r
+    Creates a new Library under the given Drawing Template parameter. Returns the created Library.\r
+    """\r
+    createLibraryInTemplate :: DrawingTemplate -> <Proc> Library\r
+\r
+importJava "org.simantics.modeling.ModelingUtils" where\r
+    importDrawingTemplate :: Model -> File -> <Proc> Resource\r
+\r
+setMonitorPropertyValue :: Monitor -> String -> String -> <WriteGraph> ()\r
+setMonitorPropertyValue monitor property newValue = do\r
+    monitorUri = uriOf (toResource monitor)\r
+    completeUri = monitorUri + "#" + property + "#HasDisplayValue"\r
+    propertyVariable = variable completeUri\r
+    setValue propertyVariable newValue\r
+    \r
+setFlagTablePropertyValue :: FlagTable -> String -> String -> <WriteGraph> ()\r
+setFlagTablePropertyValue flagTable property newValue = do\r
+    flagTableUri = uriOf (toResource flagTable)\r
+    completeUri = flagTableUri + "#" + property + "#HasDisplayValue"\r
+    propertyVariable = variable completeUri\r
+    setValue propertyVariable newValue\r
+\r
+importJava "org.simantics.modeling.ui.SCLDiagramTemplate" where\r
+    templateComposite :: Variable -> <ReadGraph> Variable\r
+    templateDiagram :: Variable -> <ReadGraph> Variable\r
+    templateModel :: Variable -> <ReadGraph> Variable\r
+\r
+importJava "org.simantics.diagram.flag.IOTableUtil" where\r
+    bindFlagToTable :: Diagram -> Flag -> Double -> Double -> <WriteGraph> Boolean\r