| org.zkoss.mil.MilComponent org.zkoss.mil.Item org.zkoss.mil.impl.InputElement org.zkoss.mil.Decimalbox
Decimalbox | public class Decimalbox extends InputElement (Code) | | Decimal input box.
author: henrichen |
Field Summary | |
final public static int | AUTO |
Method Summary | |
protected Object | coerceFromString(String value) | protected String | coerceToString(Object value) | public double | doubleValue() Returns the value in double. | protected int | getInternalType() | public int | getRoundingMode() Returns the rounding mode. | public int | getScale() Returns the scale for the decimal number storing in this component,
or
Decimalbox.AUTO if the scale is decided automatically (based on
what user has entered). | public BigDecimal | getValue() Returns the value (in BigDecimal), might be null unless
a constraint stops it. | public int | intValue() Returns the value in integer. | public long | longValue() Returns the value in long. | 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. | public void | setScale(int scale) Returns the scale for the decimal number storing in this component,
or
Decimalbox.AUTO if the scale is decided automatically (based on
what user has entered). | public void | setValue(BigDecimal value) Sets the value (in BigDecimal). | public short | shortValue() Returns the value in short. | 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. |
AUTO | final public static int AUTO(Code) | | |
Decimalbox | public Decimalbox()(Code) | | |
doubleValue | public double doubleValue() throws WrongValueException(Code) | | Returns the value in double. If null, zero is returned.
|
getInternalType | protected int getInternalType()(Code) | | |
getScale | public int getScale()(Code) | | Returns the scale for the decimal number storing in this component,
or
Decimalbox.AUTO if the scale is decided automatically (based on
what user has entered).
Default:
Decimalbox.AUTO .
|
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 |
setScale | public void setScale(int scale)(Code) | | Returns the scale for the decimal number storing in this component,
or
Decimalbox.AUTO if the scale is decided automatically (based on
what user has entered).
Default:
Decimalbox.AUTO .
|
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. |
|
|