public abstract class NumberInputElement extends FormatInputElement
_value
AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED
Constructor and Description |
---|
NumberInputElement() |
Modifier and Type | Method and Description |
---|---|
protected String |
formatNumber(Object value,
String defaultFormat)
Formats a number (Integer, BigDecimal...) into a string.
|
protected String |
getDefaultFormat()
Return a default format for the number input element when the locale is specified.
|
protected Locale |
getDefaultLocale()
Returns the default locale, either
getLocale() or
Locales.getCurrent() (never null). |
Locale |
getLocale()
Returns the locale associated with this number input element,
or null if
Locales.getCurrent() is preferred. |
org.zkoss.zk.ui.sys.PropertyAccess |
getPropertyAccess(String prop) |
int |
getRoundingMode()
Returns the rounding mode.
|
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
setLocale(Locale locale)
Sets the locale used to identify the symbols of this number input element.
|
void |
setLocale(String locale)
Sets the locale used to identify the symbols of this number input element.
|
void |
setRoundingMode(int mode)
Sets the rounding mode.
|
void |
setRoundingMode(String name)
Sets the rounding mode by the name.
|
protected Object[] |
toNumberOnly(String val)
Filters out non digit characters, such comma and whitespace,
from the specified value.
|
getFormat, getRealFormat, setFormat
checkUserError, clearErrorMessage, clearErrorMessage, clone, coerceFromString, coerceToString, getCols, getConstraint, getErrorboxIconSclass, getErrorboxSclass, getErrorMessage, getInstant, getMaxlength, getName, getPlaceholder, getRawText, getRawValue, getTargetValue, getText, getType, isChildable, isDisabled, isInplace, isInstant, isMultiline, isReadonly, isValid, marshall, onWrongValue, select, service, setCols, setConstraint, setConstraint, setDisabled, setErrorboxIconSclass, setErrorboxSclass, setErrorMessage, setInplace, setInstant, setMaxlength, setName, setPlaceholder, setRawValue, setReadonly, setSelectedText, setSelectionRange, setText, setValueDirectly, showCustomError, unmarshall, validate
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
public void setRoundingMode(int mode)
mode
- the rounding mode. Allowed value:
BigDecimal.ROUND_CEILING
, BigDecimal.ROUND_DOWN
,
BigDecimal.ROUND_FLOOR
, BigDecimal.ROUND_HALF_DOWN
,
BigDecimal.ROUND_HALF_UP
, BigDecimal.ROUND_HALF_EVEN
,
BigDecimal.ROUND_UNNECESSARY
and BigDecimal.ROUND_UP
UnsupportedOperationException
- if Java 5 or belowpublic void setRoundingMode(String name)
name
- the rounding mode's name. Allowed value:
UnsupportedOperationException
- if Java 5 or belowRoundingModes
public int getRoundingMode()
Default: BigDecimal.ROUND_HALF_EVEN
.
public Locale getLocale()
Locales.getCurrent()
is preferred.public void setLocale(Locale locale)
Default: null (i.e., Locales.getCurrent()
, the current locale
is assumed)
If the format of FormatInputElement.getFormat()
is null, the format is assumed from
getDefaultFormat()
. (since 5.0.9)
public void setLocale(String locale)
Default: null (i.e., Locales.getCurrent()
, the current locale
is assumed)
protected Locale getDefaultLocale()
getLocale()
or
Locales.getCurrent()
(never null).
It is useful when you wan to get a locale for this input.protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException
renderProperties
in class FormatInputElement
IOException
protected String getDefaultFormat()
Default: ##,##0.##
, you can overwrite this by specifying
the following setting in zk.xml
org.zkoss.zul.numberFormat
##,##0.##
setLocale(Locale)
protected String formatNumber(Object value, String defaultFormat)
A utility to assist the handling of numeric data.
defaultFormat
- used if FormatInputElement.getFormat()
returns null.
If defaultFormat and FormatInputElement.getFormat()
are both null,
the system's default format is used.toNumberOnly(java.lang.String)
protected Object[] toNumberOnly(String val)
formatNumber(java.lang.Object, java.lang.String)
public org.zkoss.zk.ui.sys.PropertyAccess getPropertyAccess(String prop)
getPropertyAccess
in interface org.zkoss.zk.ui.sys.ComponentCtrl
getPropertyAccess
in class FormatInputElement
Copyright © 2017. All rights reserved.