iberck
9/9/2015 - 1:34 PM

Herencia

Herencia

La regla a seguir es que los nombres de los métodos deben tener distinto nombre para evitar interfieran entre sí y estar anotados para identificar la fase en la que se ejecutarán:

@SetupRender, @BeginRender, @AfterRender, si se llegara a dar el caso que tengan el mismo nombre, hay que ponerles el identificador private para evitar interfieran unos con otros.

"Component1 extends Base1", orden de ejecución:

  1. Base1 - [ENTER] setupRenderBase()

  2. Base1 - [ EXIT] setupRenderBase

  3. Component1 - [ENTER] setupRender()

  4. Component1 - [ EXIT] setupRender

  5. Base1 - [ENTER] beginRenderBase()

  6. Base1 - [ EXIT] beginRenderBase

  7. Component1 - [ENTER] beginRender()

  8. Component1 - [ EXIT] beginRender

  9. Component1 - [ENTER] afterRender()

  10. Component1 - [ EXIT] afterRender

  11. Base1 - [ENTER] afterRenderBase()

  12. Base1 - [ EXIT] afterRenderBase

"Howard Lewis: parent class render event methods are invoked before subclass render event methods."

Parents before Child

Ordering is always parent-first. Methods defined in the parent class are always invoked before methods defined in the child class.

When a sub-class overrides an render phase method of a base class, the method is only invoked once, along with any other base class methods. The subclass can change the implementation of the base class method via an override, but can't change the timing of when that method is invoked.