summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/THtmlElement.php
blob: 856db4fd337802c2a610669eacda7dd1e2e5559f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
 * THtmlElement class file.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @link http://www.pradosoft.com/
 * @copyright Copyright &copy; 2005-2008 PradoSoft
 * @license http://www.pradosoft.com/license/
 * @version $Id$
 * @package System.Web.UI.WebControls
 */

Prado::using('System.Web.UI.WebControls.TWebControl');

/**
 * THtmlElement class.
 *
 * THtmlElement represents a generic HTML element whose tag name is specified
 * via {@link setTagName TagName} property. Because THtmlElement extends from
 * {@link TWebControl}, it enjoys all its functionalities.
 *
 * To change the default tag your subclass should override {@link getDefaultTag}
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @author Brad Anderson <javalizard@gmail.com>
 * @version $Id$
 * @package System.Web.UI.WebControls
 * @since 3.1.2
 */
class THtmlElement extends TWebControl
{
	/**
	 * @var the tag of this element
	 */
	private $_tagName=null;

	/**
	 * @return string the tag name of this control. Defaults to 'span'.
	 */
	public function getTagName()
	{
		if($this->_tagName !== null) return $this->_tagName;
		
		$this->_tagName = $this->getDefaultTag();
		
		return $this->_tagName;
	}

	/**
	 * @param string the tag name of this control.
	 */
	public function setTagName($value)
	{
		$this->_tagName=TPropertyValue::ensureString($value);
	}
	
	/**
	 *	This is the default tag when no other is specified
	 * @return string the default tag 
	 */
	protected function getDefaultTagName() {
		return 'span';
	}
}