Version:

This lesson is part of the Perspective Components and Bindings course. You can browse the rest of the lessons below.

LESSON LIST

Autoplay Off
Take topic challenge

Supplemental Videos

LESSON

Persistent Properties

Description

Learn what "Persistent" component properties are in this lesson.

Transcript

(open in window)

[00:00] By default, component properties and their values are saved with the project. Meaning that a property in a Perspective session will initialize with a value matching the last saved value in the designer. This is why you can create a label with a static text value, save your project, and then see the same text value in your session. These properties are considered to be persistent. Conversely, properties can be configured to not retain their values in a session. Meaning they will initialize without a value. These properties are non-persistent. The purpose of non-persistent properties is so that views do not start up with initial values that represent the last running values in the designer. In other words, bindings that generate very large objects, arrays or data sets will not have their values stored as configuration with a component. This is useful, because large objects can cause the same view size to be bloated by the size of large objects. Let's take a look at how persistent versus non-persistent properties work.

[01:03] Here on the left, we have designer opened showing a perspective view with a gauge component on it. On the right, we have a perspective session launch for the view we have open on the designer. If I right-click on the gauge's value property, I see that the persistent flag is set to true. Properties are configured to persist by default, this means that if I set the gauge value to 50, when I save my changes, since the value property is set to be persistent, the session will display the last known value from the designer, which was 50. Let's go back to our designer, and change the gauge's value property to be non-persistent. Non-persistent properties are denoted by the transient icon to the right of the property's value in the property editor. After setting this property to not persist, saving my changes will cause the gauge in the session to show a value of zero which is the gauge's default value. This is because the property is non-persistent and the value of 50 was not retained in the session, and therefore the default value was used.

[02:04] Another important aspect of persistence in properties, is that user created properties that are both user created and not flagged as persistent, will be lost once the view containing the property is closed in the designer. Regardless of whether or not the project was saved. Our gauge here has a user defined property named "myproperty". It is currently set to persist so if I close the view on the designer and reopen it, I see that the properties still exist. If I set it to not persist, and close the view, once the view reopens, we see that the property is now missing. This is also true for launching a session. As a user created property that is not persistent will not be present in the session itself. The one exception to this rule is if a binding was configured on the property. Binding configurations are always saved with a component, and will execute in the session.

[03:00] The existence of a binding on a property will result in the property being recreated. If I configure a simple expression binding on a custom property like this, setting this bond property to not persist and closing the view, when the view is reopened, notice how the custom property was recreated due to its configured binding.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.

close

Share this video