Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * TStyle class file.
4
 *
5
 * @author Qiang Xue <qiang.xue@gmail.com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2005-2008 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
10
 * @package System.Web.UI.WebControls
11
 */
12
 
13
/**
14
 * Includes TFont definition
15
 */
16
Prado::using('System.Web.UI.WebControls.TFont');
17
 
18
/**
19
 * TStyle class
20
 *
21
 * TStyle encapsulates the CSS style applied to a control.
22
 *
23
 * @author Qiang Xue <qiang.xue@gmail.com>
24
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
25
 * @package System.Web.UI.WebControls
26
 * @since 3.0
27
 */
28
class TStyle extends TComponent
29
{
30
	/**
31
	 * @var array storage of CSS fields
32
	 */
33
	private $_fields=array();
34
	/**
35
	 * @var TFont font object
36
	 */
37
	private $_font=null;
38
	/**
39
	 * @var string CSS class name
40
	 */
41
	private $_class=null;
42
	/**
43
	 * @var string CSS style string (those not represented by specific fields of TStyle)
44
	 */
45
	private $_customStyle=null;
46
	/**
47
	 * @var string display style
48
	 */
49
	private $_displayStyle='Fixed';
50
 
51
	/**
52
	 * Constructor.
53
	 * @param TStyle style to copy from
54
	 */
55
	public function __construct($style=null)
56
	{
57
		if($style!==null)
58
			$this->copyFrom($style);
59
	}
60
 
61
	/**
62
	 * Need to clone the font object.
63
	 */
64
	public function __clone()
65
	{
66
		if(!is_null($this->_font))
67
			$this->_font = clone($this->_font);
68
	}
69
 
70
	/**
71
	 * @return string the background color of the control
72
	 */
73
	public function getBackColor()
74
	{
75
		return isset($this->_fields['background-color'])?$this->_fields['background-color']:'';
76
	}
77
 
78
	/**
79
	 * @param string the background color of the control
80
	 */
81
	public function setBackColor($value)
82
	{
83
		if(trim($value)==='')
84
			unset($this->_fields['background-color']);
85
		else
86
			$this->_fields['background-color']=$value;
87
	}
88
 
89
	/**
90
	 * @return string the border color of the control
91
	 */
92
	public function getBorderColor()
93
	{
94
		return isset($this->_fields['border-color'])?$this->_fields['border-color']:'';
95
	}
96
 
97
	/**
98
	 * @param string the border color of the control
99
	 */
100
	public function setBorderColor($value)
101
	{
102
		if(trim($value)==='')
103
			unset($this->_fields['border-color']);
104
		else
105
			$this->_fields['border-color']=$value;
106
	}
107
 
108
	/**
109
	 * @return string the border style of the control
110
	 */
111
	public function getBorderStyle()
112
	{
113
		return isset($this->_fields['border-style'])?$this->_fields['border-style']:'';
114
	}
115
 
116
	/**
117
	 * Sets the border style of the control.
118
	 * @param string the border style of the control
119
	 */
120
	public function setBorderStyle($value)
121
	{
122
		if(trim($value)==='')
123
			unset($this->_fields['border-style']);
124
		else
125
			$this->_fields['border-style']=$value;
126
	}
127
 
128
	/**
129
	 * @return string the border width of the control
130
	 */
131
	public function getBorderWidth()
132
	{
133
		return isset($this->_fields['border-width'])?$this->_fields['border-width']:'';
134
	}
135
 
136
	/**
137
	 * @param string the border width of the control
138
	 */
139
	public function setBorderWidth($value)
140
	{
141
		if(trim($value)==='')
142
			unset($this->_fields['border-width']);
143
		else
144
			$this->_fields['border-width']=$value;
145
	}
146
 
147
	/**
148
	 * @return string the CSS class of the control
149
	 */
150
	public function getCssClass()
151
	{
152
		return $this->_class===null?'':$this->_class;
153
	}
154
 
155
	/**
156
	 * @return boolean true if CSS is set or empty.
157
	 */
158
	public function hasCssClass()
159
	{
160
		return !is_null($this->_class);
161
	}
162
 
163
	/**
164
	 * @param string the name of the CSS class of the control
165
	 */
166
	public function setCssClass($value)
167
	{
168
		$this->_class=$value;
169
	}
170
 
171
	/**
172
	 * @return TFont the font of the control
173
	 */
174
	public function getFont()
175
	{
176
		if($this->_font===null)
177
			$this->_font=new TFont;
178
		return $this->_font;
179
	}
180
 
181
	/**
182
	 * @return boolean true if font is set.
183
	 */
184
	public function hasFont()
185
	{
186
		return $this->_font !== null;
187
	}
188
 
189
	/**
190
	 * @param TDisplayStyle control display style, default is TDisplayStyle::Fixed
191
	 */
192
	public function setDisplayStyle($value)
193
	{
194
		$this->_displayStyle = TPropertyValue::ensureEnum($value, 'TDisplayStyle');
195
		switch($this->_displayStyle)
196
		{
197
			case TDisplayStyle::None:
198
				$this->_fields['display'] = 'none';
199
				break;
200
			case TDisplayStyle::Dynamic:
201
				$this->_fields['display'] = ''; //remove the display property
202
				break;
203
			case TDisplayStyle::Fixed:
204
				$this->_fields['visibility'] = 'visible';
205
				break;
206
			case TDisplayStyle::Hidden:
207
				$this->_fields['visibility'] = 'hidden';
208
				break;
209
		}
210
	}
211
 
212
	/**
213
	 * @return TDisplayStyle display style
214
	 */
215
	public function getDisplayStyle()
216
	{
217
		return $this->_displayStyle;
218
	}
219
 
220
	/**
221
	 * @return string the foreground color of the control
222
	 */
223
	public function getForeColor()
224
	{
225
		return isset($this->_fields['color'])?$this->_fields['color']:'';
226
	}
227
 
228
	/**
229
	 * @param string the foreground color of the control
230
	 */
231
	public function setForeColor($value)
232
	{
233
		if(trim($value)==='')
234
			unset($this->_fields['color']);
235
		else
236
			$this->_fields['color']=$value;
237
	}
238
 
239
	/**
240
	 * @return string the height of the control
241
	 */
242
	public function getHeight()
243
	{
244
		return isset($this->_fields['height'])?$this->_fields['height']:'';
245
	}
246
 
247
	/**
248
	 * @param string the height of the control
249
	 */
250
	public function setHeight($value)
251
	{
252
		if(trim($value)==='')
253
			unset($this->_fields['height']);
254
		else
255
			$this->_fields['height']=$value;
256
	}
257
 
258
	/**
259
	 * @return string the custom style of the control
260
	 */
261
	public function getCustomStyle()
262
	{
263
		return $this->_customStyle===null?'':$this->_customStyle;
264
	}
265
 
266
	/**
267
	 * Sets custom style fields from a string.
268
	 * Custom style fields will be overwritten by style fields explicitly defined.
269
	 * @param string the custom style of the control
270
	 */
271
	public function setCustomStyle($value)
272
	{
273
		$this->_customStyle=$value;
274
	}
275
 
276
	/**
277
	 * @return string a single style field value set via {@link setStyleField}. Defaults to empty string.
278
	 */
279
	public function getStyleField($name)
280
	{
281
		return isset($this->_fields[$name])?$this->_fields[$name]:'';
282
	}
283
 
284
	/**
285
	 * Sets a single style field value.
286
	 * Style fields set by this method will overwrite those set by {@link setCustomStyle}.
287
	 * @param string style field name
288
	 * @param string style field value
289
	 */
290
	public function setStyleField($name,$value)
291
	{
292
		$this->_fields[$name]=$value;
293
	}
294
 
295
	/**
296
	 * Clears a single style field value;
297
	 * @param string style field name
298
	 */
299
	public function clearStyleField($name)
300
	{
301
		unset($this->_fields[$name]);
302
	}
303
 
304
	/**
305
	 * @return boolean whether a style field has been defined by {@link setStyleField}
306
	 */
307
	public function hasStyleField($name)
308
	{
309
		return isset($this->_fields[$name]);
310
	}
311
 
312
	/**
313
	 * @return string the width of the control
314
	 */
315
	public function getWidth()
316
	{
317
		return isset($this->_fields['width'])?$this->_fields['width']:'';
318
	}
319
 
320
	/**
321
	 * @param string the width of the control
322
	 */
323
	public function setWidth($value)
324
	{
325
		$this->_fields['width']=$value;
326
	}
327
 
328
	/**
329
	 * Resets the style to the original empty state.
330
	 */
331
	public function reset()
332
	{
333
		$this->_fields=array();
334
		$this->_font=null;
335
		$this->_class=null;
336
		$this->_customStyle=null;
337
	}
338
 
339
	/**
340
	 * Copies the fields in a new style to this style.
341
	 * If a style field is set in the new style, the corresponding field
342
	 * in this style will be overwritten.
343
	 * @param TStyle the new style
344
	 */
345
	public function copyFrom($style)
346
	{
347
		if($style instanceof TStyle)
348
		{
349
			$this->_fields=array_merge($this->_fields,$style->_fields);
350
			if($style->_class!==null)
351
				$this->_class=$style->_class;
352
			if($style->_customStyle!==null)
353
				$this->_customStyle=$style->_customStyle;
354
			if($style->_font!==null)
355
				$this->getFont()->copyFrom($style->_font);
356
		}
357
	}
358
 
359
	/**
360
	 * Merges the style with a new one.
361
	 * If a style field is not set in this style, it will be overwritten by
362
	 * the new one.
363
	 * @param TStyle the new style
364
	 */
365
	public function mergeWith($style)
366
	{
367
		if($style instanceof TStyle)
368
		{
369
			$this->_fields=array_merge($style->_fields,$this->_fields);
370
			if($this->_class===null)
371
				$this->_class=$style->_class;
372
			if($this->_customStyle===null)
373
				$this->_customStyle=$style->_customStyle;
374
			if($style->_font!==null)
375
				$this->getFont()->mergeWith($style->_font);
376
		}
377
	}
378
 
379
	/**
380
	 * Adds attributes related to CSS styles to renderer.
381
	 * @param THtmlWriter the writer used for the rendering purpose
382
	 */
383
	public function addAttributesToRender($writer)
384
	{
385
		if($this->_customStyle!==null)
386
		{
387
			foreach(explode(';',$this->_customStyle) as $style)
388
			{
389
				$arr=explode(':',$style);
390
				if(isset($arr[1]) && trim($arr[0])!=='')
391
					$writer->addStyleAttribute(trim($arr[0]),trim($arr[1]));
392
			}
393
		}
394
		$writer->addStyleAttributes($this->_fields);
395
		if($this->_font!==null)
396
			$this->_font->addAttributesToRender($writer);
397
		if($this->_class!==null)
398
			$writer->addAttribute('class',$this->_class);
399
	}
400
 
401
	/**
402
	 * @return array list of style fields.
403
	 */
404
	public function getStyleFields()
405
	{
406
		return $this->_fields;
407
	}
408
}
409
 
