From e83edc3f20163ac25e2307f9c854e7bc9384970c Mon Sep 17 00:00:00 2001
From: xue <>
Date: Mon, 4 Sep 2006 18:12:17 +0000
Subject: Finished updating code related with enumerable data types.
---
HISTORY | 1 +
UPGRADE | 4 +-
.../quickstart/protected/pages/Controls/Pager.page | 2 +-
.../pages/Controls/Samples/TPager/Sample1.page | 2 +-
framework/Security/TSecurityManager.php | 2 +-
framework/Security/TUserManager.php | 2 +-
framework/TApplication.php | 2 +-
framework/TComponent.php | 54 +++---
framework/Web/THttpRequest.php | 2 +-
framework/Web/THttpSession.php | 2 +-
framework/Web/UI/WebControls/TBaseDataList.php | 47 +----
framework/Web/UI/WebControls/TBaseValidator.php | 27 ++-
framework/Web/UI/WebControls/TBulletedList.php | 101 ++++++++---
framework/Web/UI/WebControls/TButton.php | 31 +++-
framework/Web/UI/WebControls/TButtonColumn.php | 14 +-
framework/Web/UI/WebControls/TCheckBox.php | 29 ++-
framework/Web/UI/WebControls/TCheckBoxList.php | 9 +-
framework/Web/UI/WebControls/TColorPicker.php | 34 +++-
framework/Web/UI/WebControls/TCompareValidator.php | 69 ++++---
framework/Web/UI/WebControls/TDataBoundControl.php | 33 ++++
framework/Web/UI/WebControls/TDataGrid.php | 199 +++++++++++++--------
framework/Web/UI/WebControls/TDataGridColumn.php | 23 +++
framework/Web/UI/WebControls/TDataList.php | 111 ++++++------
.../Web/UI/WebControls/TDataTypeValidator.php | 15 +-
framework/Web/UI/WebControls/TDatePicker.php | 78 ++++++--
.../Web/UI/WebControls/TEditCommandColumn.php | 73 +++++++-
framework/Web/UI/WebControls/TImageMap.php | 62 ++++---
framework/Web/UI/WebControls/TInlineFrame.php | 72 ++++++--
framework/Web/UI/WebControls/TListBox.php | 38 +++-
framework/Web/UI/WebControls/TPager.php | 68 +++++--
framework/Web/UI/WebControls/TPanelStyle.php | 88 ++++++---
framework/Web/UI/WebControls/TRangeValidator.php | 58 ++++--
framework/Web/UI/WebControls/TRepeatInfo.php | 90 +++++++---
framework/Web/UI/WebControls/TRepeater.php | 43 ++---
framework/Web/UI/WebControls/TStyle.php | 130 ++++++++++----
framework/Web/UI/WebControls/TTable.php | 69 ++++---
framework/Web/UI/WebControls/TTableHeaderCell.php | 35 +++-
framework/Web/UI/WebControls/TTableRow.php | 32 +++-
framework/Web/UI/WebControls/TTextBox.php | 4 +-
.../Web/UI/WebControls/TValidationSummary.php | 4 +-
framework/Web/UI/WebControls/TWizard.php | 4 +-
.../quickstart/Controls/DataGrid3TestCase.php | 26 +--
42 files changed, 1248 insertions(+), 541 deletions(-)
diff --git a/HISTORY b/HISTORY
index 4c6aad59..9f50ae4a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -12,6 +12,7 @@ ENH: Uses uncompressed javascript in debug mode. (Wei)
ENH: Cells in TDataGrid rows can now be accessed via the corresponding column IDs (Qiang)
ENH: Input controls in some datagrid columns can now be accessed in a named fashion (Qiang)
ENH: Prado::fatalError() now displays function parameter information (Qiang)
+ENH: TEditCommandColumn now supports image buttons (Qiang)
CHG: Ticket#356 - TLabel will not render if its associated control is invisible (Qiang)
CHG: Validator the error message visibility before raising events OnError and OnSuccess (Wei)
CHG: Unify all client-side javascript event handler syntax. (Wei)
diff --git a/UPGRADE b/UPGRADE
index ab916ea3..19cb8141 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -17,8 +17,8 @@ Upgrading from v3.0.3
---------------------
- The 'Static' value is changed to 'Fixed' for the Display property of
all validators as well as TValidationSummary, due to conflict with PHP keywords.
-- The 'List' value is changed to 'SimpleList' for the DisplayMode property
- of TValidationSummary, due to conflict with PHP keywords.
+- The 'List' value is changed to 'SimpleList' for TValidationSummary.DisplayMode.
+- The 'List' value is changed to 'DropDownList' for TPager.Mode
- This change affects existing client-side javascript handlers such as
All ClientSide javascript event handlers (such as ClientSide.OnSuccess)
diff --git a/demos/quickstart/protected/pages/Controls/Pager.page b/demos/quickstart/protected/pages/Controls/Pager.page
index 821eab71..20b33b95 100644
--- a/demos/quickstart/protected/pages/Controls/Pager.page
+++ b/demos/quickstart/protected/pages/Controls/Pager.page
@@ -17,7 +17,7 @@ Note, the target data-bound control must have its AllowPaging set to tr
- NextPrev - a next page and a previous page button are rendered on each page.
- Numeric - a list of page index buttons are rendered.
-- List - a dropdown list of page indices is rendered.
+- DropDownList - a dropdown list of page indices is rendered.
These user interfaces may be further customized by configuring the following properties
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page
index 0d61f580..fc0783f5 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page
@@ -70,7 +70,7 @@ Total <%# $this->Parent->PageCount %> pages.
Choose page:
diff --git a/framework/Security/TSecurityManager.php b/framework/Security/TSecurityManager.php
index 6c227c8e..89f3711a 100644
--- a/framework/Security/TSecurityManager.php
+++ b/framework/Security/TSecurityManager.php
@@ -137,7 +137,7 @@ class TSecurityManager extends TModule
*/
public function setValidation($value)
{
- $this->_validation=TPropertyValue::ensureEnumerable($value,'TSecurityManagerValidationMode');
+ $this->_validation=TPropertyValue::ensureEnum($value,'TSecurityManagerValidationMode');
}
/**
diff --git a/framework/Security/TUserManager.php b/framework/Security/TUserManager.php
index 8d91c92a..c0bbe65d 100644
--- a/framework/Security/TUserManager.php
+++ b/framework/Security/TUserManager.php
@@ -198,7 +198,7 @@ class TUserManager extends TModule implements IUserManager
*/
public function setPasswordMode($value)
{
- $this->_passwordMode=TPropertyValue::ensureEnumerable($value,'TUserManagerPasswordMode');
+ $this->_passwordMode=TPropertyValue::ensureEnum($value,'TUserManagerPasswordMode');
}
/**
diff --git a/framework/TApplication.php b/framework/TApplication.php
index 0cce1a1a..56126fbb 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -478,7 +478,7 @@ class TApplication extends TComponent
*/
public function setMode($value)
{
- $this->_mode=TPropertyValue::ensureEnumerable($value,'TApplicationMode');
+ $this->_mode=TPropertyValue::ensureEnum($value,'TApplicationMode');
}
/**
diff --git a/framework/TComponent.php b/framework/TComponent.php
index b9dbd3d5..986a0b32 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -594,21 +594,33 @@ class TPropertyValue
/**
* Converts a value to enum type.
- * This method is deprecated. Try to use {@link ensureEnumerable}, instead.
- * This method mainly performs sanity check of a value to make sure
- * it is a valid enumeration value. Each enumeration value is a string
- * which is case-sensistive.
+ *
+ * This method checks if the value is of the specified enumerable type.
+ * A value is a valid enumerable value if it is equal to the name of a constant
+ * in the specified enumerable type (class).
+ * For more details about enumerable, see {@link TEnumerable}.
+ *
+ * For backward compatibility, this method also supports sanity
+ * check of a string value to see if it is among the given list of strings.
* @param mixed the value to be converted.
- * @param mixed array of valid enumeration values. If this is not an array,
- * the method considers its parameters are of variable length, and the second
- * till the last parameters are enumeration values.
+ * @param mixed class name of the enumerable type, or array of valid enumeration values. If this is not an array,
+ * the method considers its parameters are of variable length, and the second till the last parameters are enumeration values.
* @return string the valid enumeration value
* @throws TInvalidDataValueException if the original value is not in the string array.
- * @deprecated deprecated since version 3.0.4
*/
public static function ensureEnum($value,$enums)
{
- if(!is_array($enums))
+ static $types=array();
+ if(func_num_args()===2 && is_string($enums))
+ {
+ if(!isset($types[$enums]))
+ $types[$enums]=new ReflectionClass($enums);
+ if($types[$enums]->hasConstant($value))
+ return $value;
+ else
+ throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid',$value,$enums);
+ }
+ else if(!is_array($enums))
{
$enums=func_get_args();
array_shift($enums);
@@ -618,30 +630,6 @@ class TPropertyValue
else
throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid',$value,implode(' | ',$enums));
}
-
- /**
- * Converts a value to enum type.
- * This method checks if the value is of the specified enumerable type.
- * A value is a valid enumerable value if it is equal to the name of a constant
- * in the specified enumerable type (class).
- * For more details about enumerable, see {@link TEnumerable}.
- * @param string enumerable value
- * @param string enumerable class name
- * @return string valid enumerable value
- * @throws TInvalidDataValueException if the original value is not a valid enumerable value.
- * @see ensureEnum
- * @sine 3.0.4
- */
- public static function ensureEnumerable($value,$enumType)
- {
- static $types=array();
- if(!isset($types[$enumType]))
- $types[$enumType]=new ReflectionClass($enumType);
- if($types[$enumType]->hasConstant($value))
- return $value;
- else
- throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid',$value,$enumType);
- }
}
/**
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index fcf1c8f9..bac43057 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -222,7 +222,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function setUrlFormat($value)
{
- $this->_urlFormat=TPropertyValue::ensureEnumerable($value,'THttpRequestUrlFormat');
+ $this->_urlFormat=TPropertyValue::ensureEnum($value,'THttpRequestUrlFormat');
}
/**
diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php
index 810d8e60..eefe50e5 100644
--- a/framework/Web/THttpSession.php
+++ b/framework/Web/THttpSession.php
@@ -293,7 +293,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar
throw new TInvalidOperationException('httpsession_cookiemode_unchangeable');
else
{
- $value=TPropertyValue::ensureEnumerable($value,'THttpSessionCookieMode');
+ $value=TPropertyValue::ensureEnum($value,'THttpSessionCookieMode');
if($value===THttpSessionCookieMode::None)
ini_set('session.use_cookies','0');
else if($value===THttpSessionCookieMode::Allow)
diff --git a/framework/Web/UI/WebControls/TBaseDataList.php b/framework/Web/UI/WebControls/TBaseDataList.php
index a8ab8faf..2884ec22 100644
--- a/framework/Web/UI/WebControls/TBaseDataList.php
+++ b/framework/Web/UI/WebControls/TBaseDataList.php
@@ -53,39 +53,6 @@ abstract class TBaseDataList extends TDataBoundControl
return new TTableStyle;
}
- /**
- * @return string caption of the table layout
- */
- public function getCaption()
- {
- return $this->getViewState('Caption','');
- }
-
- /**
- * @param string caption of the table layout
- */
- public function setCaption($value)
- {
- $this->setViewState('Caption','');
- }
-
- /**
- * @return string alignment of the caption of the table layout. Defaults to 'NotSet'.
- */
- public function getCaptionAlign()
- {
- return $this->getViewState('CaptionAlign','NotSet');
- }
-
- /**
- * @return string alignment of the caption of the table layout.
- * Valid values include 'NotSet','Top','Bottom','Left','Right'.
- */
- public function setCaptionAlign($value)
- {
- $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'NotSet','Top','Bottom','Left','Right'),'NotSet');
- }
-
/**
* @return integer the cellspacing for the table layout. Defaults to -1, meaning not set.
*/
@@ -125,19 +92,18 @@ abstract class TBaseDataList extends TDataBoundControl
}
/**
- * @return string the horizontal alignment of the table content. Defaults to 'NotSet'.
+ * @return THorizontalAlign the horizontal alignment of the table content. Defaults to THorizontalAlign::NotSet.
*/
public function getHorizontalAlign()
{
if($this->getHasStyle())
return $this->getStyle()->getHorizontalAlign();
else
- return 'NotSet';
+ return THorizontalAlign::NotSet;
}
/**
- * @param string the horizontal alignment of the table content.
- * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center'.
+ * @param THorizontalAlign the horizontal alignment of the table content.
*/
public function setHorizontalAlign($value)
{
@@ -145,20 +111,19 @@ abstract class TBaseDataList extends TDataBoundControl
}
/**
- * @return string the grid line setting of the table layout. Defaults to 'None'.
+ * @return TTableGridLines the grid line setting of the table layout. Defaults to TTableGridLines::None.
*/
public function getGridLines()
{
if($this->getHasStyle())
return $this->getStyle()->getGridLines();
else
- return 'None';
+ return TTableGridLines::None;
}
/**
* Sets the grid line style of the table layout.
- * Valid values include 'None', 'Horizontal', 'Vertical', 'Both'.
- * @param string the grid line setting of the table
+ * @param TTableGridLines the grid line setting of the table
*/
public function setGridLines($value)
{
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 711dd2c4..bb53b55c 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -323,7 +323,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
*/
public function setDisplay($value)
{
- $this->setViewState('Display',TPropertyValue::ensureEnumerable($value,'TValidatorDisplayStyle'),TValidatorDisplayStyle::Fixed);
+ $this->setViewState('Display',TPropertyValue::ensureEnum($value,'TValidatorDisplayStyle'),TValidatorDisplayStyle::Fixed);
}
/**
@@ -685,4 +685,29 @@ class TValidatorDisplayStyle extends TEnumerable
const Dynamic='Dynamic';
const Fixed='Fixed';
}
+
+/**
+ * TValidationDataType class.
+ * TValidationDataType defines the enumerable type for the possible data types that
+ * a comparison validator can validate upon.
+ *
+ * The following enumerable values are defined:
+ * - Integer
+ * - Float
+ * - Date
+ * - String
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TValidationDataType extends TEnumerable
+{
+ const Integer='Integer';
+ const Float='Float';
+ const Date='Date';
+ const String='String';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php
index 09e971e4..7e8c9c3a 100644
--- a/framework/Web/UI/WebControls/TBulletedList.php
+++ b/framework/Web/UI/WebControls/TBulletedList.php
@@ -24,7 +24,7 @@ Prado::using('System.Web.UI.WebControls.TListControl');
* specifies the image used as bullets.
*
* TBulletedList displays the item texts in three different modes, specified
- * via {@link setDisplayMode DisplayMode}. When the mode is 'Text', the item texts
+ * via {@link setDisplayMode DisplayMode}. When the mode is Text, the item texts
* are displayed as static texts; When the mode is 'HyperLink', each item
* is displayed as a hyperlink whose URL is given by the item value, and the
* {@link setTarget Target} property can be used to specify the target browser window;
@@ -73,11 +73,11 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
{
switch($this->getBulletStyle())
{
- case 'Numbered':
- case 'LowerAlpha':
- case 'UpperAlpha':
- case 'LowerRoman':
- case 'UpperRoman':
+ case TBulletStyle::Numbered:
+ case TBulletStyle::LowerAlpha:
+ case TBulletStyle::UpperAlpha:
+ case TBulletStyle::LowerRoman:
+ case TBulletStyle::UpperRoman:
return 'ol';
}
return 'ul';
@@ -103,36 +103,36 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
$needStart=false;
switch($this->getBulletStyle())
{
- case 'Numbered':
+ case TBulletStyle::Numbered:
$writer->addStyleAttribute('list-style-type','decimal');
$needStart=true;
break;
- case 'LowerAlpha':
+ case TBulletStyle::LowerAlpha:
$writer->addStyleAttribute('list-style-type','lower-alpha');
$needStart=true;
break;
- case 'UpperAlpha':
+ case TBulletStyle::UpperAlpha:
$writer->addStyleAttribute('list-style-type','upper-alpha');
$needStart=true;
break;
- case 'LowerRoman':
+ case TBulletStyle::LowerRoman:
$writer->addStyleAttribute('list-style-type','lower-roman');
$needStart=true;
break;
- case 'UpperRoman':
+ case TBulletStyle::UpperRoman:
$writer->addStyleAttribute('list-style-type','upper-roman');
$needStart=true;
break;
- case 'Disc':
+ case TBulletStyle::Disc:
$writer->addStyleAttribute('list-style-type','disc');
break;
- case 'Circle':
+ case TBulletStyle::Circle:
$writer->addStyleAttribute('list-style-type','circle');
break;
- case 'Square':
+ case TBulletStyle::Square:
$writer->addStyleAttribute('list-style-type','square');
break;
- case 'CustomImage':
+ case TBulletStyle::CustomImage:
$url=$this->getBulletImageUrl();
$writer->addStyleAttribute('list-style-image',"url($url)");
break;
@@ -159,37 +159,35 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
}
/**
- * @return string style of bullets. Defaults to 'NotSet'.
+ * @return TBulletStyle style of bullets. Defaults to TBulletStyle::NotSet.
*/
public function getBulletStyle()
{
- return $this->getViewState('BulletStyle','NotSet');
+ return $this->getViewState('BulletStyle',TBulletStyle::NotSet);
}
/**
- * @param string style of bullets. Valid values include
- * 'NotSet','Numbered','LowerAlpha','UpperAlpha','LowerRoman','UpperRoman','Disc','Circle','Square','CustomImage'
+ * @param TBulletStyle style of bullets.
*/
public function setBulletStyle($value)
{
- $this->setViewState('BulletStyle',TPropertyValue::ensureEnum($value,'NotSet','Numbered','LowerAlpha','UpperAlpha','LowerRoman','UpperRoman','Disc','Circle','Square','CustomImage'),'NotSet');
+ $this->setViewState('BulletStyle',TPropertyValue::ensureEnum($value,'TBulletStyle'),TBulletStyle::NotSet);
}
/**
- * @return string display mode of the list. Defaults to 'Text'.
+ * @return TBulletedListDisplayMode display mode of the list. Defaults to TBulletedListDisplayMode::Text.
*/
public function getDisplayMode()
{
- return $this->getViewState('DisplayMode','Text');
+ return $this->getViewState('DisplayMode',TBulletedListDisplayMode::Text);
}
/**
- * @return string display mode of the list. Valid values include
- * 'Text', 'HyperLink', 'LinkButton'.
+ * @return TBulletedListDisplayMode display mode of the list.
*/
public function setDisplayMode($value)
{
- $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'Text','HyperLink','LinkButton'),'Text');
+ $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'TBulletedListDisplayMode'),TBulletedListDisplayMode::Text);
}
/**
@@ -282,13 +280,13 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
{
switch($this->getDisplayMode())
{
- case 'Text':
+ case TBulletedListDisplayMode::Text:
$this->renderTextItem($writer, $item, $index);
break;
- case 'HyperLink':
+ case TBulletedListDisplayMode::HyperLink:
$this->renderHyperLinkItem($writer, $item, $index);
break;
- case 'LinkButton':
+ case TBulletedListDisplayMode::LinkButton:
$this->renderLinkButtonItem($writer, $item, $index);
break;
}
@@ -431,4 +429,51 @@ class TBulletedListEventParameter extends TEventParameter
return $this->_index;
}
}
+
+/**
+ * TBulletStyle class.
+ * TBulletStyle defines the enumerable type for the possible bullet styles that may be used
+ * for a {@link TBulletedList} control.
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TBulletStyle extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Numbered='Numbered';
+ const LowerAlpha='LowerAlpha';
+ const UpperAlpha='UpperAlpha';
+ const LowerRoman='LowerRoman';
+ const UpperRoman='UpperRoman';
+ const Disc='Disc';
+ const Circle='Circle';
+ const Square='Square';
+ const CustomImage='CustomImage';
+}
+
+/**
+ * TBulletedListDisplayMode class.
+ * TBulletedListDisplayMode defines the enumerable type for the possible display mode
+ * of a {@link TBulletedList} control.
+ *
+ * The following enumerable values are defined:
+ * - Text: the bulleted list items are displayed as plain texts
+ * - HyperLink: the bulleted list items are displayed as hyperlinks
+ * - LinkButton: the bulleted list items are displayed as link buttons that can cause postbacks
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TBulletedListDisplayMode extends TEnumerable
+{
+ const Text='Text';
+ const HyperLink='HyperLink';
+ const LinkButton='LinkButton';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php
index d24f5ef4..09868b12 100644
--- a/framework/Web/UI/WebControls/TButton.php
+++ b/framework/Web/UI/WebControls/TButton.php
@@ -103,7 +103,7 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr
*/
protected function needPostBackScript()
{
- return $this->canCauseValidation() || ($this->getButtonType()!=='Submit' &&
+ return $this->canCauseValidation() || ($this->getButtonType()!==TButtonType::Submit &&
($this->hasEventHandler('OnClick') || $this->hasEventHandler('OnCommand')));
}
@@ -254,20 +254,41 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr
}
/**
- * @return string the type of the button. Defaults to 'Submit'.
+ * @return TButtonType the type of the button. Defaults to TButtonType::Submit.
*/
public function getButtonType()
{
- return $this->getViewState('ButtonType','Submit');
+ return $this->getViewState('ButtonType',TButtonType::Submit);
}
/**
- * @param string the type of the button. Valid values include 'Submit', 'Reset', 'Button'.
+ * @param TButtonType the type of the button.
*/
public function setButtonType($value)
{
- $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Submit','Reset','Button'),'Submit');
+ $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonType'),TButtonType::Submit);
}
}
+/**
+ * TButtonType class.
+ * TButtonType defines the enumerable type for the possible types that a {@link TButton} can take.
+ *
+ * The following enumerable values are defined:
+ * - Submit: a normal submit button
+ * - Reset: a reset button
+ * - Button: a client button (normally does not perform form submission)
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TButtonType extends TEnumerable
+{
+ const Submit='Submit';
+ const Reset='Reset';
+ const Button='Button';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TButtonColumn.php b/framework/Web/UI/WebControls/TButtonColumn.php
index fdcf58d3..5f2c228d 100644
--- a/framework/Web/UI/WebControls/TButtonColumn.php
+++ b/framework/Web/UI/WebControls/TButtonColumn.php
@@ -152,19 +152,19 @@ class TButtonColumn extends TDataGridColumn
}
/**
- * @return string the type of command button. Defaults to LinkButton.
+ * @return TButtonColumnType the type of command button. Defaults to TButtonColumnType::LinkButton.
*/
public function getButtonType()
{
- return $this->getViewState('ButtonType','LinkButton');
+ return $this->getViewState('ButtonType',TButtonColumnType::LinkButton);
}
/**
- * @param string the type of command button, LinkButton, PushButton or ImageButton
+ * @param TButtonColumnType the type of command button
*/
public function setButtonType($value)
{
- $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'LinkButton','PushButton','ImageButton'),'LinkButton');
+ $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonColumnType'),TButtonColumnType::LinkButton);
}
/**
@@ -230,9 +230,9 @@ class TButtonColumn extends TDataGridColumn
if($itemType===TDataGrid::IT_ITEM || $itemType===TDataGrid::IT_ALTERNATINGITEM || $itemType===TDataGrid::IT_SELECTEDITEM || $itemType===TDataGrid::IT_EDITITEM)
{
$buttonType=$this->getButtonType();
- if($buttonType==='LinkButton')
+ if($buttonType===TButtonColumnType::LinkButton)
$button=new TLinkButton;
- else if($buttonType==='PushButton')
+ else if($buttonType===TButtonColumnType::PushButton)
$button=new TButton;
else // image button
{
@@ -243,7 +243,7 @@ class TButtonColumn extends TDataGridColumn
$button->setCommandName($this->getCommandName());
$button->setCausesValidation($this->getCausesValidation());
$button->setValidationGroup($this->getValidationGroup());
- if($this->getDataTextField()!=='' || ($buttonType==='ImageButton' && $this->getDataImageUrlField()!==''))
+ if($this->getDataTextField()!=='' || ($buttonType===TButtonColumnType::ImageButton && $this->getDataImageUrlField()!==''))
$button->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
$cell->getControls()->add($button);
$cell->registerObject('Button',$button);
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php
index 6ee67c16..d8cdaa37 100644
--- a/framework/Web/UI/WebControls/TCheckBox.php
+++ b/framework/Web/UI/WebControls/TCheckBox.php
@@ -147,19 +147,19 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
}
/**
- * @return string the alignment (Left or Right) of the text caption, defaults to Right.
+ * @return TTextAlign the alignment (Left or Right) of the text caption, defaults to TTextAlign::Right.
*/
public function getTextAlign()
{
- return $this->getViewState('TextAlign','Right');
+ return $this->getViewState('TextAlign',TTextAlign::Right);
}
/**
- * @param string the alignment of the text caption. Valid values include Left and Right.
+ * @param TTextAlign the alignment of the text caption. Valid values include Left and Right.
*/
public function setTextAlign($value)
{
- $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,array('Left','Right')),'Right');
+ $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'TTextAlign'),TTextAlign::Right);
}
/**
@@ -270,7 +270,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
$clientID=$this->getClientID();
if(($text=$this->getText())!=='')
{
- if($this->getTextAlign()==='Left')
+ if($this->getTextAlign()===TTextAlign::Left)
{
$this->renderLabel($writer,$clientID,$text);
$this->renderInputTag($writer,$clientID,$onclick);
@@ -403,4 +403,23 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
}
+/**
+ * TTextAlign class.
+ * TTextAlign defines the enumerable type for the possible text alignments
+ *
+ * The following enumerable values are defined:
+ * - Left: left aligned
+ * - Right: right aligned
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TTextAlign extends TEnumerable
+{
+ const Left='Left';
+ const Right='Right';
+}
+
?>
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index e6ca3642..21cc330b 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -116,20 +116,19 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
}
/**
- * @return string the alignment of the text caption, defaults to 'Right'.
+ * @return TTextAlign the alignment of the text caption, defaults to TTextAlign::Right.
*/
public function getTextAlign()
{
- return $this->getViewState('TextAlign','Right');
+ return $this->getViewState('TextAlign',TTextAlign::Right);
}
/**
- * Sets the text alignment of the checkboxes
- * @param string either 'Left' or 'Right'
+ * @param TTextAlign the text alignment of the checkboxes
*/
public function setTextAlign($value)
{
- $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,array('Left','Right')),'Right');
+ $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'TTextAlign'),TTextAlign::Right);
}
diff --git a/framework/Web/UI/WebControls/TColorPicker.php b/framework/Web/UI/WebControls/TColorPicker.php
index 6172722c..21812517 100644
--- a/framework/Web/UI/WebControls/TColorPicker.php
+++ b/framework/Web/UI/WebControls/TColorPicker.php
@@ -40,19 +40,19 @@ class TColorPicker extends TTextBox
}
/**
- * @param string color picker UI mode, "Simple", "Basic" or "Full", default is "Basic"
+ * @param TColorPickerMode color picker UI mode
*/
public function setMode($value)
{
- $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'Simple', 'Basic', 'Full'), 'Basic');
+ $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'TColorPickerMode'), TColorPickerMode::Basic);
}
/**
- * @return string current color picker UI mode.
+ * @return TColorPickerMode current color picker UI mode. Defaults to TColorPickerMode::Basic.
*/
public function getMode()
{
- return $this->getViewState('Mode', 'Basic');
+ return $this->getViewState('Mode', TColorPickerMode::Basic);
}
/**
@@ -117,8 +117,8 @@ class TColorPicker extends TTextBox
{
$mode = $this->getMode();
- if($mode == 'Full') $options['Mode'] = $mode;
- else if($mode == 'Simple') $options['Palette'] = 'Tiny';
+ if($mode == TColorPickerMode::Full) $options['Mode'] = $mode;
+ else if($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny';
$options['OKButtonText'] = $this->getOKButtonText();
$options['CancelButtonText'] = $this->getCancelButtonText();
@@ -233,4 +233,26 @@ class TColorPicker extends TTextBox
}
+/**
+ * TColorPickerMode class.
+ * TColorPickerMode defines the enumerable type for the possible UI mode
+ * that a {@link TColorPicker} control can take.
+ *
+ * The following enumerable values are defined:
+ * - Simple
+ * - Basic
+ * - Full
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TColorPickerMode extends TEnumerable
+{
+ const Simple='Simple';
+ const Basic='Basic';
+ const Full='Full';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TCompareValidator.php b/framework/Web/UI/WebControls/TCompareValidator.php
index 93664b2e..2b1028ef 100644
--- a/framework/Web/UI/WebControls/TCompareValidator.php
+++ b/framework/Web/UI/WebControls/TCompareValidator.php
@@ -57,21 +57,21 @@ class TCompareValidator extends TBaseValidator
}
/**
- * @return string the data type that the values being compared are converted to before the comparison is made. Defaults to String.
+ * @return TValidationDataType the data type that the values being compared are converted to before the comparison is made. Defaults to TValidationDataType::String.
*/
public function getDataType()
{
- return $this->getViewState('DataType','String');
+ return $this->getViewState('DataType',TValidationDataType::String);
}
/**
- * Sets the data type (Integer, Float, Date, String) that the values being
+ * Sets the data type that the values being
* compared are converted to before the comparison is made.
- * @param string the data type
+ * @param TValidationDataType the data type
*/
public function setDataType($value)
{
- $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','String'),'String');
+ $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TValidationDataType'),TValidationDataType::String);
}
/**
@@ -109,20 +109,20 @@ class TCompareValidator extends TBaseValidator
}
/**
- * @return string the comparison operation to perform (Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual). Defaults to Equal.
+ * @return TValidationCompareOperator the comparison operation to perform. Defaults to TValidationCompareOperator::Equal.
*/
public function getOperator()
{
- return $this->getViewState('Operator','Equal');
+ return $this->getViewState('Operator',TValidationCompareOperator::Equal);
}
/**
- * Sets the comparison operation to perform (Equal, NotEqual, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual)
- * @param string the comparison operation
+ * Sets the comparison operation to perform
+ * @param TValidationCompareOperator the comparison operation
*/
public function setOperator($value)
{
- $this->setViewState('Operator',TPropertyValue::ensureEnum($value,'Equal','NotEqual','GreaterThan','GreaterThanEqual','LessThan','LessThanEqual'),'Equal');
+ $this->setViewState('Operator',TPropertyValue::ensureEnum($value,'TValidationCompareOperator'),TValidationCompareOperator::Equal);
}
/**
@@ -167,17 +167,17 @@ class TCompareValidator extends TBaseValidator
$values = $this->getComparisonValues($value, $value2);
switch($this->getOperator())
{
- case 'Equal':
+ case TValidationCompareOperator::Equal:
return $values[0] == $values[1];
- case 'NotEqual':
+ case TValidationCompareOperator::NotEqual:
return $values[0] != $values[1];
- case 'GreaterThan':
+ case TValidationCompareOperator::GreaterThan:
return $values[0] > $values[1];
- case 'GreaterThanEqual':
+ case TValidationCompareOperator::GreaterThanEqual:
return $values[0] >= $values[1];
- case 'LessThan':
+ case TValidationCompareOperator::LessThan:
return $values[0] < $values[1];
- case 'LessThanEqual':
+ case TValidationCompareOperator::LessThanEqual:
return $values[0] <= $values[1];
}
@@ -194,11 +194,11 @@ class TCompareValidator extends TBaseValidator
{
switch($this->getDataType())
{
- case 'Integer':
+ case TValidationDataType::Integer:
return array(intval($value1), intval($value2));
- case 'Float':
+ case TValidationDataType::Float:
return array(floatval($value1), floatval($value2));
- case 'Date':
+ case TValidationDataType::Date:
$dateFormat = $this->getDateFormat();
if($dateFormat!=='')
{
@@ -225,7 +225,7 @@ class TCompareValidator extends TBaseValidator
}
if(($value=$this->getValueToCompare())!=='')
$options['ValueToCompare']=$value;
- if(($operator=$this->getOperator())!=='Equal')
+ if(($operator=$this->getOperator())!==TValidationCompareOperator::Equal)
$options['Operator']=$operator;
$options['DataType']=$this->getDataType();
if(($dateFormat=$this->getDateFormat())!=='')
@@ -234,4 +234,33 @@ class TCompareValidator extends TBaseValidator
}
}
+
+/**
+ * TValidationCompareOperator class.
+ * TValidationCompareOperator defines the enumerable type for the comparison operations
+ * that {@link TCompareValidator} can perform validation with.
+ *
+ * The following enumerable values are defined:
+ * - Equal
+ * - NotEqual
+ * - GreaterThan
+ * - GreaterThanEqual
+ * - LessThan
+ * - LessThanEqual
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TValidationCompareOperator extends TEnumerable
+{
+ const Equal='Equal';
+ const NotEqual='NotEqual';
+ const GreaterThan='GreaterThan';
+ const GreaterThanEqual='GreaterThanEqual';
+ const LessThan='LessThan';
+ const LessThanEqual='LessThanEqual';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TDataBoundControl.php b/framework/Web/UI/WebControls/TDataBoundControl.php
index 38ed42dd..3f8ddc7e 100644
--- a/framework/Web/UI/WebControls/TDataBoundControl.php
+++ b/framework/Web/UI/WebControls/TDataBoundControl.php
@@ -506,4 +506,37 @@ abstract class TDataBoundControl extends TWebControl
}
}
+
+/**
+ * TListItemType class.
+ * TListItemType defines the enumerable type for the possible types
+ * that databound list items could take.
+ *
+ * The following enumerable values are defined:
+ * - Header: header item
+ * - Footer: footer item
+ * - Item: content item (neither header nor footer)
+ * - Separator: separator between items
+ * - AlternatingItem: alternating content item
+ * - EditItem: content item in edit mode
+ * - SelectedItem: selected content item
+ * - Pager: pager
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TListItemType extends TEnumerable
+{
+ const Header='Header';
+ const Footer='Footer';
+ const Item='Item';
+ const Separator='Separator';
+ const AlternatingItem='AlternatingItem';
+ const EditItem='EditItem';
+ const SelectedItem='SelectedItem';
+ const Pager='Pager';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index ad30ff3f..48b6a8c9 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -45,8 +45,8 @@ Prado::using('System.Web.UI.WebControls.TPanel');
*
* Each datagrid item has a {@link TDataGridItem::getItemType type}
* which tells the position and state of the item in the datalist. An item in the header
- * of the repeater is of type 'Header'. A body item may be of either
- * 'Item', 'AlternatingItem', 'SelectedItem' or 'EditItem', depending whether the item
+ * of the repeater is of type Header. A body item may be of either
+ * Item, AlternatingItem, SelectedItem or EditItem, depending whether the item
* index is odd or even, whether it is being selected or edited.
*
* A datagrid is specified with a list of columns. Each column specifies how the corresponding
@@ -151,6 +151,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
{
/**
* datagrid item types
+ * @deprecated deprecated since version 3.0.4. Use TListItemType constants instead.
*/
const IT_HEADER='Header';
const IT_FOOTER='Footer';
@@ -406,20 +407,19 @@ class TDataGrid extends TBaseDataList implements INamingContainer
}
/**
- * @return string datagrid caption alignment. Defaults to 'NotSet'.
+ * @return TTableCaptionAlign datagrid caption alignment. Defaults to TTableCaptionAlign::NotSet.
*/
public function getCaptionAlign()
{
- return $this->getViewState('CaptionAlign','NotSet');
+ return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet);
}
/**
- * @param string datagrid caption alignment. Valid values include
- * 'NotSet','Top','Bottom','Left','Right'.
+ * @param TTableCaptionAlign datagrid caption alignment. Valid values include
*/
public function setCaptionAlign($value)
{
- $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'NotSet','Top','Bottom','Left','Right'),'NotSet');
+ $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'TTableCaptionAlign'),TTableCaptionAlign::NotSet);
}
/**
@@ -495,14 +495,14 @@ class TDataGrid extends TBaseDataList implements INamingContainer
if($current>=0 && $current<$itemCount)
{
$item=$items->itemAt($current);
- if($item->getItemType()!==self::IT_EDITITEM)
- $item->setItemType($current%2?self::IT_ALTERNATINGITEM:self::IT_ITEM);
+ if($item->getItemType()!==TListItemType::EditItem)
+ $item->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
}
if($value>=0 && $value<$itemCount)
{
$item=$items->itemAt($value);
- if($item->getItemType()!==self::IT_EDITITEM)
- $item->setItemType(self::IT_SELECTEDITEM);
+ if($item->getItemType()!==TListItemType::EditItem)
+ $item->setItemType(TListItemType::SelectedItem);
}
}
}
@@ -545,9 +545,9 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$items=$this->getItems();
$itemCount=$items->getCount();
if($current>=0 && $current<$itemCount)
- $items->itemAt($current)->setItemType($current%2?self::IT_ALTERNATINGITEM:self::IT_ITEM);
+ $items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
if($value>=0 && $value<$itemCount)
- $items->itemAt($value)->setItemType(self::IT_EDITITEM);
+ $items->itemAt($value)->setItemType(TListItemType::EditItem);
}
}
@@ -923,22 +923,22 @@ class TDataGrid extends TBaseDataList implements INamingContainer
{
if($allowPaging)
$this->_topPager=$this->createPager();
- $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,false,null,$columns);
+ $this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,false,null,$columns);
}
if($index===$editIndex)
- $itemType=self::IT_EDITITEM;
+ $itemType=TListItemType::EditItem;
else if($index===$selectedIndex)
- $itemType=self::IT_SELECTEDITEM;
+ $itemType=TListItemType::SelectedItem;
else if($index % 2)
- $itemType=self::IT_ALTERNATINGITEM;
+ $itemType=TListItemType::AlternatingItem;
else
- $itemType=self::IT_ITEM;
+ $itemType=TListItemType::Item;
$items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns));
$dsIndex++;
}
if($index>0)
{
- $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,false,null,$columns);
+ $this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,false,null,$columns);
if($allowPaging)
$this->_bottomPager=$this->createPager();
}
@@ -996,23 +996,23 @@ class TDataGrid extends TBaseDataList implements INamingContainer
{
if($allowPaging)
$this->_topPager=$this->createPager();
- $this->_header=$this->createItemInternal(-1,-1,self::IT_HEADER,true,null,$columns);
+ $this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,true,null,$columns);
}
if($index===$editIndex)
- $itemType=self::IT_EDITITEM;
+ $itemType=TListItemType::EditItem;
else if($index===$selectedIndex)
- $itemType=self::IT_SELECTEDITEM;
+ $itemType=TListItemType::SelectedItem;
else if($index % 2)
- $itemType=self::IT_ALTERNATINGITEM;
+ $itemType=TListItemType::AlternatingItem;
else
- $itemType=self::IT_ITEM;
+ $itemType=TListItemType::Item;
$items->add($this->createItemInternal($index,$dsIndex,$itemType,true,$row,$columns));
$index++;
$dsIndex++;
}
if($index>0)
{
- $this->_footer=$this->createItemInternal(-1,-1,self::IT_FOOTER,true,null,$columns);
+ $this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,true,null,$columns);
if($allowPaging)
$this->_bottomPager=$this->createPager();
}
@@ -1029,7 +1029,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
/**
* Creates a datagrid item instance based on the item type and index.
* @param integer zero-based item index
- * @param string item type, may be self::IT_HEADER, self::IT_FOOTER, self::IT_ITEM, self::IT_SEPARATOR, self::IT_ALTERNATINGITEM, self::IT_SELECTEDITEM, self::IT_EDITITEM.
+ * @param TListItemType item type
* @return TDataGridItem created data list item
*/
protected function createItem($itemIndex,$dataSourceIndex,$itemType)
@@ -1071,15 +1071,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$index=0;
foreach($columns as $column)
{
- if($itemType===self::IT_HEADER)
+ if($itemType===TListItemType::Header)
$cell=new TTableHeaderCell;
else
$cell=new TTableCell;
if(($id=$column->getID())!=='')
- {
- $cell->setID($id);
$item->registerObject($id,$cell);
- }
$column->initializeCell($cell,$index,$itemType);
$cells->add($cell);
$index++;
@@ -1103,10 +1100,10 @@ class TDataGrid extends TBaseDataList implements INamingContainer
{
switch($this->getPagerStyle()->getMode())
{
- case 'NextPrev':
+ case TDataGridPagerMode::NextPrev:
$this->buildNextPrevPager($pager);
break;
- case 'Numeric':
+ case TDataGridPagerMode::Numeric:
$this->buildNumericPager($pager);
break;
}
@@ -1126,7 +1123,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
*/
protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter)
{
- if($buttonType==='LinkButton')
+ if($buttonType===TDataGridPagerButtonType::LinkButton)
{
if($enabled)
$button=new TLinkButton;
@@ -1268,9 +1265,9 @@ class TDataGrid extends TBaseDataList implements INamingContainer
}
else
{
- $column->setHeaderText(self::IT_ITEM);
+ $column->setHeaderText(TListItemType::Item);
$column->setDataField($key);
- $column->setSortExpression(self::IT_ITEM);
+ $column->setSortExpression(TListItemType::Item);
$autoColumns->add($column);
}
}
@@ -1326,31 +1323,31 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$itemType=$item->getItemType();
switch($itemType)
{
- case self::IT_HEADER:
+ case TListItemType::Header:
if($headerStyle)
$item->getStyle()->mergeWith($headerStyle);
if(!$this->getShowHeader())
$item->setVisible(false);
break;
- case self::IT_FOOTER:
+ case TListItemType::Footer:
if($footerStyle)
$item->getStyle()->mergeWith($footerStyle);
if(!$this->getShowFooter())
$item->setVisible(false);
break;
- case self::IT_SEPARATOR:
+ case TListItemType::Separator:
if($separatorStyle)
$item->getStyle()->mergeWith($separatorStyle);
break;
- case self::IT_ITEM:
+ case TListItemType::Item:
if($itemStyle)
$item->getStyle()->mergeWith($itemStyle);
break;
- case self::IT_ALTERNATINGITEM:
+ case TListItemType::AlternatingItem:
if($alternatingItemStyle)
$item->getStyle()->mergeWith($alternatingItemStyle);
break;
- case self::IT_SELECTEDITEM:
+ case TListItemType::SelectedItem:
if($selectedItemStyle)
$item->getStyle()->mergeWith($selectedItemStyle);
if($index % 2==1)
@@ -1364,7 +1361,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$item->getStyle()->mergeWith($alternatingItemStyle);
}
break;
- case self::IT_EDITITEM:
+ case TListItemType::EditItem:
if($editItemStyle)
$item->getStyle()->mergeWith($editItemStyle);
if($index % 2==1)
@@ -1378,18 +1375,18 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$item->getStyle()->mergeWith($alternatingItemStyle);
}
break;
- case self::IT_PAGER:
+ case TListItemType::Pager:
if($pagerStyle)
{
$item->getStyle()->mergeWith($pagerStyle);
if($index===0)
{
- if($pagerStyle->getPosition()==='Bottom' || !$pagerStyle->getVisible())
+ if($pagerStyle->getPosition()===TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible())
$item->setVisible(false);
}
else
{
- if($pagerStyle->getPosition()==='Top' || !$pagerStyle->getVisible())
+ if($pagerStyle->getPosition()===TDataGridPagerPosition::Top || !$pagerStyle->getVisible())
$item->setVisible(false);
}
}
@@ -1397,7 +1394,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
default:
break;
}
- if($this->_columns && $itemType!==self::IT_PAGER)
+ if($this->_columns && $itemType!==TListItemType::Pager)
{
$n=$this->_columns->getCount();
$cells=$item->getCells();
@@ -1409,9 +1406,9 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$cell->setVisible(false);
else
{
- if($itemType===self::IT_HEADER)
+ if($itemType===TListItemType::Header)
$style=$column->getHeaderStyle(false);
- else if($itemType===self::IT_FOOTER)
+ else if($itemType===TListItemType::Footer)
$style=$column->getFooterStyle(false);
else
$style=$column->getItemStyle(false);
@@ -1432,7 +1429,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer
parent::renderBeginTag($writer);
if(($caption=$this->getCaption())!=='')
{
- if(($align=$this->getCaptionAlign())!=='NotSet')
+ if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet)
$writer->addAttribute('align',strtolower($align));
$writer->renderBeginTag('caption');
$writer->write($caption);
@@ -1789,21 +1786,21 @@ class TDataGridItem extends TTableRow implements INamingContainer
/**
* Constructor.
* @param integer zero-based index of the item in the item collection of datagrid
- * @param string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'.
+ * @param TListItemType item type
*/
public function __construct($itemIndex,$dataSourceIndex,$itemType)
{
$this->_itemIndex=$itemIndex;
$this->_dataSourceIndex=$dataSourceIndex;
$this->setItemType($itemType);
- if($itemType===TDataGrid::IT_HEADER)
- $this->setTableSection('Header');
- else if($itemType===TDataGrid::IT_FOOTER)
- $this->setTableSection('Footer');
+ if($itemType===TListItemType::Header)
+ $this->setTableSection(TTableRowSection::Header);
+ else if($itemType===TListItemType::Footer)
+ $this->setTableSection(TTableRowSection::Footer);
}
/**
- * @return string item type.
+ * @return TListItemType item type.
*/
public function getItemType()
{
@@ -1811,11 +1808,11 @@ class TDataGridItem extends TTableRow implements INamingContainer
}
/**
- * @param string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'
+ * @param TListItemType item type
*/
public function setItemType($value)
{
- $this->_itemType=$value;
+ $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
}
/**
@@ -1924,7 +1921,7 @@ class TDataGridPager extends TPanel implements INamingContainer
*/
public function getItemType()
{
- return TDataGrid::IT_PAGER;
+ return TListItemType::Pager;
}
}
@@ -2032,35 +2029,35 @@ class TDataGridPagerStyle extends TPanelStyle
private $_buttonType=null;
/**
- * @return string pager mode. Defaults to 'NextPrev'.
+ * @return TDataGridPagerMode pager mode. Defaults to TDataGridPagerMode::NextPrev.
*/
public function getMode()
{
- return $this->_mode===null?'NextPrev':$this->_mode;
+ return $this->_mode===null?TDataGridPagerMode::NextPrev : $this->_mode;
}
/**
- * @param string pager mode. Valid values include 'NextPrev' and 'Numeric'.
+ * @param TDataGridPagerMode pager mode.
*/
public function setMode($value)
{
- $this->_mode=TPropertyValue::ensureEnum($value,'NextPrev','Numeric');
+ $this->_mode=TPropertyValue::ensureEnum($value,'TDataGridPagerMode');
}
/**
- * @return string the type of command button. Defaults to LinkButton.
+ * @return TDataGridPagerButtonType the type of command button. Defaults to TDataGridPagerButtonType::LinkButton.
*/
public function getButtonType()
{
- return $this->_buttonType===null?'LinkButton':$this->_buttonType;
+ return $this->_buttonType===null?TDataGridPagerButtonType::LinkButton:$this->_buttonType;
}
/**
- * @param string the type of command button, LinkButton or PushButton
+ * @param TDataGridPagerButtonType the type of command button
*/
public function setButtonType($value)
{
- $this->_buttonType=TPropertyValue::ensureEnum($value,'LinkButton','PushButton');
+ $this->_buttonType=TPropertyValue::ensureEnum($value,'TDataGridPagerButtonType');
}
/**
@@ -2115,19 +2112,19 @@ class TDataGridPagerStyle extends TPanelStyle
}
/**
- * @return string where the pager is to be displayed. Defaults to 'Bottom'.
+ * @return TDataGridPagerPosition where the pager is to be displayed. Defaults to TDataGridPagerPosition::Bottom.
*/
public function getPosition()
{
- return $this->_position===null?'Bottom':$this->_position;
+ return $this->_position===null?TDataGridPagerPosition::Bottom:$this->_position;
}
/**
- * @param string where the pager is to be displayed. Valid values include 'Bottom', 'Top', 'TopAndBottom'
+ * @param TDataGridPagerPosition where the pager is to be displayed.
*/
public function setPosition($value)
{
- $this->_position=TPropertyValue::ensureEnum($value,'Bottom','Top','TopAndBottom');
+ $this->_position=TPropertyValue::ensureEnum($value,'TDataGridPagerPosition');
}
/**
@@ -2218,4 +2215,66 @@ class TDataGridPagerStyle extends TPanelStyle
}
}
+
+/**
+ * TDataGridPagerMode class.
+ * TDataGridPagerMode defines the enumerable type for the possible modes that a datagrid pager can take.
+ *
+ * The following enumerable values are defined:
+ * - NextPrev: pager buttons are displayed as next and previous pages
+ * - Numeric: pager buttons are displayed as numeric page numbers
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TDataGridPagerMode extends TEnumerable
+{
+ const NextPrev='NextPrev';
+ const Numeric='Numeric';
+}
+
+
+/**
+ * TDataGridPagerButtonType class.
+ * TDataGridPagerButtonType defines the enumerable type for the possible types of datagrid pager buttons.
+ *
+ * The following enumerable values are defined:
+ * - LinkButton: link buttons
+ * - PushButton: form submit buttons
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TDataGridPagerButtonType extends TEnumerable
+{
+ const LinkButton='LinkButton';
+ const PushButton='PushButton';
+}
+
+
+/**
+ * TDataGridPagerPosition class.
+ * TDataGridPagerPosition defines the enumerable type for the possible positions that a datagrid pager can be located at.
+ *
+ * The following enumerable values are defined:
+ * - Bottom: pager appears only at the bottom of the data grid.
+ * - Top: pager appears only at the top of the data grid.
+ * - TopAndBottom: pager appears on both top and bottom of the data grid.
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TDataGridPagerPosition extends TEnumerable
+{
+ const Bottom='Bottom';
+ const Top='Top';
+ const TopAndBottom='TopAndBottom';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php
index 8c34b85f..dacc7206 100644
--- a/framework/Web/UI/WebControls/TDataGridColumn.php
+++ b/framework/Web/UI/WebControls/TDataGridColumn.php
@@ -388,4 +388,27 @@ abstract class TDataGridColumn extends TApplicationComponent
}
}
+
+/**
+ * TButtonColumnType class.
+ * TButtonColumnType defines the enumerable type for the possible types of buttons
+ * that can be used in a {@link TButtonColumn}.
+ *
+ * The following enumerable values are defined:
+ * - LinkButton: link buttons
+ * - PushButton: form buttons
+ * - ImageButton: image buttons
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TButtonColumnType extends TEnumerable
+{
+ const LinkButton='LinkButton';
+ const PushButton='PushButton';
+ const ImageButton='ImageButton';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php
index 22bec07e..c0aa5da6 100644
--- a/framework/Web/UI/WebControls/TDataList.php
+++ b/framework/Web/UI/WebControls/TDataList.php
@@ -87,8 +87,8 @@ Prado::using('System.Web.UI.WebControls.TRepeatInfo');
*
* Each datalist item has a {@link TDataListItem::getItemType type}
* which tells the position and state of the item in the datalist. An item in the header
- * of the repeater is of type 'Header'. A body item may be of either
- * 'Item', 'AlternatingItem', 'SelectedItem' or 'EditItem', depending whether the item
+ * of the repeater is of type Header. A body item may be of either
+ * Item, AlternatingItem, SelectedItem or EditItem, depending whether the item
* index is odd or even, whether it is being selected or edited.
*
* TDataList raises an {@link onItemCommand OnItemCommand} whenever a button control
@@ -458,14 +458,14 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
if($current>=0 && $current<$itemCount)
{
$item=$items->itemAt($current);
- if($item->getItemType()!=='EditItem')
- $item->setItemType($current%2?'AlternatingItem':'Item');
+ if($item->getItemType()!==TListItemType::EditItem)
+ $item->setItemType($current%2?TListItemType::AlternatingItem : TListItemType::Item);
}
if($value>=0 && $value<$itemCount)
{
$item=$items->itemAt($value);
- if($item->getItemType()!=='EditItem')
- $item->setItemType('SelectedItem');
+ if($item->getItemType()!==TListItemType::EditItem)
+ $item->setItemType(TListItemType::SelectedItem);
}
}
}
@@ -524,9 +524,9 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$items=$this->getItems();
$itemCount=$items->getCount();
if($current>=0 && $current<$itemCount)
- $items->itemAt($current)->setItemType($current%2?'AlternatingItem':'Item');
+ $items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem : TListItemType::Item);
if($value>=0 && $value<$itemCount)
- $items->itemAt($value)->setItemType('EditItem');
+ $items->itemAt($value)->setItemType(TListItemType::EditItem);
}
}
@@ -605,7 +605,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
}
/**
- * @return string alignment of the caption of the table layout. Defaults to 'NotSet'.
+ * @return TTableCaptionAlign alignment of the caption of the table layout. Defaults to TTableCaptionAlign::NotSet.
*/
public function getCaptionAlign()
{
@@ -613,8 +613,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
}
/**
- * @return string alignment of the caption of the table layout.
- * Valid values include 'NotSet','Top','Bottom','Left','Right'.
+ * @return TTableCaptionAlign alignment of the caption of the table layout.
*/
public function setCaptionAlign($value)
{
@@ -638,7 +637,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
}
/**
- * @return string the direction of traversing the list, defaults to 'Vertical'
+ * @return TRepeatDirection the direction of traversing the list, defaults to TRepeatDirection::Vertical
*/
public function getRepeatDirection()
{
@@ -646,7 +645,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
}
/**
- * @param string the direction (Vertical, Horizontal) of traversing the list
+ * @param TRepeatDirection the direction of traversing the list
*/
public function setRepeatDirection($value)
{
@@ -654,7 +653,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
}
/**
- * @return string how the list should be displayed, using table or using line breaks. Defaults to 'Table'.
+ * @return TRepeatLayout how the list should be displayed, using table or using line breaks. Defaults to TRepeatLayout::Table.
*/
public function getRepeatLayout()
{
@@ -662,7 +661,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
}
/**
- * @param string how the list should be displayed, using table or using line breaks (Table, Flow, Raw)
+ * @param TRepeatLayout how the list should be displayed, using table or using line breaks
*/
public function setRepeatLayout($value)
{
@@ -875,14 +874,14 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
{
switch($itemType)
{
- case 'Header': return $this->getControls()->itemAt(0);
- case 'Footer': return $this->getControls()->itemAt($this->getControls()->getCount()-1);
- case 'Item':
- case 'AlternatingItem':
- case 'SelectedItem':
- case 'EditItem':
+ case TListItemType::Header: return $this->getControls()->itemAt(0);
+ case TListItemType::Footer: return $this->getControls()->itemAt($this->getControls()->getCount()-1);
+ case TListItemType::Item:
+ case TListItemType::AlternatingItem:
+ case TListItemType::SelectedItem:
+ case TListItemType::EditItem:
return $this->getItems()->itemAt($index);
- case 'Separator':
+ case TListItemType::Separator:
$i=$index+$index+1;
if($this->_headerTemplate!==null)
$i++;
@@ -895,7 +894,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
* Creates a data list item and does databinding if needed.
* This method invokes {@link createItem} to create a new data list item.
* @param integer zero-based item index.
- * @param string item type, may be 'Header', 'Footer', 'Item', 'Separator', 'AlternatingItem', 'SelectedItem', 'EditItem'.
+ * @param TListItemType item type
* @param boolean whether to do databinding for the item
* @param mixed data to be associated with the item
* @return TDataListItem the created item
@@ -925,7 +924,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
/**
* Creates a DataList item instance based on the item type and index.
* @param integer zero-based item index
- * @param string item type, may be 'Header', 'Footer', 'Item', 'Separator', 'AlternatingItem', 'SelectedItem', 'EditItem'.
+ * @param TListItemType item type
* @return TDataListItem created data list item
*/
protected function createItem($itemIndex,$itemType)
@@ -978,27 +977,27 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
continue;
switch($item->getItemType())
{
- case 'Header':
+ case TListItemType::Header:
if($headerStyle)
$item->getStyle()->mergeWith($headerStyle);
break;
- case 'Footer':
+ case TListItemType::Footer:
if($footerStyle)
$item->getStyle()->mergeWith($footerStyle);
break;
- case 'Separator':
+ case TListItemType::Separator:
if($separatorStyle)
$item->getStyle()->mergeWith($separatorStyle);
break;
- case 'Item':
+ case TListItemType::Item:
if($itemStyle)
$item->getStyle()->mergeWith($itemStyle);
break;
- case 'AlternatingItem':
+ case TListItemType::AlternatingItem:
if($alternatingItemStyle)
$item->getStyle()->mergeWith($alternatingItemStyle);
break;
- case 'SelectedItem':
+ case TListItemType::SelectedItem:
if($selectedItemStyle)
$item->getStyle()->mergeWith($selectedItemStyle);
if($index % 2==1)
@@ -1012,7 +1011,7 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$item->getStyle()->mergeWith($alternatingItemStyle);
}
break;
- case 'EditItem':
+ case TListItemType::EditItem:
if($editItemStyle)
$item->getStyle()->mergeWith($editItemStyle);
if($index % 2==1)
@@ -1043,30 +1042,30 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$template=null;
switch($item->getItemType())
{
- case 'Header':
+ case TListItemType::Header:
$template=$this->_headerTemplate;
break;
- case 'Footer':
+ case TListItemType::Footer:
$template=$this->_footerTemplate;
break;
- case 'Item':
+ case TListItemType::Item:
$template=$this->_itemTemplate;
break;
- case 'AlternatingItem':
+ case TListItemType::AlternatingItem:
if(($template=$this->_alternatingItemTemplate)===null)
$template=$this->_itemTemplate;
break;
- case 'Separator':
+ case TListItemType::Separator:
$template=$this->_separatorTemplate;
break;
- case 'SelectedItem':
+ case TListItemType::SelectedItem:
if(($template=$this->_selectedItemTemplate)===null)
{
if(!($item->getItemIndex()%2) || ($template=$this->_alternatingItemTemplate)===null)
$template=$this->_itemTemplate;
}
break;
- case 'EditItem':
+ case TListItemType::EditItem:
if(($template=$this->_editItemTemplate)===null)
{
if($item->getItemIndex()!==$this->getSelectedItemIndex() || ($template=$this->_selectedItemTemplate)===null)
@@ -1130,21 +1129,21 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$editIndex=$this->getEditItemIndex();
$hasSeparator=$this->_separatorTemplate!==null;
if($this->_headerTemplate!==null)
- $this->_header=$this->createItemInternal(-1,'Header',false,null);
+ $this->_header=$this->createItemInternal(-1,TListItemType::Header,false,null);
for($i=0;$i<$itemCount;++$i)
{
if($hasSeparator && $i>0)
- $this->createItemInternal($i-1,'Separator',false,null);
+ $this->createItemInternal($i-1,TListItemType::Separator,false,null);
if($i===$editIndex)
- $itemType='EditItem';
+ $itemType=TListItemType::EditItem;
else if($i===$selectedIndex)
- $itemType='SelectedItem';
+ $itemType=TListItemType::SelectedItem;
else
- $itemType=$i%2?'AlternatingItem':'Item';
+ $itemType=$i%2?TListItemType::AlternatingItem : TListItemType::Item;
$items->add($this->createItemInternal($i,$itemType,false,null));
}
if($this->_footerTemplate!==null)
- $this->_footer=$this->createItemInternal(-1,'Footer',false,null);
+ $this->_footer=$this->createItemInternal(-1,TListItemType::Footer,false,null);
}
else if($this->_emptyTemplate!==null)
$this->_emptyTemplate->instantiateIn($this);
@@ -1175,20 +1174,20 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
else
$keys->add($key);
if($itemIndex===0 && $this->_headerTemplate!==null)
- $this->_header=$this->createItemInternal(-1,'Header',true,null);
+ $this->_header=$this->createItemInternal(-1,TListItemType::Header,true,null);
if($hasSeparator && $itemIndex>0)
- $this->createItemInternal($itemIndex-1,'Separator',true,null);
+ $this->createItemInternal($itemIndex-1,TListItemType::Separator,true,null);
if($itemIndex===$editIndex)
- $itemType='EditItem';
+ $itemType=TListItemType::EditItem;
else if($itemIndex===$selectedIndex)
- $itemType='SelectedItem';
+ $itemType=TListItemType::SelectedItem;
else
- $itemType=$itemIndex%2?'AlternatingItem':'Item';
+ $itemType=$itemIndex%2?TListItemType::AlternatingItem : TListItemType::Item;
$items->add($this->createItemInternal($itemIndex,$itemType,true,$dataItem));
$itemIndex++;
}
if($itemIndex>0 && $this->_footerTemplate!==null)
- $this->_footer=$this->createItemInternal(-1,'Footer',true,null);
+ $this->_footer=$this->createItemInternal(-1,TListItemType::Footer,true,null);
if($itemIndex===0 && $this->_emptyTemplate!==null)
{
$this->_emptyTemplate->instantiateIn($this);
@@ -1335,9 +1334,9 @@ class TDataListItem extends TWebControl implements INamingContainer
private $_itemIndex='';
/**
* type of the TDataListItem
- * @var string
+ * @var TListItemType
*/
- private $_itemType='';
+ private $_itemType;
/**
* value of the data item
* @var mixed
@@ -1347,7 +1346,7 @@ class TDataListItem extends TWebControl implements INamingContainer
/**
* Constructor.
* @param integer zero-based index of the item in the item collection of DataList
- * @param string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'.
+ * @param TListItemType item type
*/
public function __construct($itemIndex,$itemType)
{
@@ -1366,7 +1365,7 @@ class TDataListItem extends TWebControl implements INamingContainer
}
/**
- * @return string item type
+ * @return TListItemType item type
*/
public function getItemType()
{
@@ -1374,11 +1373,11 @@ class TDataListItem extends TWebControl implements INamingContainer
}
/**
- * @param string item type. Valid values include 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'.
+ * @param TListItemType item type.
*/
public function setItemType($value)
{
- $this->_itemType=TPropertyValue::ensureEnum($value,'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager');
+ $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
}
/**
diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php
index ec39e8a3..e6cdb30e 100644
--- a/framework/Web/UI/WebControls/TDataTypeValidator.php
+++ b/framework/Web/UI/WebControls/TDataTypeValidator.php
@@ -47,7 +47,7 @@ class TDataTypeValidator extends TBaseValidator
}
/**
- * @return string the data type that the values being compared are converted to before the comparison is made. Defaults to String.
+ * @return TValidationDataType the data type that the values being compared are converted to before the comparison is made. Defaults to TValidationDataType::String.
*/
public function getDataType()
{
@@ -55,13 +55,12 @@ class TDataTypeValidator extends TBaseValidator
}
/**
- * Sets the data type (Integer, Float, Date, String) that the values being
- * compared are converted to before the comparison is made.
- * @param string the data type
+ * Sets the data type that the values being compared are converted to before the comparison is made.
+ * @param TValidationDataType the data type
*/
public function setDataType($value)
{
- $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Integer','Float','Date','String'),'String');
+ $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TValidationDataType'),TValidationDataType::String);
}
/**
@@ -94,11 +93,11 @@ class TDataTypeValidator extends TBaseValidator
switch($this->getDataType())
{
- case 'Integer':
+ case TValidationDataType::Integer:
return preg_match('/^[-+]?[0-9]+$/',trim($value));
- case 'Float':
+ case TValidationDataType::Float:
return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
- case 'Date':
+ case TValidationDataType::Date:
$dateFormat = $this->getDateFormat();
if(strlen($dateFormat))
{
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 2a9340e5..73a69abc 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -131,30 +131,36 @@ class TDatePicker extends TTextBox
$this->setViewState('Culture', $value, '');
}
+ /**
+ * @param TDatePickerInputMode input method of date values
+ */
public function setInputMode($value)
{
- $this->setViewState('InputMode', TPropertyValue::ensureEnum($value, 'TextBox', 'DropDownList'), 'TextBox');
+ $this->setViewState('InputMode', TPropertyValue::ensureEnum($value, 'TDatePickerInputMode'), TDatePickerInputMode::TextBox);
}
+ /**
+ * @return TDatePickerInputMode input method of date values. Defaults to TDatePickerInputMode::TextBox.
+ */
public function getInputMode()
{
- return $this->getViewState('InputMode', 'TextBox');
+ return $this->getViewState('InputMode', TDatePickerInputMode::TextBox);
}
/**
- * @param string calendar UI mode, "Basic", "Button" or "ImageButton"
+ * @param TDatePickerMode calendar UI mode
*/
public function setMode($value)
{
- $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'Basic', 'Button', 'ImageButton'), 'Basic');
+ $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'TDatePickerMode'), TDatePickerMode::Basic);
}
/**
- * @return string current calendar UI mode.
+ * @return TDatePickerMode current calendar UI mode.
*/
public function getMode()
{
- return $this->getViewState('Mode', 'Basic');
+ return $this->getViewState('Mode', TDatePickerMode::Basic);
}
/**
* @param string the image url for "Image" UI mode.
@@ -340,12 +346,12 @@ class TDatePicker extends TTextBox
/**
* Renders body content.
* This method overrides parent implementation by adding
- * additional date picker button if Mode is "Button" or "ImageButton".
+ * additional date picker button if Mode is Button or ImageButton.
* @param THtmlWriter writer
*/
public function render($writer)
{
- if($this->getInputMode() == 'TextBox')
+ if($this->getInputMode() == TDatePickerInputMode::TextBox)
{
parent::render($writer);
$this->renderDatePickerButtons($writer);
@@ -370,8 +376,8 @@ class TDatePicker extends TTextBox
{
switch ($this->getMode())
{
- case 'Button': $this->renderButtonDatePicker($writer); break;
- case 'ImageButton' : $this->renderImageButtonDatePicker($writer); break;
+ case TDatePickerMode::Button: $this->renderButtonDatePicker($writer); break;
+ case TDatePickerMode::ImageButton : $this->renderImageButtonDatePicker($writer); break;
}
}
}
@@ -386,7 +392,7 @@ class TDatePicker extends TTextBox
*/
public function loadPostData($key,$values)
{
- if($this->getInputMode() == "TextBox")
+ if($this->getInputMode() == TDatePickerInputMode::TextBox)
return parent::loadPostData($key, $values);
$value = $this->getDateFromPostData($key, $values);
if(!$this->getReadOnly() && $this->getText()!==$value)
@@ -447,7 +453,7 @@ class TDatePicker extends TTextBox
$options['ClassName'] = $cssClass;
$options['FromYear'] = $this->getFromYear();
$options['UpToYear'] = $this->getUpToYear();
- if($this->getMode()!=='Basic')
+ if($this->getMode()!==TDatePickerMode::Basic)
$options['Trigger'] = $this->getDatePickerButtonID();
$options = array_merge($options, $this->getCulturalOptions());
@@ -501,8 +507,8 @@ class TDatePicker extends TTextBox
*/
protected function renderDropDownListCalendar($writer)
{
- if($this->getMode() == 'Basic')
- $this->setMode('ImageButton');
+ if($this->getMode() == TDatePickerMode::Basic)
+ $this->setMode(TDatePickerMode::ImageButton);
parent::addAttributesToRender($writer);
$writer->removeAttribute('name');
$writer->removeAttribute('type');
@@ -824,4 +830,46 @@ class TDatePickerClientScript extends TClientSideOptions
}
}
-?>
+
+/**
+ * TDatePickerInputMode class.
+ * TDatePickerInputMode defines the enumerable type for the possible datepicker input methods.
+ *
+ * The following enumerable values are defined:
+ * - TextBox: text boxes are used to input date values
+ * - DropDownList: dropdown lists are used to pick up date values
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TDatePickerInputMode extends TEnumerable
+{
+ const TextBox='TextBox';
+ const DropDownList='DropDownList';
+}
+
+/**
+ * TDatePickerMode class.
+ * TDatePickerMode defines the enumerable type for the possible UI mode
+ * that a {@link TDatePicker} control can take.
+ *
+ * The following enumerable values are defined:
+ * - Basic: Only shows a text input, focusing on the input shows the date picker
+ * - Button: Shows a button next to the text input, clicking on the button shows the date, button text can be by the
+ * - ImageButton: Shows an image next to the text input, clicking on the image shows the date picker,
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TDatePickerMode extends TEnumerable
+{
+ const Basic='Basic';
+ const Button='Button';
+ const ImageButton='ImageButton';
+}
+
+?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php
index c742ef11..327e03a2 100644
--- a/framework/Web/UI/WebControls/TEditCommandColumn.php
+++ b/framework/Web/UI/WebControls/TEditCommandColumn.php
@@ -25,7 +25,7 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn');
* The button captions are specified using {@link setEditText EditText},
* {@link setUpdateText UpdateText}, and {@link setCancelText CancelText}.
*
- * The buttons in the column can be set to display as hyperlinks or push buttons
+ * The buttons in the column can be set to display as hyperlinks, push or image buttons
* by setting the {@link setButtonType ButtonType} property.
*
* When an edit button is clicked, the datagrid will generate an
@@ -54,19 +54,19 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn');
class TEditCommandColumn extends TDataGridColumn
{
/**
- * @return string the type of command button. Defaults to LinkButton.
+ * @return TButtonColumnType the type of command button. Defaults to TButtonColumnType::LinkButton.
*/
public function getButtonType()
{
- return $this->getViewState('ButtonType','LinkButton');
+ return $this->getViewState('ButtonType',TButtonColumnType::LinkButton);
}
/**
- * @param string the type of command button, LinkButton or PushButton
+ * @param TButtonColumnType the type of command button.
*/
public function setButtonType($value)
{
- $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'LinkButton','PushButton'),'LinkButton');
+ $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonColumnType'),TButtonColumnType::LinkButton);
}
/**
@@ -85,6 +85,22 @@ class TEditCommandColumn extends TDataGridColumn
$this->setViewState('EditText',$value,'Edit');
}
+ /**
+ * @return string the URL of the image file for edit image buttons
+ */
+ public function getEditImageUrl()
+ {
+ return $this->getViewState('EditImageUrl','');
+ }
+
+ /**
+ * @param string the URL of the image file for edit image buttons
+ */
+ public function setEditImageUrl($value)
+ {
+ $this->setViewState('EditImageUrl',$value,'');
+ }
+
/**
* @return string the caption of the update button. Defaults to 'Update'.
*/
@@ -101,6 +117,22 @@ class TEditCommandColumn extends TDataGridColumn
$this->setViewState('UpdateText',$value,'Update');
}
+ /**
+ * @return string the URL of the image file for update image buttons
+ */
+ public function getUpdateImageUrl()
+ {
+ return $this->getViewState('UpdateImageUrl','');
+ }
+
+ /**
+ * @param string the URL of the image file for update image buttons
+ */
+ public function setUpdateImageUrl($value)
+ {
+ $this->setViewState('UpdateImageUrl',$value,'');
+ }
+
/**
* @return string the caption of the cancel button. Defaults to 'Cancel'.
*/
@@ -117,6 +149,22 @@ class TEditCommandColumn extends TDataGridColumn
$this->setViewState('CancelText',$value,'Cancel');
}
+ /**
+ * @return string the URL of the image file for cancel image buttons
+ */
+ public function getCancelImageUrl()
+ {
+ return $this->getViewState('CancelImageUrl','');
+ }
+
+ /**
+ * @param string the URL of the image file for cancel image buttons
+ */
+ public function setCancelImageUrl($value)
+ {
+ $this->setViewState('CancelImageUrl',$value,'');
+ }
+
/**
* @return boolean whether postback event trigger by edit or update button will cause input validation, default is true
*/
@@ -191,10 +239,21 @@ class TEditCommandColumn extends TDataGridColumn
*/
protected function createButton($commandName,$text,$causesValidation,$validationGroup)
{
- if($this->getButtonType()==='LinkButton')
+ if($this->getButtonType()===TButtonColumnType::LinkButton)
$button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
- else
+ else if($this->getButtonType()===TButtonColumnType::PushButton)
$button=Prado::createComponent('System.Web.UI.WebControls.TButton');
+ else // image buttons
+ {
+ $button=Prado::createComponent('System.Web.UI.WebControls.TImageButton');
+ if(strcasecmp($commandName,'Update')===0)
+ $url=$this->getUpdateImageUrl();
+ else if(strcasecmp($commandName,'Cancel')===0)
+ $url=$this->getCancelImageUrl();
+ else
+ $url=$this->getEditImageUrl();
+ $button->setImageUrl($url);
+ }
$button->setText($text);
$button->setCommandName($commandName);
$button->setCausesValidation($causesValidation);
diff --git a/framework/Web/UI/WebControls/TImageMap.php b/framework/Web/UI/WebControls/TImageMap.php
index 9444df46..9f876fdd 100644
--- a/framework/Web/UI/WebControls/TImageMap.php
+++ b/framework/Web/UI/WebControls/TImageMap.php
@@ -88,19 +88,19 @@ class TImageMap extends TImage implements IPostBackEventHandler
$writer->addAttribute('name',self::MAP_NAME_PREFIX.$clientID);
$writer->renderBeginTag('map');
$writer->writeLine();
- if(($mode=$this->getHotSpotMode())==='NotSet')
- $mode='Navigate';
+ if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet)
+ $mode=THotSpotMode::Navigate;
$target=$this->getTarget();
$i=0;
$options['EventTarget'] = $this->getUniqueID();
$options['StopEvent'] = true;
foreach($hotspots as $hotspot)
{
- if($hotspot->getHotSpotMode()==='NotSet')
+ if($hotspot->getHotSpotMode()===THotSpotMode::NotSet)
$hotspot->setHotSpotMode($mode);
if($target!=='' && $hotspot->getTarget()==='')
$hotspot->setTarget($target);
- if($hotspot->getHotSpotMode()==='PostBack')
+ if($hotspot->getHotSpotMode()===THotSpotMode::PostBack)
{
$id=$clientID.'_'.$i;
$writer->addAttribute('id',$id);
@@ -135,9 +135,9 @@ class TImageMap extends TImage implements IPostBackEventHandler
if($index>=0 && $index<$hotspots->getCount())
{
$hotspot=$hotspots->itemAt($index);
- if(($mode=$hotspot->getHotSpotMode())==='NotSet')
+ if(($mode=$hotspot->getHotSpotMode())===THotSpotMode::NotSet)
$mode=$this->getHotSpotMode();
- if($mode==='PostBack')
+ if($mode===THotSpotMode::PostBack)
{
$postBackValue=$hotspot->getPostBackValue();
if($hotspot->getCausesValidation())
@@ -150,23 +150,22 @@ class TImageMap extends TImage implements IPostBackEventHandler
}
/**
- * @return string the behavior of hotspot regions in this imagemap when they are clicked. Defaults to 'NotSet'.
+ * @return THotSpotMode the behavior of hotspot regions in this imagemap when they are clicked. Defaults to THotSpotMode::NotSet.
*/
public function getHotSpotMode()
{
- return $this->getViewState('HotSpotMode','NotSet');
+ return $this->getViewState('HotSpotMode',THotSpotMode::NotSet);
}
/**
* Sets the behavior of hotspot regions in this imagemap when they are clicked.
* If an individual hotspot has a mode other than 'NotSet', the mode set in this
* imagemap will be ignored. By default, 'NotSet' is equivalent to 'Navigate'.
- * @param string the behavior of hotspot regions in this imagemap when they are clicked.
- * Valid values include 'NotSet','Navigate','PostBack','Inactive'.
+ * @param THotSpotMode the behavior of hotspot regions in this imagemap when they are clicked.
*/
public function setHotSpotMode($value)
{
- $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'NotSet','Navigate','PostBack','Inactive'),'NotSet');
+ $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet);
}
/**
@@ -365,20 +364,19 @@ abstract class THotSpot extends TComponent
}
/**
- * @return string the behavior of a HotSpot object when it is clicked. Defaults to 'NotSet'.
+ * @return THotSpotMode the behavior of a HotSpot object when it is clicked. Defaults to THotSpotMode::NotSet.
*/
public function getHotSpotMode()
{
- return $this->getViewState('HotSpotMode','NotSet');
+ return $this->getViewState('HotSpotMode',THotSpotMode::NotSet);
}
/**
- * @param string the behavior of a HotSpot object when it is clicked.
- * Valid values include 'NotSet','Navigate','PostBack','Inactive'.
+ * @param THotSpotMode the behavior of a HotSpot object when it is clicked.
*/
public function setHotSpotMode($value)
{
- $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'NotSet','Navigate','PostBack','Inactive'),'NotSet');
+ $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet);
}
/**
@@ -487,15 +485,15 @@ abstract class THotSpot extends TComponent
{
$writer->addAttribute('shape',$this->getShape());
$writer->addAttribute('coords',$this->getCoordinates());
- if(($mode=$this->getHotSpotMode())==='NotSet')
- $mode='Navigate';
- if($mode==='Navigate')
+ if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet)
+ $mode=THotSpotMode::Navigate;
+ if($mode===THotSpotMode::Navigate)
{
$writer->addAttribute('href',$this->getNavigateUrl());
if(($target=$this->getTarget())!=='')
$writer->addAttribute('target',$target);
}
- else if($mode==='Inactive')
+ else if($mode===THotSpotMode::Inactive)
$writer->addAttribute('nohref','true');
$text=$this->getAlternateText();
$writer->addAttribute('title',$text);
@@ -723,4 +721,28 @@ class TPolygonHotSpot extends THotSpot
}
}
+
+/**
+ * THotSpotMode class.
+ * THotSpotMode defines the enumerable type for the possible hot spot modes.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: the mode is not specified
+ * - Navigate: clicking on the hotspot will redirect the browser to a different page
+ * - PostBack: clicking on the hotspot will cause a postback
+ * - Inactive: the hotspot is inactive (not clickable)
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class THotSpotMode extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Navigate='Navigate';
+ const PostBack='PostBack';
+ const Inactive='Inactive';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TInlineFrame.php b/framework/Web/UI/WebControls/TInlineFrame.php
index 5b0be90c..f0ecf3f5 100644
--- a/framework/Web/UI/WebControls/TInlineFrame.php
+++ b/framework/Web/UI/WebControls/TInlineFrame.php
@@ -42,20 +42,19 @@ class TInlineFrame extends TWebControl
}
/**
- * @return string alignment of the iframe. Defaults to 'NotSet'.
+ * @return TInlineFrameAlign alignment of the iframe. Defaults to TInlineFrameAlign::NotSet.
*/
public function getAlign()
{
- return $this->getViewState('Align','NotSet');
+ return $this->getViewState('Align',TInlineFrameAlign::NotSet);
}
/**
- * @param string alignment of the iframe. Valid values include
- * 'NotSet', 'Left', 'Right', 'Top', 'Middle', 'Bottom'.
+ * @param TInlineFrameAlign alignment of the iframe.
*/
public function setAlign($value)
{
- $this->setViewState('Align',TPropertyValue::ensureEnum($value,'NotSet','Left','Right','Top','Middle','Bottom'),'NotSet');
+ $this->setViewState('Align',TPropertyValue::ensureEnum($value,'TInlineFrameAlign'),TInlineFrameAlign::NotSet);
}
/**
@@ -107,20 +106,19 @@ class TInlineFrame extends TWebControl
}
/**
- * @return string the visibility and position of scroll bars in an iframe. Defaults to 'Auto'.
+ * @return TInlineFrameScrollBars the visibility and position of scroll bars in an iframe. Defaults to TInlineFrameScrollBars::Auto.
*/
public function getScrollBars()
{
- return $this->getViewState('ScrollBars','Auto');
+ return $this->getViewState('ScrollBars',TInlineFrameScrollBars::Auto);
}
/**
- * @param string the visibility and position of scroll bars in an iframe.
- * Valid values include None, Auto, Both.
+ * @param TInlineFrameScrollBars the visibility and position of scroll bars in an iframe.
*/
public function setScrollBars($value)
{
- $this->setViewState('ScrollBars',TPropertyValue::ensureEnum($value,array('None','Auto','Both')),'Auto');
+ $this->setViewState('ScrollBars',TPropertyValue::ensureEnum($value,'TInlineFrameScrollBars'),TInlineFrameScrollBars::Auto);
}
/**
@@ -180,9 +178,9 @@ class TInlineFrame extends TWebControl
$writer->addAttribute('align',$align);
$scrollBars=$this->getScrollBars();
- if($scrollBars==='None')
+ if($scrollBars===TInlineFrameScrollBars::None)
$writer->addAttribute('scrolling','no');
- else if($scrollBars==='Both')
+ else if($scrollBars===TInlineFrameScrollBars::Both)
$writer->addAttribute('scrolling','yes');
if (!$this->getShowBorder())
@@ -200,4 +198,54 @@ class TInlineFrame extends TWebControl
parent::addAttributesToRender($writer);
}
}
+
+/**
+ * TInlineFrameAlign class.
+ * TInlineFrameAlign defines the enumerable type for the possible alignments
+ * that the content in a {@link TInlineFrame} could be.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: the alignment is not specified.
+ * - Left: left aligned
+ * - Right: right aligned
+ * - Top: top aligned
+ * - Middle: middle aligned
+ * - Bottom: bottom aligned
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TInlineFrameAlign extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Left='Left';
+ const Right='Right';
+ const Top='Top';
+ const Middle='Middle';
+ const Bottom='Bottom';
+}
+
+/**
+ * TInlineFrameScrollBars class.
+ * TInlineFrameScrollBars defines the enumerable type for the possible scroll bar mode
+ * that a {@link TInlineFrame} control could use.
+ *
+ * The following enumerable values are defined:
+ * - None: no scroll bars.
+ * - Auto: scroll bars automatically appeared when needed.
+ * - Both: show both horizontal and vertical scroll bars all the time.
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TInlineFrameScrollBars extends TEnumerable
+{
+ const None='None';
+ const Auto='Auto';
+ const Both='Both';
+}
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php
index 79b73fb6..0191c168 100644
--- a/framework/Web/UI/WebControls/TListBox.php
+++ b/framework/Web/UI/WebControls/TListBox.php
@@ -20,7 +20,7 @@ Prado::using('System.Web.UI.WebControls.TListControl');
*
* TListBox displays a list box on a Web page that allows single or multiple selection.
* The list box allows multiple selections if {@link setSelectionMode SelectionMode}
- * is 'Multiple'. It takes single selection only if 'Single'.
+ * is TListSelectionMode::Multiple. It takes single selection only if Single.
* The property {@link setRows Rows} specifies how many rows of options are visible
* at a time. See {@link TListControl} for inherited properties.
*
@@ -47,7 +47,7 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
{
$rows=$this->getRows();
$writer->addAttribute('size',"$rows");
- if($this->getSelectionMode()==='Multiple')
+ if($this->getSelectionMode()===TListSelectionMode::Multiple)
$writer->addAttribute('name',$this->getUniqueID().'[]');
else
$writer->addAttribute('name',$this->getUniqueID());
@@ -92,7 +92,7 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
if($selections!==null)
{
$items=$this->getItems();
- if($this->getSelectionMode()==='Single')
+ if($this->getSelectionMode()===TListSelectionMode::Single)
{
$selection=is_array($selections)?$selections[0]:$selections;
$index=$items->findIndexByValue($selection,false);
@@ -158,7 +158,7 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
*/
protected function getIsMultiSelect()
{
- return $this->getSelectionMode()==='Multiple';
+ return $this->getSelectionMode()===TListSelectionMode::Multiple;
}
/**
@@ -181,20 +181,19 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
}
/**
- * @return string the selection mode (Single, Multiple). Defaults to 'Single'.
+ * @return TListSelectionMode the selection mode (Single, Multiple). Defaults to TListSelectionMode::Single.
*/
public function getSelectionMode()
{
- return $this->getViewState('SelectionMode', 'Single');
+ return $this->getViewState('SelectionMode', TListSelectionMode::Single);
}
/**
- * Sets the selection mode of the list control (Single, Multiple)
- * @param string the selection mode
+ * @param TListSelectionMode the selection mode
*/
public function setSelectionMode($value)
{
- $this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,array('Single','Multiple')),'Single');
+ $this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,'TListSelectionMode'),TListSelectionMode::Single);
}
/**
@@ -207,4 +206,25 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
return $this->getSelectedValue();
}
}
+
+
+/**
+ * TListSelectionMode class.
+ * TListSelectionMode defines the enumerable type for the possible selection modes of a {@link TListBox}.
+ *
+ * The following enumerable values are defined:
+ * - Single: single selection
+ * - Multiple: allow multiple selection
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TListSelectionMode extends TEnumerable
+{
+ const Single='Single';
+ const Multiple='Multiple';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TPager.php b/framework/Web/UI/WebControls/TPager.php
index 0401c4f2..a6bf75e7 100644
--- a/framework/Web/UI/WebControls/TPager.php
+++ b/framework/Web/UI/WebControls/TPager.php
@@ -86,35 +86,35 @@ class TPager extends TWebControl implements INamingContainer
}
/**
- * @return string pager mode. Defaults to 'NextPrev'.
+ * @return TPagerMode pager mode. Defaults to TPagerMode::NextPrev.
*/
public function getMode()
{
- return $this->getViewState('Mode','NextPrev');
+ return $this->getViewState('Mode',TPagerMode::NextPrev);
}
/**
- * @param string pager mode. Valid values include 'NextPrev', 'Numeric' and 'List'.
+ * @param TPagerMode pager mode.
*/
public function setMode($value)
{
- $this->setViewState('Mode',TPropertyValue::ensureEnum($value,'NextPrev','Numeric','List'),'NextPrev');
+ $this->setViewState('Mode',TPropertyValue::ensureEnum($value,'TPagerMode'),TPagerMode::NextPrev);
}
/**
- * @return string the type of command button for paging. Defaults to 'LinkButton'.
+ * @return TPagerButtonType the type of command button for paging. Defaults to TPagerButtonType::LinkButton.
*/
public function getButtonType()
{
- return $this->getViewState('ButtonType','LinkButton');
+ return $this->getViewState('ButtonType',TPagerButtonType::LinkButton);
}
/**
- * @param string the type of command button for paging. Valid values include 'LinkButton' and 'PushButton'.
+ * @param TPagerButtonType the type of command button for paging.
*/
public function setButtonType($value)
{
- $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'LinkButton','PushButton'));
+ $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TPagerButtonType'),TPagerButtonType::LinkButton);
}
/**
@@ -282,20 +282,20 @@ class TPager extends TWebControl implements INamingContainer
/**
* Builds the pager content based on the pager mode.
- * Current implementation includes building 'NextPrev', 'Numeric' and 'List' pagers.
+ * Current implementation includes building 'NextPrev', 'Numeric' and 'DropDownList' pagers.
* Derived classes may override this method to provide additional pagers.
*/
protected function buildPager()
{
switch($this->getMode())
{
- case 'NextPrev':
+ case TPagerMode::NextPrev:
$this->buildNextPrevPager();
break;
- case 'Numeric':
+ case TPagerMode::Numeric:
$this->buildNumericPager();
break;
- case 'List':
+ case TPagerMode::DropDownList:
$this->buildListPager();
break;
}
@@ -315,7 +315,7 @@ class TPager extends TWebControl implements INamingContainer
*/
protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter)
{
- if($buttonType==='LinkButton')
+ if($buttonType===TPagerButtonType::LinkButton)
{
if($enabled)
$button=new TLinkButton;
@@ -600,4 +600,46 @@ class TPagerPageChangedEventParameter extends TEventParameter
}
}
+
+/**
+ * TPagerMode class.
+ * TPagerMode defines the enumerable type for the possible modes that a {@link TPager} control can take.
+ *
+ * The following enumerable values are defined:
+ * - NextPrev: pager buttons are displayed as next and previous pages
+ * - Numeric: pager buttons are displayed as numeric page numbers
+ * - DropDownList: a dropdown list is used to select pages
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TPagerMode extends TEnumerable
+{
+ const NextPrev='NextPrev';
+ const Numeric='Numeric';
+ const DropDownList='DropDownList';
+}
+
+
+/**
+ * TPagerButtonType class.
+ * TPagerButtonType defines the enumerable type for the possible types of pager buttons.
+ *
+ * The following enumerable values are defined:
+ * - LinkButton: link buttons
+ * - PushButton: form submit buttons
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TPagerButtonType extends TEnumerable
+{
+ const LinkButton='LinkButton';
+ const PushButton='PushButton';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TPanelStyle.php b/framework/Web/UI/WebControls/TPanelStyle.php
index dc20806e..d3f8cee8 100644
--- a/framework/Web/UI/WebControls/TPanelStyle.php
+++ b/framework/Web/UI/WebControls/TPanelStyle.php
@@ -59,21 +59,21 @@ class TPanelStyle extends TStyle
switch($this->getScrollBars())
{
- case 'Horizontal': $this->setStyleField('overflow-x','scroll'); break;
- case 'Vertical': $this->setStyleField('overflow-y','scroll'); break;
- case 'Both': $this->setStyleField('overflow','scroll'); break;
- case 'Auto': $this->setStyleField('overflow','auto'); break;
+ case TScrollBars::Horizontal: $this->setStyleField('overflow-x','scroll'); break;
+ case TScrollBars::Vertical: $this->setStyleField('overflow-y','scroll'); break;
+ case TScrollBars::Both: $this->setStyleField('overflow','scroll'); break;
+ case TScrollBars::Auto: $this->setStyleField('overflow','auto'); break;
}
- if(($align=$this->getHorizontalAlign())!=='NotSet')
+ if(($align=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
$this->setStyleField('text-align',strtolower($align));
if(!$this->getWrap())
$this->setStyleField('white-space','nowrap');
- if(($direction=$this->getDirection())!=='NotSet')
+ if(($direction=$this->getDirection())!==TContentDirection::NotSet)
{
- if($direction==='LeftToRight')
+ if($direction===TContentDirection::LeftToRight)
$this->setStyleField('direction','ltr');
else
$this->setStyleField('direction','rtl');
@@ -100,20 +100,19 @@ class TPanelStyle extends TStyle
}
/**
- * @return string alignment of the content in the panel. Defaults to 'NotSet'.
+ * @return TContentDirection alignment of the content in the panel. Defaults to TContentDirection::NotSet.
*/
public function getDirection()
{
- return $this->_direction===null?'NotSet':$this->_direction;
+ return $this->_direction===null?TContentDirection::NotSet:$this->_direction;
}
/**
- * @param string alignment of the content in the panel.
- * Valid values include 'NotSet', 'LeftToRight', 'RightToLeft'.
+ * @param TContentDirection alignment of the content in the panel.
*/
public function setDirection($value)
{
- $this->_direction=TPropertyValue::ensureEnum($value,array('NotSet','LeftToRight','RightToLeft'));
+ $this->_direction=TPropertyValue::ensureEnum($value,'TContentDirection');
}
/**
@@ -134,38 +133,36 @@ class TPanelStyle extends TStyle
}
/**
- * @return string the horizontal alignment of the contents within the panel, defaults to 'NotSet'.
+ * @return THorizontalAlign the horizontal alignment of the contents within the panel, defaults to THorizontalAlign::NotSet.
*/
public function getHorizontalAlign()
{
- return $this->_horizontalAlign===null?'NotSet':$this->_horizontalAlign;
+ return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
}
/**
* Sets the horizontal alignment of the contents within the panel.
- * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center'
- * @param string the horizontal alignment
+ * @param THorizontalAlign the horizontal alignment
*/
public function setHorizontalAlign($value)
{
- $this->_horizontalAlign=TPropertyValue::ensureEnum($value,array('NotSet','Left','Right','Center','Justify'));
+ $this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
}
/**
- * @return string the visibility and position of scroll bars in a panel control, defaults to None.
+ * @return TScrollBars the visibility and position of scroll bars in a panel control, defaults to TScrollBars::None.
*/
public function getScrollBars()
{
- return $this->_scrollBars===null?'None':$this->_scrollBars;
+ return $this->_scrollBars===null?TScrollBars::None:$this->_scrollBars;
}
/**
- * @param string the visibility and position of scroll bars in a panel control.
- * Valid values include None, Auto, Both, Horizontal and Vertical.
+ * @param TScrollBars the visibility and position of scroll bars in a panel control.
*/
public function setScrollBars($value)
{
- $this->_scrollBars=TPropertyValue::ensureEnum($value,array('None','Auto','Both','Horizontal','Vertical'));
+ $this->_scrollBars=TPropertyValue::ensureEnum($value,'TScrollBars');
}
/**
@@ -232,4 +229,51 @@ class TPanelStyle extends TStyle
}
}
+/**
+ * TContentDirection class.
+ * TContentDirection defines the enumerable type for the possible directions that a panel can be at.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: the direction is not specified
+ * - LeftToRight: content in a panel is left to right
+ * - RightToLeft: content in a panel is right to left
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TContentDirection extends TEnumerable
+{
+ const NotSet='NotSet';
+ const LeftToRight='LeftToRight';
+ const RightToLeft='RightToLeft';
+}
+
+/**
+ * TScrollBars class.
+ * TScrollBars defines the enumerable type for the possible scroll bar mode
+ * that a {@link TPanel} control could use.
+ *
+ * The following enumerable values are defined:
+ * - None: no scroll bars.
+ * - Auto: scroll bars automatically appeared when needed.
+ * - Both: show both horizontal and vertical scroll bars all the time.
+ * - Horizontal: horizontal scroll bar only
+ * - Vertical: vertical scroll bar only
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TScrollBars extends TEnumerable
+{
+ const None='None';
+ const Auto='Auto';
+ const Both='Both';
+ const Horizontal='Horizontal';
+ const Vertical='Vertical';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php
index b54a1684..a868dd67 100644
--- a/framework/Web/UI/WebControls/TRangeValidator.php
+++ b/framework/Web/UI/WebControls/TRangeValidator.php
@@ -35,10 +35,10 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator');
* the GNU date syntax is assumed.
* - String A string data type.
* - StringLength check for string length.
- *
+ *
* The TRangeValidator allows a special DataType "StringLength" that
- * can be used to verify minimum and maximum string length. The
- * {@link setCharset Charset} property can be used to force a particular
+ * can be used to verify minimum and maximum string length. The
+ * {@link setCharset Charset} property can be used to force a particular
* charset for comparison. Otherwise, the application charset is used and is
* defaulted as UTF-8.
*
@@ -94,23 +94,21 @@ class TRangeValidator extends TBaseValidator
}
/**
- * @return string the data type that the values being compared are
- * converted to before the comparison is made. Defaults to String.
+ * @return TRangeValidationDataType the data type that the values being compared are
+ * converted to before the comparison is made. Defaults to TRangeValidationDataType::String.
*/
public function getDataType()
{
- return $this->getViewState('DataType','String');
+ return $this->getViewState('DataType',TRangeValidationDataType::String);
}
/**
- * Sets the data type (Integer, Float, Date, String, StringLength) that the
- * values being compared are converted to before the comparison is made.
- * @param string the data type
+ * Sets the data type that the values being compared are converted to before the comparison is made.
+ * @param TRangeValidationDataType the data type
*/
public function setDataType($value)
{
- $this->setViewState('DataType',TPropertyValue::ensureEnum(
- $value,'Integer','Float','Date','String', 'StringLength'),'String');
+ $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TRangeValidationDataType'),TRangeValidationDataType::String);
}
/**
@@ -137,7 +135,7 @@ class TRangeValidator extends TBaseValidator
{
$this->setViewState('Charset', $value, '');
}
-
+
/**
* @return string charset for string length comparison.
*/
@@ -160,13 +158,13 @@ class TRangeValidator extends TBaseValidator
switch($this->getDataType())
{
- case 'Integer':
+ case TRangeValidationDataType::Integer:
return $this->isValidInteger($value);
- case 'Float':
+ case TRangeValidationDataType::Float:
return $this->isValidFloat($value);
- case 'Date':
+ case TRangeValidationDataType::Date:
return $this->isValidDate($value);
- case 'StringLength':
+ case TRangeValidationDataType::StringLength:
return $this->isValidStringLength($value);
default:
return $this->isValidString($value);
@@ -264,10 +262,10 @@ class TRangeValidator extends TBaseValidator
$valid=$valid && (strcmp($value,$maxValue)<=0);
return $valid;
}
-
+
/**
* @param string string for comparision
- * @return boolean true if min and max string length are satisfied.
+ * @return boolean true if min and max string length are satisfied.
*/
protected function isValidStringLength($value)
{
@@ -283,7 +281,7 @@ class TRangeValidator extends TBaseValidator
if(!$charset)
$charset = 'UTF-8';
}
-
+
$length = iconv_strlen($value, $charset);
if($minValue!=='')
$valid = $valid && $length >= intval($minValue);
@@ -308,4 +306,26 @@ class TRangeValidator extends TBaseValidator
}
}
+
+/**
+ * TRangeValidationDataType class.
+ * TRangeValidationDataType defines the enumerable type for the possible data types that
+ * a range validator can validate upon.
+ *
+ * The following enumerable values are defined:
+ * - Integer
+ * - Float
+ * - Date
+ * - String
+ * - StringLength
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TRangeValidationDataType extends TValidationDataType
+{
+ const StringLength='StringLength';
+}
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TRepeatInfo.php b/framework/Web/UI/WebControls/TRepeatInfo.php
index 81b82c33..f5a827aa 100644
--- a/framework/Web/UI/WebControls/TRepeatInfo.php
+++ b/framework/Web/UI/WebControls/TRepeatInfo.php
@@ -10,6 +10,8 @@
* @package System.Web.UI.WebControls
*/
+Prado::using('System.Web.UI.WebControls.TTable');
+
/**
* IRepeatInfoUser interface.
* This interface must be implemented by classes who want to use {@link TRepeatInfo}.
@@ -57,7 +59,7 @@ interface IRepeatInfoUser
* TRepeatInfo class.
* TRepeatInfo represents repeat information for controls like {@link TCheckBoxList}.
* The layout of the repeated items is specified via {@link setRepeatLayout RepeatLayout},
- * which can be either 'Table' (default), 'Flow' or 'Raw'.
+ * which can be either Table (default), Flow or Raw.
* A table layout uses HTML table cells to organize the items while
* a flow layout uses line breaks to organize the items.
* The number of columns used to display the items is specified via
@@ -79,21 +81,21 @@ class TRepeatInfo extends TComponent
*/
private $_caption='';
/**
- * @var string alignment of the caption of the table used to organize the repeated items
+ * @var TTableCaptionAlign alignment of the caption of the table used to organize the repeated items
*/
- private $_captionAlign='NotSet';
+ private $_captionAlign=TTableCaptionAlign::NotSet;
/**
* @var integer number of columns that the items should be arranged in
*/
private $_repeatColumns=0;
/**
- * @var string direction of the repetition
+ * @var TRepeatDirection direction of the repetition
*/
- private $_repeatDirection='Vertical';
+ private $_repeatDirection=TRepeatDirection::Vertical;
/**
- * @var string layout of the repeated items
+ * @var TRepeatLayout layout of the repeated items
*/
- private $_repeatLayout='Table';
+ private $_repeatLayout=TRepeatLayout::Table;
/**
* @return string caption of the table layout
@@ -112,7 +114,7 @@ class TRepeatInfo extends TComponent
}
/**
- * @return string alignment of the caption of the table layout. Defaults to 'NotSet'.
+ * @return TTableCaptionAlign alignment of the caption of the table layout. Defaults to TTableCaptionAlign::NotSet.
*/
public function getCaptionAlign()
{
@@ -120,12 +122,11 @@ class TRepeatInfo extends TComponent
}
/**
- * @return string alignment of the caption of the table layout.
- * Valid values include 'NotSet','Top','Bottom','Left','Right'.
+ * @return TTableCaptionAlign alignment of the caption of the table layout.
*/
public function setCaptionAlign($value)
{
- $this->_captionAlign=TPropertyValue::ensureEnum($value,array('NotSet','Top','Bottom','Left','Right'));
+ $this->_captionAlign=TPropertyValue::ensureEnum($value,'TTableCaptionAlign');
}
/**
@@ -147,7 +148,7 @@ class TRepeatInfo extends TComponent
}
/**
- * @return string the direction of traversing the repeated items, defaults to 'Vertical'
+ * @return TRepeatDirection the direction of traversing the repeated items, defaults to TRepeatDirection::Vertical
*/
public function getRepeatDirection()
{
@@ -155,16 +156,15 @@ class TRepeatInfo extends TComponent
}
/**
- * Sets the direction of traversing the repeated items (Vertical, Horizontal)
- * @param string the direction of traversing the repeated items
+ * @param TRepeatDirection the direction of traversing the repeated items
*/
public function setRepeatDirection($value)
{
- $this->_repeatDirection=TPropertyValue::ensureEnum($value,array('Horizontal','Vertical'));
+ $this->_repeatDirection=TPropertyValue::ensureEnum($value,'TRepeatDirection');
}
/**
- * @return string how the repeated items should be displayed, using table or using line breaks. Defaults to 'Table'.
+ * @return TRepeatLayout how the repeated items should be displayed, using table or using line breaks. Defaults to TRepeatLayout::Table.
*/
public function getRepeatLayout()
{
@@ -172,12 +172,11 @@ class TRepeatInfo extends TComponent
}
/**
- * @param string how the repeated items should be displayed, using table or using line breaks.
- * Valid values include 'Table', 'Flow' and 'Raw'.
+ * @param TRepeatLayout how the repeated items should be displayed, using table or using line breaks.
*/
public function setRepeatLayout($value)
{
- $this->_repeatLayout=TPropertyValue::ensureEnum($value,array('Table','Flow','Raw'));
+ $this->_repeatLayout=TPropertyValue::ensureEnum($value,'TRepeatLayout');
}
/**
@@ -187,7 +186,7 @@ class TRepeatInfo extends TComponent
*/
public function renderRepeater($writer, IRepeatInfoUser $user)
{
- if($this->_repeatLayout==='Table')
+ if($this->_repeatLayout===TRepeatLayout::Table)
{
$control=new TTable;
if($this->_caption!=='')
@@ -196,7 +195,7 @@ class TRepeatInfo extends TComponent
$control->setCaptionAlign($this->_captionAlign);
}
}
- else if($this->_repeatLayout==='Raw')
+ else if($this->_repeatLayout===TRepeatLayout::Raw)
{
$this->renderRawContents($writer,$user);
return;
@@ -210,7 +209,7 @@ class TRepeatInfo extends TComponent
$control->renderBeginTag($writer);
$writer->writeLine();
- if($this->_repeatDirection==='Vertical')
+ if($this->_repeatDirection===TRepeatDirection::Vertical)
$this->renderVerticalContents($writer,$user);
else
$this->renderHorizontalContents($writer,$user);
@@ -248,7 +247,7 @@ class TRepeatInfo extends TComponent
*/
protected function renderHorizontalContents($writer,$user)
{
- $tableLayout=($this->_repeatLayout==='Table');
+ $tableLayout=($this->_repeatLayout===TRepeatLayout::Table);
$hasSeparators=$user->getHasSeparators();
$itemCount=$user->getItemCount();
$columns=$this->_repeatColumns===0?$itemCount:$this->_repeatColumns;
@@ -330,7 +329,7 @@ class TRepeatInfo extends TComponent
*/
protected function renderVerticalContents($writer,$user)
{
- $tableLayout=($this->_repeatLayout==='Table');
+ $tableLayout=($this->_repeatLayout===TRepeatLayout::Table);
$hasSeparators=$user->getHasSeparators();
$itemCount=$user->getItemCount();
if($this->_repeatColumns<=1)
@@ -516,4 +515,47 @@ class TRepeatInfo extends TComponent
}
}
+
+/**
+ * TRepeatDirection class.
+ * TRepeatDirection defines the enumerable type for the possible directions
+ * that repeated contents can repeat along
+ *
+ * The following enumerable values are defined:
+ * - Vertical
+ * - Horizontal
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TRepeatDirection extends TEnumerable
+{
+ const Vertical='Vertical';
+ const Horizontal='Horizontal';
+}
+
+/**
+ * TRepeatLayout class.
+ * TRepeatLayout defines the enumerable type for the possible layouts
+ * that repeated contents can take.
+ *
+ * The following enumerable values are defined:
+ * - Table: the repeated contents are organized using an HTML table
+ * - Flow: the repeated contents are organized using HTML spans and breaks
+ * - Raw: the repeated contents are stacked together without any additional decorations
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TRepeatLayout extends TEnumerable
+{
+ const Table='Table';
+ const Flow='Flow';
+ const Raw='Raw';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php
index 01c88a30..c5b3e2ef 100644
--- a/framework/Web/UI/WebControls/TRepeater.php
+++ b/framework/Web/UI/WebControls/TRepeater.php
@@ -38,8 +38,8 @@ Prado::using('System.Util.TDataFieldAccessor');
*
* Each repeater item has a {@link TRepeaterItem::getItemType type}
* which tells the position of the item in the repeater. An item in the header
- * of the repeater is of type TRepeater::IT_HEADER. A body item may be of either
- * TRepeater::IT_ITEM or TRepeater::IT_ALTERNATINGITEM, depending whether the item
+ * of the repeater is of type TListItemType::Header. A body item may be of either
+ * TListItemType::Item or TListItemType::AlternatingItem, depending whether the item
* index is odd or even.
*
* You can retrive the repeated contents by the {@link getItems Items} property.
@@ -73,6 +73,7 @@ class TRepeater extends TDataBoundControl implements INamingContainer
{
/**
* Repeater item types
+ * @deprecated deprecated since version 3.0.4. Use TListItemType constants instead.
*/
const IT_HEADER='Header';
const IT_FOOTER='Footer';
@@ -345,11 +346,11 @@ class TRepeater extends TDataBoundControl implements INamingContainer
$template=null;
switch($item->getItemType())
{
- case self::IT_HEADER: $template=$this->_headerTemplate; break;
- case self::IT_FOOTER: $template=$this->_footerTemplate; break;
- case self::IT_ITEM : $template=$this->_itemTemplate; break;
- case self::IT_SEPARATOR : $template=$this->_separatorTemplate; break;
- case self::IT_ALTERNATINGITEM : $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate; break;
+ case TListItemType::Header: $template=$this->_headerTemplate; break;
+ case TListItemType::Footer: $template=$this->_footerTemplate; break;
+ case TListItemType::Item : $template=$this->_itemTemplate; break;
+ case TListItemType::Separator : $template=$this->_separatorTemplate; break;
+ case TListItemType::AlternatingItem : $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate; break;
}
if($template!==null)
$template->instantiateIn($item);
@@ -416,16 +417,16 @@ class TRepeater extends TDataBoundControl implements INamingContainer
$items=$this->getItems();
$hasSeparator=$this->_separatorTemplate!==null;
if($this->_headerTemplate!==null)
- $this->_header=$this->createItemInternal(-1,self::IT_HEADER,false,null);
+ $this->_header=$this->createItemInternal(-1,TListItemType::Header,false,null);
for($i=0;$i<$itemCount;++$i)
{
if($hasSeparator && $i>0)
- $this->createItemInternal($i-1,self::IT_SEPARATOR,false,null);
- $itemType=$i%2==0?self::IT_ITEM:self::IT_ALTERNATINGITEM;
+ $this->createItemInternal($i-1,TListItemType::Separator,false,null);
+ $itemType=$i%2==0?TListItemType::Item : TListItemType::AlternatingItem;
$items->add($this->createItemInternal($i,$itemType,false,null));
}
if($this->_footerTemplate!==null)
- $this->_footer=$this->createItemInternal(-1,self::IT_FOOTER,false,null);
+ $this->_footer=$this->createItemInternal(-1,TListItemType::Footer,false,null);
}
else if($this->_emptyTemplate!==null)
$this->_emptyTemplate->instantiateIn($this);
@@ -456,15 +457,15 @@ class TRepeater extends TDataBoundControl implements INamingContainer
else
$keys->add($key);
if($itemIndex===0 && $this->_headerTemplate!==null)
- $this->_header=$this->createItemInternal(-1,self::IT_HEADER,true,null);
+ $this->_header=$this->createItemInternal(-1,TListItemType::Header,true,null);
if($hasSeparator && $itemIndex>0)
- $this->createItemInternal($itemIndex-1,self::IT_SEPARATOR,true,null);
- $itemType=$itemIndex%2==0?self::IT_ITEM:self::IT_ALTERNATINGITEM;
+ $this->createItemInternal($itemIndex-1,TListItemType::Separator,true,null);
+ $itemType=$itemIndex%2==0?TListItemType::Item : TListItemType::AlternatingItem;
$items->add($this->createItemInternal($itemIndex,$itemType,true,$dataItem));
$itemIndex++;
}
if($itemIndex>0 && $this->_footerTemplate!==null)
- $this->_footer=$this->createItemInternal(-1,self::IT_FOOTER,true,null);
+ $this->_footer=$this->createItemInternal(-1,TListItemType::Footer,true,null);
if($itemIndex===0 && $this->_emptyTemplate!==null)
{
$this->_emptyTemplate->instantiateIn($this);
@@ -674,9 +675,9 @@ class TRepeaterItem extends TControl implements INamingContainer
private $_itemIndex='';
/**
* type of the TRepeaterItem
- * @var string
+ * @var TListItemType
*/
- private $_itemType='';
+ private $_itemType;
/**
* value of the data item
* @var mixed
@@ -686,7 +687,7 @@ class TRepeaterItem extends TControl implements INamingContainer
/**
* Constructor.
* @param integer zero-based index of the item in the item collection of repeater
- * @param string item type, can be 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'.
+ * @param TListItemType item type
*/
public function __construct($itemIndex,$itemType)
{
@@ -695,7 +696,7 @@ class TRepeaterItem extends TControl implements INamingContainer
}
/**
- * @return string item type
+ * @return TListItemType item type
*/
public function getItemType()
{
@@ -703,11 +704,11 @@ class TRepeaterItem extends TControl implements INamingContainer
}
/**
- * @param string item type. Valid values include 'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager'.
+ * @param TListItemType item type.
*/
public function setItemType($value)
{
- $this->_itemType=TPropertyValue::ensureEnum($value,'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager');
+ $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
}
/**
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index cdc4cbe4..38637480 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -351,11 +351,11 @@ class TStyle extends TComponent
class TTableStyle extends TStyle
{
/**
- * @var string the URL of the background image for the table
+ * @var TVerticalAlign the URL of the background image for the table
*/
private $_backImageUrl=null;
/**
- * @var string horizontal alignment of the contents within the table
+ * @var THorizontalAlign horizontal alignment of the contents within the table
*/
private $_horizontalAlign=null;
/**
@@ -367,7 +367,7 @@ class TTableStyle extends TStyle
*/
private $_cellSpacing=null;
/**
- * @var string grid line setting of the table
+ * @var TTableGridLines grid line setting of the table
*/
private $_gridLines=null;
/**
@@ -453,7 +453,7 @@ class TTableStyle extends TStyle
if(($url=trim($this->getBackImageUrl()))!=='')
$writer->addStyleAttribute('background-image','url('.$url.')');
- if(($horizontalAlign=$this->getHorizontalAlign())!=='NotSet')
+ if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
$writer->addStyleAttribute('text-align',strtolower($horizontalAlign));
if(($cellPadding=$this->getCellPadding())>=0)
@@ -467,9 +467,9 @@ class TTableStyle extends TStyle
switch($this->getGridLines())
{
- case 'Horizontal' : $writer->addAttribute('rules','rows'); break;
- case 'Vertical' : $writer->addAttribute('rules','cols'); break;
- case 'Both' : $writer->addAttribute('rules','all'); break;
+ case TTableGridLines::Horizontal : $writer->addAttribute('rules','rows'); break;
+ case TTableGridLines::Vertical : $writer->addAttribute('rules','cols'); break;
+ case TTableGridLines::Both : $writer->addAttribute('rules','all'); break;
}
parent::addAttributesToRender($writer);
@@ -493,21 +493,20 @@ class TTableStyle extends TStyle
}
/**
- * @return string the horizontal alignment of the contents within the table, defaults to 'NotSet'.
+ * @return THorizontalAlign the horizontal alignment of the contents within the table, defaults to THorizontalAlign::NotSet.
*/
public function getHorizontalAlign()
{
- return $this->_horizontalAlign===null?'NotSet':$this->_horizontalAlign;
+ return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
}
/**
* Sets the horizontal alignment of the contents within the table.
- * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center'
- * @param string the horizontal alignment
+ * @param THorizontalAlign the horizontal alignment
*/
public function setHorizontalAlign($value)
{
- $this->_horizontalAlign=TPropertyValue::ensureEnum($value,array('NotSet','Left','Right','Center','Justify'));
+ $this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
}
/**
@@ -547,21 +546,20 @@ class TTableStyle extends TStyle
}
/**
- * @return string the grid line setting of the table. Defaults to 'None'.
+ * @return TTableGridLines the grid line setting of the table. Defaults to TTableGridLines::None.
*/
public function getGridLines()
{
- return $this->_gridLines===null?'None':$this->_gridLines;
+ return $this->_gridLines===null?TTableGridLines::None:$this->_gridLines;
}
/**
* Sets the grid line style of the table.
- * Valid values include 'None', 'Horizontal', 'Vertical', 'Both'.
- * @param string the grid line setting of the table
+ * @param TTableGridLines the grid line setting of the table
*/
public function setGridLines($value)
{
- $this->_gridLines=TPropertyValue::ensureEnum($value,array('None', 'Horizontal', 'Vertical', 'Both'));
+ $this->_gridLines=TPropertyValue::ensureEnum($value,'TTableGridLines');
}
@@ -594,11 +592,11 @@ class TTableStyle extends TStyle
class TTableItemStyle extends TStyle
{
/**
- * @var string horizontal alignment of the contents within the table item
+ * @var THorizontalAlign horizontal alignment of the contents within the table item
*/
private $_horizontalAlign=null;
/**
- * @var string vertical alignment of the contents within the table item
+ * @var TVerticalAlign vertical alignment of the contents within the table item
*/
private $_verticalAlign=null;
/**
@@ -669,49 +667,47 @@ class TTableItemStyle extends TStyle
if(!$this->getWrap())
$writer->addStyleAttribute('white-space','nowrap');
- if(($horizontalAlign=$this->getHorizontalAlign())!=='NotSet')
+ if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
$writer->addAttribute('align',strtolower($horizontalAlign));
- if(($verticalAlign=$this->getVerticalAlign())!=='NotSet')
+ if(($verticalAlign=$this->getVerticalAlign())!==TVerticalAlign::NotSet)
$writer->addAttribute('valign',strtolower($verticalAlign));
parent::addAttributesToRender($writer);
}
/**
- * @return string the horizontal alignment of the contents within the table item, defaults to 'NotSet'.
+ * @return THorizontalAlign the horizontal alignment of the contents within the table item, defaults to THorizontalAlign::NotSet.
*/
public function getHorizontalAlign()
{
- return $this->_horizontalAlign===null?'NotSet':$this->_horizontalAlign;
+ return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
}
/**
* Sets the horizontal alignment of the contents within the table item.
- * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center'
- * @param string the horizontal alignment
+ * @param THorizontalAlign the horizontal alignment
*/
public function setHorizontalAlign($value)
{
- $this->_horizontalAlign=TPropertyValue::ensureEnum($value,array('NotSet','Left','Right','Center','Justify'));
+ $this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
}
/**
- * @return string the vertical alignment of the contents within the table item, defaults to 'NotSet'.
+ * @return TVerticalAlign the vertical alignment of the contents within the table item, defaults to TVerticalAlign::NotSet.
*/
public function getVerticalAlign()
{
- return $this->_verticalAlign===null?'NotSet':$this->_verticalAlign;
+ return $this->_verticalAlign===null?TVerticalAlign::NotSet:$this->_verticalAlign;
}
/**
* Sets the vertical alignment of the contents within the table item.
- * Valid values include 'NotSet','Top','Bottom','Middle'
- * @param string the horizontal alignment
+ * @param TVerticalAlign the horizontal alignment
*/
public function setVerticalAlign($value)
{
- $this->_verticalAlign=TPropertyValue::ensureEnum($value,array('NotSet','Top','Bottom','Middle'));
+ $this->_verticalAlign=TPropertyValue::ensureEnum($value,'TVerticalAlign');
}
/**
@@ -732,4 +728,76 @@ class TTableItemStyle extends TStyle
}
}
+/**
+ * THorizontalAlign class.
+ * THorizontalAlign defines the enumerable type for the possible horizontal alignments in a CSS style.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: the alignment is not specified.
+ * - Left: left aligned
+ * - Right: right aligned
+ * - Center: center aligned
+ * - Justify: the begin and end are justified
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class THorizontalAlign extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Left='Left';
+ const Right='Right';
+ const Center='Center';
+ const Justify='Justify';
+}
+
+/**
+ * TVerticalAlign class.
+ * TVerticalAlign defines the enumerable type for the possible vertical alignments in a CSS style.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: the alignment is not specified.
+ * - Top: top aligned
+ * - Bottom: bottom aligned
+ * - Middle: middle aligned
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TVerticalAlign extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Top='Top';
+ const Bottom='Bottom';
+ const Middle='Middle';
+}
+
+
+/**
+ * TTableGridLines class.
+ * TTableGridLines defines the enumerable type for the possible grid line types of an HTML table.
+ *
+ * The following enumerable values are defined:
+ * - None: no grid lines
+ * - Horizontal: horizontal grid lines only
+ * - Vertical: vertical grid lines only
+ * - Both: both horizontal and vertical grid lines are shown
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TTableGridLines extends TEnumerable
+{
+ const None='None';
+ const Horizontal='Horizontal';
+ const Vertical='Vertical';
+ const Both='Both';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php
index ac61eb3f..d3036c9c 100644
--- a/framework/Web/UI/WebControls/TTable.php
+++ b/framework/Web/UI/WebControls/TTable.php
@@ -107,7 +107,7 @@ class TTable extends TWebControl
$border=0;
if($this->getHasStyle())
{
- if($this->getGridLines()!=='None')
+ if($this->getGridLines()!==TTableGridLines::None)
{
if(($border=$this->getBorderWidth())==='')
$border=1;
@@ -153,20 +153,19 @@ class TTable extends TWebControl
}
/**
- * @return string table caption alignment. Defaults to 'NotSet'.
+ * @return TTableCaptionAlign table caption alignment. Defaults to TTableCaptionAlign::NotSet.
*/
public function getCaptionAlign()
{
- return $this->getViewState('CaptionAlign','NotSet');
+ return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet);
}
/**
- * @param string table caption alignment. Valid values include
- * 'NotSet','Top','Bottom','Left','Right'.
+ * @param TTableCaptionAlign table caption alignment.
*/
public function setCaptionAlign($value)
{
- $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'NotSet','Top','Bottom','Left','Right'),'NotSet');
+ $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'TTableCaptionAlign'),TTableCaptionAlign::NotSet);
}
/**
@@ -208,19 +207,18 @@ class TTable extends TWebControl
}
/**
- * @return string the horizontal alignment of the table content. Defaults to 'NotSet'.
+ * @return THorizontalAlign the horizontal alignment of the table content. Defaults to THorizontalAlign::NotSet.
*/
public function getHorizontalAlign()
{
if($this->getHasStyle())
return $this->getStyle()->getHorizontalAlign();
else
- return 'NotSet';
+ return THorizontalAlign::NotSet;
}
/**
- * @param string the horizontal alignment of the table content.
- * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center'.
+ * @param THorizontalAlign the horizontal alignment of the table content.
*/
public function setHorizontalAlign($value)
{
@@ -228,20 +226,18 @@ class TTable extends TWebControl
}
/**
- * @return string the grid line setting of the table. Defaults to 'None'.
+ * @return TTableGridLines the grid line setting of the table. Defaults to TTableGridLines::None.
*/
public function getGridLines()
{
if($this->getHasStyle())
return $this->getStyle()->getGridLines();
else
- return 'None';
+ return TTableGridLines::None;
}
/**
- * Sets the grid line style of the table.
- * Valid values include 'None', 'Horizontal', 'Vertical', 'Both'.
- * @param string the grid line setting of the table
+ * @param TTableGridLines the grid line setting of the table
*/
public function setGridLines($value)
{
@@ -277,7 +273,7 @@ class TTable extends TWebControl
parent::renderBeginTag($writer);
if(($caption=$this->getCaption())!=='')
{
- if(($align=$this->getCaptionAlign())!=='NotSet')
+ if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet)
$writer->addAttribute('align',strtolower($align));
$writer->renderBeginTag('caption');
$writer->write($caption);
@@ -296,7 +292,7 @@ class TTable extends TWebControl
$renderTableSection=false;
foreach($this->getControls() as $row)
{
- if($row->getTableSection()!=='Body')
+ if($row->getTableSection()!==TTableRowSection::Body)
{
$renderTableSection=true;
break;
@@ -304,31 +300,31 @@ class TTable extends TWebControl
}
if($renderTableSection)
{
- $currentSection='Header';
+ $currentSection=TTableRowSection::Header;
$writer->writeLine();
foreach($this->getControls() as $index=>$row)
{
if(($section=$row->getTableSection())===$currentSection)
{
- if($index===0 && $currentSection==='Header')
+ if($index===0 && $currentSection===TTableRowSection::Header)
$writer->renderBeginTag('thead');
}
else
{
- if($currentSection==='Header')
+ if($currentSection===TTableRowSection::Header)
{
if($index>0)
$writer->renderEndTag();
- if($section==='Body')
+ if($section===TTableRowSection::Body)
$writer->renderBeginTag('tbody');
else
$writer->renderBeginTag('tfoot');
$currentSection=$section;
}
- else if($currentSection==='Body')
+ else if($currentSection===TTableRowSection::Body)
{
$writer->renderEndTag();
- if($section==='Footer')
+ if($section===TTableRowSection::Footer)
$writer->renderBeginTag('tfoot');
else
throw new TConfigurationException('table_tablesection_outoforder');
@@ -385,4 +381,31 @@ class TTableRowCollection extends TControlCollection
}
}
+
+/**
+ * TTableCaptionAlign class.
+ * TTableCaptionAlign defines the enumerable type for the possible alignments
+ * that a table caption can take.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: alignment not specified
+ * - Top: top aligned
+ * - Bottom: bottom aligned
+ * - Left: left aligned
+ * - Right: right aligned
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TTableCaptionAlign extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Top='Top';
+ const Bottom='Bottom';
+ const Left='Left';
+ const Right='Right';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TTableHeaderCell.php b/framework/Web/UI/WebControls/TTableHeaderCell.php
index 12009de6..497b2088 100644
--- a/framework/Web/UI/WebControls/TTableHeaderCell.php
+++ b/framework/Web/UI/WebControls/TTableHeaderCell.php
@@ -43,8 +43,8 @@ class TTableHeaderCell extends TTableCell
protected function addAttributesToRender($writer)
{
parent::addAttributesToRender($writer);
- if(($scope=$this->getScope())!=='NotSet')
- $writer->addAttribute('scope',$scope==='Row'?'row':'col');
+ if(($scope=$this->getScope())!==TTableHeaderScope::NotSet)
+ $writer->addAttribute('scope',$scope===TTableHeaderScope::Row?'row':'col');
if(($text=$this->getAbbreviatedText())!=='')
$writer->addAttribute('abbr',$text);
if(($text=$this->getCategoryText())!=='')
@@ -52,20 +52,19 @@ class TTableHeaderCell extends TTableCell
}
/**
- * @return string the scope of the cells that the header cell applies to. Defaults to 'NotSet'.
+ * @return TTableHeaderScope the scope of the cells that the header cell applies to. Defaults to TTableHeaderScope::NotSet.
*/
public function getScope()
{
- return $this->getViewState('Scope','NotSet');
+ return $this->getViewState('Scope',TTableHeaderScope::NotSet);
}
/**
- * @param string the scope of the cells that the header cell applies to.
- * Valid values include 'NotSet','Row','Column'.
+ * @param TTableHeaderScope the scope of the cells that the header cell applies to.
*/
public function setScope($value)
{
- $this->setViewState('Scope',TPropertyValue::ensureEnum($value,'NotSet','Row','Column'),'NotSet');
+ $this->setViewState('Scope',TPropertyValue::ensureEnum($value,'TTableHeaderScope'),TTableHeaderScope::NotSet);
}
/**
@@ -101,4 +100,26 @@ class TTableHeaderCell extends TTableCell
}
}
+
+/**
+ * TTableHeaderScope class.
+ * TTableHeaderScope defines the enumerable type for the possible table scopes that a table header is associated with.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: the scope is not specified
+ * - Row: the scope is row-wise
+ * - Column: the scope is column-wise
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TTableHeaderScope extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Row='Row';
+ const Column='Column';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TTableRow.php b/framework/Web/UI/WebControls/TTableRow.php
index b0e0bfbe..d4bf7984 100644
--- a/framework/Web/UI/WebControls/TTableRow.php
+++ b/framework/Web/UI/WebControls/TTableRow.php
@@ -121,20 +121,19 @@ class TTableRow extends TWebControl
}
/**
- * @return string location of a row in a table. Defaults to 'Body'.
+ * @return TTableRowSection location of a row in a table. Defaults to TTableRowSection::Body.
*/
public function getTableSection()
{
- return $this->getViewState('TableSection','Body');
+ return $this->getViewState('TableSection',TTableRowSection::Body);
}
/**
- * @param string location of a row in a table. Valid values include 'Header', 'Footer' and 'Body'.
+ * @param TTableRowSection location of a row in a table.
*/
public function setTableSection($value)
{
- $value=TPropertyValue::ensureEnum($value,'Header','Body','Footer');
- $this->setViewState('TableSection',$value,'Body');
+ $this->setViewState('TableSection',TPropertyValue::ensureEnum($value,'TTableRowSection'),TTableRowSection::Body);
}
/**
@@ -184,4 +183,27 @@ class TTableCellCollection extends TControlCollection
}
}
+
+/**
+ * TTableRowSection class.
+ * TTableRowSection defines the enumerable type for the possible table sections
+ * that a {@link TTableRow} can be within.
+ *
+ * The following enumerable values are defined:
+ * - Header: in table header
+ * - Body: in table body
+ * - Footer: in table footer
+ *
+ * @author Qiang Xue
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TTableRowSection extends TEnumerable
+{
+ const Header='Header';
+ const Body='Body';
+ const Footer='Footer';
+}
+
?>
\ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 96c43092..b9806df4 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -242,7 +242,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
public function setAutoCompleteType($value)
{
- $this->setViewState('AutoCompleteType',TPropertyValue::ensureEnumerable($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None);
+ $this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None);
}
/**
@@ -419,7 +419,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
public function setTextMode($value)
{
- $this->setViewState('TextMode',TPropertyValue::ensureEnumerable($value,'TTextBoxMode'),TTextBoxMode::SingleLine);
+ $this->setViewState('TextMode',TPropertyValue::ensureEnum($value,'TTextBoxMode'),TTextBoxMode::SingleLine);
}
/**
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 539c6dc3..df522460 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -64,7 +64,7 @@ class TValidationSummary extends TWebControl
*/
public function setDisplay($value)
{
- $this->setViewState('Display',TPropertyValue::ensureEnumerable($value,'TValidationSummaryDisplayStyle'),TValidationSummaryDisplayStyle::Fixed);
+ $this->setViewState('Display',TPropertyValue::ensureEnum($value,'TValidationSummaryDisplayStyle'),TValidationSummaryDisplayStyle::Fixed);
}
/**
@@ -97,7 +97,7 @@ class TValidationSummary extends TWebControl
*/
public function setDisplayMode($value)
{
- $this->setViewState('DisplayMode',TPropertyValue::ensureEnumerable($value,'TValidationSummaryDisplayMode'),TValidationSummaryDisplayMode::BulletList);
+ $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'TValidationSummaryDisplayMode'),TValidationSummaryDisplayMode::BulletList);
}
/**
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index 0a9bb58c..d0e8b984 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -1528,7 +1528,7 @@ class TWizardNavigationButtonStyle extends TStyle
*/
public function setButtonType($value)
{
- $this->_buttonType=TPropertyValue::ensureEnumerable($value,'TWizardNavigationButtonType');
+ $this->_buttonType=TPropertyValue::ensureEnum($value,'TWizardNavigationButtonType');
}
/**
@@ -1631,7 +1631,7 @@ class TWizardStep extends TView
*/
public function setStepType($type)
{
- $type=TPropertyValue::ensureEnumerable($type,'TWizardStepType');
+ $type=TPropertyValue::ensureEnum($type,'TWizardStepType');
if($type!==$this->getStepType())
{
$this->setViewState('StepType',$type,TWizardStepType::Auto);
diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php
index f44432dd..ddb1bd24 100644
--- a/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php
+++ b/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php
@@ -10,40 +10,40 @@ class DataGrid3TestCase extends SeleniumTestCase
$this->verifyTextPresent("Design Patterns: Elements of Reusable Object-Oriented Software", "");
$this->verifyTextPresent("Addison-Wesley Professional", "");
$this->verifyTextPresent("$47.04", "");
- $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl1@checked','regexp:true|checked');
- $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl1@disabled','regexp:true|disabled');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@checked','regexp:true|checked');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@disabled','regexp:true|disabled');
//$this->verifyElementPresent("//img[@src='images/star5.gif']",'');
// edit the 2nd row
- $this->clickAndWait("id=ctl0_body_DataGrid_ctl2_ctl2", "");
- $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl1", "Design Pattern: Elements of Reusable Object-Oriented Software");
- $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl2", "Addison Wesley Professional");
- $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl3", "\$57.04");
- $this->click("//input[@name='ctl0\$body\$DataGrid\$ctl2\$ctl4']", "");
- $this->select("ctl0\$body\$DataGrid\$ctl2\$ctl5", "label=1");
+ $this->clickAndWait("id=ctl0_body_DataGrid_ctl2_ctl8", "");
+ $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl7", "Design Pattern: Elements of Reusable Object-Oriented Software");
+ $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl8", "Addison Wesley Professional");
+ $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl9", "\$57.04");
+ $this->click("//input[@name='ctl0\$body\$DataGrid\$ctl2\$ctl10']", "");
+ $this->select("ctl0\$body\$DataGrid\$ctl2\$ctl11", "label=1");
$this->clickAndWait("link=Save", "");
// verify the 2nd row is saved
$this->verifyTextPresent("Design Pattern: Elements of Reusable Object-Oriented Software", "");
$this->verifyTextPresent("Addison Wesley Professional", "");
$this->verifyTextPresent("$57.04", "");
- $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl1@checked','regexp:false|null');
- $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl1@disabled','regexp:true|disabled');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@checked','regexp:false|null');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@disabled','regexp:true|disabled');
//$this->verifyElementPresent("//img[@src='images/star1.gif']",'');
// verify cancel editting the 3rd row
- $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl2", "");
+ $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl8", "");
$this->clickAndWait("link=Cancel", "");
$this->verifyTextPresent("Design Patterns Explained : A New Perspective on Object-Oriented Design", "");
// verify deleting
- $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl3", "");
+ $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl9", "");
$this->verifyConfirmation("Are you sure?");
$this->verifyTextNotPresent("Design Patterns Explained : A New Perspective on Object-Oriented Design", "");
$this->verifyTextPresent("Extreme Programming Explained : Embrace Change",'');
$this->chooseCancelOnNextConfirmation();
- $this->click("id=ctl0_body_DataGrid_ctl6_ctl3", "");
+ $this->click("id=ctl0_body_DataGrid_ctl6_ctl9", "");
$this->verifyConfirmation("Are you sure?");
$this->verifyTextPresent("Extreme Programming Explained : Embrace Change",'');
}
--
cgit v1.2.3