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
 
 public class ViewModel extends AbstractLifecycle implements View - Since:
- 8.0
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected com.inductiveautomation.perspective.gateway.model.ActionCollectionactionsprotected BindingCollectionbindingsprotected PropertyChangeScriptCollectionchangeScriptsprotected ViewConfigconfigprotected ReferenceDependencyGraphdependencyGraphprotected ViewInstanceIdidprotected java.util.Set<java.lang.String>inputParamsprotected static LoggerExlogprotected PageModelpageprotected java.util.Map<PropertyType,PropertyTree>propertiesprotected ComponentModelrootContainerstatic java.lang.ThreadLocal<ViewModel>VIEW
 - 
Constructor SummaryConstructors Constructor Description ViewModel(PageModel page, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject inputParams)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.booleanequals(java.lang.Object o)java.util.Optional<PerspectiveElement>findChildByIndexLocation(java.lang.String indexLocation)Tries to look up a component by its index location.java.util.Optional<PerspectiveElement>findChildByPath(java.lang.String path)Tries to look up a component by its name path.AuditContext.BuildergetAuditSnapshot()intgetBindingCount()longgetBirthDate()intgetComponentCount()ViewConfiggetConfig()ViewInstanceIdgetId()LoggerExgetLogger()LoggingContextgetMdcParent()java.lang.StringgetName()PagegetPage()java.util.Optional<PropertyConfig>getPropertyConfig(PropertyKey property)PropertyTreegetPropertyTreeOf(PropertyType type)Fetch thePropertyTreeassociated with the givenPropertyTypejava.lang.StringgetQualifiedPath()ComponentModelgetRootContainer()SessiongetSession()ViewModelgetView()com.google.common.eventbus.EventBusgetViewEventBus()Deprecated.EventManagergetViewEventManager()com.inductiveautomation.ignition.common.gson.JsonObjectgetViewInfo()Provides information pertaining to this View Model object including it's instance id, and information about it's children.com.inductiveautomation.ignition.common.gson.JsonElementgetViewState()booleanhasAbandonedViewTimeout()inthashCode()protected voidinitRoot(ComponentConfig rootConfig)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)voidonEventFired(EventFiredMsg message)protected voidonShutdown()protected voidonStartup()voidrefreshBinding(PropertyKey property)protected voidresolveReferences()Resolving 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(java.util.concurrent.ScheduledFuture<?> newTimeout)voidsetBirthDate(long birthDate)java.lang.StringtoString()- 
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycleisRunning, shutdown, startup
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface com.inductiveautomation.perspective.gateway.api.AuditingContextaudit
 - 
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 
 - 
VIEWpublic static final java.lang.ThreadLocal<ViewModel> VIEW 
 - 
idprotected final ViewInstanceId id 
 - 
configprotected final ViewConfig config 
 - 
pageprotected final PageModel page 
 - 
inputParamsprotected final java.util.Set<java.lang.String> inputParams 
 - 
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 
 - 
rootContainerprotected ComponentModel rootContainer 
 - 
dependencyGraphprotected ReferenceDependencyGraph dependencyGraph 
 
- 
 - 
Constructor Detail- 
ViewModelpublic ViewModel(@Nonnull PageModel page, ViewInstanceId id, ViewConfig config, com.inductiveautomation.ignition.common.gson.JsonObject inputParams)
 
- 
 - 
Method Detail- 
getBirthDatepublic long getBirthDate() 
 - 
getConfigpublic ViewConfig getConfig() 
 - 
getSession@Nonnull public Session getSession() - Specified by:
- getSessionin interface- PerspectiveElement
- Returns:
- The session that this element is a part of.
 
 - 
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
 
 - 
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.
 
 - 
getViewEventBus@Deprecated public com.google.common.eventbus.EventBus getViewEventBus() Deprecated.- Specified by:
- getViewEventBusin interface- View
 
 - 
getViewEventManagerpublic EventManager getViewEventManager() - Specified by:
- getViewEventManagerin interface- View
 
 - 
newActionHandlerprotected com.inductiveautomation.perspective.gateway.model.ActionCollection newActionHandler(EventConfig config) 
 - 
setAbandonedViewTimeoutpublic void setAbandonedViewTimeout(java.util.concurrent.ScheduledFuture<?> newTimeout) 
 - 
setBirthDatepublic void setBirthDate(long birthDate) 
 - 
hasAbandonedViewTimeoutpublic boolean hasAbandonedViewTimeout() 
 - 
restartpublic void restart(com.inductiveautomation.ignition.common.gson.JsonObject params) 
 - 
refreshBindingpublic void refreshBinding(PropertyKey property) 
 - 
initRootprotected void initRoot(ComponentConfig rootConfig) 
 - 
resolveReferencesprotected 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.
 - 
createPermissionModelprotected PropertyTreePermissionModel createPermissionModel(PropertyType scope, PropertyConfigCollection config) 
 - 
onEventFiredpublic void onEventFired(EventFiredMsg message) 
 - 
getIdpublic ViewInstanceId getId() 
 - 
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
 
 - 
getPagepublic Page getPage() - Specified by:
- getPagein interface- PerspectiveElement
- Returns:
- The Page that this element is part of. Will return null if this is the Session
 
 - 
getMdcParent@Nullable public 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() - Specified by:
- onStartupin class- AbstractLifecycle
 
 - 
getRootContainerpublic ComponentModel getRootContainer() - Specified by:
- getRootContainerin interface- View
 
 - 
onShutdownprotected void onShutdown() - Specified by:
- onShutdownin class- AbstractLifecycle
 
 - 
getPropertyConfigpublic java.util.Optional<PropertyConfig> getPropertyConfig(PropertyKey property) - Specified by:
- getPropertyConfigin interface- View
 
 - 
findChildByIndexLocationpublic java.util.Optional<PerspectiveElement> findChildByIndexLocation(java.lang.String indexLocation) 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 interface- View
 
 - 
findChildByPathpublic java.util.Optional<PerspectiveElement> findChildByPath(java.lang.String path) 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 interface- View
 
 - 
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
 
 - 
getLoggerpublic LoggerEx getLogger() - Specified by:
- getLoggerin interface- LoggingContext
 
 - 
getViewStatepublic com.inductiveautomation.ignition.common.gson.JsonElement getViewState() 
 - 
getViewInfopublic 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.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object o) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
getComponentCountpublic int getComponentCount() 
 - 
getBindingCountpublic int getBindingCount() 
 - 
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.
 
 
- 
 
-