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 monitor completeUri = monitorUri + "#" + property + "#HasDisplayValue" propertyVariable = variable completeUri setValue propertyVariable newValue setFlagTablePropertyValue :: FlagTable -> String -> String -> () setFlagTablePropertyValue flagTable property newValue = do flagTableUri = uriOf 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