Package com.iizix.api.vs
Class VSFieldEvent
- All Implemented Interfaces:
IMessageBox
The VirtualSpace Field Value Event is a multi-purpose event that is used for validation and conversion of a value type between two native types, e.g. to convert a Value from an SQL Time instance to a Boolean (where the Boolean meaning could be "Working Hours 08:00-17:00").
The class has 4 members that are public and read-only: operation
, sourceType
, targetType
, and originalValue
.
The VALIDATE
event is fired when the VirtualSpace Field Value needs validation of the value to set.
The CONVERT_TO_NATIVE
or CONVERT_FROM_NATIVE
is fired when required (but cached result is kept).
- Author:
- Christopher Mindus
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Category for message.static enum
The Virtual Field Event Operations.Nested classes/interfaces inherited from interface com.iizix.gyro.IMessageBox
IMessageBox.Icon
Field Summary
Modifier and TypeFieldDescriptionfinal VSFieldEvent.Op
The operation.final Object
The original value, null when none applies.final Value.Type
The convert-from-type of Value.final Value.Type
The convert-to-type of value.Fields inherited from interface com.iizix.gyro.IMessageBox
ICON_ERROR, ICON_INFORMATION, ICON_MAP, ICON_NONE, ICON_QUESTION, ICON_WARNING
Constructor Summary
ConstructorDescriptionVSFieldEvent
(VSField source, VSFieldEvent.Op operation, Object value, Value.Type sourceType, Value.Type targetType, GProp<?> trigger) Constructs the event for an action to use with value conversion.VSFieldEvent
(VSField source, Value value, GProp<?> trigger) Constructs the validation event for an action with a property being the trigger source, e.g.Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if propagation is stopped.Gets the message category.Gets the converted value.Gets the message.Gets the VirtualSpace Field that is the source of the event.boolean
Checks if the event has been handled and no further processing by other processors should be done.protected String
Gets the parameter string.void
setConvertedValue
(Object value) Sets the converted value and marks the event as handled.void
Marks the event as handled and no further processing by other processors should be done.void
setMessage
(PlainKString message, VSFieldEvent.Category category) Sets the validation message.void
Stops propagation of the event in the event processor chain.Methods inherited from class com.iizix.api.vs.VSBaseEventWithTrigger
getTrigger, getTriggerClientSessionGyro, getTriggerUIComp
Methods inherited from class com.iizix.api.vs.VSBaseEvent
getAppSessionGyro, getVirtualSpace
Methods inherited from class com.iizix.api.BaseEvent
getAction, getAction2, getActionNull, getActionNull2, getField, getField2, getFieldNull, getFieldNull2, getGroup, getGroup2, getGroupNull, getGroupNull2, getTable, getTable2, getTableNull, getTableNull2, getTime, getVirtualizedVirtualSpace, getVSComponent, getVSComponent2, getVSComponentNull, getVSComponentNull2, messageBox, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.gyro.IMessageBox
messageBox, messageBox, messageBox
Field Details
operation
The operation.originalValue
The original value, null when none applies.sourceType
The convert-from-type of Value.This value is also set to the validating value.
targetType
The convert-to-type of value.This value is also set to the validating value.
Constructor Details
VSFieldEvent
public VSFieldEvent(VSField source, VSFieldEvent.Op operation, Object value, Value.Type sourceType, Value.Type targetType, GProp<?> trigger) Constructs the event for an action to use with value conversion.- Parameters:
source
- The field.operation
- Operation to perform.value
- The value to convert.sourceType
- The source value type.targetType
- The target value type.- Throws:
NullPointerException
- If the source is null.
VSFieldEvent
Constructs the validation event for an action with a property being the trigger source, e.g. an UIButton or UICheckBox.- Parameters:
source
- The field.value
- The value being validated.trigger
- The trigger property, null for none.- Throws:
NullPointerException
- If the source or field Raw value is null.IllegalArgumentException
- If the native form doesn't match what is expected.
Method Details
getSource
Gets the VirtualSpace Field that is the source of the event.setConvertedValue
Sets the converted value and marks the event as handled.- Parameters:
value
- The value as requested by the conversion.- Throws:
NullPointerException
- If the value isnull
.IllegalArgumentException
- If the value class is not matching the expected conversion intoType
.
getConvertedValue
Gets the converted value.- Returns:
- The converted value, or null if not yet converted.
setMessage
Sets the validation message.- Parameters:
message
- The message to set, null to clear message (category will not be changed).category
- TheCategory
NONE
(-1, default value),INFORMATION
(0),WARNING
(1) orERROR
(2).- Throws:
NullPointerException
- Ifmessage
orcategory
is null.
getCategory
Gets the message category.- Returns:
- The
Category
NONE
(-1, default value),INFORMATION
(0),WARNING
(1) orERROR
(2).
getMessage
Gets the message.- Returns:
- A message, or null for none.
stopPropagation
public void stopPropagation()Stops propagation of the event in the event processor chain.doStopPropagation
public boolean doStopPropagation()Checks if propagation is stopped.setHandled
public void setHandled()Marks the event as handled and no further processing by other processors should be done.hasBeenHandled
public boolean hasBeenHandled()Checks if the event has been handled and no further processing by other processors should be done.paramString
Gets the parameter string.- Overrides:
paramString
in classVSBaseEventWithTrigger<VSField>