410
/**
411
 * TDisplayStyle defines the enumerable type for the possible styles
412
 * that a web control can display.
413
 *
414
 * The following enumerable values are defined:
415
 * - None: the control is not displayed and not included in the layout.
416
 * - Dynamic: the control is displayed and included in the layout, the layout flow is dependent on the control (equivalent to display:'' in css).
417
 * - Fixed: Similar to Dynamic with CSS "visibility" set "shown".
418
 * - Hidden: the control is not displayed and is included in the layout.
419
 *
420
 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
421
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
422
 * @package System.Web.UI.WebControls
423
 * @since 3.1
424
 */
425
class TDisplayStyle extends TEnumerable
426
{
427
	const None='None';
428
	const Dynamic='Dynamic';
429
	const Fixed='Fixed';
430
	const Hidden='Hidden';
431
}
432
 
433
/**
434
 * TTableStyle class.
435
 * TTableStyle represents the CSS style specific for HTML table.
436
 *
437
 * @author Qiang Xue <qiang.xue@gmail.com>
438
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
439
 * @package System.Web.UI.WebControls
440
 * @since 3.0
441
 */
442
class TTableStyle extends TStyle
443
{
444
	/**
445
	 * @var TVerticalAlign the URL of the background image for the table
446
	 */
447
	private $_backImageUrl=null;
448
	/**
449
	 * @var THorizontalAlign horizontal alignment of the contents within the table
450
	 */
451
	private $_horizontalAlign=null;
452
	/**
453
	 * @var integer cellpadding of the table
454
	 */
455
	private $_cellPadding=null;
456
	/**
457
	 * @var integer cellspacing of the table
458
	 */
459
	private $_cellSpacing=null;
460
	/**
461
	 * @var TTableGridLines grid line setting of the table
462
	 */
463
	private $_gridLines=null;
464
	/**
465
	 * @var boolean whether the table border should be collapsed
466
	 */
467
	private $_borderCollapse=null;
468
 
469
	/**
470
	 * Sets the style attributes to default values.
471
	 * This method overrides the parent implementation by
472
	 * resetting additional TTableStyle specific attributes.
473
	 */
474
	public function reset()
475
	{
476
		$this->_backImageUrl=null;
477
		$this->_horizontalAlign=null;
478
		$this->_cellPadding=null;
479
		$this->_cellSpacing=null;
480
		$this->_gridLines=null;
481
		$this->_borderCollapse=null;
482
	}
483
 
484
	/**
485
	 * Copies the fields in a new style to this style.
486
	 * If a style field is set in the new style, the corresponding field
487
	 * in this style will be overwritten.
488
	 * @param TStyle the new style
489
	 */
490
	public function copyFrom($style)
491
	{
492
		parent::copyFrom($style);
493
		if($style instanceof TTableStyle)
494
		{
495
			if($style->_backImageUrl!==null)
496
				$this->_backImageUrl=$style->_backImageUrl;
497
			if($style->_horizontalAlign!==null)
498
				$this->_horizontalAlign=$style->_horizontalAlign;
499
			if($style->_cellPadding!==null)
500
				$this->_cellPadding=$style->_cellPadding;
501
			if($style->_cellSpacing!==null)
502
				$this->_cellSpacing=$style->_cellSpacing;
503
			if($style->_gridLines!==null)
504
				$this->_gridLines=$style->_gridLines;
505
			if($style->_borderCollapse!==null)
506
				$this->_borderCollapse=$style->_borderCollapse;
507
		}
508
	}
509
 
510
	/**
511
	 * Merges the style with a new one.
512
	 * If a style field is not set in this style, it will be overwritten by
513
	 * the new one.
514
	 * @param TStyle the new style
515
	 */
516
	public function mergeWith($style)
517
	{
518
		parent::mergeWith($style);
519
		if($style instanceof TTableStyle)
520
		{
521
			if($this->_backImageUrl===null && $style->_backImageUrl!==null)
522
				$this->_backImageUrl=$style->_backImageUrl;
523
			if($this->_horizontalAlign===null && $style->_horizontalAlign!==null)
524
				$this->_horizontalAlign=$style->_horizontalAlign;
525
			if($this->_cellPadding===null && $style->_cellPadding!==null)
526
				$this->_cellPadding=$style->_cellPadding;
527
			if($this->_cellSpacing===null && $style->_cellSpacing!==null)
528
				$this->_cellSpacing=$style->_cellSpacing;
529
			if($this->_gridLines===null && $style->_gridLines!==null)
530
				$this->_gridLines=$style->_gridLines;
531
			if($this->_borderCollapse===null && $style->_borderCollapse!==null)
532
				$this->_borderCollapse=$style->_borderCollapse;
533
		}
534
	}
535
 
536
 
537
	/**
538
	 * Adds attributes related to CSS styles to renderer.
539
	 * This method overrides the parent implementation.
540
	 * @param THtmlWriter the writer used for the rendering purpose
541
	 */
542
	public function addAttributesToRender($writer)
543
	{
544
		if(($url=trim($this->getBackImageUrl()))!=='')
545
			$writer->addStyleAttribute('background-image','url('.$url.')');
546
 
547
		if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
548
			$writer->addStyleAttribute('text-align',strtolower($horizontalAlign));
549
 
550
		if(($cellPadding=$this->getCellPadding())>=0)
551
			$writer->addAttribute('cellpadding',"$cellPadding");
552
 
553
		if(($cellSpacing=$this->getCellSpacing())>=0)
554
			$writer->addAttribute('cellspacing',"$cellSpacing");
555
 
556
		if($this->getBorderCollapse())
557
			$writer->addStyleAttribute('border-collapse','collapse');
558
 
559
		switch($this->getGridLines())
560
		{
561
			case TTableGridLines::Horizontal : $writer->addAttribute('rules','rows'); break;
562
			case TTableGridLines::Vertical : $writer->addAttribute('rules','cols'); break;
563
			case TTableGridLines::Both : $writer->addAttribute('rules','all'); break;
564
		}
565
 
566
		parent::addAttributesToRender($writer);
567
	}
568
 
569
	/**
570
	 * @return string the URL of the background image for the table
571
	 */
572
	public function getBackImageUrl()
573
	{
574
		return $this->_backImageUrl===null?'':$this->_backImageUrl;
575
	}
576
 
577
	/**
578
	 * Sets the URL of the background image for the table
579
	 * @param string the URL
580
	 */
581
	public function setBackImageUrl($value)
582
	{
583
		$this->_backImageUrl=$value;
584
	}
585
 
586
	/**
587
	 * @return THorizontalAlign the horizontal alignment of the contents within the table, defaults to THorizontalAlign::NotSet.
588
	 */
589
	public function getHorizontalAlign()
590
	{
591
		return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
592
	}
593
 
594
	/**
595
	 * Sets the horizontal alignment of the contents within the table.
596
	 * @param THorizontalAlign the horizontal alignment
597
	 */
598
	public function setHorizontalAlign($value)
599
	{
600
		$this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
601
	}
602
 
603
	/**
604
	 * @return integer cellpadding of the table. Defaults to -1, meaning not set.
605
	 */
606
	public function getCellPadding()
607
	{
608
		return $this->_cellPadding===null?-1:$this->_cellPadding;
609
	}
610
 
611
	/**
612
	 * @param integer cellpadding of the table. A value equal to -1 clears up the setting.
613
	 * @throws TInvalidDataValueException if the value is less than -1.
614
	 */
615
	public function setCellPadding($value)
616
	{
617
		if(($this->_cellPadding=TPropertyValue::ensureInteger($value))<-1)
618
			throw new TInvalidDataValueException('tablestyle_cellpadding_invalid');
619
	}
620
 
621
	/**
622
	 * @return integer cellspacing of the table. Defaults to -1, meaning not set.
623
	 */
624
	public function getCellSpacing()
625
	{
626
		return $this->_cellSpacing===null?-1:$this->_cellSpacing;
627
	}
628
 
629
	/**
630
	 * @param integer cellspacing of the table. A value equal to -1 clears up the setting.
631
	 * @throws TInvalidDataValueException if the value is less than -1.
632
	 */
633
	public function setCellSpacing($value)
634
	{
635
		if(($this->_cellSpacing=TPropertyValue::ensureInteger($value))<-1)
636
			throw new TInvalidDataValueException('tablestyle_cellspacing_invalid');
637
	}
638
 
639
	/**
640
	 * @return TTableGridLines the grid line setting of the table. Defaults to TTableGridLines::None.
641
	 */
642
	public function getGridLines()
643
	{
644
		return $this->_gridLines===null?TTableGridLines::None:$this->_gridLines;
645
	}
646
 
647
	/**
648
	 * Sets the grid line style of the table.
649
	 * @param TTableGridLines the grid line setting of the table
650
	 */
651
	public function setGridLines($value)
652
	{
653
		$this->_gridLines=TPropertyValue::ensureEnum($value,'TTableGridLines');
654
	}
655
 
656
 
657
	/**
658
	 * @return boolean whether the table borders should be collapsed. Defaults to false.
659
	 */
660
	public function getBorderCollapse()
661
	{
662
		return $this->_borderCollapse===null?false:$this->_borderCollapse;
663
	}
664
 
665
	/**
666
	 * @param boolean whether the table borders should be collapsed.
667
	 */
668
	public function setBorderCollapse($value)
669
	{
670
		$this->_borderCollapse=TPropertyValue::ensureBoolean($value);
671
	}
672
}
673
 
