FoxitPDFSDKforWeb  7.1.1
Foxit PDF SDK for Web
ContainerComponent Class Reference

An container is a component to organize widgets. You need to inherit this class and implement some necessary methods to customize your own container components.
The features that distinguish from widgets are following: More...

Inheritance diagram for ContainerComponent:
Component CommentListCardComponent DropdownComponent DropdownItemComponent GroupComponent GroupListComponent LayerComponent LayerHeaderComponent LayerToolbarComponent LayerViewComponent SidebarComponent SlotComponent TabItemComponent TabsComponent ToolbarComponent

Public Member Functions

 append (child)
 Inserts a component before the first child of this container component. More...
 
 childAt (index)
 Get the specific child component at the given zero-based index. Returns undefined if the index is out of range. More...
 
 children ()
 Get all children of this container component. More...
 
 doInsertAll (children, index)
 Insert components array into this container component at the specified index. More...
 
 empty ()
 Remove all children of this component.
 
 first ()
 Get the first child fom this container component, if there is no children, null will returned. More...
 
 indexOf (child)
 Get the index of an child component. More...
 
 insert (child, index)
 Inserts a component. More...
 
 insertAll (children, index)
 Inserts a set of components to the specified index. More...
 
 last ()
 Get the last child from this container component. More...
 
 prepend (child)
 Inserts a component after the last child of thie container component. More...
 
 removeChild (child)
 Remove a child from this component and trigger UIExtension.UIConsts.COMPONENT_EVENTS.REMOVED event;. More...
 
 size ()
 The number of children in this container component. More...
 
- Public Member Functions inherited from Component
 active ()
 Actives the component, and set isActive property to true, this method triggers UIExtension.UIConsts.COMPONENT_EVENTS.ACTIVE event. More...
 
 addDestroyHook (...hooks)
 Add a function to destroyHooks list, which will be called during destroy. More...
 
 after (component)
 Inserts this component after the specified component. More...
 
 before (component)
 Insert this component before the specified component. More...
 
 deactive ()
 Deactives the component, and set isActive property to false, this method triggers UIExtension.UIConsts.COMPONENT_EVENTS.DEACTIVE event. More...
 
 destroy ()
 Destroy the component and remove from its parent. this method triggers UIExtension.UIConsts.COMPONENT_EVENTS.DESTROYED event. More...
 
 disable ()
 To disable the component, and set disabled property to true, this method triggers UIExtension.UIConsts.COMPONENT_EVENTS.DISABLE event. More...
 
 enable ()
 Enables component, and set disabled property to false, this method triggers UIExtension.UIConsts.COMPONENT_EVENTS.ENABLE event. More...
 
 findClosestComponent (callback)
 Find the closest component that pass the test implemented by the provided callback. More...
 
 getComponentByName (name)
 This method returns an Component object representing the component whose name property matches the specified string. If there are more than one components matched, only the first one is taken. More...
 
 getPDFUI ()
 Get PDFUI instance, PDFUI instance is passing into a component after constructed. So that an undefined value will be returned in constructoring lifecycle. More...
 
 getRoot ()
 Get root component of this component tree. More...
 
 hide ()
 Hide component and set isVisible property to false, this method UIExtension.UIConsts.COMPONENT_EVENTS.HIDDEN event. More...
 
 index ()
 Get the index of this component in parent. More...
 
 localize (localizer=this.localizer)
 Localize message with the value of the data-i18n attribute above the DOM element of component recursively. More...
 
 nextSiblings ()
 This method returns the component immediately following this component's parent children list, or returns null if this component is the last in that list. More...
 
 off (eventName, listener)
 Unregister event handler of a geven event type, if no handler function specified, all handler of this given event type will be removed. More...
 
 on (eventName, listener)
 Registers an event handler to a specific event type on the component. More...
 
 once (eventName, listener)
 Registers an event handler to a specific event type on the component, but difference from Component#on, this event handler will be triggered only once. More...
 
 previousSiblings ()
 This method returns the component immediately preceding this component's parent children list, or returns null if this component is the first in that list. More...
 
 remove ()
 Remove component from its parent, and triggers UIExtension.UIConsts.COMPONENT_EVENTS.REMOVED event. More...
 
 removeElement ()
 Remove element from DOM tree.
 
 show ()
 Shows up component, and set isVisible property to true, this method triggers UIExtension.UIConsts.COMPONENT_EVENTS.SHOWN event. More...
 
 trigger (eventName,...data)
 Calls each of the listeners registered for a given event type. More...
 

Protected Member Functions

 doInsert (child, index)
 Insert component into this container component at the specified index. More...
 
 getContainerElement ()
 
 rerenderChildren ()
 Rerender all children of this container component, it's called after children removed or added,.
 
