public abstract class NumberInputElement extends FormatInputElement
HtmlBasedComponent.ExtraCtrl
AbstractComponent.Children
_value
_zclass
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
NumberInputElement() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
formatNumber(java.lang.Object value,
java.lang.String defaultFormat)
Formats a number (Integer, BigDecimal...) into a string.
|
protected java.lang.String |
getDefaultFormat()
Return a default format for the number input element when the locale is specified.
|
protected java.util.Locale |
getDefaultLocale()
Returns the default locale, either
getLocale() or
Locales.getCurrent() (never null). |
java.util.Locale |
getLocale()
Returns the locale associated with this number input element,
or null if
Locales.getCurrent() is preferred. |
PropertyAccess |
getPropertyAccess(java.lang.String prop)
Returns the corresponding property access object from the given property
name, if any.
|
int |
getRoundingMode()
Returns the rounding mode.
|
protected void |
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing
tags and children.
|
void |
setLocale(java.util.Locale locale)
Sets the locale used to identify the symbols of this number input element.
|
void |
setLocale(java.lang.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(java.lang.String name)
Sets the rounding mode by the name.
|
protected java.lang.Object[] |
toNumberOnly(java.lang.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, setInsertedText, 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
java.lang.UnsupportedOperationException
- if Java 5 or belowpublic void setRoundingMode(java.lang.String name)
name
- the rounding mode's name. Allowed value:
java.lang.UnsupportedOperationException
- if Java 5 or belowRoundingModes
public int getRoundingMode()
Default: BigDecimal.ROUND_HALF_EVEN
.
public java.util.Locale getLocale()
Locales.getCurrent()
is preferred.public void setLocale(java.util.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(java.lang.String locale)
Default: null (i.e., Locales.getCurrent()
, the current locale
is assumed)
protected java.util.Locale getDefaultLocale()
getLocale()
or
Locales.getCurrent()
(never null).
It is useful when you wan to get a locale for this input.protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
renderProperties
in class FormatInputElement
java.io.IOException
protected java.lang.String getDefaultFormat()
Default: ##,##0.##
, you can overwrite this by specifying
the following setting in zk.xml
org.zkoss.zul.numberFormat
##,##0.##
setLocale(Locale)
protected java.lang.String formatNumber(java.lang.Object value, java.lang.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 java.lang.Object[] toNumberOnly(java.lang.String val)
formatNumber(java.lang.Object, java.lang.String)
public PropertyAccess getPropertyAccess(java.lang.String prop)
ComponentCtrl
getPropertyAccess
in interface ComponentCtrl
getPropertyAccess
in class FormatInputElement
prop
- the name of the propertyCopyright © 2005-2018 Potix Corporation. All Rights Reserved.