Class Container

Description

This is a generic

  1. Container
implementation that should be sufficient for all means and purposes.



The

  1. Container
interface is an extension of the
  1. Component
interface;
  1. Containers
are capable of storing multiple sub-
  1. Components
and when rendering Containers, all sub-
  1. Components
will be rendered as well.

  • version: $Id: Container.class.php,v 1.17 2007/09/04 20:25:21 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/GUIManager/Container.class.php (line 24)

ComponentInterface
   |
   --Component
      |
      --Container
Direct descendents
Class Description
Menu A
  1. Menu
is a
  1. Container
that stores a number of MenuItem objects. The familiar add/get/remove
  1. Container
methods can be used to manage the
  1. MenuItems
.
Variable Summary
array $_components
object _layout $_layout
Method Summary
Container Container (ref $layout, integer $type, integer $index, optional 3)
ref add (ref $component, [string $width = NULL], [string $height = NULL], [integer $alignmentX = NULL], [integer $alignmentY = NULL])
integer addPlaceholder ()
ref getComponent (integer $id)
integer getComponentAlignmentX (integer $id)
integer getComponentAlignmentY (integer $id)
string getComponentHeight (integer $id)
ref getComponents ()
integer getComponentsCount ()
string getComponentWidth (integer $id)
ref getLayout ()
ref insertAtPlaceholder (integer $placeholderId, ref $component, [string $width = NULL], [string $height = NULL], [integer $alignmentX = NULL], [integer $alignmentY = NULL])
ref remove (integer $id)
void removeAll ()
void render (ref $theme, [string $tabs = ""])
void setLayout (ref $layout)
Variables
array $_components (line 38)

The

  1. Components
of this
  1. Container
.

  • var: _components
  • access: private
array $_constraints (line 47)

An array storing constraint information for each component. Each element is another array of four elements storing the width, height, horizontal alignment, and vertical alignment of each component.

  • var: _constraints
  • access: private
object _layout $_layout (line 31)

The

  1. Layout
of this
  1. Container
.

  • access: private

Inherited Variables

Inherited from Component

Component::$_content
Component::$_id
Component::$_index
Component::$_postHTML
Component::$_preHTML
Component::$_styleCollections
Component::$_type
Methods
Constructor Container (line 66)

The constructor.

  • access: public
Container Container (ref $layout, integer $type, integer $index, optional 3)
  • optional 3: object StyleCollections styles,... Zero, one, or more StyleCollection objects that will be added to the newly created Component. Warning, this will result in copying the objects instead of referencing them as using
    1. addStyle()
    would do.
  • ref $layout: object layout The
    1. Layout
    of this container.
  • integer $type: type The type of this component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index of this component. The index has no semantic meaning: you can think of the index as 'level' of the component. Alternatively, the index could serve as means of distinguishing between components with the same type. Most often one would use the index in conjunction with the
    1. getStylesForComponentType()
    and
    1. addStyleForComponentType()
    methods.
add (line 113)

Adds the given component to this container.

  • return: object The component that was just added.
  • access: public
ref add (ref $component, [string $width = NULL], [string $height = NULL], [integer $alignmentX = NULL], [integer $alignmentY = NULL])
  • ref $component: object component The component to add.
  • string $width: width The available width for the added component. If null, will be ignored.
  • string $height: height The available height for the added component. If null, will be ignored.
  • integer $alignmentX: alignmentX The horizontal alignment for the added component. Allowed values are
    1. LEFT
    ,
    1. CENTER
    , and
    1. RIGHT
    . If null, will be ignored.
  • integer $alignmentY: alignmentY The vertical alignment for the added component. Allowed values are
    1. TOP
    ,
    1. CENTER
    , and
    1. BOTTOM
    . If null, will be ignored.

Redefined in descendants as:
  • Menu::add() : Adds the given menu item to this container. The only difference from the familiar
    1. add()
    method of the Container class is that now explicit checking is performed to make sure that the given component is indeed a
    1. menuItem
    and not just any component.
addPlaceholder (line 142)

Add a placeholder and recieve back an id with which to reference it.

This method can be used in conjunction with insertAtPlaceholder() to allow out-of-order addition of components.

  • since: 1/24/07
  • access: public
integer addPlaceholder ()
getComponent (line 217)

Returns the component of this container with the specified id. Ids reflect the order in which components are added. That is, the very first component has an id of 1, the second component has an id of 2, and so forth.

  • return: object The component.
  • access: public
ref getComponent (integer $id)
  • integer $id: id The id of the component which should be returned.
getComponentAlignmentX (line 279)

