Class ComponentModel
java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.model.ComponentModel
- All Implemented Interfaces:
AuditingContext
,Component
,LoggingContext
,PerspectiveElement
,PropertyTreeOwner
- Direct Known Subclasses:
DesignerComponentModel
The model for a running client component, of which many may exist forming the complete component tree for a running
DesignerViewModel
;
ComponentModels are created from the ComponentConfig
s of a saved project.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.inductiveautomation.perspective.gateway.model.ActionCollection
protected final int[]
protected final String
protected final BindingCollection
protected final PropertyChangeScriptCollection
protected final ComponentConfig
protected final CustomMethodCollection
protected final com.inductiveautomation.perspective.gateway.model.ExtensionFunctionCollection
protected static LoggerEx
protected final MessageHandlerCollection
protected final ComponentModel
protected final Map<PropertyType,
PropertyTree> protected final ViewModel
Fields inherited from interface com.inductiveautomation.perspective.gateway.api.Component
MDC_COMPONENT
-
Constructor Summary
ConstructorsConstructorDescriptionComponentModel
(ViewModel view, ComponentConfig config, int[] addressPath, ComponentModel parent) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<ComponentModel>
children()
This method should always return a list containing all children, in the proper order.protected PropertyTreePermissionModel
createPermissionModel
(PropertyType scope, PropertyConfigCollection config) createPropertyReference
(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins) Create aPropertyReference
with thisPerspectiveElement
as the target.void
dispatch
(int[] propPath, int pointer, Consumer<ComponentModel> task) Call that will walk down the component tree given a path of indices, and then execute a task on the component indicated by the path.findChildByName
(Iterator<String> pathIterator) Attempts to locate a child at a given path.Optional<org.python.core.PyMethod>
findCustomMethod
(String methodName) findExtensionFunction
(String name) void
Fire an event on component.void
focus()
int
getChild
(int childId) Index path of the component, like "0:5"com.inductiveautomation.ignition.common.gson.JsonElement
getName()
getPropertyConfig
(PropertyKey property) Fetch thePropertyTree
associated with the givenPropertyType
getType()
The type ID of this component, like "ia.display.label"getView()
protected void
initChildren
(List<ComponentConfig> configChildren) protected Map<PropertyType,
PropertyTree> void
mdcSetup()
Set up the MDC keys for this contextvoid
Tear down the MDC keys that are added in #mdcSetupprotected com.inductiveautomation.perspective.gateway.model.ActionCollection
newActionHandler
(EventConfig config) protected void
Shuts down bindings and then shuts down all childrenprotected void
Starts up the bindings and any childrenvoid
refreshBinding
(PropertyKey property) void
void
void
void
requestPrint
(com.inductiveautomation.ignition.common.gson.JsonObject config) void
protected void
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startup
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
audit
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.Component
getPage, getSession
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrap
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElement
getAuditProfile, isRunning
-
Field Details
-
log
-
view
-
config
-
addressPath
protected final int[] addressPath -
addressPathString
-
properties
-
bindings
-
changeScripts
-
actions
protected final com.inductiveautomation.perspective.gateway.model.ActionCollection actions -
customMethods
-
messageHandlers
-
extensionFunctions
protected final com.inductiveautomation.perspective.gateway.model.ExtensionFunctionCollection extensionFunctions -
parent
-
-
Constructor Details
-
ComponentModel
public ComponentModel(@Nonnull ViewModel view, @Nonnull ComponentConfig config, @Nonnull int[] addressPath, @Nullable ComponentModel parent)
-
-
Method Details
-
newActionHandler
protected com.inductiveautomation.perspective.gateway.model.ActionCollection newActionHandler(EventConfig config) -
initChildren
-
findExtensionFunction
- Specified by:
findExtensionFunction
in interfaceComponent
-
initProperties
-
createPermissionModel
protected PropertyTreePermissionModel createPermissionModel(PropertyType scope, PropertyConfigCollection config) -
setName
-
getName
- Specified by:
getName
in interfacePerspectiveElement
- Returns:
- The name of the element. If this is a component, it will be the name of the component. If this is a View, the name will be "view". If this is a Page, the name will be "page". If this is the session, the name will be "session".
-
getQualifiedPath
- Specified by:
getQualifiedPath
in interfacePerspectiveElement
- Returns:
- The qualified name of the element. If session or page, this is just the name. If a view or component, is the logical path starting at the view id.
-
findCustomMethod
-
getPropertyConfig
- Specified by:
getPropertyConfig
in interfaceComponent
-
getMdcParent
- Specified by:
getMdcParent
in interfaceLoggingContext
-
mdcSetup
public void mdcSetup()Description copied from interface:LoggingContext
Set up the MDC keys for this context- Specified by:
mdcSetup
in interfaceLoggingContext
-
mdcTeardown
public void mdcTeardown()Description copied from interface:LoggingContext
Tear down the MDC keys that are added in #mdcSetup- Specified by:
mdcTeardown
in interfaceLoggingContext
-
onStartup
protected void onStartup()Starts up the bindings and any children- Specified by:
onStartup
in classAbstractLifecycle
-
onShutdown
protected void onShutdown()Shuts down bindings and then shuts down all children- Specified by:
onShutdown
in classAbstractLifecycle
-
getComponentAddressPath
Description copied from interface:Component
Index path of the component, like "0:5"- Specified by:
getComponentAddressPath
in interfaceComponent
-
getLogger
- Specified by:
getLogger
in interfaceLoggingContext
-
getParent
-
getModelDelegate
-
refreshBinding
-
focus
public void focus() -
requestTooltip
public void requestTooltip() -
removeTooltip
public void removeTooltip() -
requestContextMenu
public void requestContextMenu() -
removeContextMenu
public void removeContextMenu() -
requestPrint
public void requestPrint(com.inductiveautomation.ignition.common.gson.JsonObject config) -
dispatch
Call that will walk down the component tree given a path of indices, and then execute a task on the component indicated by the path. -
children
This method should always return a list containing all children, in the proper order. Note that though all children are present and in the correct order, their index values may not be representative of their actual child ID (as is the case in the designer, where index and id diverge as changes are made to children).- Returns:
- a list of child component models, which may be empty but will never be null.
-
fireEvent
Description copied from interface:Component
Fire an event on component. Can either be a 'component' event or a 'delegate' event. -
getComponentState
public com.inductiveautomation.ignition.common.gson.JsonElement getComponentState() -
getBindingCount
public int getBindingCount() -
getTraceId
- Returns:
- A string suitable for identifying this component in log messages. Will contain the address path, name, and component type, like "ia.display.label-MyLabel-0:5"
-
getPropertyTreeOf
Description copied from interface:PropertyTreeOwner
Fetch thePropertyTree
associated with the givenPropertyType
- Specified by:
getPropertyTreeOf
in interfacePropertyTreeOwner
- Parameters:
type
- ThePropertyType
of thePropertyTree
we want to fetch- Returns:
- The PropertyTree or null if this PropertyTreeOwner does not manage a PropertyTree for the given PropertyType or if a null PropertyType is given
-
findChildByName
@Nonnull public Optional<PerspectiveElement> findChildByName(@Nonnull Iterator<String> pathIterator) Attempts to locate a child at a given path. If the iterator is exhausted (hasNext() returns false), then this method will return itself. Otherwise, the iterator's values are interpreted as names of children and this method will call into a child's implementation of findChildByName.- Specified by:
findChildByName
in interfaceComponent
- Parameters:
pathIterator
- an iterator whose next value is the name of a child of this component, or if the iterator is exhausted, then this component is the one that will be returned.- Returns:
- an optional of the component being searched for, empty if not found.
-
getChild
-
getChildren
- Specified by:
getChildren
in interfaceComponent
-
getView
- Specified by:
getView
in interfaceComponent
- Specified by:
getView
in interfacePerspectiveElement
- Returns:
- The view within which this element exists, or null if this is a Page or Session
-
getType
Description copied from interface:Component
The type ID of this component, like "ia.display.label" -
createPropertyReference
@Nonnull public PropertyReference createPropertyReference(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins) Description copied from interface:PerspectiveElement
Create aPropertyReference
with thisPerspectiveElement
as the target.- Specified by:
createPropertyReference
in interfacePerspectiveElement
- Parameters:
referencePath
- the path to the propertysubscriber
- the subscriber - aConsumer
ofPropertyTreeChangeEvent
sacceptableOrigins
- theSet
ofOrigin
s in which the subscriber is interested- Returns:
- the
PropertyReference
-
getAuditSnapshot
- Specified by:
getAuditSnapshot
in interfaceAuditingContext
- Returns:
- A new, or extended,
AuditContext.Builder
, with qualified information about the current scope.
-