Package com.iizix.prop.vs
Class VSRelativeReference<TARGET extends VSComponent>
- java.lang.Object
- com.iizix.prop.GProp<java.lang.String>
- com.iizix.prop.StringProp
- com.iizix.prop.vs.VSRelativeReference<TARGET>
- All Implemented Interfaces:
EventListener
,ICircularRetargetParent
,IGProp<java.lang.String>
,IPropReference
,java.lang.Cloneable
- Direct Known Subclasses:
VSActionReference
,VSColumnReference
,VSComponentReference
,VSFieldReference
,VSFocusReference
,VSGroupReference
,VSOnUIEvent
,VSTableColumnReference
,VSTableReference
public abstract class VSRelativeReference<TARGET extends VSComponent> extends StringProp implements IPropReference, ICircularRetargetParent
The VirtualSpace Relative Reference property class hold the reference to a VirtualSpace.- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface com.iizix.prop.IPropReference
IPropReference.ReferenceChangeEvent
Field Summary
Fields Modifier and Type Field Description protected TARGET
currentTarget
The current target reference.protected TARGET
fixedTarget
The current target reference.protected PropReference
reference
The instance of the property reference.protected java.lang.String
vsRefBase
The current VSReference base.Fields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2
Fields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
Constructor Summary
Constructors Constructor Description VSRelativeReference()
Creates a VirtualSpace Reference property with no name and with a null value.VSRelativeReference(Atom propertyAtom)
Creates a VirtualSpace Reference property with the specified name with a null value.VSRelativeReference(Atom propertyAtom, java.lang.String newValue)
Creates a VirtualSpace Reference property with the specified name and value.
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addError(java.lang.String err)
Adds an error.protected void
clearError()
Clears the error.VSRelativeReference<TARGET>
clone()
Overrides clone to clear existing reference.protected void
createReference(GEvent event)
Creates the reference.protected void
disposeReference()
Disposes and clears the reference.protected boolean
equalsErrors(PropError pe1, PropError pe2, int how)
Processes error property verification.abstract java.lang.Class<? extends GProp<?>>
getPropertyClass()
Gets the class wanted.java.lang.String
getReference()
Gets the full reference string.abstract java.lang.String
getReferenceDescription()
Gets a short description of this reference, e.g.int
getReferences(java.util.List<Reference> references)
Gets the references of this property top others.TARGET
getVSTarget()
Gets the target VS component.protected boolean
isPropPrivateAtCreation()
Called upon creation of the property to check it's private state.boolean
isReferenceValid(GProp<?> property)
Validates the property reference that has been looked up.void
onEventSelf(GEvent event)
Called when a property event is send to this property.protected void
onPropDispose()
Property disposed of: dispose of reference.protected void
onPropParentChanged(PropCnr oldParent, PropCnr newParent)
The parent has been changed, if added to a container or moved, recheck the reference.protected void
onReferenceEvent(ResolveReferencesEvent event)
Called to perform reference resolving.void
onReferenceEvent(PropReference reference, IPropReference.ReferenceChangeEvent event, GEvent triggerEvent)
Called when a property reference event occurs.protected abstract void
onRemoved(TARGET oldTarget)
Called when the property reference has been disposed of e.g.protected abstract void
onResolved(TARGET target)
Called when the property reference has been resolved.protected void
onVirtualizationCompleted(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, boolean isPostResolve)
Called when virtualization completed.protected void
onVirtualized(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, GProp<?> clonedProp)
Called when this property has been virtualized.protected void
onVSReferenceChanged(GEvent event)
Rechecks the reference, the VSReference has changed.void
resolve(boolean doReCheck, GEvent event)
Resolves the reference.protected void
resolve(PropReference ref, boolean doReCheck, GEvent event)
Resolves the reference.protected void
setInvalid()
Sets as invalid.protected void
targetChanged(GProp<?> prop)
Internal method called when target changes.Methods inherited from class com.iizix.prop.StringProp
appendPropValue, getPropValue0, getString, getString, getValueClasses, initializeValue, setPropValue, toNativeValue0, validatePropType
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, convertPropError, dispose, equals, equals, equalsObj, equalsPropValue, equalsTree, equalValues, extendsClone, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropBaseReference, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParent, getTreeLock, getVSReference, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeElement, initializeGElement, initializeGProp, initializeProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCommunicating, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, list, list, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onPrepare, onPropInvalidateCache, onPropTreeInitialized, onPropValueSet, onRemoteEvent, paramString, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, resolveRuntimeReferences, setChanged, setConstraints, setConstraints, setCreateRequiredProp, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toElementString, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, validatePropValue, verify, verifyHasPropertyItem, virtualize, warning, warning, warning
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.prop.ICircularRetargetParent
isCircularRetargetParent
Field Detail
reference
protected PropReference reference
The instance of the property reference.
vsRefBase
protected java.lang.String vsRefBase
The current VSReference base.
currentTarget
protected TARGET extends VSComponent currentTarget
The current target reference.
fixedTarget
protected TARGET extends VSComponent fixedTarget
The current target reference. This reference may be virtualized or not depending on if this reference is located in the VirtualSpace being virtualized (not probable), or if it's located in e.g. a panel that is virtualized caused by a VirtualSpace. This instance is then kept as long as the reference string is not changed. If it is changed, this relative-reference-property reverts back to non-fixed mode.
Constructor Detail
VSRelativeReference
public VSRelativeReference()
Creates a VirtualSpace Reference property with no name and with a null value.
VSRelativeReference
public VSRelativeReference(Atom propertyAtom)
Creates a VirtualSpace Reference property with the specified name with a null value.- Parameters:
propertyAtom
- the property atom.
VSRelativeReference
public VSRelativeReference(Atom propertyAtom, java.lang.String newValue)
Creates a VirtualSpace Reference property with the specified name and value.- Parameters:
propertyAtom
- the property atom.newValue
- the new string value for the property.
Method Detail
isPropPrivateAtCreation
protected boolean isPropPrivateAtCreation()
Called upon creation of the property to check it's private state. This is used by properties that are not distributed to the remote party.- Overrides:
isPropPrivateAtCreation
in classGProp<java.lang.String>
- Returns:
- true, always.
disposeReference
protected void disposeReference()
Disposes and clears the reference.
onPropDispose
protected void onPropDispose()
Property disposed of: dispose of reference.- Overrides:
onPropDispose
in classGProp<java.lang.String>
clone
public VSRelativeReference<TARGET> clone()
Overrides clone to clear existing reference.- Overrides:
clone
in classStringProp
- Returns:
- A new cloned String property.
onVirtualized
protected void onVirtualized(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, GProp<?> clonedProp)
Called when this property has been virtualized.Override to perform required processing.
- Overrides:
onVirtualized
in classGProp<java.lang.String>
- Parameters:
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can benull
if not initialized from the client gyro.virtualSpace
- The virtualized VirtualSpace.virtualizedProp
- The property being virtualized.clonedProp
- The property that is cloned to produce this virtualized property.
equalsErrors
protected boolean equalsErrors(PropError pe1, PropError pe2, int how)
Processes error property verification. The default processing is to verify the two error propertiespe1
andpe2
for equality ifincludeErrors
is 0 or 1, and returns true if the value is 2=no comparison with error properties.Override to verify property errors for reference properties.
- Overrides:
equalsErrors
in classGProp<java.lang.String>
- Parameters:
pe1
- The first error property, may be null.pe2
- The second error property, may be null.how
- Flags EQC_* values for equal checking.- Returns:
- Equality flag depending on
includeErrors
value.
onEventSelf
public final void onEventSelf(GEvent event)
Called when a property event is send to this property.A subclass can override this method to perform appropriate processing and is not required to call
super.onEventSelf(e)
.- Specified by:
onEventSelf
in interfaceIGProp<TARGET extends VSComponent>
- Overrides:
onEventSelf
in classGProp<java.lang.String>
- Parameters:
event
- The property event.
onReferenceEvent
protected void onReferenceEvent(ResolveReferencesEvent event)
Called to perform reference resolving. A property should override this method if it needs to perform reference resolving and validation.Subclasses override this method and only subclasses extending
PropCnr
needs to callsuper.onReferenceEvent(ResolveReferenceEvent event)
.- Overrides:
onReferenceEvent
in classGProp<java.lang.String>
- Parameters:
event
- The resolve references event.
onPropParentChanged
protected final void onPropParentChanged(PropCnr oldParent, PropCnr newParent)
The parent has been changed, if added to a container or moved, recheck the reference.- Overrides:
onPropParentChanged
in classGProp<java.lang.String>
- Parameters:
oldParent
- The old parent (or null if none).newParent
- The new parent (or null if none).
resolve
public void resolve(boolean doReCheck, GEvent event)
Resolves the reference.- Parameters:
doReCheck
- Performs a re-check in case e.g. reference class type changes.event
- The triggering event, null for none.
getReference
public java.lang.String getReference()
Gets the full reference string.- Returns:
- The full reference string, or another reference string for failure in case it cannot be retrieved, or null for no reference defined.
onVSReferenceChanged
protected void onVSReferenceChanged(GEvent event)
Rechecks the reference, the VSReference has changed.
setInvalid
protected void setInvalid()
Sets as invalid.
createReference
protected void createReference(GEvent event)
Creates the reference.
resolve
protected final void resolve(PropReference ref, boolean doReCheck, GEvent event)
Resolves the reference.
onReferenceEvent
public void onReferenceEvent(PropReference reference, IPropReference.ReferenceChangeEvent event, GEvent triggerEvent)
Called when a property reference event occurs. The events are ReferenceChangeEvent.FOUND, FOUND_WRONG_CLASS, RENAMED, MOVED, NEW_PROPERTY, BROKEN.- Specified by:
onReferenceEvent
in interfaceIPropReference
- Parameters:
reference
- The property reference object.event
- The event.triggerEvent
- The event that triggered this reference event, null for none.
clearError
protected final void clearError()
Clears the error.
addError
protected final void addError(java.lang.String err)
Adds an error.
targetChanged
protected final void targetChanged(GProp<?> prop)
Internal method called when target changes.
getVSTarget
public final TARGET getVSTarget()
Gets the target VS component.- Returns:
- The target resolved, null for none (or not a valid reference).
isReferenceValid
public boolean isReferenceValid(GProp<?> property)
Validates the property reference that has been looked up. Override to provide additional functionality than checking for property class type matching with
.getPropertyClass()
- Specified by:
isReferenceValid
in interfaceIPropReference
- Parameters:
property
- The property to validate.- Returns:
- true if valid, false otherwise.
getReferences
public int getReferences(java.util.List<Reference> references)
Gets the references of this property top others. This method is typically used in the Designer to search for circular references during verification.- Specified by:
getReferences
in interfaceIGProp<TARGET extends VSComponent>
- Overrides:
getReferences
in classGProp<java.lang.String>
- Parameters:
references
- The references array is filled in by this method.- Returns:
- The count of references added.
onVirtualizationCompleted
protected void onVirtualizationCompleted(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, boolean isPostResolve)
Called when virtualization completed.This method is called to the entire tree of the newly virtualized property container.
- Overrides:
onVirtualizationCompleted
in classGProp<java.lang.String>
- Parameters:
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can benull
if not initialized from the client gyro.virtualSpace
- The virtualized VirtualSpace.virtualizedProp
- The property being virtualized.isPostResolve
- Flag indicating this call is done after references are attempted to be resolved.
getPropertyClass
public abstract java.lang.Class<? extends GProp<?>> getPropertyClass()
Gets the class wanted.
getReferenceDescription
public abstract java.lang.String getReferenceDescription()
Gets a short description of this reference, e.g. "VirtualSpace" or "Label For".- Specified by:
getReferenceDescription
in interfaceIPropReference
- Returns:
- The reference description string.
onResolved
protected abstract void onResolved(TARGET target)
Called when the property reference has been resolved.- Parameters:
target
- The target reference.
onRemoved
protected abstract void onRemoved(TARGET oldTarget)
Called when the property reference has been disposed of e.g. due to new reference or pure disposal of this property.- Parameters:
oldTarget
- The old target reference.