Class StyleCollection

Description

A StyleCollection is one of the tree building pieces of CSS styles. As the name suggests it handles a collection of StyleProperties.

The other two CSS styles building pieces are

  1. StylePropertiy
and
  1. StyleComponent
. To clarify the relationship between these three building pieces, consider the following example:
 div {
     margin: 20px;
     border: 1px solid #000;
 }
  1. div
is a
  1. StyleCollection
consisting of 2
  1. StyleProperties
:
  1. margin
and
  1. border
. Each of the latter consists of one or more
  1. StyleComponents
. In specific,
  1. margin
consists of one
  1. StyleComponent
with the value
  1. 20px
, and
  1. border
has three
  1. StyleComponents
with values
  1. 1px
,
  1. solid
, and
  1. #000
correspondingly.

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

Located in /harmoni/core/GUIManager/StyleCollection.class.php (line 33)

StyleCollectionInterface
   |
   --StyleCollection
Direct descendents
Class Description
A StyleCollection is one of the tree building pieces of CSS styles. As the name suggests it handles a collection of StyleProperties.
Variable Summary
string $_description
string $_displayName
mixed $_id
string $_postHTML
string $_preHTML
string $_selector
array $_SPs
Method Summary
StyleCollection StyleCollection (string $selector, string $classSelector, string $displayName, string $description)
ref addSP (ref $sp)
boolean canBeApplied ()
string getClassSelector ()
string getComponent ()
string getCSS ([string $tabs = ""])
string getDescription ()
string getDisplayName ()
string getIndex ()
string getPostHTML (string $tabs)
string getPreHTML (string $tabs)
string getSelector ()
ref getSPs ()
ref getStyleProperty (string $name)
ref removeSP (ref $sp)
void setComponent (string $component)
void setId (object HarmoniId $id)
void setIndex (string $index)
Variables
string $_classSelector (line 64)

The class selector of this style collection. A class selector is the string that would be included in the 'class' attribute of HTML tags.

  • var: _classSelector
  • access: private
string $_description (line 49)

The description of this StyleCollection.

  • var: _description
  • access: private
string $_displayName (line 42)

The display name of this StyleCollection.

  • var: _displayName
  • access: private
mixed $_id (line 35)
string $_postHTML = "" (line 89)

HTML to place around the the component's content.

  • since: 11/22/05
  • access: private
string $_preHTML = "" (line 80)

HTML to place around the the component's content.

  • since: 11/22/05
  • access: private
string $_selector (line 56)

The selector of this StyleCollection.

  • var: _selector
  • access: private
array $_SPs (line 71)

An array of the StyleProperties contained by this StyleCollection.

  • var: _SPs
  • access: private
Methods
Constructor StyleCollection (line 101)

The constructor.

  • access: public
StyleCollection StyleCollection (string $selector, string $classSelector, string $displayName, string $description)
  • string $selector: selector The selector of this StyleCollection.
  • string $classSelector: classSelector The class selector of this style collection. If
    1. null
    , it will be ignored, but the collection will not be able to be applied to components.
  • string $displayName: displayName The display name of this StyleCollection.
  • string $description: description The description of this StyleCollection.
addSP (line 270)

Adds one StyleProperty to this StyleCollection.

  • return: object The style property that was just added.
  • access: public
ref addSP (ref $sp)
  • ref $sp: object sc A StyleProperty object.

Redefinition of:
StyleCollectionInterface::addSP()
Adds one StyleProperty to this StyleCollection.
canBeApplied (line 233)

Determines whether this

  1. StyleCollection
can be applied to
  1. Components
.

  • return:
    1. TRUE
    if this
    1. StyleCollection
    can be applied to
    1. Components
    .
  • access: public
boolean canBeApplied ()

Redefinition of:
StyleCollectionInterface::canBeApplied()
Determines whether this
  1. StyleCollection
can be applied to
  1. Components
.
getClassSelector (line 224)

Returns the class selector of this style collection. A class selector is the string that would be included in the 'class' attribute of HTML tags. One can use this method in order to apply the style collection to an arbitrary component.

  • return: The class name of this style collection.
  • access: public
