diff -r 000000000000 -r 4eba9c11703f web/Zend/Dojo/Form/Element/NumberTextBox.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/Zend/Dojo/Form/Element/NumberTextBox.php Mon Dec 13 18:29:26 2010 +0100 @@ -0,0 +1,173 @@ +setConstraint('locale', (string) $locale); + return $this; + } + + /** + * Retrieve locale + * + * @return string|null + */ + public function getLocale() + { + return $this->getConstraint('locale'); + } + + /** + * Set numeric format pattern + * + * @param string $pattern + * @return Zend_Dojo_Form_Element_NumberTextBox + */ + public function setPattern($pattern) + { + $this->setConstraint('pattern', (string) $pattern); + return $this; + } + + /** + * Retrieve numeric format pattern + * + * @return string|null + */ + public function getPattern() + { + return $this->getConstraint('pattern'); + } + + /** + * Set numeric format type + * + * @see $_allowedTypes + * @param string $type + * @return Zend_Dojo_Form_Element_NumberTextBox + */ + public function setType($type) + { + $type = strtolower($type); + if (!in_array($type, $this->_allowedTypes)) { + require_once 'Zend/Form/Element/Exception.php'; + throw new Zend_Form_Element_Exception(sprintf('Invalid numeric type "%s" specified', $type)); + } + + $this->setConstraint('type', $type); + return $this; + } + + /** + * Retrieve type + * + * @return string|null + */ + public function getType() + { + return $this->getConstraint('type'); + } + + /** + * Set decimal places + * + * @param int $places + * @return Zend_Dojo_Form_Element_NumberTextBox + */ + public function setPlaces($places) + { + $this->setConstraint('places', (int) $places); + return $this; + } + + /** + * Retrieve decimal places + * + * @return int|null + */ + public function getPlaces() + { + return $this->getConstraint('places'); + } + + /** + * Set strict flag + * + * @param bool $strict + * @return Zend_Dojo_Form_Element_NumberTextBox + */ + public function setStrict($flag) + { + $this->setConstraint('strict', (bool) $flag); + return $this; + } + + /** + * Retrieve strict flag + * + * @return bool + */ + public function getStrict() + { + if (!$this->hasConstraint('strict')) { + return false; + } + return ('true' == $this->getConstraint('strict')); + } +}