674
/**
675
 * TTableItemStyle class.
676
 * TTableItemStyle represents the CSS style specific for HTML table item.
677
 *
678
 * @author Qiang Xue <qiang.xue@gmail.com>
679
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
680
 * @package System.Web.UI.WebControls
681
 * @since 3.0
682
 */
683
class TTableItemStyle extends TStyle
684
{
685
	/**
686
	 * @var THorizontalAlign horizontal alignment of the contents within the table item
687
	 */
688
	private $_horizontalAlign=null;
689
	/**
690
	 * @var TVerticalAlign vertical alignment of the contents within the table item
691
	 */
692
	private $_verticalAlign=null;
693
	/**
694
	 * @var boolean whether the content wraps within the table item
695
	 */
696
	private $_wrap=null;
697
 
698
	/**
699
	 * Sets the style attributes to default values.
700
	 * This method overrides the parent implementation by
701
	 * resetting additional TTableItemStyle specific attributes.
702
	 */
703
	public function reset()
704
	{
705
		parent::reset();
706
		$this->_verticalAlign=null;
707
		$this->_horizontalAlign=null;
708
		$this->_wrap=null;
709
	}
710
 
711
	/**
712
	 * Copies the fields in a new style to this style.
713
	 * If a style field is set in the new style, the corresponding field
714
	 * in this style will be overwritten.
715
	 * @param TStyle the new style
716
	 */
717
	public function copyFrom($style)
718
	{
719
		parent::copyFrom($style);
720
		if($style instanceof TTableItemStyle)
721
		{
722
			if($this->_verticalAlign===null && $style->_verticalAlign!==null)
723
				$this->_verticalAlign=$style->_verticalAlign;
724
			if($this->_horizontalAlign===null && $style->_horizontalAlign!==null)
725
				$this->_horizontalAlign=$style->_horizontalAlign;
726
			if($this->_wrap===null && $style->_wrap!==null)
727
				$this->_wrap=$style->_wrap;
728
		}
729
	}
730
 
731
	/**
732
	 * Merges the style with a new one.
733
	 * If a style field is not set in this style, it will be overwritten by
734
	 * the new one.
735
	 * @param TStyle the new style
736
	 */
737
	public function mergeWith($style)
738
	{
739
		parent::mergeWith($style);
740
		if($style instanceof TTableItemStyle)
741
		{
742
			if($style->_verticalAlign!==null)
743
				$this->_verticalAlign=$style->_verticalAlign;
744
			if($style->_horizontalAlign!==null)
745
				$this->_horizontalAlign=$style->_horizontalAlign;
746
			if($style->_wrap!==null)
747
				$this->_wrap=$style->_wrap;
748
		}
749
	}
750
 
751
	/**
752
	 * Adds attributes related to CSS styles to renderer.
753
	 * This method overrides the parent implementation.
754
	 * @param THtmlWriter the writer used for the rendering purpose
755
	 */
756
	public function addAttributesToRender($writer)
757
	{
758
		if(!$this->getWrap())
759
			$writer->addStyleAttribute('white-space','nowrap');
760
 
761
		if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
762
			$writer->addAttribute('align',strtolower($horizontalAlign));
763
 
764
		if(($verticalAlign=$this->getVerticalAlign())!==TVerticalAlign::NotSet)
765
			$writer->addAttribute('valign',strtolower($verticalAlign));
766
 
767
		parent::addAttributesToRender($writer);
768
	}
769
 
770
	/**
771
	 * @return THorizontalAlign the horizontal alignment of the contents within the table item, defaults to THorizontalAlign::NotSet.
772
	 */
773
	public function getHorizontalAlign()
774
	{
775
		return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
776
	}
777
 
778
	/**
779
	 * Sets the horizontal alignment of the contents within the table item.
780
	 * @param THorizontalAlign the horizontal alignment
781
	 */
782
	public function setHorizontalAlign($value)
783
	{
784
		$this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
785
	}
786
 
787
	/**
788
	 * @return TVerticalAlign the vertical alignment of the contents within the table item, defaults to TVerticalAlign::NotSet.
789
	 */
790
	public function getVerticalAlign()
791
	{
792
		return $this->_verticalAlign===null?TVerticalAlign::NotSet:$this->_verticalAlign;
793
	}
794
 
795
	/**
796
	 * Sets the vertical alignment of the contents within the table item.
797
	 * @param TVerticalAlign the horizontal alignment
798
	 */
799
	public function setVerticalAlign($value)
800
	{
801
		$this->_verticalAlign=TPropertyValue::ensureEnum($value,'TVerticalAlign');
802
	}
803
 
804
	/**
805
	 * @return boolean whether the content wraps within the table item. Defaults to true.
806
	 */
807
	public function getWrap()
808
	{
809
		return $this->_wrap===null?true:$this->_wrap;
810
	}
811
 
812
	/**
813
	 * Sets the value indicating whether the content wraps within the table item.
814
	 * @param boolean whether the content wraps within the panel.
815
	 */
816
	public function setWrap($value)
817
	{
818
		$this->_wrap=TPropertyValue::ensureBoolean($value);
819
	}
820
}
821
 
