diff options
author | rojaro <> | 2009-10-14 12:27:26 +0000 |
---|---|---|
committer | rojaro <> | 2009-10-14 12:27:26 +0000 |
commit | 0238f964a8412ac426051632c65c9d6f2f78c49b (patch) | |
tree | da239b92222c51c4a47feb9fc91ab6d22becd0a4 | |
parent | cd5a8d15e2923f1c93fd6401ce574ffcc5cff2db (diff) |
added TActiveMultiView
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | framework/Web/UI/ActiveControls/TActiveMultiView.php | 110 |
3 files changed, 113 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index 0ebf45f9..6ccbb89c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2678,6 +2678,7 @@ framework/Web/UI/ActiveControls/TActiveDataGrid.php -text framework/Web/UI/ActiveControls/TActiveDataList.php -text framework/Web/UI/ActiveControls/TActiveHiddenField.php -text framework/Web/UI/ActiveControls/TActiveLabel.php -text +framework/Web/UI/ActiveControls/TActiveMultiView.php -text framework/Web/UI/ActiveControls/TActivePageAdapter.php -text framework/Web/UI/ActiveControls/TActivePager.php -text framework/Web/UI/ActiveControls/TActivePanel.php -text @@ -6,9 +6,11 @@ NEW: Port Yii's Models and Behaviors (Daniel + Robin) NEW: Add TActiveDataList (Marcosanobre, Robin) NEW: Add TActiveRepeater (LCS Team, Christophe) NEW: Add TActiveDatagrid (LCS Team, Christophe) +BUG: Fixed an inconsistency in TRegularExpressionValidator NEW: Add TActiveTableRow (LCS Team) NEW: Add TActiveTableCell (LCS Team) ENH: Issue#173 - Add "dragdropextra" (superghosting) patch, mouse coordinates and key status to drag & drop controls (Christophe, DevWorx) +NEW: Add TActiveMultiView (LCS Team) Version 3.1.6 to be released BUG: Issue#98 - Missing file in quickstart demo (Chrisotphe) diff --git a/framework/Web/UI/ActiveControls/TActiveMultiView.php b/framework/Web/UI/ActiveControls/TActiveMultiView.php new file mode 100644 index 00000000..5040ef94 --- /dev/null +++ b/framework/Web/UI/ActiveControls/TActiveMultiView.php @@ -0,0 +1,110 @@ +<?php +/** + * TActiveMultiView class file + * + * @author LANDWEHR Computer und Software GmbH <programmierung@landwehr-software.de> + * @link http://www.landwehr-software.de/ + * @copyright Copyright © 2009 LANDWEHR Computer und Software GmbH + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.ActiveControls + */ + +/** + * Includes the following used classes + */ +Prado::using('System.Web.UI.WebControls.TMultiView'); + +/** + * TActiveMultiView class. + * + * TActiveMultiView is the active counterpart to the original {@link TMultiView} control. + * It re-renders on Callback when {@link setActiveView ActiveView} or + * {@link setActiveViewIndex ActiveViewIndex} is called. + * + * Please refer to the original documentation of the regular counterpart for usage. + * + * @author LANDWEHR Computer und Software GmbH <programmierung@landwehr-software.de> + * @package System.Web.UI.ActiveControls + * @since 3.1.6 + */ +class TActiveMultiView extends TMultiView implements IActiveControl +{ + /** + * Creates a new callback control, sets the adapter to + * TActiveControlAdapter. + */ + public function __construct() + { + parent::__construct(); + $this->setAdapter(new TActiveControlAdapter($this)); + } + + /** + * @return TBaseActiveControl standard active control options. + */ + public function getActiveControl() + { + return $this->getAdapter()->getBaseActiveControl(); + } + + /** + * Returns the id of the surrounding container (span). + * @return string container id + */ + protected function getContainerID() + { + return $this->ClientID.'_Container'; + } + + /** + * Renders the TActiveMultiView. + * If the MutliView did not pass the prerender phase yet, it will register itself for rendering later. + * Else it will call the {@link renderMultiView()} method which will do the rendering of the MultiView. + * @param THtmlWriter writer for the rendering purpose + */ + public function render($writer) + { + if($this->getHasPreRendered()) { + $this->renderMultiView($writer); + if($this->getActiveControl()->canUpdateClientSide()) + $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); + } + else + $this->getPage()->getAdapter()->registerControlToRender($this,$writer); + } + + /** + * Renders the TActiveMultiView by writing a span tag with the container id obtained from {@link getContainerID()} + * which will be called by the replacement method of the client script to update it's content. + * @param $writer THtmlWriter writer for the rendering purpose + */ + protected function renderMultiView($writer) + { + $writer->addAttribute('id', $this->getContainerID()); + $writer->renderBeginTag('span'); + parent::render($writer); + $writer->renderEndTag(); + } + + /** + * @param integer the zero-based index of the current view in the view collection. -1 if no active view. + * @throws TInvalidDataValueException if the view index is invalid + */ + public function setActiveViewIndex($value) + { + parent::setActiveViewIndex($value); + if($this->getActiveControl()->canUpdateClientSide()) + $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); + } + + /** + * @param TView the view to be activated + * @throws TInvalidOperationException if the view is not in the view collection + */ + public function setActiveView($value) + { + parent::setActiveView($value); + if($this->getActiveControl()->canUpdateClientSide()) + $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); + } +} |