Returns the horizontal alignment for the component of this container with the specified id. Ids reflect the order in which components are added. That is, the very first component has an id of 1, the second component has an id of 2, and so forth.

  • return: The horizontal alignment.
  • access: public
integer getComponentAlignmentX (integer $id)
  • integer $id: id The id of the component which should be returned.
getComponentAlignmentY (line 291)

Returns the vertical alignment for the component of this container with the specified id. Ids reflect the order in which components are added. That is, the very first component has an id of 1, the second component has an id of 2, and so forth.

  • return: The vertical alignment.
  • access: public
integer getComponentAlignmentY (integer $id)
  • integer $id: id The id of the component which should be returned.
getComponentHeight (line 267)

Returns the height for the component of this container with the specified id. Ids reflect the order in which components are added. That is, the very first component has an id of 1, the second component has an id of 2, and so forth.

  • return: The height.
  • access: public
string getComponentHeight (integer $id)
  • integer $id: id The id of the component which should be returned.
getComponents (line 243)

Returns all components in this

  1. Container
.

  • return: array An array of the components in this
    1. Container
    .
  • access: public
ref getComponents ()
getComponentsCount (line 234)

Returns the number of components in this container.

  • return: The number of components in this container.
  • access: public
integer getComponentsCount ()
getComponentWidth (line 255)

Returns the width for the component of this container with the specified id. Ids reflect the order in which components are added. That is, the very first component has an id of 1, the second component has an id of 2, and so forth.

  • return: The width.
  • access: public
string getComponentWidth (integer $id)
  • integer $id: id The id of the component which should be returned.
getLayout (line 330)

Returns the

  1. Layout
of this container.

  • return: object The
    1. Layout
    of this container.
  • access: public
ref getLayout ()
insertAtPlaceholder (line 172)

Insert a component at the place of a predefined placeholder that had been created with addPlaceholder().

  • return: object The component that was just inserted.
  • since: 1/24/07
  • access: public
ref insertAtPlaceholder (integer $placeholderId, ref $component, [string $width = NULL], [string $height = NULL], [integer $alignmentX = NULL], [integer $alignmentY = NULL])
  • integer $placeholderId
  • ref $component: object component The component to add.
  • string $width: width The available width for the added component. If null, will be ignored.
  • string $height: height The available height for the added component. If null, will be ignored.
  • integer $alignmentX: alignmentX The horizontal alignment for the added component. Allowed values are
    1. LEFT
    ,
    1. CENTER
    , and
    1. RIGHT
    . If null, will be ignored.
  • integer $alignmentY: alignmentY The vertical alignment for the added component. Allowed values are
    1. TOP
    ,
    1. CENTER
    , and
    1. BOTTOM
    . If null, will be ignored.
remove (line 304)

Removes the component with the specified id from this container. Ids reflect the order in which components are added. That is, the very first component has an id of 1, the second component has an id of 2, and so forth.

  • return: object The component that was just removed.
  • access: public
ref remove (integer $id)
  • integer $id: id The id of the component which should be removed from this container..
removeAll (line 320)

Removes all components from this

  1. Container
.

  • access: public
void removeAll ()
render (line 93)

Renders the component on the screen.

  • access: public
void render (ref $theme, [string $tabs = ""])
  • ref $theme: object theme The Theme object to use in producing the result of this method.
  • string $tabs: tabs This is a string (normally a bunch of tabs) that will be prepended to each text line. This argument is optional but its usage is highly recommended in order to produce a nicely formatted HTML output.

Redefinition of:
Component::render()
Renders the component on the screen.
setLayout (line 339)

Sets the

  1. Layout
of this container

  • access: public
void setLayout (ref $layout)
  • ref $layout: object layout The Layout to assign to this container.

Inherited Methods

Inherited From Component

Component::Component()
Component::addStyle()
Component::getId()
Component::getIndex()
Component::getPostHTML()
Component::getPreHTML()
Component::getStyle()
Component::getStyles()
Component::getType()
Component::removeStyle()
Component::render()
Component::setId()
Component::setPostHTML()
Component::setPreHTML()

Inherited From ComponentInterface

ComponentInterface::addStyle()
ComponentInterface::getIndex()
ComponentInterface::getPostHTML()
ComponentInterface::getPreHTML()
ComponentInterface::getStyle()
ComponentInterface::getStyles()
ComponentInterface::getType()
ComponentInterface::removeStyle()
ComponentInterface::render()
ComponentInterface::setPostHTML()
ComponentInterface::setPreHTML()

Documentation generated on Wed, 19 Sep 2007 10:22:10 -0400 by phpDocumentor 1.3.0RC3