Class StyleComponent

Description

This

  1. StyleComponent
generic class is the base for all the other
  1. StyleComponents
. It is up to the user to provide all the necessary data (display name, description, the ValidatorRule, the value of the SC, etc.)

The

  1. StyleComponent
(SC) is the most basic of the three building pieces of CSS styles. It combines a CSS property value with a ValidatorRule to ensure that the value follows a certain format.

The other two CSS styles building pieces are
  1. StyleProperties
and
  1. StyleCollections
. 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: StyleComponent.class.php,v 1.14 2007/09/04 20:25:21 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/GUIManager/StyleComponent.class.php (line 38)

StyleComponentInterface
   |
   --StyleComponent
Direct descendents
Class Description
AttachmentSC The RepeatSC represents CSS "attachment" value. The allowed values are:
AutoLengthSC The AutoLengthSC represents CSS "top", "left", "right", "bottom",
BackgroundAttachmentSC The BackgroundAttachmentSC represents CSS background-attachment values. The allowed values are:
BackgroundRepeatSC The BackgroundRepeatSC represents CSS background-repeat values. The allowed values are:
BorderStyleSC The BorderStyleSC represents CSS border-style values. The allowed values are:
ClearSC The ClearSC represents CSS clear values. The allowed values are:
ColorSC The ColorSC represents CSS color values. For efficiency reasons, constant
CursorSC The CursorSC represents CSS "cursor" values. The allowed
DirectionSC The DirectionSC represents CSS direction values. The allowed values are:
DisplaySC The DisplaySC represents CSS "display" values. The allowed
FloatSC The FloatSC represents CSS float values. The allowed values are:
FontFamilySC The FontFamilySC represents CSS "font-family" values. The allowed
FontSizeSC The FontSizeSC represents CSS "font-size" values. The allowed
FontStyleSC The FontStyleSC represents CSS "font-style" values. The allowed
FontVariantSC The FontVariantSC represents CSS "font-variant" values. The allowed
FontWeightSC The FontWeightSC represents CSS "font-weight" values. The allowed
HorizontalAlignmentPositionSC The HorizontalAlignmentPosition represents CSS relative and absolute position values, as well as certain alignments. The allowed
LengthSC The LengthSC represents CSS relative and absolute length values. The allowed
LineHeightSC The LineHeightSC represents CSS "line-height" values. The allowed
MaxDimensionSC The MaxDimensionSC represents CSS "max-height" and "max-width" values.
OverflowSC The OverflowSC represents CSS overflow values. The allowed values are:
PositionSC The PositionSC represents CSS "position" values. The allowed
RepeatSC The RepeatSC represents CSS "repeat" value. The allowed values are:
TextAlignSC The TextAlignSC represents CSS text-align values. The allowed values are:
TextDecorationSC The TextDecorationSC represents CSS text-decoration values. The allowed values are:
TextSpacingSC The TextSpacingSC represents CSS "word-spacing" and "letter-spacing" values.
TextTransformSC The TextTransformSC represents CSS text-transform values. The allowed values are:
UrlSC The UrlSC represents CSS "url" values. The URL format is:
VerticalAlignmentPositionSC The VerticalAlignmentPosition represents CSS relative and absolute position values, as well as certain alignments. The allowed
VerticalAlignSC The VerticalAlignSC represents CSS vertical-align values. The allowed values are:
VisibilitySC The VisibilitySC represents CSS visibility values. The allowed values are:
WhiteSpaceSC The WhiteSpaceSC represents CSS white-space values. The allowed values are:
ZIndexSC The ZIndexSC represents CSS z-index values. The allowed values are:
Variable Summary
string $_description
string $_displayName
object _error $_errorDescription
array $_options
object _rule $_rule
Method Summary
StyleComponent StyleComponent (string $value, ref $rule, array $options, mixed $limitedToOptions, ref $errorDescription, ref $displayName, string $description, string 7)
string getDescription ()
string getDisplayName ()
array getOptions ()
object ValidatorRule getRule ()
string getValue ()
boolean hasOptions ()
boolean isLimitedToOptions ()
void setId (object HarmoniId $id)
void setValue (string $value)
Variables
string $_description (line 52)

The description of this SC.

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

The display name of this SC.

  • var: _displayName
  • access: private
object _error $_errorDescription (line 66)

The description of the Error that will be thrown whenever validation fails.

  • access: private
boolean $_limitedToOptions (line 81)

If TRUE, then the value of this SC will be restricted to the list of options.

  • var: _limitedToOptions
  • access: private
array $_options (line 74)

An array of strings that will store the list of options (may or may not be

set in the constructor)

  • var: _options
  • access: private
