[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/UI/WebControls/ -> TBaseDataList.php (source)

   1  <?php
   2  /**
   3   * TBaseDataList class file
   4   *
   5   * @author Qiang Xue <qiang.xue@gmail.com>
   6   * @link http://www.pradosoft.com/
   7   * @copyright Copyright &copy; 2005 PradoSoft
   8   * @license http://www.pradosoft.com/license/
   9   * @version $Id: TBaseDataList.php 1397 2006-09-07 07:55:53Z wei $
  10   * @package System.Web.UI.WebControls
  11   */
  12  
  13  /**
  14   * Includes TDataBoundControl and TDataFieldAccessor classes
  15   */
  16  Prado::using('System.Web.UI.WebControls.TDataBoundControl');
  17  Prado::using('System.Util.TDataFieldAccessor');
  18  
  19  /**
  20   * TBaseDataList class
  21   *
  22   * TBaseDataList is the base class for data listing controls, including
  23   * {@link TDataList} and {@link TDataGrid}.
  24   *
  25   * The key field in the data source is specified by {@link setKeyField KeyField},
  26   * while {@link getKeyValues KeyValues} stores the key values of each record in
  27   * a data listing control. You may use the list item index to obtain the corresponding
  28   * database key value.
  29   *
  30   * TBaseDataList also implements a few properties used for presentation based
  31   * on tabular layout. The {@link setCaption Caption}, whose alignment is
  32   * specified via {@link setCaptionAlign CaptionAlign}, is rendered as the table caption.
  33   * The table cellpadding and cellspacing are specified by
  34   * {@link setCellPadding CellPadding} and {@link setCellSpacing CellSpacing}
  35   * properties, respectively. The {@link setGridLines GridLines} specifies how
  36   * the table should display its borders, and the horizontal alignment of the table
  37   * content can be specified via {@link setHorizontalAlign HorizontalAlign}.
  38   *
  39   * @author Qiang Xue <qiang.xue@gmail.com>
  40   * @version $Id: TBaseDataList.php 1397 2006-09-07 07:55:53Z wei $
  41   * @package System.Web.UI.WebControls
  42   * @since 3.0
  43   */
  44  abstract class TBaseDataList extends TDataBoundControl
  45  {
  46      /**
  47       * Creates a style object for the control.
  48       * This method creates a {@link TTableStyle} to be used by the data list control.
  49       * @return TTableStyle control style to be used
  50       */
  51  	protected function createStyle()
  52      {
  53          return new TTableStyle;
  54      }
  55  
  56      /**
  57       * @return integer the cellspacing for the table layout. Defaults to -1, meaning not set.
  58       */
  59  	public function getCellSpacing()
  60      {
  61          if($this->getHasStyle())
  62              return $this->getStyle()->getCellSpacing();
  63          else
  64              return -1;
  65      }
  66  
  67      /**
  68       * @param integer the cellspacing for the table layout.
  69       */
  70  	public function setCellSpacing($value)
  71      {
  72          $this->getStyle()->setCellSpacing($value);
  73      }
  74  
  75      /**
  76       * @return integer the cellpadding for the table layout. Defaults to -1, meaning not set.
  77       */
  78  	public function getCellPadding()
  79      {
  80          if($this->getHasStyle())
  81              return $this->getStyle()->getCellPadding();
  82          else
  83              return -1;
  84      }
  85  
  86      /**
  87       * @param integer the cellpadding for the table layout
  88       */
  89  	public function setCellPadding($value)
  90      {
  91          $this->getStyle()->setCellPadding($value);
  92      }
  93  
  94      /**
  95       * @return THorizontalAlign the horizontal alignment of the table content. Defaults to THorizontalAlign::NotSet.
  96       */
  97  	public function getHorizontalAlign()
  98      {
  99          if($this->getHasStyle())
 100              return $this->getStyle()->getHorizontalAlign();
 101          else
 102              return THorizontalAlign::NotSet;
 103      }
 104  
 105      /**
 106       * @param THorizontalAlign the horizontal alignment of the table content.
 107       */
 108  	public function setHorizontalAlign($value)
 109      {
 110          $this->getStyle()->setHorizontalAlign($value);
 111      }
 112  
 113      /**
 114       * @return TTableGridLines the grid line setting of the table layout. Defaults to TTableGridLines::None.
 115       */
 116  	public function getGridLines()
 117      {
 118          if($this->getHasStyle())
 119              return $this->getStyle()->getGridLines();
 120          else
 121              return TTableGridLines::None;
 122      }
 123  
 124      /**
 125       * Sets the grid line style of the table layout.
 126       * @param TTableGridLines the grid line setting of the table
 127       */
 128  	public function setGridLines($value)
 129      {
 130          $this->getStyle()->setGridLines($value);
 131      }
 132  
 133  
 134      /**
 135       * @return string the field of the data source that provides the keys of the list items.
 136       */
 137  	public function getDataKeyField()
 138      {
 139          return $this->getViewState('DataKeyField','');
 140      }
 141  
 142      /**
 143       * @param string the field of the data source that provides the keys of the list items.
 144       */
 145  	public function setDataKeyField($value)
 146      {
 147          $this->setViewState('DataKeyField',$value,'');
 148      }
 149  
 150      /**
 151       * @return TList the keys used in the data listing control.
 152       */
 153  	public function getDataKeys()
 154      {
 155          if(($dataKeys=$this->getViewState('DataKeys',null))===null)
 156          {
 157              $dataKeys=new TList;
 158              $this->setViewState('DataKeys',$dataKeys,null);
 159          }
 160          return $dataKeys;
 161      }
 162  
 163      /**
 164       * Returns the value of the data at the specified field.
 165       * If data is an array, TMap or TList, the value will be returned at the index
 166       * of the specified field. If the data is a component with a property named
 167       * as the field name, the property value will be returned.
 168       * Otherwise, an exception will be raised.
 169       * @param mixed data item
 170       * @param mixed field name
 171       * @return mixed data value at the specified field
 172       * @throws TInvalidDataValueException if the data is invalid
 173       */
 174  	protected function getDataFieldValue($data,$field)
 175      {
 176          return TDataFieldAccessor::getDataFieldValue($data,$field);
 177      }
 178  
 179      /**
 180       * Raises OnSelectedIndexChanged event.
 181       * This method is invoked when a different item is selected
 182       * in a data listing control between posts to the server.
 183       * @param mixed event parameter
 184       */
 185  	public function onSelectedIndexChanged($param)
 186      {
 187          $this->raiseEvent('OnSelectedIndexChanged',$this,$param);
 188      }
 189  }
 190  
 191  ?>


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7