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
 
 public class ComponentModel extends AbstractLifecycle implements Component The model for a running client component, of which many may exist forming the complete component tree for a runningDesignerViewModel;ComponentModels are created from the ComponentConfigs of a saved project.
- 
- 
Field SummaryFields Modifier and Type Field Description protected com.inductiveautomation.perspective.gateway.model.ActionCollectionactionsprotected int[]addressPathprotected java.lang.StringaddressPathStringprotected BindingCollectionbindingsprotected PropertyChangeScriptCollectionchangeScriptsprotected ComponentConfigconfigprotected CustomMethodCollectioncustomMethodsprotected com.inductiveautomation.perspective.gateway.model.ExtensionFunctionCollectionextensionFunctionsprotected static LoggerExlogprotected MessageHandlerCollectionmessageHandlersprotected ComponentModelparentprotected java.util.Map<PropertyType,PropertyTree>propertiesprotected ViewModelview- 
Fields inherited from interface com.inductiveautomation.perspective.gateway.api.ComponentMDC_COMPONENT
 
- 
 - 
Constructor SummaryConstructors Constructor Description ComponentModel(ViewModel view, ComponentConfig config, int[] addressPath, ComponentModel parent)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<ComponentModel>children()This method should always return a list containing all children, in the proper order.protected PropertyTreePermissionModelcreatePermissionModel(PropertyType scope, PropertyConfigCollection config)PropertyReferencecreatePropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins)Create aPropertyReferencewith thisPerspectiveElementas the target.voiddispatch(int[] propPath, int pointer, java.util.function.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.java.util.Optional<PerspectiveElement>findChildByName(java.util.Iterator<java.lang.String> pathIterator)Attempts to locate a child at a given path.java.util.Optional<org.python.core.PyMethod>findCustomMethod(java.lang.String methodName)java.util.Optional<ExtensionFunction>findExtensionFunction(java.lang.String name)voidfireEvent(java.lang.String eventType, java.lang.String eventName, java.lang.Object eventObject)Fire an event on component.voidfocus()AuditContext.BuildergetAuditSnapshot()intgetBindingCount()java.util.Optional<Component>getChild(int childId)java.util.Collection<Component>getChildren()java.lang.StringgetComponentAddressPath()Index path of the component, like "0:5"com.inductiveautomation.ignition.common.gson.JsonElementgetComponentState()LoggerExgetLogger()LoggingContextgetMdcParent()java.util.Optional<ComponentModelDelegate>getModelDelegate()java.lang.StringgetName()ComponentgetParent()java.util.Optional<PropertyConfig>getPropertyConfig(PropertyKey property)PropertyTreegetPropertyTreeOf(PropertyType type)Fetch thePropertyTreeassociated with the givenPropertyTypejava.lang.StringgetQualifiedPath()java.lang.StringgetTraceId()ViewModelgetView()protected voidinitChildren(java.util.List<ComponentConfig> configChildren)protected java.util.Map<PropertyType,PropertyTree>initProperties()voidmdcSetup()Set up the MDC keys for this contextvoidmdcTeardown()Tear down the MDC keys that are added in #mdcSetupprotected com.inductiveautomation.perspective.gateway.model.ActionCollectionnewActionHandler(EventConfig config)protected voidonShutdown()Shuts down bindings and then shuts down all childrenprotected voidonStartup()Starts up the bindings and any childrenvoidrefreshBinding(PropertyKey property)voidremoveTooltip()voidrequestTooltip()protected voidsetName(java.lang.String name)- 
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycleisRunning, shutdown, startup
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContextaudit
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.ComponentgetPage, getSession
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContextmdc, mdcSetupTree, mdcTeardownTree, mdcWrap
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.PerspectiveElementgetAuditProfile, isRunning
 
- 
 
- 
- 
- 
Field Detail- 
logprotected static LoggerEx log 
 - 
viewprotected final ViewModel view 
 - 
configprotected final ComponentConfig config 
 - 
addressPathprotected final int[] addressPath 
 - 
addressPathStringprotected final java.lang.String addressPathString 
 - 
propertiesprotected final java.util.Map<PropertyType,PropertyTree> properties 
 - 
bindingsprotected final BindingCollection bindings 
 - 
changeScriptsprotected final PropertyChangeScriptCollection changeScripts 
 - 
actionsprotected final com.inductiveautomation.perspective.gateway.model.ActionCollection actions 
 - 
customMethodsprotected final CustomMethodCollection customMethods 
 - 
messageHandlersprotected final MessageHandlerCollection messageHandlers 
 - 
extensionFunctionsprotected final com.inductiveautomation.perspective.gateway.model.ExtensionFunctionCollection extensionFunctions 
 - 
parentprotected final ComponentModel parent 
 
- 
 - 
Constructor Detail- 
ComponentModelpublic ComponentModel(@Nonnull ViewModel view, @Nonnull ComponentConfig config, @Nonnull int[] addressPath, @Nullable ComponentModel parent)
 
- 
 - 
Method Detail- 
newActionHandlerprotected com.inductiveautomation.perspective.gateway.model.ActionCollection newActionHandler(EventConfig config) 
 - 
initChildrenprotected void initChildren(java.util.List<ComponentConfig> configChildren) 
 - 
findExtensionFunctionpublic java.util.Optional<ExtensionFunction> findExtensionFunction(java.lang.String name) - Specified by:
- findExtensionFunctionin interface- Component
 
 - 
initPropertiesprotected java.util.Map<PropertyType,PropertyTree> initProperties() 
 - 
createPermissionModelprotected PropertyTreePermissionModel createPermissionModel(PropertyType scope, PropertyConfigCollection config) 
 - 
setNameprotected void setName(java.lang.String name) 
 - 
getNamepublic java.lang.String getName() - Specified by:
- getNamein interface- PerspectiveElement
- 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".
 
 - 
getQualifiedPathpublic java.lang.String getQualifiedPath() - Specified by:
- getQualifiedPathin interface- PerspectiveElement
- 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.
 
 - 
findCustomMethodpublic java.util.Optional<org.python.core.PyMethod> findCustomMethod(java.lang.String methodName) 
 - 
getPropertyConfigpublic java.util.Optional<PropertyConfig> getPropertyConfig(PropertyKey property) - Specified by:
- getPropertyConfigin interface- Component
 
 - 
getMdcParentpublic LoggingContext getMdcParent() - Specified by:
- getMdcParentin interface- LoggingContext
 
 - 
mdcSetuppublic void mdcSetup() Description copied from interface:LoggingContextSet up the MDC keys for this context- Specified by:
- mdcSetupin interface- LoggingContext
 
 - 
mdcTeardownpublic void mdcTeardown() Description copied from interface:LoggingContextTear down the MDC keys that are added in #mdcSetup- Specified by:
- mdcTeardownin interface- LoggingContext
 
 - 
onStartupprotected void onStartup() Starts up the bindings and any children- Specified by:
- onStartupin class- AbstractLifecycle
 
 - 
onShutdownprotected void onShutdown() Shuts down bindings and then shuts down all children- Specified by:
- onShutdownin class- AbstractLifecycle
 
 - 
getComponentAddressPathpublic java.lang.String getComponentAddressPath() Description copied from interface:ComponentIndex path of the component, like "0:5"- Specified by:
- getComponentAddressPathin interface- Component
 
 - 
getLoggerpublic LoggerEx getLogger() - Specified by:
- getLoggerin interface- LoggingContext
 
 - 
getParent@Nullable public Component getParent() 
 - 
getModelDelegatepublic java.util.Optional<ComponentModelDelegate> getModelDelegate() 
 - 
refreshBindingpublic void refreshBinding(PropertyKey property) 
 - 
focuspublic void focus() 
 - 
requestTooltippublic void requestTooltip() 
 - 
removeTooltippublic void removeTooltip() 
 - 
dispatchpublic void dispatch(int[] propPath, int pointer, java.util.function.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.
 - 
children@Nonnull protected java.util.List<ComponentModel> 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.
 
 - 
fireEventpublic void fireEvent(java.lang.String eventType, java.lang.String eventName, java.lang.Object eventObject)Description copied from interface:ComponentFire an event on component. Can either be a 'component' event or a 'delegate' event.
 - 
getComponentStatepublic com.inductiveautomation.ignition.common.gson.JsonElement getComponentState() 
 - 
getBindingCountpublic int getBindingCount() 
 - 
getTraceIdpublic java.lang.String 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@Nullable public PropertyTree getPropertyTreeOf(@Nullable PropertyType type) Description copied from interface:PropertyTreeOwnerFetch thePropertyTreeassociated with the givenPropertyType- Specified by:
- getPropertyTreeOfin interface- PropertyTreeOwner
- Parameters:
- type- The- PropertyTypeof the- PropertyTreewe 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 java.util.Optional<PerspectiveElement> findChildByName(@Nonnull java.util.Iterator<java.lang.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:
- findChildByNamein interface- Component
- 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.
 
 - 
getChildpublic java.util.Optional<Component> getChild(int childId) 
 - 
getChildrenpublic java.util.Collection<Component> getChildren() - Specified by:
- getChildrenin interface- Component
 
 - 
getViewpublic ViewModel getView() - Specified by:
- getViewin interface- PerspectiveElement
- Returns:
- The view within which this element exists, or null if this is a Page or Session
 
 - 
createPropertyReference@Nonnull public PropertyReference createPropertyReference(java.lang.String referencePath, java.util.function.Consumer<PropertyTreeChangeEvent> subscriber, java.util.Set<Origin> acceptableOrigins) Description copied from interface:PerspectiveElementCreate aPropertyReferencewith thisPerspectiveElementas the target.- Specified by:
- createPropertyReferencein interface- PerspectiveElement
- Parameters:
- referencePath- the path to the property
- subscriber- the subscriber - a- Consumerof- PropertyTreeChangeEvents
- acceptableOrigins- the- Setof- Origins in which the subscriber is interested
- Returns:
- the PropertyReference
 
 - 
getAuditSnapshot@Nonnull public AuditContext.Builder getAuditSnapshot() - Specified by:
- getAuditSnapshotin interface- AuditingContext
- Returns:
- A new, or extended, AuditContext.Builder, with qualified information about the current scope.
 
 
- 
 
-