| |
| |
| During its life a Wicket component goes through three basic stages: |
| |
| # *Initialization:* a component is instantiated by Wicket and prepared for the rendering phase. |
| # *Rendering:* in this stage Wicket generates component markup. If a component contains children (i.e. is a subclass of @MarkupContainer@) it must first wait for them to be rendered before starting its own rendering. |
| # *Removing:* this stage is triggered when a component is explicitly removed from its component hierarchy, i.e. when its parent invokes @remove(component)@ on it. This stage is facultative and is never triggered for pages. |
| |
| The following picture shows the state diagram of component lifecycle: |
| |
| !component-lifecycle.png! |
| |
| Once a component has been removed it can be added again to a container, but the initialization stage won't be executed again. |
| |
| {note} |
| If you read the JavaDoc of class @Component@ you will find a more detailed description of component lifecycle. |
| However this description introduces some advanced topics we didn't covered yet hence, to avoid confusion, in this chapter some details have been omitted and they will be covered later in the next chapters. |
| |
| For now you can consider just the simplified version of the lifecycle described above. |
| {note} |