summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-03-05 04:18:04 +0000
committerxue <>2006-03-05 04:18:04 +0000
commit9bca357865376660fb53c2f4df72ca409345e777 (patch)
tree2fe67522d3ea5570b58a093fb11f38b8e6e6a31e
parent8c0cc31021515bdc29a6c6ebc44e903acdb0430f (diff)
TMultiView and TView are completed.
-rw-r--r--framework/Exceptions/messages.txt11
-rw-r--r--framework/Web/UI/WebControls/TMultiView.php16
2 files changed, 19 insertions, 8 deletions
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt
index 8ca618bd..81664b3e 100644
--- a/framework/Exceptions/messages.txt
+++ b/framework/Exceptions/messages.txt
@@ -248,4 +248,13 @@ datalistitemcollection_datalistitem_required = TDataListItemCollection can only
tablerowcollection_tablerow_required = TTableRowCollection can only accept TTableRow objects.
-tablecellcollection_tablerow_required = TTableCellCollection can only accept TTableCell objects. \ No newline at end of file
+tablecellcollection_tablerow_required = TTableCellCollection can only accept TTableCell objects.
+
+multiview_view_required = TMultiView can only accept TView as child.
+multiview_activeviewindex_invalid = TMultiView.ActiveViewIndex has an invalid index '{0}'.
+multiview_view_inexistent = TMultiView cannot find the specified view.
+multiview_viewid_invalid = TMultiView cannot find the view '{0}' to switch to.
+
+viewcollection_view_required = TViewCollection can only accept TView as its element.
+
+view_visible_readonly = TView.Visible is read-only. Use TView.Active to toggle its visibility. \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TMultiView.php b/framework/Web/UI/WebControls/TMultiView.php
index 4208c6d0..fc4385c6 100644
--- a/framework/Web/UI/WebControls/TMultiView.php
+++ b/framework/Web/UI/WebControls/TMultiView.php
@@ -24,7 +24,7 @@
* contained in current active view. A command event with name 'NextView'
* will cause TMultiView to make the next available view active.
* Other command names recognized by TMultiView include
- * - PrevView : switch to previous view
+ * - PreviousView : switch to previous view
* - SwitchViewID : switch to a view by its ID path
* - SwitchViewIndex : switch to a view by its index in the {@link getViews Views} collection.
*
@@ -36,9 +36,10 @@
class TMultiView extends TControl
{
const CMD_NEXTVIEW='NextView';
- const CMD_PREVIOUSVIEW='PrevView';
+ const CMD_PREVIOUSVIEW='PreviousView';
const CMD_SWITCHVIEWID='SwitchViewID';
const CMD_SWITCHVIEWINDEX='SwitchViewIndex';
+ private $_cachedActiveViewIndex=-1;
/**
* Processes an object that is created during parsing template.
@@ -86,7 +87,7 @@ class TMultiView extends TControl
$index=-1;
$views=$this->getViews();
$count=$views->getCount();
- if($view->getCount()===0 && $this->getControlStage()<TControl::CS_CHILD_INITIALIZED)
+ if($count===0 && $this->getControlStage()<TControl::CS_CHILD_INITIALIZED)
$this->_cachedActiveViewIndex=$index;
else if($index<$count)
{
@@ -293,7 +294,7 @@ class TView extends TControl
*/
public function onActivate($param)
{
- $this->raiseEvent('Activate',$this,$param);
+ $this->raiseEvent('OnActivate',$this,$param);
}
/**
@@ -319,20 +320,21 @@ class TView extends TControl
public function setActive($value)
{
$value=TPropertyValue::ensureBoolean($value);
- $this->_active=$value
+ $this->_active=$value;
parent::setVisible($value);
}
/**
+ * @param boolean whether the parents should also be checked if visible
* @return boolean whether this view is visible.
* The view is visible if it is active and its parent is visible.
*/
- public function getVisible()
+ public function getVisible($checkParents=true)
{
if(($parent=$this->getParent())===null)
return $this->getActive();
else if($this->getActive())
- return $parent->getVisible();
+ return $parent->getVisible($checkParents);
else
return false;
}