X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.modeling.template2d.ui%2Fscl%2FSimantics%2FDrawingTemplate.scl;fp=bundles%2Forg.simantics.modeling.template2d.ui%2Fscl%2FSimantics%2FDrawingTemplate.scl;h=34b4f82f27767631e6b108b949affa7a0639abb8;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=bdffc3ec463cbf771298c4648ae489aae79f7c9a;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.template2d.ui/scl/Simantics/DrawingTemplate.scl b/bundles/org.simantics.modeling.template2d.ui/scl/Simantics/DrawingTemplate.scl index bdffc3ec4..34b4f82f2 100644 --- a/bundles/org.simantics.modeling.template2d.ui/scl/Simantics/DrawingTemplate.scl +++ b/bundles/org.simantics.modeling.template2d.ui/scl/Simantics/DrawingTemplate.scl @@ -1,135 +1,135 @@ -import "Simantics/Variables" -include "Simantics/Model" -import "Simantics/Misc" -import "Simantics/Library" -import "Simantics/Diagram" -import "Simantics/Flag" -//import "Simantics/DB" -//import "Simantics/Entity" - -// --- Entity types ------------------------------------------------- - -type DrawingTemplate = Resource -type DrawingTemplateLibrary = Resource -type FlagTable = Resource -type VisualComposite = Resource -type FlagTypeVisual = Resource -type VisualFilter = Resource -type Monitor = Resource -type SVGImage = Resource - -importJava "org.simantics.modeling.template2d.ui.actions.NewDrawingTemplate" where - @JavaName createDrawingTemplate - """ - Creates new Drawing Template under the given Drawing Template library instance. Returns the created Drawing Template. - """ - createDrawingTemplate :: DrawingTemplateLibrary -> DrawingTemplate - - @JavaName getDrawingTemplateLibrary - """ - Returns the Drawing Template library folder of the given Model instance. - """ - drawingTemplateLibraryOf :: Model -> DrawingTemplateLibrary - -importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTable" where - @JavaName createFlagTable - """ - Creates new Flag Table under the given Drawing Template instance. Returns the created Flag Table. - """ - createFlagTable :: DrawingTemplate -> FlagTable - -importJava "org.simantics.modeling.template2d.ui.actions.NewScenegraph" where - @JavaName createVisualComposite - """ - Creates new Visual Composite under the given Drawing Template instance. Returns the created Visual Composite. - """ - createVisualComposite :: DrawingTemplate -> VisualComposite - -importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisual" where - @JavaName createNewFlagTypeVisual - """ - Creates new FlagTypeVisual under the given Flag Table instance. Returns the created FlagTypeVisual - """ - createFlagTypeVisual :: FlagTable -> FlagTypeVisual - -importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisualFilter" where - @JavaName createNewFilter - """ - Creates new Filter under the given Flag Table instance. Returns the created Filter. - """ - createFilter :: FlagTable -> VisualFilter - -importJava "org.simantics.modeling.template2d.ui.actions.NewMonitor" where - @JavaName createNewMonitor - """ - Creates new Monitor under the given Flag Table instance. Returns the created Monitor. - """ - createMonitor :: FlagTable -> Monitor - - @JavaName createNewMonitor - """ - Creates new Monitor under the given Visual Composite instance. Returns the created Monitor. - """ - createMonitorInComposite :: VisualComposite -> Monitor - -importJava "org.simantics.modeling.template2d.ui.actions.NewSVGImage" where - @JavaName createNewSVGImage - """ - Creates new SVG image under the given Flag Table instance. Returns the created SVG Image. - """ - createImageInTable :: FlagTable -> SVGImage - - @JavaName createNewSVGImage - """ - Creates new SVG image under the given Visual Composite instance. Returns the created SVG Image. - """ - createImageInComposite :: VisualComposite -> SVGImage - -importJava "org.simantics.modeling.template2d.ui.wizard.DrawingTemplateExporter" where - @JavaName doExport - """ - Exports the given Drawing Template to the given File location - """ - exportDrawingTemplate :: File -> DrawingTemplate -> () - -importJava "org.simantics.modeling.template2d.ui.actions.AssignDrawingTemplate" where - @Javaname assignTemplateToDiagram - """ - Assigns the given Drawing Template to the given Diagram instance - """ - assignTemplateToDiagrams :: [Diagram] -> DrawingTemplate -> () - -assignTemplateToDiagram :: Diagram -> DrawingTemplate -> () -assignTemplateToDiagram diagram template = assignTemplateToDiagrams [diagram] template - -importJava "org.simantics.modeling.ui.SCLLibrary" where - @JavaName createLibrary - """ - Creates a new Library under the given Drawing Template parameter. Returns the created Library. - """ - createLibraryInTemplate :: DrawingTemplate -> Library - -importJava "org.simantics.modeling.ModelingUtils" where - importDrawingTemplate :: Model -> File -> Resource - -setMonitorPropertyValue :: Monitor -> String -> String -> () -setMonitorPropertyValue monitor property newValue = do - monitorUri = uriOf (toResource monitor) - completeUri = monitorUri + "#" + property + "#HasDisplayValue" - propertyVariable = variable completeUri - setValue propertyVariable newValue - -setFlagTablePropertyValue :: FlagTable -> String -> String -> () -setFlagTablePropertyValue flagTable property newValue = do - flagTableUri = uriOf (toResource flagTable) - completeUri = flagTableUri + "#" + property + "#HasDisplayValue" - propertyVariable = variable completeUri - setValue propertyVariable newValue - -importJava "org.simantics.modeling.ui.SCLDiagramTemplate" where - templateComposite :: Variable -> Variable - templateDiagram :: Variable -> Variable - templateModel :: Variable -> Variable - -importJava "org.simantics.diagram.flag.IOTableUtil" where - bindFlagToTable :: Diagram -> Flag -> Double -> Double -> Boolean +import "Simantics/Variables" +include "Simantics/Model" +import "Simantics/Misc" +import "Simantics/Library" +import "Simantics/Diagram" +import "Simantics/Flag" +//import "Simantics/DB" +//import "Simantics/Entity" + +// --- Entity types ------------------------------------------------- + +type DrawingTemplate = Resource +type DrawingTemplateLibrary = Resource +type FlagTable = Resource +type VisualComposite = Resource +type FlagTypeVisual = Resource +type VisualFilter = Resource +type Monitor = Resource +type SVGImage = Resource + +importJava "org.simantics.modeling.template2d.ui.actions.NewDrawingTemplate" where + @JavaName createDrawingTemplate + """ + Creates new Drawing Template under the given Drawing Template library instance. Returns the created Drawing Template. + """ + createDrawingTemplate :: DrawingTemplateLibrary -> DrawingTemplate + + @JavaName getDrawingTemplateLibrary + """ + Returns the Drawing Template library folder of the given Model instance. + """ + drawingTemplateLibraryOf :: Model -> DrawingTemplateLibrary + +importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTable" where + @JavaName createFlagTable + """ + Creates new Flag Table under the given Drawing Template instance. Returns the created Flag Table. + """ + createFlagTable :: DrawingTemplate -> FlagTable + +importJava "org.simantics.modeling.template2d.ui.actions.NewScenegraph" where + @JavaName createVisualComposite + """ + Creates new Visual Composite under the given Drawing Template instance. Returns the created Visual Composite. + """ + createVisualComposite :: DrawingTemplate -> VisualComposite + +importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisual" where + @JavaName createNewFlagTypeVisual + """ + Creates new FlagTypeVisual under the given Flag Table instance. Returns the created FlagTypeVisual + """ + createFlagTypeVisual :: FlagTable -> FlagTypeVisual + +importJava "org.simantics.modeling.template2d.ui.actions.NewFlagTypeVisualFilter" where + @JavaName createNewFilter + """ + Creates new Filter under the given Flag Table instance. Returns the created Filter. + """ + createFilter :: FlagTable -> VisualFilter + +importJava "org.simantics.modeling.template2d.ui.actions.NewMonitor" where + @JavaName createNewMonitor + """ + Creates new Monitor under the given Flag Table instance. Returns the created Monitor. + """ + createMonitor :: FlagTable -> Monitor + + @JavaName createNewMonitor + """ + Creates new Monitor under the given Visual Composite instance. Returns the created Monitor. + """ + createMonitorInComposite :: VisualComposite -> Monitor + +importJava "org.simantics.modeling.template2d.ui.actions.NewSVGImage" where + @JavaName createNewSVGImage + """ + Creates new SVG image under the given Flag Table instance. Returns the created SVG Image. + """ + createImageInTable :: FlagTable -> SVGImage + + @JavaName createNewSVGImage + """ + Creates new SVG image under the given Visual Composite instance. Returns the created SVG Image. + """ + createImageInComposite :: VisualComposite -> SVGImage + +importJava "org.simantics.modeling.template2d.ui.wizard.DrawingTemplateExporter" where + @JavaName doExport + """ + Exports the given Drawing Template to the given File location + """ + exportDrawingTemplate :: File -> DrawingTemplate -> () + +importJava "org.simantics.modeling.template2d.ui.actions.AssignDrawingTemplate" where + @Javaname assignTemplateToDiagram + """ + Assigns the given Drawing Template to the given Diagram instance + """ + assignTemplateToDiagrams :: [Diagram] -> DrawingTemplate -> () + +assignTemplateToDiagram :: Diagram -> DrawingTemplate -> () +assignTemplateToDiagram diagram template = assignTemplateToDiagrams [diagram] template + +importJava "org.simantics.modeling.ui.SCLLibrary" where + @JavaName createLibrary + """ + Creates a new Library under the given Drawing Template parameter. Returns the created Library. + """ + createLibraryInTemplate :: DrawingTemplate -> Library + +importJava "org.simantics.modeling.ModelingUtils" where + importDrawingTemplate :: Model -> File -> Resource + +setMonitorPropertyValue :: Monitor -> String -> String -> () +setMonitorPropertyValue monitor property newValue = do + monitorUri = uriOf (toResource monitor) + completeUri = monitorUri + "#" + property + "#HasDisplayValue" + propertyVariable = variable completeUri + setValue propertyVariable newValue + +setFlagTablePropertyValue :: FlagTable -> String -> String -> () +setFlagTablePropertyValue flagTable property newValue = do + flagTableUri = uriOf (toResource flagTable) + completeUri = flagTableUri + "#" + property + "#HasDisplayValue" + propertyVariable = variable completeUri + setValue propertyVariable newValue + +importJava "org.simantics.modeling.ui.SCLDiagramTemplate" where + templateComposite :: Variable -> Variable + templateDiagram :: Variable -> Variable + templateModel :: Variable -> Variable + +importJava "org.simantics.diagram.flag.IOTableUtil" where + bindFlagToTable :: Diagram -> Flag -> Double -> Double -> Boolean