822
/**
823
 * THorizontalAlign class.
824
 * THorizontalAlign defines the enumerable type for the possible horizontal alignments in a CSS style.
825
 *
826
 * The following enumerable values are defined:
827
 * - NotSet: the alignment is not specified.
828
 * - Left: left aligned
829
 * - Right: right aligned
830
 * - Center: center aligned
831
 * - Justify: the begin and end are justified
832
 *
833
 * @author Qiang Xue <qiang.xue@gmail.com>
834
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
835
 * @package System.Web.UI.WebControls
836
 * @since 3.0.4
837
 */
838
class THorizontalAlign extends TEnumerable
839
{
840
	const NotSet='NotSet';
841
	const Left='Left';
842
	const Right='Right';
843
	const Center='Center';
844
	const Justify='Justify';
845
}
846
 
847
/**
848
 * TVerticalAlign class.
849
 * TVerticalAlign defines the enumerable type for the possible vertical alignments in a CSS style.
850
 *
851
 * The following enumerable values are defined:
852
 * - NotSet: the alignment is not specified.
853
 * - Top: top aligned
854
 * - Bottom: bottom aligned
855
 * - Middle: middle aligned
856
 *
857
 * @author Qiang Xue <qiang.xue@gmail.com>
858
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
859
 * @package System.Web.UI.WebControls
860
 * @since 3.0.4
861
 */
862
class TVerticalAlign extends TEnumerable
863
{
864
	const NotSet='NotSet';
865
	const Top='Top';
866
	const Bottom='Bottom';
867
	const Middle='Middle';
868
}
869
 
870
 
871
/**
872
 * TTableGridLines class.
873
 * TTableGridLines defines the enumerable type for the possible grid line types of an HTML table.
874
 *
875
 * The following enumerable values are defined:
876
 * - None: no grid lines
877
 * - Horizontal: horizontal grid lines only
878
 * - Vertical: vertical grid lines only
879
 * - Both: both horizontal and vertical grid lines are shown
880
 *
881
 * @author Qiang Xue <qiang.xue@gmail.com>
882
 * @version $Id: TStyle.php 2541 2008-10-21 15:05:13Z qiang.xue $
883
 * @package System.Web.UI.WebControls
884
 * @since 3.0.4
885
 */
886
class TTableGridLines extends TEnumerable
887
{
888
	const None='None';
889
	const Horizontal='Horizontal';
890
	const Vertical='Vertical';
891
	const Both='Both';
892
}
893