Flex UI User Lifecycle

In the life cycle of the user interface component, I heard validation and invalidation events.

Please explain to me briefly about these events.

What does updateDisplayList() in this life cycle.

Please explain to me briefly if possible.

Thanks in advance.

+6
source share
2 answers

Flex Component LifeCycle is the set of methods and events that Flex uses to configure components. In our own components that extend the UIComponent class, we can listen to these events or override these methods to make material specific to our component.

I will add that updateDisplayList () is a method, not an event, in case this is confusion.

These are the main methods of overcoming:

  • createChildren () : used to create child components.
  • commitProperties () . This is the wild card method. You use it to coordinate multiple property changes in one place. What you use for this depends on the component you are creating and on the properties.
  • measure () : used to set the β€œideal” height and width of the component based on its children. You set the measured height and the measured width.
  • updateDisplayList () . This is used to display all display-related, most often placing and sorting child components.

All of these methods will work during the creation of the source component. However, three of these methods β€” commitProperties (), measure (), and updateDisplayList () β€”can be configured to fire during the next render event. To prepare them for launch, simply invalidate them using the appropriate invalidation method:

  • invalidateProperties () forces commitProperties () to restart.
  • invalidateSize () forces measure () to be repeated.
  • invalidateDisplayList () forces updateDisplayList () to restart.

How often rendering events fire depends on the frame rate of your application. I think the default default frame rate is 24 frames per second, so every rendering event happens every 1/24 second.

I defined the component life cycle as a set of methods and events. So these are the events, in the order in which they shoot:

  • preinitialize
  • Initialize
  • childAdd
  • updateComplete
  • creationComplete
I believe that after each rendering event

updateComplete will fire. But others are part of creating a component.

You should read the Flex documentation on this.

The Spark Component life cycle adds various hooks to accommodate the two-class approach; with one class for business logic and one for skinning. But this threshold set extends the life cycle of the MX / Halo component.

+15
source

In short:

  • Invalid labels retain properties for validation. Validation will only be performed in the next rendering cycle, so if you set the property value 5 times, in the meantime only the last value will be effectively executed. (Gives you better performance)
  • validation: if a property has been checked, it will be updated in the commitProperties () method
  • updateDisplayList () is called after verification: new property values ​​can now be used to change the view to match those values

Good version: http://www.dlgsoftware.com/primers/Primer_on_Flex3_Component_Lifecycle.htm

+1
source

Source: https://habr.com/ru/post/890601/


All Articles