| org.zkoss.zul.impl.XulElement org.zkoss.zul.impl.InputElement org.zkoss.zul.impl.FormatInputElement org.zkoss.zul.impl.NumberInputElement
All known Subclasses: org.zkoss.zul.Decimalbox, org.zkoss.zul.Intbox, org.zkoss.zul.Longbox, org.zkoss.zul.Doublebox,
NumberInputElement | abstract public class NumberInputElement extends FormatInputElement (Code) | | A skeletal implementation for number-type input box.
author: tomyeh |
Method Summary | |
protected String | formatNumber(Object value, String defaultFormat) Formats a number (Integer, BigDecimal...) into a string. | public int | getRoundingMode() Returns the rounding mode. | public void | setRoundingMode(int mode) Sets the rounding mode.
Note: You cannot change the rounding mode unless you are
using Java 6 or later.
Parameters: mode - the rounding mode. | public void | setRoundingMode(String name) Sets the rounding mode by the name.
Note: You cannot change the rounding mode unless you are
using Java 6 or later.
Parameters: name - the rounding mode's name. | protected Object[] | toNumberOnly(String val) Filters out non digit characters, such comma and whitespace,
from the specified value.
It is designed to let user enter data in more free style.
They may or may not enter data in the specified format.
a two element array. |
setRoundingMode | public void setRoundingMode(String name)(Code) | | Sets the rounding mode by the name.
Note: You cannot change the rounding mode unless you are
using Java 6 or later.
Parameters: name - the rounding mode's name. Allowed value:- CEILING
- Rounding mode to round towards positive infinity.
- DOWN
- Rounding mode to round towards zero.
- FLOOR
- Rounding mode to round towards negative infinity.
- HALF_DOWN
- Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.
- HALF_EVEN
- Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.
- HALF_UP
- Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.
- UNNECESSARY
- Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
- UP
- Rounding mode to round away from zero.
exception: UnsupportedOperationException - if Java 5 or below See Also: RoundingModes |
toNumberOnly | protected Object[] toNumberOnly(String val)(Code) | | Filters out non digit characters, such comma and whitespace,
from the specified value.
It is designed to let user enter data in more free style.
They may or may not enter data in the specified format.
a two element array. The first element is the string toparse with, say, Double.parseDouble. The second element isan integer to indicate how many digits the result shall be scaled.For example, if the second element is 2. Then, the result shall bedivided with 10 ^ 2. See Also: NumberInputElement.formatNumber |
|
|