public class Text<T> extends Input implements IControl<T>, IHasModifiedIndication, IConvertable<T>, ITypedControl<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
Text.NumberMode |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptRequestParameter(String[] values)
Handle the input from the request for this component.
|
void |
addValidator(Class<? extends IValueValidator<T>> clz) |
void |
addValidator(Class<? extends IValueValidator<T>> clz,
String[] parameters) |
void |
addValidator(IValueValidator<?> v) |
void |
addValidator(PropertyMetaValidator v) |
static void |
assignPrecisionValidator(Text<?> control,
int precision,
int scale)
This adds a validator for the maximal and minimal value for a numeric input, depending on the precision
and scale.
|
static void |
assignPrecisionValidator(Text<?> control,
PropertyMetaModel<?> pmm)
This adds a validator for the maximal and minimal value for an input, gotten from the property metamodel.
|
void |
clearMessage()
Clear message and reset validated flag, so next getValue would result with new validation check.
|
static void |
configureNumericInput(Text<?> txt,
PropertyMetaModel<?> pmm,
boolean editable) |
static Text<BigDecimal> |
createBDMoneyInput(Class<?> clz,
String property,
boolean editable) |
static Text<BigDecimal> |
createBDMoneyInput(PropertyMetaModel<BigDecimal> pmm,
boolean editable) |
static Text<BigDecimal> |
createBigDecimalInput(Class<?> clz,
String property,
boolean editable) |
void |
createContent() |
static Text<Double> |
createDoubleInput(Class<?> clz,
String property,
boolean editable) |
static Text<Double> |
createDoubleMoneyInput(Class<?> clz,
String property,
boolean editable)
Create a control to input a monetary value proper for the specified property.
|
static Text<Double> |
createDoubleMoneyInput(PropertyMetaModel<Double> pmm,
boolean editable) |
static Text<Integer> |
createIntInput(Class<?> clz,
String property,
boolean editable)
Create an int input control, properly configured for the specified property.
|
static Text<Long> |
createLongInput(Class<?> clz,
String property,
boolean editable) |
static <T extends Number> |
createNumericInput(PropertyMetaModel<T> pmm,
boolean editable) |
static <T> Text<?> |
createText(Class<?> clz,
String property,
boolean editable) |
static <T> Text<T> |
createText(Class<T> iclz,
PropertyMetaModel<T> pmm,
boolean editable) |
static <T> Text<T> |
createText(Class<T> iclz,
PropertyMetaModel<T> pmm,
boolean editable,
boolean setDefaultErrorLocation) |
Class<T> |
getActualType()
Returns the datatype of the value of this control, as passed in the constructor.
|
T |
getBindValue()
Bind-capable version of getValue().
|
IConverter<T> |
getConverter()
|
String |
getEmptyMarker()
Returns assigned empty marker.
|
String |
getMarkerImage()
Returns assigned empty marker.
|
Text.NumberMode |
getNumberMode()
Returns the current numeric mode in effect.
|
String |
getRegexpUserString() |
String |
getValidationRegexp() |
T |
getValue()
Returns the current value of this input component.
|
T |
getValueSafe()
Like
IControl.getValue() this returns the value of the component, but this returns null
if the value was invalid. |
boolean |
hasError()
Return T if this node currently has an error associated with it.
|
boolean |
isMandatory()
Returns T if this control is mandatory.
|
boolean |
isModified()
Returns the modified-by-user flag.
|
boolean |
isUntrimmed()
Returns T if the input is to be left untrimmed.
|
static void |
main(String[] args) |
void |
setBindValue(T value) |
void |
setConverter(IConverter<T> converter)
|
void |
setMandatory(boolean mandatory)
Set the control as mandatory.
|
void |
setMarker()
Method can be used to show default marker icon (THEME/icon-search.png) with magnifier image in background of input.
|
void |
setMarker(String iconUrl)
Method can be used to show custom marker icon as image in background of input.
|
void |
setMarker(String iconUrl,
String caption)
Method can be used to show custom marker icon and custom label as image in background of input.
|
void |
setMarkerImage(String emptyMarker)
This sets a marker image to be used as the background image for an empty text box.
|
void |
setMarkerText(String caption)
Method can be used to show default marker icon (THEME/icon-search.png) with magnifier and custom label as image in background of input.
|
void |
setModified(boolean as)
Set or clear the modified by user flag.
|
void |
setNumberMode(Text.NumberMode numberMode)
Sets the current numeric mode in effect.
|
void |
setRegexpUserString(String regexpUserString) |
void |
setUntrimmed(boolean untrimmed)
Specify whether the input is to be space-trimmed before being used.
|
void |
setValidationRegexp(String validationRegexp) |
void |
setValue(T value)
Set a new value in this component.
|
componentHandleWebAction, getDisabledBecause, getInputType, getMaxLength, getOnKeyPressJS, getOnLookupTyping, getOnValueChanged, getRawValue, getSize, isDisabled, isReadOnly, setDisabled, setDisabledBecause, setMaxLength, setOnKeyPressJS, setOnLookupTyping, setOnValueChanged, setRawValue, setReadOnly, setSize, visit$, addBinding, addCssClass, addGlobalMessage, addNotificationListener, afterCreateContent, alignToLeft, alignToLeft, alignToMiddle, alignToMiddle, alignTopToBottom, alignTopToBottom, alignToRight, alignToRight, alignToTop, alignToTop, appendAfterMe, appendBeforeMe, appendCreateJS, appendJavascript, appendJQuerySelector, appendJsCustomUpdatesContributor, appendShowOverflowTextAsTitleJs, appendStatement, appendTreeErrors, beforeCreateContent, bind, bind, bindErrors, build, calcTestID, changed, changedJavascriptState, clearFocusRequested, clearGlobalMessage, clearGlobalMessage, clearGlobalMessage, clearValidationFailure, componentHandleWebDataRequest, createStatement, findComponentBundle, findParent, forceRebuild, getActualID, getAllocationTracepoint, getBindingErrors, getBindingList, getBrowserWindowSize, getCalculatedTestID, getClicked, getClientBounds, getComponentBundle, getComponentDataURL, getComponentDataURL, getComponentInfo, getComponentJSONURL, getCreateJS, getCssClass, getErrorList, getErrorLocation, getFocusID, getMessage, getOnClickJS, getOnMouseDownJS, getOnSizeAndPositionChange, getPage, getParent, getParent, getParent, getParentOfTypes, getSharedContext, getSharedContextFactory, getSpecialAttribute, getSpecialAttributeList, getTag, getTestID, getTestRepeatId, getThemedResourceRURL, getTitle, getUserObject, handleDrop, hasCssClass, hasParent, internalClearDelta, internalClearDeltaFully, internalCreateFrame, internalGetNodeCount, internalGetOldParent, internalGetParent, internalHasChangedAttributes, internalNeedClickHandler, internalOnBeforeRender, internalOnClicked, internalOnValueChanged, internalRenderJavascriptDelta, internalRenderJavascriptState, internalSetHasChangedAttributes, internalSetHasChangedAttributes, internalSetLogAllocations, internalSetTag, internalShelve, internalUnshelve, isAttached, isBuilt, isFocusable, isFocusRequested, isRendersOwnClose, isStretchHeight, lc, notify, notifyParentOrOpenerPage, onAddedToPage, onBeforeFullRender, onBeforeRender, onForceRebuild, onHeaderContributors, onRefresh, onRemoveFromPage, onShelve, onUnshelve, refresh, remove, removeBinding, removeCssClass, renderJavascriptDelta, renderJavascriptState, renderJavascriptState, replaceWith, setBrowserWindowSize, setCalculcatedId, setCalculcatedId, setClicked, setClientBounds, setComponentBundle, setCssClass, setErrorLocation, setFocus, setMessage, setOnClickJS, setOnMouseDownJS, setOnSizeAndPositionChange, setOverrideTitle, setSpecialAttribute, setStretchHeight, setTestID, setTestRepeatID, setTitle, setUserObject, toStringgetBackgroundAttachment, getBackgroundColor, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorderBottomColor, getBorderBottomStyle, getBorderBottomWidth, getBorderLeftColor, getBorderLeftStyle, getBorderLeftWidth, getBorderRightColor, getBorderRightStyle, getBorderRightWidth, getBorderTopColor, getBorderTopStyle, getBorderTopWidth, getBottom, getCachedStyle, getClear, getColor, getDisplay, getFloat, getFontFamily, getFontSize, getFontSizeAdjust, getFontStyle, getFontVariant, getFontWeight, getHeight, getLeft, getLineHeight, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOverflow, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPosition, getRight, getTextAlign, getTop, getTransform, getVerticalAlign, getVisibility, getWidth, getZIndex, internalSetDisplay, setBackgroundAttachment, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBorder, setBorderBottomColor, setBorderBottomStyle, setBorderBottomWidth, setBorderColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftWidth, setBorderRightColor, setBorderRightStyle, setBorderRightWidth, setBorderStyle, setBorderTopColor, setBorderTopStyle, setBorderTopWidth, setBorderWidth, setBottom, setBottom, setCachedStyle, setClear, setColor, setDisplay, setFloat, setFontFamily, setFontSize, setFontSizeAdjust, setFontStyle, setFontVariant, setFontWeight, setHeight, setLeft, setLeft, setLineHeight, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOverflow, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPosition, setRight, setRight, setTextAlign, setTop, setTop, setTransform, setVerticalAlign, setVisibility, setWidth, setZIndexclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetErrorLocation, isDisabled, isReadOnly, setErrorLocation, setReadOnlysetDisabled, setTestIDgetOnValueChanged, setOnValueChangedgetMessage, setMessagepublic boolean acceptRequestParameter(@Nonnull String[] values)
acceptRequestParameter in class InputInput.acceptRequestParameter(java.lang.String[])@Nonnull public Class<T> getActualType()
getActualType in interface ITypedControl<T>public IConverter<T> getConverter()
IConvertable.getConverter().
This returns null if no converter has been set. It also returns null if a default converter is used.getConverter in interface IConvertable<T>public void setConverter(IConverter<T> converter)
IConvertable.setConverter(IConverter).
Sets the Converter to use to convert the string value to a T and vice versa. It is the programmer's
responsibility to ensure that the converter actually converts to a T; if not the code will throw
ClassCastExceptions.setConverter in interface IConvertable<T>converter - public T getBindValue()
public T getValue()
IControlValidationException. This means that this
call either delivers correct input (as defined by it's converter and validators), null
(when empty) or throws an exception. When a ValidationException occurs the framework
mostly ignores it - it does not produce a stacktrace or error in the client. Instead
the resulting error as posted by the error handling framework gets displayed on the
form when the request completes.
To get the value of a component while ignoring exceptions call IControl.getValueSafe().
getValue in interface IControl<T>IControl.getValue()public void clearMessage()
clearMessage in interface INodeErrorDelegateclearMessage in class NodeBaseNodeBase.clearMessage()public T getValueSafe()
IControlIControl.getValue() this returns the value of the component, but this returns null
if the value was invalid. For this method NULL either means the value was invalid OR
it's content was empty. To distinguish between the two call IControl.hasError() or use
IControl.getValue() instead of this call.getValueSafe in interface IControl<T>IControl.getValueSafe()public boolean hasError()
NodeBasepublic void setValue(@Nullable T value)
setValue in interface IControl<T>IControl.setValue(java.lang.Object)public boolean isMandatory()
isMandatory in interface IControl<T>IControl.isMandatory()public void setMandatory(boolean mandatory)
setMandatory in interface IControl<T>IControl.setMandatory(boolean)public boolean isUntrimmed()
public void setUntrimmed(boolean untrimmed)
untrimmed - public String getEmptyMarker()
setEmptyMarker(String)public void setMarkerImage(String emptyMarker)
emptyMarker - public String getMarkerImage()
setMarkerImage(String)public void setMarker()
public void setMarker(String iconUrl)
iconUrl - public void setMarkerText(String caption)
caption - public void setMarker(String iconUrl, String caption)
iconUrl - caption - @Nonnull public Text.NumberMode getNumberMode()
public void setNumberMode(@Nonnull Text.NumberMode numberMode)
numberMode - public void addValidator(IValueValidator<?> v)
public void addValidator(PropertyMetaValidator v)
public void addValidator(Class<? extends IValueValidator<T>> clz)
public void addValidator(Class<? extends IValueValidator<T>> clz, String[] parameters)
public String getValidationRegexp()
public void setValidationRegexp(String validationRegexp)
public String getRegexpUserString()
public void setRegexpUserString(String regexpUserString)
public boolean isModified()
isModified in interface IHasModifiedIndicationIHasModifiedIndication.isModified()public void setModified(boolean as)
setModified in interface IHasModifiedIndicationIHasModifiedIndication.setModified(boolean)public static final void assignPrecisionValidator(@Nonnull Text<?> control, @Nonnull PropertyMetaModel<?> pmm)
control - pmm - public static final void assignPrecisionValidator(@Nonnull Text<?> control, int precision, int scale)
control - precision - scale - @Nonnull public static Text<Double> createDoubleMoneyInput(@Nonnull Class<?> clz, @Nonnull String property, boolean editable)
clz - property - @Nonnull public static Text<BigDecimal> createBDMoneyInput(Class<?> clz, String property, boolean editable)
@Nonnull public static Text<BigDecimal> createBDMoneyInput(PropertyMetaModel<BigDecimal> pmm, boolean editable)
@Nonnull public static Text<Double> createDoubleMoneyInput(@Nonnull PropertyMetaModel<Double> pmm, boolean editable)
public static void configureNumericInput(@Nonnull Text<?> txt, @Nonnull PropertyMetaModel<?> pmm, boolean editable)
@Nonnull public static <T extends Number> Text<T> createNumericInput(PropertyMetaModel<T> pmm, boolean editable)
@Nonnull public static Text<Integer> createIntInput(Class<?> clz, String property, boolean editable)
clz - property - editable - @Nonnull public static Text<Long> createLongInput(Class<?> clz, String property, boolean editable)
@Nonnull public static Text<Double> createDoubleInput(Class<?> clz, String property, boolean editable)
@Nonnull public static Text<BigDecimal> createBigDecimalInput(Class<?> clz, String property, boolean editable)
@Nonnull public static <T> Text<?> createText(Class<?> clz, String property, boolean editable)
@Nonnull public static <T> Text<T> createText(Class<T> iclz, PropertyMetaModel<T> pmm, boolean editable)
@Nonnull public static <T> Text<T> createText(Class<T> iclz, PropertyMetaModel<T> pmm, boolean editable, boolean setDefaultErrorLocation)
public void createContent()
throws Exception
createContent in class NodeBaseExceptionpublic static void main(String[] args)
Copyright © 2017 etc.to. All rights reserved.