Package com.iizix.api.vs
Class VSFieldEvent
- java.lang.Object
- com.iizix.api.BaseEvent<VSCOMP>
- com.iizix.api.vs.VSBaseEvent<VSCOMP>
- com.iizix.api.vs.VSBaseEventWithTrigger<VSField>
- com.iizix.api.vs.VSFieldEvent
- All Implemented Interfaces:
IMessageBox
public class VSFieldEvent extends VSBaseEventWithTrigger<VSField>
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, andoriginalValue.The
VALIDATEevent is fired when the VirtualSpace Field Value needs validation of the value to set.The
CONVERT_TO_NATIVEorCONVERT_FROM_NATIVEis fired when required (but cached result is kept).- Author:
- Christopher Mindus
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVSFieldEvent.CategoryCategory for message.static classVSFieldEvent.OpThe Virtual Field Event Operations.Nested classes/interfaces inherited from interface com.iizix.gyro.IMessageBox
IMessageBox.Icon
Field Summary
Fields Modifier and Type Field Description VSFieldEvent.OpoperationThe operation.java.lang.ObjectoriginalValueThe original value, null when none applies.Value.TypesourceTypeThe convert-from-type of Value.Value.TypetargetTypeThe 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
Constructors Constructor Description VSFieldEvent(VSField source, VSFieldEvent.Op operation, java.lang.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandoStopPropagation()Checks if propagation is stopped.VSFieldEvent.CategorygetCategory()Gets the message category.java.lang.ObjectgetConvertedValue()Gets the converted value.PlainKStringgetMessage()Gets the message.VSFieldgetSource()Gets the VirtualSpace Field that is the source of the event.booleanhasBeenHandled()Checks if the event has been handled and no further processing by other processors should be done.protected java.lang.StringparamString()Gets the parameter string.voidsetConvertedValue(java.lang.Object value)Sets the converted value and marks the event as handled.voidsetHandled()Marks the event as handled and no further processing by other processors should be done.voidsetMessage(PlainKString message, VSFieldEvent.Category category)Sets the validation message.voidstopPropagation()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
Field Detail
operation
public final VSFieldEvent.Op operation
The operation.
originalValue
public final java.lang.Object originalValue
The original value, null when none applies.
sourceType
public final Value.Type sourceType
The convert-from-type of Value.This value is also set to the validating value.
targetType
public final Value.Type targetType
The convert-to-type of value.This value is also set to the validating value.
Constructor Detail
VSFieldEvent
public VSFieldEvent(VSField source, VSFieldEvent.Op operation, java.lang.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:
java.lang.NullPointerException- If the source is null.
VSFieldEvent
public VSFieldEvent(VSField source, Value value, GProp<?> trigger)
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:
java.lang.NullPointerException- If the source or field Raw value is null.java.lang.IllegalArgumentException- If the native form doesn't match what is expected.
Method Detail
getSource
public VSField getSource()
Gets the VirtualSpace Field that is the source of the event.
setConvertedValue
public void setConvertedValue(java.lang.Object value)
Sets the converted value and marks the event as handled.- Parameters:
value- The value as requested by the conversion.- Throws:
java.lang.NullPointerException- If the value isnull.java.lang.IllegalArgumentException- If the value class is not matching the expected conversion intoType.
getConvertedValue
public java.lang.Object getConvertedValue()
Gets the converted value.- Returns:
- The converted value, or null if not yet converted.
setMessage
public void setMessage(PlainKString message, VSFieldEvent.Category category)
Sets the validation message.- Parameters:
message- The message to set, null to clear message (category will not be changed).category- TheCategoryNONE(-1, default value),INFORMATION(0),WARNING(1) orERROR(2).- Throws:
java.lang.NullPointerException- Ifmessageorcategoryis null.
getCategory
public VSFieldEvent.Category getCategory()
Gets the message category.- Returns:
- The
CategoryNONE(-1, default value),INFORMATION(0),WARNING(1) orERROR(2).
getMessage
public PlainKString 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
protected java.lang.String paramString()
Gets the parameter string.- Overrides:
paramStringin classVSBaseEventWithTrigger<VSField>