Package org.zkoss.zk.ui.sys

## Class StubsComponent

- java.lang.Object
- - org.zkoss.zk.ui.AbstractComponent
  - - org.zkoss.zk.ui.sys.StubComponent
    - - org.zkoss.zk.ui.sys.StubsComponent

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Cloneable`, `Component`, `Scope`, `ComponentCtrl`
  Direct Known Subclasses:
    `IStubsComponent`

      public class StubsComponent
      extends StubComponent

  Represents a tree of `StubComponent` that are merged into a single component.
  Since:
    6.0.0
  Author:
    tomyeh
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

      `AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.lang.Object[][]` | `_evtmap` | [0]: uuid, [1]: EventListenerMap.
    `protected java.lang.String[][]` | `_idmap` | [0]: uuid, [1]: id
    `protected java.lang.String[]` | `_uuids` |

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

      `APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE`

    - ### Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl

      `AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StubsComponent()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getId​(java.lang.String uuid)` | Returns ID of the given UUID, or null if not found or no ID assigned.
    `java.lang.String` | `getWidgetClass()` | Returns the widget class, "#stubs".
    `protected boolean` | `isChildable()` | `StubsComponent` represents a collection of `StubComponent`, so it does not allow any child.
    `protected void` | `mapChildren​(DesktopCtrl desktopCtrl, java.util.List<java.lang.String> uuids, java.util.List<java.lang.String[]> idmap, java.util.List<java.lang.Object[]> evtmap, Component comp)` |
    `void` | `onChildrenMerged​(Component replaced, boolean bListener)` | Called when this component replaced the given component, and the children of the given component shall be 'merged' to this component.
    `void` | `onPageAttached​(Page newpage, Page oldpage)` | Default: handles special event listeners.
    `void` | `onPageDetached​(Page page)` | Default: handles special event listeners.
    `void` | `service​(Event event, Scope scope)` | Handles an event.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class org.zkoss.zk.ui.sys.StubComponent

      `replace, service`

    - ### Methods inherited from class org.zkoss.zk.ui.AbstractComponent

      `addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getExtraCtrl, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getPropertyAccess, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderProperties, renderPropertiesOnly, response, response, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize`

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

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

- - ### Field Detail

    - #### _uuids

          protected java.lang.String[] _uuids

    - #### _idmap

          protected java.lang.String[][] _idmap

      [0]: uuid, [1]: id

    - #### _evtmap

          protected java.lang.Object[][] _evtmap

      [0]: uuid, [1]: EventListenerMap.

  - ### Constructor Detail

    - #### StubsComponent

          public StubsComponent()

  - ### Method Detail

    - #### onChildrenMerged

          public void onChildrenMerged​(Component replaced,
                                       boolean bListener)

      Called when this component replaced the given component, and the children of the given component shall be 'merged' to this component.
      Parameters:
        `replaced` - the component that this component will replace.
      Throws:
        `java.lang.IllegalStateException` - if this method has been called twice (we can modify the algorithm to support but not worth).

    - #### mapChildren

          protected void mapChildren​(DesktopCtrl desktopCtrl,
                                     java.util.List<java.lang.String> uuids,
                                     java.util.List<java.lang.String[]> idmap,
                                     java.util.List<java.lang.Object[]> evtmap,
                                     Component comp)

    - #### getId

          public java.lang.String getId​(java.lang.String uuid)

      Description copied from class: `StubComponent`
      Returns ID of the given UUID, or null if not found or no ID assigned. It assumes the given UUID belonged to one of the component being merged into this component.

      Notice that it searches all descendants of this component.

      Overrides:
        `getId` in class `StubComponent`

    - #### onPageAttached

          public void onPageAttached​(Page newpage,
                                     Page oldpage)

      Description copied from class: `AbstractComponent`
      Default: handles special event listeners.
      Specified by:
        `onPageAttached` in interface `ComponentCtrl`
      Overrides:
        `onPageAttached` in class `AbstractComponent`
      Parameters:
        `newpage` - the new page (never null).
        `oldpage` - the previous page, if any, or null if it didn't belong to any page.
      See Also:
        `ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)`

    - #### onPageDetached

          public void onPageDetached​(Page page)

      Description copied from class: `AbstractComponent`
      Default: handles special event listeners.
      Specified by:
        `onPageDetached` in interface `ComponentCtrl`
      Overrides:
        `onPageDetached` in class `AbstractComponent`
      Parameters:
        `page` - the previous page (never null)
      See Also:
        `ComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)`

    - #### service

          public void service​(Event event,
                              Scope scope)
                       throws java.lang.Exception

      Description copied from interface: `ComponentCtrl`
      Handles an event. This method will invoke the event handlers registered in a ZUML page, the event listeners registered in Java, and the event handlers declared as part of the component.
      Specified by:
        `service` in interface `ComponentCtrl`
      Overrides:
        `service` in class `StubComponent`
      Parameters:
        `event` - the event to handle
        `scope` - the scope to evaluate the zscript, if any. (see also `Page.interpret(java.lang.String, java.lang.String, org.zkoss.zk.ui.ext.Scope)`.
      Throws:
        `java.lang.Exception`

    - #### getWidgetClass

          public java.lang.String getWidgetClass()

      Returns the widget class, "#stubs".
      Specified by:
        `getWidgetClass` in interface `Component`
      Overrides:
        `getWidgetClass` in class `StubComponent`
      See Also:
        `Component.setWidgetClass(java.lang.String)`

    - #### isChildable

          protected boolean isChildable()

      `StubsComponent` represents a collection of `StubComponent`, so it does not allow any child.
      Overrides:
        `isChildable` in class `AbstractComponent`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `AbstractComponent`