EditableProperty
is identical to caplin.presenter.property.WritableProperty,
except that it also has the ability to be edited by users.
Because editable properties can be displayed using controls that allow unconstrained input (e.g text input boxes), #addValidator can be used to add validators that provide user feedback when invalid values are entered, and #addParser can be used to help convert user input into valid forms.
Attributes | Name and Description |
---|---|
|
caplin.presenter.property.EditableProperty(Object vValue)
Constructs a new |
Attributes | Name and Description |
---|---|
|
caplin.presenter.property.EditableProperty
addParser(caplin.core.Parser oParser, Object mConfig)
Adds a caplin.core.Parser that will be run each time the user enters a new value. |
|
caplin.presenter.property.PropertyListener
addValidationCompleteListener(Object oListener, String sMethod, boolean bNotifyImmediately)
A convenience method that allows validation complete listeners to be added for objects that do not themselves implement caplin.presenter.property.PropertyListener. |
|
caplin.presenter.property.PropertyListener
addValidationErrorListener(Object oListener, String sMethod, boolean bNotifyImmediately)
A convenience method that allows validation error listeners to be added for objects that do not themselves implement caplin.presenter.property.PropertyListener. |
|
caplin.presenter.property.PropertyListener
addValidationSuccessListener(Object oListener, String sMethod, boolean bNotifyImmediately)
A convenience method that allows validation success listeners to be added for objects that do not themselves implement caplin.presenter.property.PropertyListener. |
|
caplin.presenter.property.EditableProperty
addValidator(caplin.core.Validator oValidator, Object mConfig)
Adds a caplin.core.Validator that will be run each time the user enters a new value. |
|
void
forceValidation()
Force the property to be re-validated. |
|
caplin.presenter.property.EditableProperty
setUserEnteredValue(Object vUserEnteredValue)
Accepts a user entered value that may need to be parsed before calling #setValue. |
|
void
setValue(Variant vValue)
Sets the unformatted value for this property and notifies listeners of the change. |
►
caplin.presenter.property.EditableProperty(Object vValue)
Constructs a new EditableProperty
instance.
Object | vValue | (optional) The default value for this property. |
►
caplin.presenter.property.EditableProperty
addParser(caplin.core.Parser oParser, Object mConfig)
Adds a caplin.core.Parser that will be run each time the user enters a new value.
Parsers allow user input to be normalized prior to validation. For example, the user may be allowed to enter '1M' into an amount field, and a parser might convert this to '1000000' before it is validated by a numeric validator.
Any number of parsers can be added to an editable property, and will be applied in the same way that production rules are applied in production rule systems:
By configuring a number of simple parsers in the same way as production rules are used, complex input handling can be supported.
caplin.core.Parser | oParser | the caplin.core.Parser being added. |
Object | mConfig | (optional) Any additional configuration for the parser. |
►
caplin.presenter.property.PropertyListener
addValidationCompleteListener(Object oListener, String sMethod, boolean bNotifyImmediately)
A convenience method that allows validation complete listeners to be added for objects that do not themselves implement caplin.presenter.property.PropertyListener.
Listeners added using addValidationCompleteListener()
will only be
notified when caplin.presenter.property.PropertyListener#onValidationComplete
fires, and will not be notified if any of the other
caplin.presenter.property.PropertyListener call-backs fire. The advantage to
using this method is that objects can choose to listen to call-back events on
multiple properties.
Object | oListener | The listener to be added. |
String | sMethod | The name of the method on the listener that will be invoked each time validation is successful. |
boolean | bNotifyImmediately | (optional) Whether to invoke the listener immediately for the current value. |
►
caplin.presenter.property.PropertyListener
addValidationErrorListener(Object oListener, String sMethod, boolean bNotifyImmediately)
A convenience method that allows validation error listeners to be added for objects that do not themselves implement caplin.presenter.property.PropertyListener.
Listeners added using addValidationErrorListener()
will only be
notified when caplin.presenter.property.PropertyListener#onValidationError
fires, and will not be notified if any of the other
caplin.presenter.property.PropertyListener call-backs fire. The advantage to
using this method is that objects can choose to listen to call-back events on
multiple properties.
The invoked method will be passed two arguments:
vPropertyValue
— The current value of the property.sErrorMessage
— The failure message.Object | oListener | The listener to be added. |
String | sMethod | The name of the method on the listener that will be invoked each time there is a validation error. |
boolean | bNotifyImmediately | (optional) Whether to invoke the listener immediately for the current value. |
►
caplin.presenter.property.PropertyListener
addValidationSuccessListener(Object oListener, String sMethod, boolean bNotifyImmediately)
A convenience method that allows validation success listeners to be added for objects that do not themselves implement caplin.presenter.property.PropertyListener.
Listeners added using addValidationSuccessListener()
will only be
notified when caplin.presenter.property.PropertyListener#onValidationSuccess
fires, and will not be notified if any of the other
caplin.presenter.property.PropertyListener call-backs fire. The advantage to
using this method is that objects can choose to listen to call-back events on
multiple properties.
Object | oListener | The listener to be added. |
String | sMethod | The name of the method on the listener that will be invoked each time validation is successful. |
boolean | bNotifyImmediately | (optional) Whether to invoke the listener immediately for the current value. |
►
caplin.presenter.property.EditableProperty
addValidator(caplin.core.Validator oValidator, Object mConfig)
Adds a caplin.core.Validator that will be run each time the user enters a new value.
Validators allow users to be immediately informed when any of their input is
invalid. The caplin.presenter.node.Field,
caplin.presenter.node.SelectionField and
caplin.presenter.node.MultiSelectionField classes all listen to the
validation call-backs on caplin.presenter.property.PropertyListener and
maintain hasError
and failureMessage
properties that can
be displayed within the view.
caplin.core.Validator | oValidator | the caplin.core.Validator being added. |
Object | mConfig | (optional) Any additional configuration for the validator. |
►
void
forceValidation()
Force the property to be re-validated.
This method is useful for code that wishes to perform cross-property validation — it is used by the caplin.presenter.validator.CrossValidationPropertyBinder class for example.
►
caplin.presenter.property.EditableProperty
setUserEnteredValue(Object vUserEnteredValue)
Accepts a user entered value that may need to be parsed before calling #setValue.
Object | vUserEnteredValue | The unparsed value to set. |
►
void
setValue(Variant vValue)
Sets the unformatted value for this property and notifies listeners of the change.
This method is the same as caplin.presenter.property.WritableProperty#setValue, except that validation will also be performed.
Variant | vValue | The value to set. |