string getClassSelector ()

Redefinition of:
StyleCollectionInterface::getClassSelector()
Returns the class selector of this style collection. A class selector is the string that would be included in the 'class' attribute of HTML tags. One can use this method in order to apply the style collection to an arbitrary component.
getComponent (line 162)

Answers the component this style collection acts on ie BLANK, BLOCK, etc.

  • since: 4/26/06
  • access: public
string getComponent ()
getCSS (line 199)

Returns the CSS code for this StyleCollection.

  • return: The CSS code for this StyleCollection.
  • access: public
string getCSS ([string $tabs = ""])
  • 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:
StyleCollectionInterface::getCSS()
Returns the CSS code for this StyleCollection.

Redefined in descendants as:
getDescription (line 260)

Returns the description of this StlyeProperty.

  • return: The description of this StlyeProperty.
  • access: public
string getDescription ()

Redefinition of:
StyleCollectionInterface::getDescription()
Returns the description of this StyleCollection.
getDisplayName (line 251)

Returns the display name of this StyleCollection.

  • return: The display name of this StyleCollection.
  • access: public
string getDisplayName ()

Redefinition of:
StyleCollectionInterface::getDisplayName()
Returns the display name of this StyleCollection.
getId (line 133)

Answers the id

  • since: 4/26/06
  • access: public
object HarmoniId getId ()
getIndex (line 186)

Answers the component this style collection acts on ie BLANK, BLOCK, etc.

  • since: 4/26/06
  • access: public
string getIndex ()
getPostHTML (line 396)

Return HTML to nested inside of the component's block. This includes things such as corner images.

See the example below:

 	

Hello world! (this is when my component renders itself)

 

  • since: 11/22/05
  • access: public
string getPostHTML (string $tabs)
  • string $tabs

Redefined in descendants as:
getPreHTML (line 355)

Return HTML to nested inside of the component's block. This includes things such as corner images.

See the example below:

 	

Hello world! (this is when my component renders itself)

 

  • since: 11/22/05
  • access: public
string getPreHTML (string $tabs)
  • string $tabs

Redefined in descendants as:
getSelector (line 242)

Returns the selector of this StyleCollection.

  • return: The selector of this StyleCollection.
  • access: public
string getSelector ()

Redefinition of:
StyleCollectionInterface::getSelector()
Returns the selector of this StyleCollection.
getSPs (line 283)

Returns the StyleProperties of this StyleCollection in a suitable for CSS generation order.

  • return: array An array of the StyleProperties of this StyleCollection.
  • access: public
ref getSPs ()

Redefinition of:
StyleCollectionInterface::getSPs()
Returns the StyleProperties of this StyleCollection in a suitable for CSS generation order.
getStyleProperty (line 294)

Returns the StyleProperty with the given name

  • return: object StyleProperty
  • access: public
ref getStyleProperty (string $name)
  • string $name: the name of the Styleproperty
removeSP (line 311)

Remove the given StyleProperty from this Style Collection.

  • return: object The style property that was removed.
    1. NULL
    if it could not be found.
  • access: public
ref removeSP (ref $sp)
  • ref $sp: object The style property to remove.

Redefinition of:
StyleCollectionInterface::removeSP()
Remove the given StyleProperty from this Style Collection.
setComponent (line 151)

Sets the index

  • since: 4/26/06
  • access: public
void setComponent (string $component)
  • string $component
setId (line 120)

Sets the id

  • since: 4/26/06
  • access: public
void setId (object HarmoniId $id)
setIndex (line 175)

Sets the Index

  • since: 4/26/06
  • access: public
void setIndex (string $index)
  • string $index

Inherited Methods

Inherited From StyleCollectionInterface

StyleCollectionInterface::addSP()
StyleCollectionInterface::canBeApplied()
StyleCollectionInterface::getClassSelector()
StyleCollectionInterface::getCSS()
StyleCollectionInterface::getDescription()
StyleCollectionInterface::getDisplayName()
StyleCollectionInterface::getSelector()
StyleCollectionInterface::getSPs()
StyleCollectionInterface::removeSP()

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