Package org.zkoss.zk.ui

## Class AbstractPage

- java.lang.Object
- - org.zkoss.zk.ui.AbstractPage

- All Implemented Interfaces:
    `java.io.Serializable`, `ClassResolver`, `Scope`, `IdSpace`, `Page`, `PageCtrl`
  Direct Known Subclasses:
    `PageImpl`

      public abstract class AbstractPage
      extends java.lang.Object
      implements Page, PageCtrl, java.io.Serializable

  A skeletal implementation of `Page`.
  Since:
    3.5.2
  Author:
    tomyeh
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface org.zkoss.zk.ui.Page

      `APPLICATION_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `AbstractPage()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `destroy()` | Called when this page is about to be destroyed.
    `Component` | `getFellow​(java.lang.String compId)` | Returns a component of the specified ID in this ID space.
    `Component` | `getFellow​(java.lang.String compId, boolean recurse)` | The same as `getFellow(String)`.
    `Component` | `getFellowIfAny​(java.lang.String compId)` | Returns a component of the specified ID in this ID space, or null if not found.
    `Component` | `getFellowIfAny​(java.lang.String compId, boolean recurse)` | The same as `getFellowIfAny(String)`.
    `java.util.Collection<Component>` | `getFellows()` | Returns all fellows in this ID space.
    `Component` | `getFirstRoot()` | Returns the first root component.
    `Component` | `getLastRoot()` | Returns the last root component.
    `java.util.Collection<Component>` | `getRoots()` | Returns a readonly list of the root components.
    `boolean` | `hasFellow​(java.lang.String compId)` | Returns whether there is a fellow named with the specified component ID.
    `boolean` | `hasFellow​(java.lang.String compId, boolean recurse)` | The same as `hasFellow(String)`.
    `void` | `removeComponents()` | Removes all components in this page.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.zkoss.zk.ui.Page

      `addClassResolver, addEventListener, addFunctionMapper, addTemplate, addVariableResolver, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getComponentDefinition, getComponentDefinition, getComponentDefinitionMap, getDesktop, getEventListeners, getExpressionFactoryClass, getFunctionMapper, getId, getInterpreter, getLanguageDefinition, getLoadedInterpreters, getRequestPath, getStyle, getTemplate, getTitle, getUuid, getViewport, getXelVariable, getXelVariable, getZScriptClass, getZScriptFunction, getZScriptFunction, getZScriptLanguage, getZScriptVariable, getZScriptVariable, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFunctionMapper, hasVariableResolver, interpret, invalidate, isAlive, isComplete, isListenerAvailable, removeAttribute, removeAttribute, removeEventListener, removeFunctionMapper, removeTemplate, removeVariableResolver, resolveClass, setAttribute, setAttribute, setComplete, setExpressionFactoryClass, setId, setStyle, setTitle, setViewport, setZScriptLanguage`

    - ### Methods inherited from interface org.zkoss.zk.ui.sys.PageCtrl

      `addAfterHeadTags, addBeforeHeadTags, addDeferredZScript, getAfterHeadTags, getAutomaticTimeout, getBeforeHeadTags, getCacheable, getContentType, getDocType, getFirstLine, getOwner, getResponseHeaders, getRootAttributes, getWidgetClass, init, preInit, redraw, sessionDidActivate, sessionWillPassivate, setAutomaticTimeout, setCacheable, setContentType, setDocType, setFirstLine, setOwner, setRootAttributes, setWidgetClass`

    - ### Methods inherited from interface org.zkoss.zk.ui.ext.Scope

      `addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute`

- - ### Constructor Detail

    - #### AbstractPage

          protected AbstractPage()

  - ### Method Detail

    - #### getFirstRoot

          public Component getFirstRoot()

      Description copied from interface: `Page`
      Returns the first root component.
      Specified by:
        `getFirstRoot` in interface `Page`

    - #### getLastRoot

          public Component getLastRoot()

      Description copied from interface: `Page`
      Returns the last root component.
      Specified by:
        `getLastRoot` in interface `Page`

    - #### hasFellow

          public boolean hasFellow​(java.lang.String compId)

      Description copied from interface: `IdSpace`
      Returns whether there is a fellow named with the specified component ID.
      Specified by:
        `hasFellow` in interface `IdSpace`

    - #### hasFellow

          public boolean hasFellow​(java.lang.String compId,
                                   boolean recurse)

      The same as `hasFellow(String)`. In other words, the recurse parameter is not applicable.
      Specified by:
        `hasFellow` in interface `IdSpace`
        `recurse` - whether to look up the parent ID space for the existence of the fellow
      Since:
        5.0.0

    - #### getFellow

          public Component getFellow​(java.lang.String compId)
                              throws ComponentNotFoundException

      Description copied from interface: `IdSpace`
      Returns a component of the specified ID in this ID space. Components in the same ID space are called fellows.

      Unlike `IdSpace.getFellowIfAny(String)`, it throws `ComponentNotFoundException` if not found.

      Specified by:
        `getFellow` in interface `IdSpace`
      Throws:
        `ComponentNotFoundException` - is thrown if this component doesn't belong to any ID space

    - #### getFellow

          public Component getFellow​(java.lang.String compId,
                                     boolean recurse)
                              throws ComponentNotFoundException

      The same as `getFellow(String)`. In other words, the recurse parameter is not applicable.
      Specified by:
        `getFellow` in interface `IdSpace`
        `recurse` - whether to look up the parent ID space for the existence of the fellow
      Throws:
        `ComponentNotFoundException` - is thrown if this component doesn't belong to any ID space
      Since:
        5.0.0

    - #### getFellowIfAny

          public Component getFellowIfAny​(java.lang.String compId)

      Description copied from interface: `IdSpace`
      Returns a component of the specified ID in this ID space, or null if not found.

      Unlike `IdSpace.getFellow(String)`, it returns null if not found.

      Specified by:
        `getFellowIfAny` in interface `IdSpace`

    - #### getFellowIfAny

          public Component getFellowIfAny​(java.lang.String compId,
                                          boolean recurse)

      The same as `getFellowIfAny(String)`. In other words, the recurse parameter is not applicable.
      Specified by:
        `getFellowIfAny` in interface `IdSpace`
        `recurse` - whether to look up the parent ID space for the existence of the fellow
      Since:
        5.0.0

    - #### getFellows

          public java.util.Collection<Component> getFellows()

      Description copied from interface: `IdSpace`
      Returns all fellows in this ID space. The returned collection is readonly.
      Specified by:
        `getFellows` in interface `IdSpace`

    - #### getRoots

          public java.util.Collection<Component> getRoots()

      Description copied from interface: `Page`
      Returns a readonly list of the root components.
      Specified by:
        `getRoots` in interface `Page`

    - #### removeComponents

          public void removeComponents()

      Description copied from interface: `Page`
      Removes all components in this page.
      Specified by:
        `removeComponents` in interface `Page`
      See Also:
        `Execution.createComponents(String,Component,Map)`

    - #### destroy

          public void destroy()

      Description copied from interface: `PageCtrl`
      Called when this page is about to be destroyed. It is called by desktop, after removing it from the desktop.
      Specified by:
        `destroy` in interface `PageCtrl`