object _rule $_rule (line 59)

This is the ValidatorRule of this SC.

  • access: private
Methods
Constructor StyleComponent (line 110)

The constructor.

  • access: public
StyleComponent StyleComponent (string $value, ref $rule, array $options, mixed $limitedToOptions, ref $errorDescription, ref $displayName, string $description, string 7)
  • string 7: description The description of the SC.
  • string $value: value The value to assign to this SC.
  • ref $rule: object rule The ValidatorRule that will be used to validate the values of this SC. If
    1. NULL
    , no validator rule will be used.
  • array $options: options An array of strings that represents the allowed values (i.e. the list of options) of this SC. If this argument is not null, hasOptions() will return
    1. true
    and getOptions() will return an iterator of the options. In addition, if
    1. limitedToOptions
    is set to
    1. TRUE
    , then a new ChoiceValidatorRule will be created with the given options. If this argument is
    1. null
    , then hasOptions() will return
    1. false
    .
  • mixed $limitedToOptions: limitedToOptions This is either a boolean or null. If TRUE, a new ChoiceValidatorRule will be created for the given list of options. If
    1. limitedToOptions
    is not set, then the value of the argument is irrelevant. FALSE and
    1. null
    will result the same behavior but it is recommended that
    1. FALSE
    is used whenever
    1. options
    is set, and
    1. null
    if not.
  • ref $errorDescription: mixed This is one of the following two: 1) The ValidatorRule that will be used to validate the values of this SC, or 2) An array of strings that represents the allowed values (i.e. the list of options) of this SC. Pass the array whenever you want hasOptions() and getOptions to function accordingly.
  • ref $displayName: object error This is the Error to throw when validation fails.
  • string $description: displayName The display name of the SC.
getDescription (line 197)

Returns the description of this StlyeProperty.

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

Redefinition of:
StyleComponentInterface::getDescription()
Returns the description of this StlyeProperty.
getDisplayName (line 188)

Returns the display name of this SC.

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

Redefinition of:
StyleComponentInterface::getDisplayName()
Returns the display name of this SC.
getErrorDescription (line 215)

Get the error description of this SC.

  • return: The error description of this SC.
  • access: public
string getErrorDescription ()
getId (line 173)

Answers the id

  • since: 4/26/06
  • access: public
object HarmoniId getId ()
getOptions (line 277)

Returns the list of options (list of allowed values) of this SC.

  • return: An array containing the list of options (list of allowed values) of this SC.
  • access: public
array getOptions ()

Redefinition of:
StyleComponentInterface::getOptions()
Returns the list of options (list of allowed values) of this SC.
getRule (line 224)

Get the rule of this SC.

  • return: The rule of this SC.
  • access: public
object ValidatorRule getRule ()
getValue (line 206)

Get the value of this SC.

  • return: The value of this SC.
  • access: public
string getValue ()

Redefinition of:
StyleComponentInterface::getValue()
Get the value of this SC.
hasOptions (line 252)

Determines whether this SC has a list of options. If there is a list of options, then the ValidatorRule of this SC would be a ChoiceValidatorRule.

If not, the ValidatorRule could be any ValidatorRule.

  • return: True if the SC has a list of options. FALSE if the SC can take any value.
  • access: public
boolean hasOptions ()

Redefinition of:
StyleComponentInterface::hasOptions()
Determines whether this SC has a list of options. If there is a list of options, then the ValidatorRule of this SC would be a ChoiceValidatorRule.
isLimitedToOptions (line 266)

This function will return

  1. TRUE
if the value of this SC is restricted only to the list of options. It will return
  1. FALSE
, if not.

  • return:
    1. TRUE
    if the value of this SC is restricted only to the list of options.
    1. FALSE
    , if not.
  • access: public
boolean isLimitedToOptions ()

Redefinition of:
StyleComponentInterface::isLimitedToOptions()
This function will return
  1. TRUE
if the value of this SC is restricted only to the list of options. It will return
  1. FALSE
, if not.
setId (line 160)

Sets the id

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

Sets the value of this SC and validates it using the attached

  1. ValidatorRule
.

  • access: public
void setValue (string $value)
  • string $value: value The new value.

Redefinition of:
StyleComponentInterface::setValue()
Sets the value of this SC and validates it using the attached
  1. ValidatorRule
.

Inherited Methods

Inherited From StyleComponentInterface

StyleComponentInterface::getDescription()
StyleComponentInterface::getDisplayName()
StyleComponentInterface::getOptions()
StyleComponentInterface::getValue()
StyleComponentInterface::hasOptions()
StyleComponentInterface::isLimitedToOptions()
StyleComponentInterface::setValue()

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