summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--demos/quickstart/protected/pages/Controls/List.page1
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page105
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php34
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php24
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page16
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page132
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php22
-rw-r--r--framework/Exceptions/messages.txt5
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php49
-rw-r--r--framework/Web/UI/WebControls/TListControl.php4
-rw-r--r--framework/Web/UI/WebControls/TRadioButtonList.php26
-rw-r--r--framework/Web/UI/WebControls/TRepeatInfo.php1
-rw-r--r--framework/Web/UI/WebControls/TStyle.php114
14 files changed, 426 insertions, 109 deletions
diff --git a/.gitattributes b/.gitattributes
index 53d811fb..b16270db 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -50,6 +50,8 @@ demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.page -text
demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/TPanel/hello_world.gif -text
+demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page -text
+demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/TTable/Home.page -text
demos/quickstart/protected/pages/Controls/Samples/TTable/backimage.gif -text
demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.page -text
diff --git a/demos/quickstart/protected/pages/Controls/List.page b/demos/quickstart/protected/pages/Controls/List.page
index f3c4cd96..f70c4368 100644
--- a/demos/quickstart/protected/pages/Controls/List.page
+++ b/demos/quickstart/protected/pages/Controls/List.page
@@ -21,6 +21,7 @@ List controls covered in this section are all inherit directly or indirectly fro
<com:RunBar PagePath="Controls.Samples.TCheckBoxList.Home" />
<h2>TRadioButtonList</h2>
+<com:RunBar PagePath="Controls.Samples.TRadioButtonList.Home" />
<h2>TBulletList</h2>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page
index 7f8772c8..ac9de17e 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page
@@ -6,10 +6,10 @@
<tr>
<td class="samplenote">
-Check box list with initial items:
+Check box list with default settings:
</td>
<td class="sampleaction">
-<com:TCheckBoxList AutoPostBack="true" BorderWidth="1px" BorderStyle="solid" BorderColor="black" GridLines="Both" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="2">
+<com:TCheckBoxList>
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
@@ -20,15 +20,110 @@ Check box list with initial items:
<tr>
<td class="samplenote">
-Check box list with initial items:
+Check box list with customized cellpadding, cellspacing, color and text alignment:
</td>
<td class="sampleaction">
-<com:TRadioButtonList AutoPostBack="true" BorderWidth="1px" BorderStyle="solid" BorderColor="black" GridLines="Both" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="2">
+<com:TCheckBoxList
+ CellPadding="5"
+ CellSpacing="1"
+ BackColor="silver"
+ TextAlign="Left">
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
-</com:TRadioButtonList>
+</com:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList RepeatDirection="Horizontal" RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with flow layout and vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList RepeatLayout="Flow" RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list with flow layout and horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList
+ RepeatLayout="Flow"
+ RepeatDirection="Horizontal"
+ RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TCheckBoxList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Check box list's behavior upon postback:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList ID="CheckBoxList">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TCheckBoxList>
+<com:TButton Text="Submit" Click="buttonClicked" />
+<br/>
+<com:TLabel ID="SelectionResult" ForeColor="red" />
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Auto postback check box list:
+</td>
+<td class="sampleaction">
+<com:TCheckBoxList AutoPostBack="true" SelectedIndexChanged="selectionChanged">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+</com:TCheckBoxList>
+<com:TLabel ID="SelectionResult2" ForeColor="red" />
</td>
</tr>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php
index 6b1d07e1..3873ca30 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php
@@ -2,50 +2,34 @@
class Home extends TPage
{
- public function selectionChanged($sender,$param)
- {
- $index=$sender->SelectedIndex;
- $value=$sender->SelectedValue;
- $text=$sender->SelectedItem->Text;
- $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
- }
-
public function buttonClicked($sender,$param)
{
- $index=$this->ListBox1->SelectedIndex;
- $value=$this->ListBox1->SelectedValue;
- $text=$this->ListBox1->SelectedItem->Text;
- $this->SelectionResult2->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
- }
-
- public function multiSelectionChanged($sender,$param)
- {
- $indices=$sender->SelectedIndices;
+ $indices=$this->CheckBoxList->SelectedIndices;
$result='';
foreach($indices as $index)
{
- $item=$sender->Items[$index];
+ $item=$this->CheckBoxList->Items[$index];
$result.="(Index: $index, Value: $item->Value, Text: $item->Text)\n";
}
if($result==='')
- $this->MultiSelectionResult->Text='Your selection is empty.';
+ $this->SelectionResult->Text='Your selection is empty.';
else
- $this->MultiSelectionResult->Text='Your selection is: '.$result;
+ $this->SelectionResult->Text='Your selection is: '.$result;
}
- public function buttonClicked2($sender,$param)
+ public function selectionChanged($sender,$param)
{
- $indices=$this->ListBox2->SelectedIndices;
+ $indices=$sender->SelectedIndices;
$result='';
foreach($indices as $index)
{
- $item=$this->ListBox2->Items[$index];
+ $item=$sender->Items[$index];
$result.="(Index: $index, Value: $item->Value, Text: $item->Text)\n";
}
if($result==='')
- $this->MultiSelectionResult2->Text='Your selection is empty.';
+ $this->SelectionResult2->Text='Your selection is empty.';
else
- $this->MultiSelectionResult2->Text='Your selection is: '.$result;
+ $this->SelectionResult2->Text='Your selection is: '.$result;
}
}
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php
index 3835d3c3..5dfa3bba 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php
@@ -4,18 +4,26 @@ class Home extends TPage
{
public function selectionChanged($sender,$param)
{
- $index=$sender->SelectedIndex;
- $value=$sender->SelectedValue;
- $text=$sender->SelectedItem->Text;
- $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ if(($index=$sender->SelectedIndex)>=0)
+ {
+ $value=$sender->SelectedValue;
+ $text=$sender->SelectedItem->Text;
+ $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+ else
+ $this->SelectionResult->Text="Your selection is empty.";
}
public function buttonClicked($sender,$param)
{
- $index=$this->ListBox1->SelectedIndex;
- $value=$this->ListBox1->SelectedValue;
- $text=$this->ListBox1->SelectedItem->Text;
- $this->SelectionResult2->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ if(($index=$this->ListBox1->SelectedIndex)>=0)
+ {
+ $value=$this->ListBox1->SelectedValue;
+ $text=$this->ListBox1->SelectedItem->Text;
+ $this->SelectionResult2->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+ else
+ $this->SelectionResult2->Text="Your selection is empty.";
}
}
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page
index 28d0dc1a..f6640879 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page
@@ -122,33 +122,33 @@ List box with initial items:
<tr>
<td class="samplenote">
-Auto postback list box:
+List box's behavior upon postback:
</td>
<td class="sampleaction">
-<com:TListBox AutoPostBack="true" SelectionMode="Multiple" SelectedIndexChanged="multiSelectionChanged">
+<com:TListBox ID="ListBox2" SelectionMode="Multiple">
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
</com:TListBox>
-<com:TLabel ID="MultiSelectionResult" ForeColor="red" />
+<com:TButton Text="Submit" Click="buttonClicked2" />
+<br/>
+<com:TLabel ID="MultiSelectionResult2" ForeColor="red" />
</td>
</tr>
<tr>
<td class="samplenote">
-List box's behavior upon postback:
+Auto postback list box:
</td>
<td class="sampleaction">
-<com:TListBox ID="ListBox2" SelectionMode="Multiple">
+<com:TListBox AutoPostBack="true" SelectionMode="Multiple" SelectedIndexChanged="multiSelectionChanged">
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
</com:TListBox>
-<com:TButton Text="Submit" Click="buttonClicked2" />
-<br/>
-<com:TLabel ID="MultiSelectionResult2" ForeColor="red" />
+<com:TLabel ID="MultiSelectionResult" ForeColor="red" />
</td>
</tr>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page
new file mode 100644
index 00000000..95fea89b
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page
@@ -0,0 +1,132 @@
+<com:TContent ID="body">
+
+<h1>TRadioButtonList Samples</h1>
+
+<table class="sampletable">
+
+<tr>
+<td class="samplenote">
+Radio button list with default settings:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList>
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with customized cellpadding, cellspacing, color and text alignment:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList
+ CellPadding="5"
+ CellSpacing="1"
+ BackColor="silver"
+ TextAlign="Left">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList RepeatDirection="Horizontal" RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with flow layout and vertical (default) repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList RepeatLayout="Flow" RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list with flow layout and horizontal repeat direction:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList
+ RepeatLayout="Flow"
+ RepeatDirection="Horizontal"
+ RepeatColumns="3">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Radio button list's behavior upon postback:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList ID="RadioButtonList">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+<com:TButton Text="Submit" Click="buttonClicked" />
+<br/>
+<com:TLabel ID="SelectionResult" ForeColor="red" />
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Auto postback radio button list:
+</td>
+<td class="sampleaction">
+<com:TRadioButtonList AutoPostBack="true" SelectedIndexChanged="selectionChanged">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TRadioButtonList>
+<com:TLabel ID="SelectionResult2" ForeColor="red" />
+</td>
+</tr>
+
+</table>
+
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php
new file mode 100644
index 00000000..47d9b23b
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php
@@ -0,0 +1,22 @@
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $index=$this->RadioButtonList->SelectedIndex;
+ $value=$this->RadioButtonList->SelectedValue;
+ $text=$this->RadioButtonList->SelectedItem->Text;
+ $this->SelectionResult->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $index=$sender->SelectedIndex;
+ $value=$sender->SelectedValue;
+ $text=$sender->SelectedItem->Text;
+ $this->SelectionResult2->Text="Your selection is (Index: $index, Value: $value, Text: $text).";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt
index 8547527f..c260255d 100644
--- a/framework/Exceptions/messages.txt
+++ b/framework/Exceptions/messages.txt
@@ -146,4 +146,7 @@ hiddenfield_focus_unsupported = THiddenField does not support setting input fo
hiddenfield_theming_unsupported = THiddenField does not support theming.
hiddenfield_skinid_unsupported = THiddenField does not support control skin.
-panel_defaultbutton_invalid = TPanel.DefaultButton '%s' does not refer to an existing button control. \ No newline at end of file
+panel_defaultbutton_invalid = TPanel.DefaultButton '%s' does not refer to an existing button control.
+
+tablestyle_cellpadding_invalid = TTableStyle.CellPadding must take an integer equal to or greater than -1.
+tablestyle_cellspacing_invalid = TTableStyle.CellSpacing must take an integer equal to or greater than -1. \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index c4addcdd..f351acba 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -6,6 +6,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
{
private $_repeatedControl;
private $_isEnabled;
+ private $_changedEventRaised=false;
public function __construct()
{
@@ -154,14 +155,6 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$this->getStyle()->setCellPadding($value);
}
- public function loadPostData($key,$values)
- {
- }
-
- public function raisePostDataChangedEvent()
- {
- }
-
public function getHasHeader()
{
return false;
@@ -200,10 +193,50 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
$this->_repeatedControl->setID("$index");
$this->_repeatedControl->setText($item->getText());
$this->_repeatedControl->setChecked($item->getSelected());
+ $this->_repeatedControl->setAttribute('value',$item->getValue());
$this->_repeatedControl->setEnabled($this->_isEnabled && $item->getEnabled());
$this->_repeatedControl->renderControl($writer);
}
+ public function loadPostData($key,$values)
+ {
+ if($this->getEnabled(true))
+ {
+ $index=(int)substr($key,strlen($this->getUniqueID())+1);
+ $this->ensureDataBound();
+ if($index>=0 && $index<$this->getRepeatedItemCount())
+ {
+ $item=$this->getItems()->itemAt($index);
+ if($item->getEnabled())
+ {
+ $checked=isset($values[$key]);
+ if($item->getSelected()!=$checked)
+ {
+ $item->setSelected($checked);
+ if(!$this->_changedEventRaised)
+ {
+ $this->_changedEventRaised=true;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public function raisePostDataChangedEvent()
+ {
+ $page=$this->getPage();
+ if($this->getAutoPostBack() && !$page->getPostBackEventTarget())
+ {
+ $page->setPostBackEventTarget($this);
+ if($this->getCausesValidation())
+ $page->validate($this->getValidationGroup());
+ }
+ $this->onSelectedIndexChanged(null);
+ }
+
protected function onPreRender($param)
{
parent::onPreRender($param);
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php
index b32471fb..860cbc48 100644
--- a/framework/Web/UI/WebControls/TListControl.php
+++ b/framework/Web/UI/WebControls/TListControl.php
@@ -254,7 +254,7 @@ abstract class TListControl extends TDataBoundControl
}
}
- protected function getSelectedIndices()
+ public function getSelectedIndices()
{
$selections=array();
if($this->_items)
@@ -267,7 +267,7 @@ abstract class TListControl extends TDataBoundControl
return $selections;
}
- protected function setSelectedIndices($indices)
+ public function setSelectedIndices($indices)
{
if($this->_items)
{
diff --git a/framework/Web/UI/WebControls/TRadioButtonList.php b/framework/Web/UI/WebControls/TRadioButtonList.php
index 8d80745e..e434e709 100644
--- a/framework/Web/UI/WebControls/TRadioButtonList.php
+++ b/framework/Web/UI/WebControls/TRadioButtonList.php
@@ -2,17 +2,35 @@
class TRadioButtonList extends TCheckBoxList
{
- protected function createRepeatedControl()
+ protected function getIsMultiSelect()
{
- return new TRadioButton;
+ return false;
}
- public function loadPostData($key,$values)
+ protected function createRepeatedControl()
{
+ return new TRadioButton;
}
- public function raisePostDataChangedEvent()
+ public function loadPostData($key,$values)
{
+ $value=isset($values[$key])?$values[$key]:'';
+ $oldSelection=$this->getSelectedIndex();
+ $this->ensureDataBound();
+ foreach($this->getItems() as $index=>$item)
+ {
+ if($item->getEnabled() && $item->getValue()===$value)
+ {
+ if($index===$oldSelection)
+ return false;
+ else
+ {
+ $this->setSelectedIndex($index);
+ return true;
+ }
+ }
+ }
+ return false;
}
}
diff --git a/framework/Web/UI/WebControls/TRepeatInfo.php b/framework/Web/UI/WebControls/TRepeatInfo.php
index 14b57cfb..d3178c0c 100644
--- a/framework/Web/UI/WebControls/TRepeatInfo.php
+++ b/framework/Web/UI/WebControls/TRepeatInfo.php
@@ -271,6 +271,7 @@ class TRepeatInfo extends TComponent
}
if($index>=$itemCount)
continue;
+ $renderedItems++;
$user->renderItem($writer,$this,'Item',$index);
$writer->writeLine();
if(!$hasSeparators)
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index 4585cca3..bc77bfcf 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -259,14 +259,6 @@ class TStyle extends TComponent
}
/**
- * @param boolean if the style contains nothing
- */
- public function getIsEmpty()
- {
- return empty($this->_fields) && $this->_class==='' && $this->_customStyle==='' && (!$this->_font || $this->_font->getIsEmpty());
- }
-
- /**
* Resets the style to the original empty state.
*/
public function reset()
@@ -278,48 +270,19 @@ class TStyle extends TComponent
}
/**
- * Merges the current style with another one.
- * If the two styles have the same style field, the new one
- * will overwrite the current one.
- * @param TStyle the new style
- */
- public function mergeWith($style)
- {
- if($style===null)
- return;
- foreach($style->_fields as $name=>$value)
- $this->_fields[$name]=$value;
- if($style->_class!=='')
- $this->_class=$style->_class;
- if($style->_customStyle!=='')
- $this->_customStyle=$style->_customStyle;
- if($style->_font!==null)
- $this->getFont()->mergeWith($style->_font);
- }
-
- /**
* Copies from a style.
* Existing style will be reset first.
* @param TStyle the new style
*/
public function copyFrom($style)
{
- $this->reset();
- $this->mergeWith($style);
- }
-
- /**
- * Converts the style into a string representation suitable for rendering.
- * @return string the string representation of the style
- */
- public function toString()
- {
- $str='';
- foreach($this->_fields as $name=>$value)
- $str.=' '.$name.':'.$value.';';
- if($this->_font)
- $str.=$this->_font->toString();
- return $str;
+ $this->_fields=$style->_fields;
+ $this->_class=$style->_class;
+ $this->_customStyle=$style->_customStyle;
+ if($style->_font!==null)
+ $this->getFont()->copyFrom($style->_font);
+ else
+ $this->_font=null;
}
/**
@@ -378,6 +341,35 @@ class TTableStyle extends TStyle
*/
private $_gridLines='None';
+ /**
+ * Sets the style attributes to default values.
+ * This method overrides the parent implementation by
+ * resetting additional TTableStyle specific attributes.
+ */
+ public function reset()
+ {
+ $this->_backImageUrl='';
+ $this->_horizontalAlign='NotSet';
+ $this->_cellPadding=-1;
+ $this->_cellSpacing=-1;
+ $this->_gridLines='None';
+ }
+
+ /**
+ * Copies the style content from an existing style
+ * This method overrides the parent implementation by
+ * adding additional TTableStyle specific attributes.
+ * @param TStyle source style
+ */
+ public function copyFrom($style)
+ {
+ parent::copyFrom($style);
+ $this->_backImageUrl=$style->_backImageUrl;
+ $this->_horizontalAlign=$style->_horizontalAlign;
+ $this->_cellPadding=$style->_cellPadding;
+ $this->_cellSpacing=$style->_cellSpacing;
+ $this->_gridLines=$style->_gridLines;
+ }
/**
* Adds attributes related to CSS styles to renderer.
@@ -387,10 +379,10 @@ class TTableStyle extends TStyle
public function addAttributesToRender($writer)
{
if(($url=trim($this->_backImageUrl))!=='')
- $this->setStyleField('background-image','url('.$url.')');
+ $writer->addStyleAttribute('background-image','url('.$url.')');
if($this->_horizontalAlign!=='NotSet')
- $this->setStyleField('text-align',strtolower($this->_horizontalAlign));
+ $writer->addStyleAttribute('text-align',strtolower($this->_horizontalAlign));
if($this->_cellPadding>=0)
$writer->addAttribute('cellpadding',"$this->_cellPadding");
@@ -399,7 +391,7 @@ class TTableStyle extends TStyle
{
$writer->addAttribute('cellspacing',"$this->_cellSpacing");
if($this->_cellSpacing===0)
- $this->setStyleField('border-collapse','collapse');
+ $writer->addStyleAttribute('border-collapse','collapse');
}
switch($this->_gridLines)
@@ -527,6 +519,32 @@ class TTableItemStyle extends TStyle
private $_wrap=true;
/**
+ * Sets the style attributes to default values.
+ * This method overrides the parent implementation by
+ * resetting additional TTableItemStyle specific attributes.
+ */
+ public function reset()
+ {
+ $this->_verticalAlign='NotSet';
+ $this->_horizontalAlign='NotSet';
+ $this->_wrap=true;
+ }
+
+ /**
+ * Copies the style content from an existing style
+ * This method overrides the parent implementation by
+ * adding additional TTableItemStyle specific attributes.
+ * @param TStyle source style
+ */
+ public function copyFrom($style)
+ {
+ parent::copyFrom($style);
+ $this->_verticalAlign=$style->_verticalAlign;
+ $this->_horizontalAlign=$style->_horizontalAlign;
+ $this->_wrap=$style->_wrap;
+ }
+
+ /**
* Adds attributes related to CSS styles to renderer.
* This method overrides the parent implementation.
* @param THtmlWriter the writer used for the rendering purpose
@@ -534,7 +552,7 @@ class TTableItemStyle extends TStyle
public function addAttributesToRender($writer)
{
if(!$this->_wrap)
- $this->setStyleField('nowrap','nowrap');
+ $writer->addStyleAttribute('nowrap','nowrap');
if($this->_horizontalAlign!=='NotSet')
$writer->addAttribute('align',strtolower($this->_horizontalAlign));