- Protected Member Functions inherited from Component
 createDOMElement ()
 This method creates a HTMLElement as the root element for this component. More...
 
 doActive ()
 This method is called after the component is activated. It is used to update the rendering effect after the component is activated. It is usefull to override this method to customize the rendering.
 
 doDeactive ()
 This method is called after the component is deactivated. It is used to update the rendering effect after the component is deactivated. It is usefull to override this method to customize the rendering.
 
 doDestroy ()
 This method is called to destroy the component, You should override this method for your custom component to write your customize destroy logic.
 
 doDisable (reason='')
 This method is called after the component is disabled. It is used to update the rendering effect after the component is disabled. It is usefull to override this method to customize the rendering.
 
 doEnable (reason='')
 This method is called after the component is enabled. It is used to update the rendering effect after the component is enabled. It is usefull to override this method to customize the rendering.
 
 doHidden ()
 This method is called to hide the DOM element of this component. It is usefull to override this method to customize the hidding logic.
 
 doShown ()
 This method is called to show the DOM element of this component. It is usefull to override this method to customize the showing logic.
 
 mounted ()
 Lifecycle method: mounted. The mounted method is called after the element of component is appended into the DOM tree. More...
 
 postlink ()
 Lifecycle method: postlink. The postlink method is called after all of the children are parsed. More...
 
 prelink ()
 Lifecycle method: prelink. The prelink method is called after component is rendered. More...
 
 render ()
 Lifecycle method: render. The render method is always been called to create DOM element of the component, it's called after createDOMElement called and before calling prelink. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Component
static getName ()
 This method returns a string identifies as the name of a component type that you can use this string as the tag name in the template. Each component must override this static method so that the template can get this component class. More...
 
- Public Attributes inherited from Component
boolean canBeDisabled
 Whether or not this component can be disabled. All of the component can be disabled by default unless you manually set the value of this property to true. More...
 
Controller constroller
 The controller instanceof of this component. The controller is specified externally and that contains the business logic of this component. More...
 
boolean disabled
 Whether or not this component is enabled. Components are enabled by default, and must be enable to recieve user inut or generate events. More...
 
public< T extends HTMLElement|DocumentFragment|Text > T element
 The root DOM element object of this component. More...
 
boolean isActive
 Whether or not this component is active.Active is a complicated state, it can prepresent different interaction states in different component. More...
 
boolean isVisible
 Whether or not this component is visible. Expect for layers, Most components are initially visible. More...
 
string name
 The name of this component. More...
 
ContainerComponent parent
 The parent of this component. More...
 

Detailed Description

An container is a component to organize widgets. You need to inherit this class and implement some necessary methods to customize your own container components.
The features that distinguish from widgets are following:

  1. Widget cannot have children
  2. If disable or enable method of container component is called, the all children of that will be disabled or enabled. You can customize this behavior by overriding doDisable and doEnable methods together.
  3. Widget must inherit from Component but container component must inherit from ContainerComponent

For more details on usage please visit this page: /examples/UIExtension/tutorials/container.html

ContainerComponent

Member Function Documentation

◆ append()

append (   child)
inline

Inserts a component before the first child of this container component.

Parameters
childComponent

◆ childAt()

childAt (   index)
inline

Get the specific child component at the given zero-based index. Returns undefined if the index is out of range.

Parameters
indexnumber
Returns
{Component}

◆ children()

children ( )
inline

Get all children of this container component.

Returns
{Array.<Component>} all children components

◆ doInsert()

doInsert (   child,
  index 
)
inlineprotected

Insert component into this container component at the specified index.

Parameters
childComponent -
indexnumber - if index less then or equal to 0, the child shoud insert into the head position, and if index great

◆ doInsertAll()

doInsertAll (   children,
  index 
)
inline

Insert components array into this container component at the specified index.

Parameters
childrenArray.<Component>
indexnumber

◆ first()

first ( )
inline

Get the first child fom this container component, if there is no children, null will returned.

Returns
{Component}

◆ getContainerElement()

getContainerElement ( )
inlineprotected
Returns
HTMLElement

◆ indexOf()

indexOf (   child)
inline

Get the index of an child component.

Parameters
childComponent - child component instance
Returns
{number} - this function returns -1 if not contains this child component.

◆ insert()

ContainerComponent::insert (   child,
  index 
)
inline

Inserts a component.

Parameters
childComponent
indexnumber

◆ insertAll()

insertAll (   children,
  index 
)
inline

Inserts a set of components to the specified index.

Parameters
childrenArray.<Component>
indexnumber

◆ last()

last ( )
inline

Get the last child from this container component.

Returns
{Component}

◆ prepend()

prepend (   child)
inline

Inserts a component after the last child of thie container component.

Parameters
childComponent

◆ removeChild()

removeChild (   child)
inline

Remove a child from this component and trigger UIExtension.UIConsts.COMPONENT_EVENTS.REMOVED event;.

component.on(UIExtension.UIConsts.COMPONENT_EVENTS.REMOVED,function(){
})
Parameters
childComponent

◆ size()

size ( )
inline

The number of children in this container component.

Returns
{number}

Foxit Software Corporation Logo
@2019 Foxit Software Incorporated. All rights reserved.