Module Simantics/UserComponent
This module is undocumented. This is a list of its definitions.
addToGraph :: Resource -> Resource -> Resource -> <WriteGraph> ()
addToGraph symbolDiagram connectionRelation terminal makes the diagram
element terminal on symbolDiagram a terminal of the connection point
connectionRelation of the component type.
The diagram side terminal relation corresponding to connectionRelation is
created and added as a connection point of the symbol's defined element if
the symbol does not have one yet, and reused otherwise.
addUserComponentScript :: Resource -> String -> String -> String -> <WriteGraph> ()
addUserComponentScript userComponent scriptName scriptType scriptCode adds the script to the user component.
assignSymbolGroup :: [Resource] -> [Resource] -> [Resource] -> <WriteGraph> ()
assignSymbolGroup addedGroups removedGroups symbols adds every one of the
given symbols to each symbol group in addedGroups and removes it from
each symbol group in removedGroups. An undo point is marked before the
change.
changeAllComponentTypes :: Resource -> Resource -> Resource -> <WriteGraph> ()
changeAllComponentTypes model oldComponentType newComponentType
configToDiagram :: Resource -> Resource
Returns the given configuration composite unchanged. A composite is already
usable as a diagram, so no conversion is needed.
configurationOfComponentType :: Resource -> <ReadGraph> Resource
Returns the configuration composite that defines the substructure of the given
user component type. Fails if the component type does not define exactly one.
createNewSymbolGroup :: Resource -> String -> <WriteGraph> Resource
createNewSymbolGroup model name creates a new symbol group with the given
name in model and returns it. A symbol group collects symbols so that
they can be offered together in the symbol palette.
createUserComponent :: Resource -> <WriteGraph> Resource
Creates a new user component type under the given model or library and
returns it. The new component type gets a fresh name, the component type
supertype and the substructure and symbol types that the enclosing index
root declares as its defaults, a Configuration composite that holds its
substructure, and a symbol.
createUserComponentMonitorProperty :: Resource -> <WriteGraph> Resource
Creates a new monitor property for the given user component type and
returns the property relation. A monitor property computes its value from
an SCL expression instead of storing it, and the expression is set with
setMonitorExpression. The property gets a fresh
name derived from newProperty and the value type Double.
createUserComponentProperty :: Resource -> <WriteGraph> Resource
Creates a new property for the given user component type and returns the
property relation. The property gets a fresh name derived from
newProperty, the required value type Double and the asserted default
value 0.0. An undo point is marked before the change.
flagToTerminal :: Resource -> <WriteGraph> Resource
Lifts the given flag with liftFlag and returns the connection
point it was lifted as. If the flag could not be lifted, the flag itself is
returned.
getSymbolGroups :: Resource -> <ReadGraph> [Resource]
Returns the symbol groups of the given index root.
liftFlag :: Resource -> <WriteGraph> Maybe String
Lifts the given diagram flag, that is, creates a connection point in the
interface of the enclosing user component type and attaches the flag to it
(DIA.IsLiftedAs). The new connection point is named after the component
and connection point the flag is connected to.
Returns Nothing when the flag was lifted. Returns Just message when it
was not, where message explains why, for instance because the flag is
already joined to another flag, is already lifted, or is not part of a
connection that could be found.
migrateUserComponents :: Resource -> Resource -> [Resource] -> <WriteGraph> ()
migrateUserComponents source target components turns the given
components from instances of the user component type source into
instances of target, carrying over the properties and connections that
the migration finds counterparts for. Components in the list that are not
instances of source are ignored. An undo point is marked before the
change.
navigateToSubstructureAction :: Resource -> <Proc> ()
Opens an editor on the substructure of the given diagram element, that is, on
the configuration that defines the component type of the component the element
maps to. Does nothing if the element does not map to a component, if the
component's type defines no substructure, or if no editor is registered for
that configuration.
populateTerminalToSymbol :: Resource -> (Double, Double) -> <WriteGraph> Resource
populateTerminalToSymbol connectionRelation (x, y) adds a terminal for
connectionRelation on the symbol of the user component type that the
relation belongs to, and returns the created diagram element.
The element is an instance of the element class the relation points to with
MOD.ConnectionRelationToTerminal, is placed at (x, y) on the symbol
diagram, and is connected to the diagram side terminal relation that
corresponds to connectionRelation.
renameUserComponentProperty :: Resource -> String -> <WriteGraph> ()
renameUserComponentProperty property newName renames the given component
type property.
setMonitorExpression :: Resource -> Resource -> String -> <WriteGraph> ()
setMonitorExpression componentType property expression sets the SCL
expression that computes the value of the monitor property of
componentType. Does nothing but log a warning if componentType does not
assert a value for property.
setUserComponentPropertyDefaultValue :: Resource -> Resource -> String -> <WriteGraph> ()
setUserComponentPropertyDefaultValue componentType property valueText
sets the default value that instances of componentType get for
property. The value is parsed from valueText according to the data type
of the property.
Two forms are special. If the property's range is an enumeration,
valueText names the enumeration value to use. If valueText begins with
=, the rest of it is stored as an SCL expression that computes the
default value.
Does nothing but log a warning if componentType does not assert a value
for property.
setUserComponentPropertyDescription :: Resource -> String -> <WriteGraph> ()
setUserComponentPropertyDescription property description sets the
description of the given component type property.
setUserComponentPropertyLabel :: Resource -> String -> <WriteGraph> ()
setUserComponentPropertyLabel property label sets the label that is shown
for the given component type property.
setUserComponentPropertyRange :: Resource -> Resource -> String -> <WriteGraph> ()
setUserComponentPropertyRange componentType property range sets the range
restriction of the given property of componentType, both in the data type
of its asserted default value and in the data type the property requires.
Has an effect only when that default value is a literal with a numeric data
type.
setUserComponentPropertyRequiredType :: Resource -> Resource -> String -> <WriteGraph> ()
setUserComponentPropertyRequiredType componentType property typeName sets the
SCL value type that the given property of componentType requires, for
instance Double or String.
The asserted default value of the property is converted to the new type, and so
are the values that existing instances of componentType have for it, in every
index root of the database.
setUserComponentPropertyUnit :: Resource -> Resource -> String -> <WriteGraph> ()
setUserComponentPropertyUnit componentType property unit sets the unit of
the given property of componentType. If the property requires a data
type, the unit is also written into the numeric data type of the property
and of its asserted default value.
setUserComponentScriptExecutionPeriod :: Resource -> String -> Maybe Double -> <Proc,WriteGraph> ()
setUserComponentScriptExecutionPeriod userComponent scriptName (Just N)
sets the execution period of the specified userComponents SCL scripts
with the specified scriptName to N seconds.
To disable the execution period setting for a script/scripts specify
executionPeriod Nothing or (Just 0).
userComponentScriptExecutionPeriod :: Resource -> String -> <ReadGraph> [Double]
userComponentScriptExecutionPeriod userComponent scriptName
gets the execution periods of all user SCL scripts of the specified
userComponent with the name scriptName.
|