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 ComponentConfigs of a saved project.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.inductiveautomation.perspective.gateway.model.ActionCollectionprotected final int[]protected final Stringprotected final BindingCollectionprotected final PropertyChangeScriptCollectionprotected final ComponentConfigprotected final CustomMethodCollectionprotected final com.inductiveautomation.perspective.gateway.model.ExtensionFunctionCollectionprotected static LoggerExprotected final MessageHandlerCollectionprotected final ComponentModelprotected final Map<PropertyType,PropertyTree> protected final ViewModelFields 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 PropertyTreePermissionModelcreatePermissionModel(PropertyType scope, PropertyConfigCollection config) createPropertyReference(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins) Create aPropertyReferencewith thisPerspectiveElementas the target.voiddispatch(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) voidFire an event on component.voidfocus()intgetChild(int childId) Index path of the component, like "0:5"com.inductiveautomation.ignition.common.gson.JsonElementgetName()getPropertyConfig(PropertyKey property) Fetch thePropertyTreeassociated with the givenPropertyTypegetType()The type ID of this component, like "ia.display.label"getView()protected voidinitChildren(List<ComponentConfig> configChildren) protected Map<PropertyType,PropertyTree> voidmdcSetup()Set up the MDC keys for this contextvoidTear down the MDC keys that are added in #mdcSetupprotected com.inductiveautomation.perspective.gateway.model.ActionCollectionnewActionHandler(EventConfig config) protected voidShuts down bindings and then shuts down all childrenprotected voidStarts up the bindings and any childrenvoidrefreshBinding(PropertyKey property) voidvoidvoidvoidrequestPrint(com.inductiveautomation.ignition.common.gson.JsonObject config) voidprotected voidMethods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startupMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
auditMethods inherited from interface com.inductiveautomation.perspective.gateway.api.Component
getPage, getSessionMethods inherited from interface com.inductiveautomation.perspective.gateway.api.LoggingContext
mdc, mdcSetupTree, mdcTeardownTree, mdcWrapMethods 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:
findExtensionFunctionin interfaceComponent
-
initProperties
-
createPermissionModel
protected PropertyTreePermissionModel createPermissionModel(PropertyType scope, PropertyConfigCollection config) -
setName
-
getName
- Specified by:
getNamein 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:
getQualifiedPathin 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:
getPropertyConfigin interfaceComponent
-
getMdcParent
- Specified by:
getMdcParentin interfaceLoggingContext
-
mdcSetup
public void mdcSetup()Description copied from interface:LoggingContextSet up the MDC keys for this context- Specified by:
mdcSetupin interfaceLoggingContext
-
mdcTeardown
public void mdcTeardown()Description copied from interface:LoggingContextTear down the MDC keys that are added in #mdcSetup- Specified by:
mdcTeardownin interfaceLoggingContext
-
onStartup
protected void onStartup()Starts up the bindings and any children- Specified by:
onStartupin classAbstractLifecycle
-
onShutdown
protected void onShutdown()Shuts down bindings and then shuts down all children- Specified by:
onShutdownin classAbstractLifecycle
-
getComponentAddressPath
Description copied from interface:ComponentIndex path of the component, like "0:5"- Specified by:
getComponentAddressPathin interfaceComponent
-
getLogger
- Specified by:
getLoggerin 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:ComponentFire 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:PropertyTreeOwnerFetch thePropertyTreeassociated with the givenPropertyType- Specified by:
getPropertyTreeOfin interfacePropertyTreeOwner- Parameters:
type- ThePropertyTypeof thePropertyTreewe 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:
findChildByNamein 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:
getChildrenin interfaceComponent
-
getView
- Specified by:
getViewin interfaceComponent- Specified by:
getViewin interfacePerspectiveElement- Returns:
- The view within which this element exists, or null if this is a Page or Session
-
getType
Description copied from interface:ComponentThe 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:PerspectiveElementCreate aPropertyReferencewith thisPerspectiveElementas the target.- Specified by:
createPropertyReferencein interfacePerspectiveElement- Parameters:
referencePath- the path to the propertysubscriber- the subscriber - aConsumerofPropertyTreeChangeEventsacceptableOrigins- theSetofOrigins in which the subscriber is interested- Returns:
- the
PropertyReference
-
getAuditSnapshot
- Specified by:
getAuditSnapshotin interfaceAuditingContext- Returns:
- A new, or extended,
AuditContext.Builder, with qualified information about the current scope.
-