Class ViewModel
java.lang.Object
com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
com.inductiveautomation.perspective.gateway.model.ViewModel
- All Implemented Interfaces:
AuditingContext,LoggingContext,PerspectiveElement,PropertyTreeOwner,View
- Direct Known Subclasses:
DesignerViewModel
- Since:
- 8.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.inductiveautomation.perspective.gateway.model.ActionCollectionprotected final BindingCollectionprotected final PropertyChangeScriptCollectionprotected final ViewConfigprotected ReferenceDependencyGraphprotected final ViewInstanceIdprotected static LoggerExprotected final PageModelprotected final Map<PropertyType,PropertyTree> protected ComponentModelstatic final ThreadLocal<ViewModel> -
Constructor Summary
ConstructorsConstructorDescriptionViewModel(PageModel page, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject inputParams) -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertyTreePermissionModelcreatePermissionModel(PropertyType scope, PropertyConfigCollection config) createPropertyReference(String referencePath, Consumer<PropertyTreeChangeEvent> subscriber, Set<Origin> acceptableOrigins) Create aPropertyReferencewith thisPerspectiveElementas the target.booleanfindChildByIndexLocation(String indexLocation) Tries to look up a component by its index location.findChildByPath(String path) Tries to look up a component by its name path.intlongintgetId()getName()getPage()getPropertyConfig(PropertyKey property) Fetch thePropertyTreeassociated with the givenPropertyTypegetView()com.google.common.eventbus.EventBusDeprecated.com.inductiveautomation.ignition.common.gson.JsonObjectProvides information pertaining to this View Model object including it's instance id, and information about it's children.com.inductiveautomation.ignition.common.gson.JsonElementbooleaninthashCode()protected voidinitRoot(ComponentConfig rootConfig) 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) voidonEventFired(EventFiredMsg message) protected voidprotected voidvoidrefreshBinding(PropertyKey property) protected voidResolving references is a step that is done after all component models have been created, and before they are started up.voidrestart(com.inductiveautomation.ignition.common.gson.JsonObject params) voidsetAbandonedViewTimeout(ScheduledFuture<?> newTimeout) voidsetBirthDate(long birthDate) toString()Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startupMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContext
auditMethods 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
-
id
-
config
-
page
-
inputParams
-
properties
-
bindings
-
changeScripts
-
actions
protected final com.inductiveautomation.perspective.gateway.model.ActionCollection actions -
rootContainer
-
dependencyGraph
-
-
Constructor Details
-
ViewModel
public ViewModel(@Nonnull PageModel page, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject inputParams)
-
-
Method Details
-
getBirthDate
public long getBirthDate() -
getConfig
-
getSession
- Specified by:
getSessionin interfacePerspectiveElement- Returns:
- The session that this element is a part of.
-
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
-
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.
-
getViewEventBus
Deprecated.- Specified by:
getViewEventBusin interfaceView
-
getViewEventManager
- Specified by:
getViewEventManagerin interfaceView
-
newActionHandler
protected com.inductiveautomation.perspective.gateway.model.ActionCollection newActionHandler(EventConfig config) -
setAbandonedViewTimeout
-
setBirthDate
public void setBirthDate(long birthDate) -
hasAbandonedViewTimeout
public boolean hasAbandonedViewTimeout() -
restart
public void restart(com.inductiveautomation.ignition.common.gson.JsonObject params) -
refreshBinding
-
initRoot
-
resolveReferences
protected void resolveReferences()Resolving references is a step that is done after all component models have been created, and before they are started up. This allows us to collect and analyze all the property references needed by bindings so that we can create a dependency graph of bindings and start them up in an intelligent order, reducing thrash of invalid / intermediate values. -
createPermissionModel
protected PropertyTreePermissionModel createPermissionModel(PropertyType scope, PropertyConfigCollection config) -
onEventFired
-
getId
-
getView
- Specified by:
getViewin interfacePerspectiveElement- Specified by:
getViewin interfaceView- Returns:
- The view within which this element exists, or null if this is a Page or Session
-
getPage
- Specified by:
getPagein interfacePerspectiveElement- Specified by:
getPagein interfaceView- Returns:
- The Page that this element is part of. Will return null if this is the Session
-
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()- Specified by:
onStartupin classAbstractLifecycle
-
getRootContainer
- Specified by:
getRootContainerin interfaceView
-
onShutdown
protected void onShutdown()- Specified by:
onShutdownin classAbstractLifecycle
-
getPropertyConfig
- Specified by:
getPropertyConfigin interfaceView
-
findChildByIndexLocation
Description copied from interface:ViewTries to look up a component by its index location. Some examples:- "": returns the view
- "0": returns the root container
- "0:4" returns a child of the root container at index 4
- Specified by:
findChildByIndexLocationin interfaceView
-
findChildByPath
Description copied from interface:ViewTries to look up a component by its name path. Some examples:- "/": returns the view
- "/root": returns the root container if the root container's name is "root"
- "/root/foo": returns a component called "foo" contained with in the root container called "root"
- Specified by:
findChildByPathin interfaceView
-
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
-
getLogger
- Specified by:
getLoggerin interfaceLoggingContext
-
getViewState
public com.inductiveautomation.ignition.common.gson.JsonElement getViewState() -
getViewInfo
public com.inductiveautomation.ignition.common.gson.JsonObject getViewInfo()Provides information pertaining to this View Model object including it's instance id, and information about it's children.- Returns:
- Returns a JsonObject representing information pertaining to this View Model object.
-
toString
-
equals
-
hashCode
public int hashCode() -
getComponentCount
public int getComponentCount() -
getBindingCount
public int getBindingCount() -
getAuditSnapshot
- Specified by:
getAuditSnapshotin interfaceAuditingContext- Returns:
- A new, or extended,
AuditContext.Builder, with qualified information about the current scope.
-