FML Update

This commit is contained in:
Steffen Schröder
2014-06-21 03:18:21 +02:00
parent 816ff486ef
commit c8d599189c
107 changed files with 2484 additions and 3099 deletions

View File

@ -20,49 +20,29 @@ use FML\Types\TextFormatable;
*/
class Label extends Control implements Actionable, Linkable, NewLineable, Scriptable, Styleable, TextFormatable {
/*
* Protected Properties
* Protected properties
*/
protected $text = '';
protected $textId = '';
protected $textPrefix = '';
protected $textEmboss = 0;
protected $translate = 0;
protected $tagName = 'label';
protected $text = null;
protected $textId = null;
protected $textPrefix = null;
protected $textEmboss = null;
protected $translate = null;
protected $maxLines = -1;
protected $action = '';
protected $opacity = 1.;
protected $action = null;
protected $actionKey = -1;
protected $url = '';
protected $urlId = '';
protected $manialink = '';
protected $manialinkId = '';
protected $autoNewLine = 0;
protected $scriptEvents = 0;
protected $style = '';
protected $url = null;
protected $urlId = null;
protected $manialink = null;
protected $manialinkId = null;
protected $autoNewLine = null;
protected $scriptEvents = null;
protected $style = null;
protected $textSize = -1;
protected $textColor = '';
protected $focusAreaColor1 = '';
protected $focusAreaColor2 = '';
/**
* Construct a new Label Control
*
* @param string $id (optional) Control Id
*/
public function __construct($id = null) {
parent::__construct($id);
$this->tagName = 'label';
$this->setZ(1);
}
/**
* Create a new Label Control
*
* @param string $id (optional) Control Id
* @return \FML\Controls\Label
*/
public static function create($id = null) {
$label = new Label($id);
return $label;
}
protected $textColor = null;
protected $focusAreaColor1 = null;
protected $focusAreaColor2 = null;
/**
* @see \FML\Controls\Control::getManiaScriptClass()
@ -72,10 +52,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* Set Text
* Set text
*
* @param string $text Text Value
* @return \FML\Controls\Label
* @param string $text Text value
* @return \FML\Controls\Label|static
*/
public function setText($text) {
$this->text = (string)$text;
@ -83,10 +63,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* Set Text Id to use from the Dico
* Set text id to use from Dico
*
* @param string $textId Text Id
* @return \FML\Controls\Label
* @param string $textId Text id
* @return \FML\Controls\Label|static
*/
public function setTextId($textId) {
$this->textId = (string)$textId;
@ -94,10 +74,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* Set Text Prefix
* Set text prefix
*
* @param string $textPrefix Text Prefix
* @return \FML\Controls\Label
* @param string $textPrefix Text prefix
* @return \FML\Controls\Label|static
*/
public function setTextPrefix($textPrefix) {
$this->textPrefix = (string)$textPrefix;
@ -105,10 +85,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* Set Text Emboss
* Set text emboss
*
* @param bool $textEmboss Whether Text should be embossed
* @return \FML\Controls\Label
* @param bool $textEmboss Whether the text should be embossed
* @return \FML\Controls\Label|static
*/
public function setTextEmboss($textEmboss) {
$this->textEmboss = ($textEmboss ? 1 : 0);
@ -116,10 +96,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* Set Translate
* Set translate
*
* @param bool $translate Whether Text should be translated
* @return \FML\Controls\Label
* @param bool $translate Whether the text should be translated
* @return \FML\Controls\Label|static
*/
public function setTranslate($translate) {
$this->translate = ($translate ? 1 : 0);
@ -127,10 +107,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* Set Max Lines Count
* Set max lines count
*
* @param int $maxLines Max Lines Count
* @return \FML\Controls\Label
* @param int $maxLines Max lines count
* @return \FML\Controls\Label|static
*/
public function setMaxLines($maxLines) {
$this->maxLines = (int)$maxLines;
@ -249,11 +229,11 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* Add a dynamic Feature showing the current Time
* Add a dynamic Feature showing the current time
*
* @param bool $showSeconds (optional) Whether the Seconds should be shown
* @param bool $showFullDate (optional) Whether the Date should be shown
* @return \FML\Controls\Label
* @param bool $showSeconds (optional) Whether the seconds should be shown
* @param bool $showFullDate (optional) Whether the date should be shown
* @return \FML\Controls\Label|static
*/
public function addClockFeature($showSeconds = true, $showFullDate = false) {
$clock = new Clock($this, $showSeconds, $showFullDate);
@ -262,7 +242,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
}
/**
* @see \FML\Control::render()
* @see \FML\Types\Renderable::render()
*/
public function render(\DOMDocument $domDocument) {
$xmlElement = parent::render($domDocument);
@ -284,6 +264,9 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
if ($this->maxLines >= 0) {
$xmlElement->setAttribute('maxlines', $this->maxLines);
}
if ($this->opacity != 1.) {
$xmlElement->setAttribute('opacity', $this->opacity);
}
if (strlen($this->action) > 0) {
$xmlElement->setAttribute('action', $this->action);
}