public abstract class GProp<VALUE> extends Object implements IGProp<VALUE>, Cloneable, EventListener
Modifier and Type | Field and Description |
---|---|
protected static boolean |
GPDEBUG
Debug mode.
|
static String |
PROP_ATTR_STRING_EDITOR_PROP
Property attribute: Editor property.
|
static String |
PROP_ATTR_STRING_ERRORED_NAME
Property attribute: errored property name, event value = String or null.
|
static String |
PROP_ATTR_STRING_EXTENDS
Property attribute: extends.
|
static String |
PROP_ATTR_STRING_EXTENDS_FINAL
Property attribute: extends private.
|
static String |
PROP_ATTR_STRING_EXTENDS_PRIVATE
Property attribute: extends private.
|
static String |
PROP_ATTR_STRING_NULLABLE
Property attribute: nullable.
|
static String |
PROP_ATTR_STRING_PRIVATE
Property attribute: private.
|
static String |
PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT
Property attribute: private change event.
|
static String |
PROP_ATTR_STRING_READ_ONLY
Property attribute: read-only.
|
protected static int |
PROP_USER_1
Flag indicating property is a USER_1 and not written to XML.
|
protected static int |
PROP_USER_2
Flag indicating property is a USER_2 and not written to XML.
|
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
Modifier | Constructor and Description |
---|---|
protected |
GProp()
Creates a generic property.
|
protected |
GProp(Atom propertyAtom)
Creates a generic property with the specified name with a null value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addPropError(IPropErrorItem item)
Adds an error input to the property.
|
void |
addPropListener(EventListener l)
Adds a listener for the property.
|
protected abstract void |
appendPropValue(PropMgr propertyManager,
Transaction trans,
Object value)
Appends the property value and all its children to a transaction using
the
AtomManager . |
GProp<?> |
clone()
Creates a clone out of this property.
|
protected Object |
convertPropError(String string,
Exception thrown)
Creates and throws a PropertyException when the
String doesn't
convert properly into a "native" Object. |
void |
dispose()
Disposes of the property, but doesn't remove it from a parent.
|
boolean |
equals(Object o)
Checks for equality, including private properties.
|
boolean |
equals(Object o,
int how)
Checks for equality.
|
protected boolean |
equalsErrors(PropError pe1,
PropError pe2,
int how)
Processes error property verification.
|
Object |
equalsObj(Object o,
int how)
Checks for equality.
|
boolean |
equalsPropValue(Object otherPropValue)
Checks if another value is equal to the value in this object.
|
protected Object |
equalsTree(PropCnr pc,
int how)
Checks for equality in the whole container structure.
|
protected Object |
equalValues(GProp<?> compareTo,
VALUE thisValue,
VALUE compareValue,
int how)
Checks for property value equality.
|
GProp<?> |
extendsClone()
Creates a clone out of this property for the Extends Framework.
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
void |
fine(String msg)
Logs a fine event.
|
void |
fine(String msg,
Object... params)
Logs a fine event.
|
void |
finer(String msg)
Logs a finer event.
|
void |
finer(String msg,
Object... params)
Logs a finer event.
|
void |
finest(String msg)
Logs a finest event.
|
void |
finest(String msg,
Object... params)
Logs a finest event.
|
Object |
fromElementString(String string)
Called from the
initializeProperty(Element element) method
once the element String is retrieved from the "value" attribute of the element. |
String |
getAliasName(GProp<?> requestor,
String projectName)
Gets an alias name for a project name, the alias does NOT begin with "*".
|
IAppSessionGyro |
getAppSessionGyro()
Returns the Application Session Gyro instance of this virtualized property.
|
Worker |
getAppWorker()
Gets the application session worker.
|
Atom[] |
getAtomPath(PropCnr stopAt)
Gets the atom path of this property.
|
static String |
getAttribute(Element element,
String name)
Gets a attribute string.
|
String |
getChildReferencePropName(GProp<?> child)
Gets the child's reference property name for this property.
|
IClientSessionGyro |
getClientSessionGyro()
Returns the Client Session Gyro instance of this virtualized property.
|
Worker |
getClientWorker()
Gets the client session worker.
|
String |
getConstraints()
Gets the constraints string for this property.
|
EnvProps |
getEnvironment()
Gets the environment properties.
|
void |
getErroredPropItems(ArrayList<PropErrorItemOrigin> list,
boolean excludeExtends)
Retrieves the list of error items for this property and its children (if this property is a container).
|
void |
getErroredProps(ArrayList<GProp<?>> list,
boolean excludeExtends)
Retrieves the properties containing errors.
|
ErrorsProp |
getErrorsProp()
Gets the error property from the parent.
|
PropCnr |
getExtendsRootContainer()
Searches for an Extends container for a property.
|
String |
getFullPropName()
Gets the full name of this property, i.e.
|
String |
getFullPropName(GProp<?> requestor)
Gets the full name of this property, i.e.
|
String |
getFullPropNameDebug()
Gets the full name of this property, i.e.
|
String |
getFullPropNameDebug(GProp<?> requestor)
Gets the full name of this property, i.e.
|
EventListener[] |
getListeners()
Gets the listeners.
|
PropCnr |
getParent()
Gets the parent of this property.
|
<PROPCNR extends PropCnr> |
getParent(Class<PROPCNR> clazz)
Gets the parent of this property with the requested type.
|
String |
getProjectName(GProp<?> requestor,
String alias)
Gets the project name from an alias, the alias does NOT begin with "*".
|
Atom |
getPropAtom()
Gets the atom used for the name of this property.
|
PropCnr |
getPropBaseReference()
Gets a base property container reference instance from the container or any parent containers.
|
PropError |
getPropError()
Gets the property error instance.
|
IPropErrorItem |
getPropError(String id)
Gets the error input item with specified ID, for none specify
empty string.
|
String |
getPropErroredName()
Gets the errored (atom) name input by the user.
|
int |
getPropErrorSeverity()
Gets the error severity of this property.
|
int |
getPropExtendsFlags()
Checks if this property extends another property, and if so gets the extends flags.
|
GProp<?> |
getPropFromPath(GProp<?> requestor,
String path)
Finds a property in the tree of the requested name from a path specification, i.e.
|
GProp<?> |
getPropFromPath(String path)
Finds a property in the tree of the requested name from a path specification, i.e.
|
GProp<?> |
getPropFromReference(GProp<?> requestor,
String path)
Internal function for getPropFromReference(ref).
|
GProp<?> |
getPropFromReference(String ref)
Gets a property from a reference name.
|
int |
getPropIndex()
Gets the index of this property in the parent container.
|
String |
getPropName()
Gets the name of this property.
|
PropCnr[] |
getPropPath(boolean includeThisPropCnr)
Gets the parents to the root of this property.
|
PropCnr[] |
getPropPath(boolean includeThisPropCnr,
IPropCnr stop)
Gets the parents to the input property or the root of this property.
|
protected GProp<?> |
getPropReferenceTarget()
Retargets the reference request as required.
|
PropMgr |
getPropRootPropMgr()
Gets the Property Manager used for communication for the root container.
|
int |
getPropTreeErrorSeverity(boolean excludeExtends)
Gets the maximum error severity of this property or any property below.
|
VALUE |
getPropValue()
Gets the current value set, null for an uninitialized value.
|
Object |
getPropValue(Class<?> requestedType)
Gets the property value in another class form than the "native" one.
|
protected abstract Object |
getPropValue0(Object value,
int index)
Gets the property value in another class form than the "native" one.
|
Object |
getPropValueObject()
Gets the current value set, null for an uninitialized value.
|
String |
getReferencePropName()
Gets the reference property name, overridden when used in the Designer to skip the
file storage property, and by the root property.
|
int |
getReferences(List<Reference> references)
Gets the references of this property top others.
|
String |
getRelativePropName(IPropCnr container)
Gets the relative name of this property to a container.
|
PropCnr |
getRootFromName(GProp<?> requestor,
String module)
Gets the module root for a name.
|
String |
getRootName(GProp<?> requestor)
Gets and checks if this container is the root.
|
PropCnr |
getRootParent()
Gets the root container in the property tree.
|
protected PropCnr |
getRootParent(GProp<?> requestor)
Gets the root container in the property tree.
|
Object |
getTreeLock()
Gets the tree-lock object used when locking the property tree when
structural changes are made or when creating/reading transactions that
could potentially cause a structural change.
|
abstract Class<?>[] |
getValueClasses()
Gets the list of possible native Java classes that can be used to set a value using
setPropertyValue , in order of importance. |
VSReference |
getVSReference(Atom refAtom)
Gets a VSReference instance from the container or any parent containers.
|
boolean |
hasChanged()
Checks if the value has been changed since last time the other party was
updated by a call to
append or since last call to
{link #resetChangedTree()} . |
boolean |
hasPrivateChangeEventProp()
Checks the flag indicating this property uses a "private" change event, i.e.
|
boolean |
hasPropError()
Checks if this property has an error.
|
boolean |
hasPropTreeError(boolean excludeExtends)
Checks if any property in the tree below this property has an error.
|
void |
info(String msg)
Logs an informational event.
|
void |
info(String msg,
Object... params)
Logs an informational event.
|
protected void |
initializeElement(Element element)
Called when the XML file for the property tree is serialized from properties.
|
void |
initializeGElement(Element element)
Called when the XML file for the property tree is serialized from properties.
|
void |
initializeGProp(Element element)
Called to initialize the generic property from an
Element . |
protected void |
initializeProp(Element element)
Called to initialize the property from an
Element . |
protected abstract boolean |
initializeValue(PropMgr propertyManager,
Transaction trans)
Initializes the property value from a transaction.
|
boolean |
isDisposed()
Checks if the property is disposed.
|
boolean |
isPropChildOf(IPropCnr parent)
Checks if this property is child of a parent property.
|
boolean |
isPropClientCreated()
Checks if this property is created on the client or not.
|
boolean |
isPropCommunicating()
Checks if this property container is used with the communication framework.
|
boolean |
isPropCreateRequired()
Checks if this property requires a "create transaction" when sent to the other
party (server to client or vice versa).
|
boolean |
isPropExtended()
Checks the flag indicating this property is a property belonging to another container.
|
boolean |
isPropExtendsFinal()
Checks if this property is Extends Final in regards to the Extends Framework.
|
boolean |
isPropExtendsPrivate()
Checks if this property is Extends Private in regards to the Extends Framework.
|
boolean |
isPropExtendsPrivateInRoot()
Checks if the property is Extends Private from this property and up to, but not
including the "isExtendsRoot()" property container in the parent chain of properties.
|
boolean |
isPropExtendsPrivateInRoot(IPropCnr root)
Checks if the property is Extends Private from this property and up to, but not
including the "isExtendsRoot()" property container in the parent chain of properties.
|
boolean |
isPropFile()
Checks if this is a File property container.
|
boolean |
isPropFolder()
Checks if this is a Folder property container.
|
boolean |
isPropForEditor()
Checks if this property is for the Editor only and should e.g.
|
boolean |
isPropNullable()
Checks if this property is nullable.
|
boolean |
isPropPrivate()
Checks if this property is private, i.e.
|
protected boolean |
isPropPrivateAtCreation()
Called upon creation of the property to check it's private state.
|
boolean |
isPropReadOnly()
Checks if this property is read-only.
|
boolean |
isPropReferenceTreeValid()
Verifies if the tree is valid for reference creation.
|
boolean |
isPropRoot()
Checks if this is a root property container.
|
protected boolean |
isPropUSER(long userValue)
Checks if this property is "PROP_USER_*.
|
protected boolean |
isPropValueTreeLockNeeded()
Checks if the tree needs to be locked when setting the property value.
|
boolean |
isPropVirtualized()
Checks if this property has been virtualized.
|
protected boolean |
isPropVirtualizing()
Checks if currently virtualizing during a clone operation.
|
boolean |
isPropVolatile()
Checks if this property is volatile, i.e.
|
protected boolean |
isPropVolatileOrEditorOnly()
Checks if this property is volatile, i.e.
|
boolean |
isProxied()
Checks if a property is a child of a proxied property container.
|
void |
list()
Prints a listing of this property to the standard system output
stream
System.out . |
void |
list(PrintStream out)
Prints a listing of this property to the specified output stream.
|
void |
list(PrintStream out,
int indent)
Prints out a list, starting at the specified indentation, to the
specified print stream.
|
void |
list(PrintWriter out)
Prints a listing to the specified print writer.
|
void |
list(PrintWriter out,
int indent)
Prints out a list, starting at the specified indentation, to
the specified print writer.
|
String |
mapAliasToReference(GProp<?> requestor,
String aliasReference)
Maps an alias reference name to a reference name.
|
String |
mapAliasToReference(String aliasReference)
Maps an alias reference name to a reference name.
|
String |
mapReferenceToAlias(GProp<?> requestor,
String referenceName)
Maps a reference name to an alias name.
|
String |
mapReferenceToAlias(String referenceName)
Maps a reference name to an alias name.
|
String |
mapReferenceToProjectRelative(String referenceName)
Maps a reference name to project relative format, i.e.
|
protected int |
modifyPropValue(Object oldValue,
Object newValue,
PropMgr propMgr)
Called when setting a new value for this property.
|
boolean |
moveProp(PropCnr moveToContainer)
Moves this property container to another container, without changing the listeners.
|
boolean |
moveProp(PropCnr moveToContainer,
Atom newName,
Atom reference,
boolean isAfter)
Moves this property container to another container, without changing the listeners.
|
boolean |
moveProp(PropCnr moveToContainer,
Atom newName,
int destinationIndex)
Moves this property container to another container, without changing the listeners.
|
void |
onEvent(GEvent event)
Called when a property event is send to this property.
|
void |
onEventSelf(GEvent event)
Called when a property event is send to this property.
|
protected void |
onPrepare(IAppOwner appOwner,
IModuleOwner moduleOwner,
boolean isPostCall,
List<Throwable> errors)
Called when the application is being prepared.
|
protected void |
onPropDispose()
Called when a property is disposed of by delete/remove in a container,
or by the dispose method.
|
protected void |
onPropInvalidateCache()
Invalidates a potential cache in this property.
|
protected void |
onPropParentChanged(PropCnr oldParent,
PropCnr newParent)
Called when the parent is changed for this class.
|
void |
onPropTreeInitialized()
Called when the property has initialized from the Element when streamed from an XML file,
has had all (if any) children elements and nodes added as properties and that the property
has been added into it's parent.
|
protected void |
onPropValueSet(Object oldValue)
Called when the property value is changed by the
GProp class. |
protected void |
onReferenceEvent(ResolveReferencesEvent event)
Called to perform reference resolving.
|
void |
onRemoteEvent(RemoteEvent event)
Called when a remote property event should be processed by this property.
|
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 String |
paramString()
Returns the parameter string representing the state of this event.
|
protected String |
paramValue(Object value)
Formats the value as a string to add to
paramString . |
void |
post(Runnable runnable)
Post a runnable for invocation at a later stage by the worker thread (or SWT thread
for the Designer).
|
void |
post(Worker worker,
Runnable runnable)
Post a runnable for invocation at a later stage by the worker thread (or SWT thread
for the Designer if the worker parameter is null).
|
boolean |
removePropError(String id)
Removes an error input from the property.
|
void |
removePropListener(EventListener l)
Removes a listener for the property.
|
protected void |
removePropUSER(long userValue)
Removes the flag indicating property is "PROP_USER_*.
|
boolean |
renameProp(Atom propertyAtom)
Renames this property.
|
boolean |
renameProp2(Atom propertyAtom)
Renames this property.
|
protected void |
resetChangedTree()
Forces clearing of the change flag for this property and all its children.
|
void |
resolveRuntimeReferences(IRuntimeResolver resolver)
Called before transactions are prepared for sending.
|
void |
setChanged()
Forces setting of the change flag.
|
void |
setConstraints(Object constraints,
String prevConstraints,
Element prevElement)
Sets the constraints for the property previously returned from the same constraints
call to
setConstraints(String,Element) with the same String and Element
as this instance would require. |
Object |
setConstraints(String constraints,
Element element)
Sets the constraints for the property.
|
protected boolean |
setCreateRequiredProp()
Sets the flag indicating property requires a "create transaction" when sent
to the other party (server to client or vice versa).
|
void |
setParent(IPropCnr aParent)
Sets the parent for this property.
|
boolean |
setPrivateChangeEventProp(boolean on)
Sets the flag indicating this property uses a "private" change event, i.e.
|
protected void |
setPrivateCreateRequiredProp()
Sets the flag indicating property requires a "create transaction" when sent
to the other party (server to client or vice versa).
|
boolean |
setPropError(PropError error)
Sets all or clears the errors for the property.
|
boolean |
setPropErroredName(String name)
Sets the errored name for this property.
|
void |
setPropExtended(boolean on)
Sets the flag indicating this property is extended.
|
boolean |
setPropExtendsFinal(boolean on)
Sets the flag indicating property is a Extends Final property in the container
when this property belongs to the Extends Framework.
|
boolean |
setPropExtendsPrivate(boolean on)
Sets the flag indicating property is a Extends Private property in the container
when this property belongs to the Extends Framework.
|
void |
setPropForEditor(boolean on)
Sets the flag indicating property is the Editor only.
|
boolean |
setPropNullable(boolean on)
Sets the flag indicating property is nullable with setPropValue.
|
boolean |
setPropPrivate(boolean on)
Sets the flag indicating property is private.
|
boolean |
setPropReadOnly(boolean on)
Sets the flag indicating property is read-only.
|
protected void |
setPropUSER(long userValue)
Sets the flag indicating property is "PROP_USER_*.
|
boolean |
setPropValue(Object newValue)
Sets a new value for this property.
|
boolean |
setPropValue(Object newValue,
IGProp<?> trigger)
Sets a new value for this property.
|
protected boolean |
setPropValue(Object newValue,
PropMgr propMgr)
Sets a new value for this property.
|
protected void |
setPropValueIncognito(Object newValue)
Sets a new value for this property.
|
void |
setPropVolatile()
Sets the flag indicating property is "volatile" and is not written to XML.
|
void |
severe(String msg)
Logs a severe event.
|
void |
severe(String msg,
Object... params)
Logs a severe event.
|
void |
severe(String msg,
Throwable exception)
Logs a severe event.
|
protected boolean |
shouldSerializeToXML(int programType)
Method used to check for serialization to XML.
|
protected void |
throwIfReadOnly()
Throw an error if the property is read-only.
|
String |
toElementString(Object value)
Called from the
initializeElement(Element element) method. |
Object |
toNativeValue(Object value)
Tries conversion of possibly accepted properties values using the
setPropertyValue method
into the most preferred property value type. |
protected abstract Object |
toNativeValue0(Object value,
int index)
Tries conversion of possibly accepted properties values using the
setPropertyValue method
into the most preferred property value type. |
String |
toString()
Returns a string representation of this component and its values.
|
static String |
toString(IGProp<?> gp)
Returns a string representation of this component and its values.
|
void |
triggerRemoteEvent(int localID)
Triggers a remote event for execution at the remote party
onRemoteEvent() method
of this remote property instance. |
void |
triggerRemoteEvent(int localID,
PropCnr params)
Triggers a remote event for execution at the remote party
onRemoteEvent() method
of this remote property instance. |
void |
validateProp(Object newValue)
Validates the value to set by first calling
validateType ,
then validateValue and finally calling an optional
validator (if set). |
abstract void |
validatePropType(Object newValue)
Validates the newValue against the property object type.
|
void |
validatePropValue(Object newValue)
Validates the value to set.
|
void |
verify(PropVerification verification)
Verifies this property.
|
boolean |
verifyHasPropertyItem(String propertyItem)
Checks if this property has the property item during validation of references.
|
protected GProp<?> |
virtualize(IAppSessionGyro appGyro,
IClientSessionGyro clientGyro,
VirtualSpace virtualSpace,
PropCnr virtualizedProp)
Call this method to "virtualize" a property tree.
|
void |
warning(String msg)
Logs a warning event.
|
void |
warning(String msg,
Object... params)
Logs a warning event.
|
void |
warning(String msg,
Throwable exception)
Logs a warning event.
|
protected static boolean GPDEBUG
protected static final int PROP_USER_1
protected static final int PROP_USER_2
public static final String PROP_ATTR_STRING_READ_ONLY
public static final String PROP_ATTR_STRING_PRIVATE
public static final String PROP_ATTR_STRING_NULLABLE
public static final String PROP_ATTR_STRING_EDITOR_PROP
public static final String PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT
public static final String PROP_ATTR_STRING_EXTENDS
public static final String PROP_ATTR_STRING_EXTENDS_PRIVATE
public static final String PROP_ATTR_STRING_EXTENDS_FINAL
public static final String PROP_ATTR_STRING_ERRORED_NAME
protected GProp()
PropertyManager
, but as the call is dynamically
processed, an empty constructor is easiest to handle.
Once the property is created, the initialize(String name)
method should be called.
protected GProp(Atom propertyAtom)
initialize
method must then be called.propertyAtom
- the property atom.public final void dispose()
All children of this property, if any, will also be disposed of.
This method calls the onPropDispose()
method.
public final boolean isDisposed()
isDisposed
in interface IGProp<VALUE>
protected void finalize() throws Throwable
When called, the property is disposed of.
public void post(Runnable runnable)
runnable
- The runnable.public void post(Worker worker, Runnable runnable)
In the server, this call MUST be done from a virtualized property if the worker
is null
. The worker used is the application session worker.
worker
- The worker to use, null for default.runnable
- The runnable.public Worker getAppWorker()
Do not abuse of this method (save the reference to the worker) as it requires a little look-up work to get the application session gyro.
IllegalStateException
- If called in the server and the AppSessionGyro cannot
be retrieved AND the property is virtualized.public Worker getClientWorker()
Do not abuse of this method (save the reference to the worker) as it requires a little look-up work to get the client session gyro.
IllegalStateException
- If called in the server and the ClientSessionGyro cannot
be retrieved AND the property is virtualized.public EventListener[] getListeners()
public final Object getTreeLock()
getTreeLock
in interface IGProp<VALUE>
public final boolean isPropClientCreated()
isPropClientCreated
in interface IGProp<VALUE>
protected void onPropInvalidateCache()
public void resolveRuntimeReferences(IRuntimeResolver resolver)
This call is propagated in the entire client tree.
resolveRuntimeReferences
in interface IGProp<VALUE>
resolver
- The reference resolver.public abstract Class<?>[] getValueClasses()
setPropertyValue
, in order of importance. Note that loss of precision
in data if e.g. an Float property accepts a Double. However, the setPropertyValue
throws IllegalArgumentException
if the range in invalid, e.g. conversion
of a Integer to a Byte, and the value is not -127 to 128.getValueClasses
in interface IGProp<VALUE>
setPropertyValue
method.
The first type is the "native" or most preferred type. The array is at least one item in length
and never null.public GProp<?> clone() throws CloneNotSupportedException
Cloning is used for "virtualization" of a property tree in the
server. Client property classes will therefore throw
CloneNotSupportedException
.
Once a tree has been cloned, the change-flag is reset, and the create-flag is set. All listeners are also removed! The new cloned property is an orphan, i.e. has no parent set.
Note that the cloning process is done WITHOUT thread synchronization for performance reasons, thus no modifications should be done to the tree!
clone
in class Object
CloneNotSupportedException
- If a subclass doesn't allow cloning,
e.g. the client properties.public GProp<?> extendsClone() throws CloneNotSupportedException
clone
, except that
every property is marked as Extended (can be checked by isPropExtended()
),
and property container do not clone the Extends Private properties
(that return true to isPropExtendsPrivate()
).CloneNotSupportedException
protected void onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, List<Throwable> errors) throws PropException
onPrepare
calls
is always parent first, the children. The method is called twice, first time with isPostCall
set to false
, then a second time with true
.appOwner
- The application owner.moduleOwner
- The Module owner.isPostCall
- Flag indicating this is a post-call.errors
- A list of errors that occurred but did not cause an abort.PropException
- For property errors during the application preparation to need to abort.protected boolean isPropVirtualizing()
protected GProp<?> virtualize(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp) throws CloneNotSupportedException, PropException
This method is similar to cloning, but enables references that are already resolved to remain if they point to a shared instance, e.g. the VirtualSpace pointing to its participants in the application property container shared instance, or a panel with references to text IDs, assets, etc.
It is up to the property class to handle this by overriding this method.
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can be null
if not
initialized from the client gyro.virtualSpace
- The virtualized VirtualSpace.virtualizedProp
- The property being virtualized.CloneNotSupportedException
- If a subclass doesn't allow cloning, e.g. the client properties.PropException
- For property errors during the virtualization.protected void onVirtualized(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, GProp<?> clonedProp) throws PropException
Override to perform required processing.
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can be null
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.PropException
- For property errors during the virtualization.protected void onVirtualizationCompleted(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, boolean isPostResolve)
This method is called to the entire tree of the newly virtualized property container.
appGyro
- The application gyro instance performing the virtualization.clientGyro
- The client gyro session, can be null
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.public IAppSessionGyro getAppSessionGyro()
To get the
instance from the current
thread use IAppSessionGyro
, or
IAppSessionGyro.getSessionInstance()
to
get it from the session information instance.
IAppSessionGyro.getSessionInstance(SessionInfo)
Do not abuse of this method as it requires a little look-up work.
getAppSessionGyro
in interface IGProp<VALUE>
public IClientSessionGyro getClientSessionGyro()
IClientSessionGyro
support.
To get the
instance from the current
thread use IClientSessionGyro
, or
IClientSessionGyro.getSessionInstance()
to
get it from the session information instance.
IClientSessionGyro.getSessionInstance(SessionInfo)
Do not abuse of this method as it requires a little look-up work.
getClientSessionGyro
in interface IGProp<VALUE>
UIPanelBase
(panels) tree (or for certain data connectors),
null otherwise.public final boolean renameProp(Atom propertyAtom) throws PropException
renameProp
in interface IGProp<VALUE>
propertyAtom
- The new atom name.PropException
- If rename causes duplicate names in parent.NullPointerException
- If propertyAtom is null.public final boolean renameProp2(Atom propertyAtom)
propertyAtom
- The new atom name.InternalError
- If rename causes duplicate names in parent.NullPointerException
- If propertyAtom is null.public final Atom getPropAtom()
getPropAtom
in interface IGProp<VALUE>
public final String getPropName()
getPropName
in interface IGProp<VALUE>
public String getPropErroredName()
public boolean setPropErroredName(String name) throws PropTypeException
name
- The name, or null for no error.PropTypeException
- If the property is read-only.public String getRootName(GProp<?> requestor)
"module:"
and in ""
(empty string) when running in the Server.
When running with assertions, this call throws an assertion error by default, showing that the call is directed to a non-root property container.
requestor
- The requestor of the information.public String getProjectName(GProp<?> requestor, String alias)
requestor
- The requestor of the information.alias
- The alias.public String getAliasName(GProp<?> requestor, String projectName)
requestor
- The requestor of the information.projectName
- The project name (without ending ':').public PropCnr getRootFromName(GProp<?> requestor, String module)
When running with assertions, this call throws an assertion error by default, showing that the call is directed to a non-root property container.
requestor
- The requestor of the information.module
- The module name (without colon), i.e. the project name in the Designer.public String getFullPropName()
getReferencePropName()
is that instances of FilePropCnr
are omitted in the path in
getReferencePropName()
, but not in this method.getFullPropName
in interface IGProp<VALUE>
public String getFullPropName(GProp<?> requestor)
getReferencePropName()
is that instances of FilePropCnr
are omitted in the path in
getReferencePropName()
, but not in this method.requestor
- The requestor.public String getFullPropNameDebug()
getReferencePropName()
is that instances of FilePropCnr
are omitted in the path in
getReferencePropName()
, but not in this method.
This method is equal to the getFullPropName()
method, without checks for root parent.
This method is typically used for debugging and trace output.
getFullPropNameDebug
in interface IGProp<VALUE>
public String getFullPropNameDebug(GProp<?> requestor)
getReferencePropName()
is that instances of FilePropCnr
are omitted in the path in
getReferencePropName()
, but not in this method.
This method is equal to the getFullPropName()
method, without checks for root parent.
This method is typically used for debugging and trace output.
requestor
- The requestor.public final String getRelativePropName(IPropCnr container)
getRelativePropName
in interface IGProp<VALUE>
container
- The container to use as base name, null if root is required."path/propName"
,
empty string if no parent or container
parameter is this property.
null
is returned if the container is not a parent of this property, i.e.
if the root is found before the container.public boolean isPropRoot()
isPropRoot
in interface IGProp<VALUE>
public PropMgr getPropRootPropMgr()
getPropRootPropMgr
in interface IGProp<VALUE>
public boolean isPropReferenceTreeValid()
isPropReferenceTreeValid
in interface IGProp<VALUE>
public boolean isPropFolder()
FolderPropCnr
.isPropFolder
in interface IGProp<VALUE>
FolderPropCnr
, false otherwise.public boolean isPropFile()
FilePropCnr
.isPropFile
in interface IGProp<VALUE>
FilePropCnr
, false otherwise.public final String mapAliasToReference(String aliasReference)
Alias reference names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
mapAliasToReference
in interface IGProp<VALUE>
aliasReference
- The alias reference name.aliasReference
.
If the aliasReference is not found, the same String as the input aliasReference
is returned.public String mapAliasToReference(GProp<?> requestor, String aliasReference)
Alias reference names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
requestor
- The requestor.aliasReference
- The alias reference name.aliasReference
.
If the aliasReference is not found, the same String as the input aliasReference
is returned.public final String mapReferenceToAlias(String referenceName)
Alias names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
mapReferenceToAlias
in interface IGProp<VALUE>
referenceName
- The reference name.referenceName
.
If there is not alias for the project, the same String as the input referenceName
is returned.public String mapReferenceToAlias(GProp<?> requestor, String referenceName)
Alias names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
requestor
- The requestor.referenceName
- The reference name.referenceName
.
If there is not alias for the project, the same String as the input referenceName
is returned.public final String mapReferenceToProjectRelative(String referenceName)
mapReferenceToProjectRelative
in interface IGProp<VALUE>
referenceName
- The reference name.referenceName
is returned.public final String getReferencePropName()
getReferencePropName
in interface IGProp<VALUE>
public String getChildReferencePropName(GProp<?> child)
child
- The child requesting the name.public GProp<?> getPropFromReference(String ref)
getPropFromReference
in interface IGProp<VALUE>
ref
- The reference string.public GProp<?> getPropFromReference(GProp<?> requestor, String path)
Gets a property from a reference name. This can be called from any property in the property tree, and will direct the request to the root property.
requestor
- The requestor.path
- The reference path.protected GProp<?> getPropReferenceTarget()
this
, should never return null.public GProp<?> getPropFromPath(String path)
The "part" as ".." specifies the parent property, if any, otherwise null
is returned.
The path may start with "project:/path" (for the Designer) or "/path", in which case the path is taken from the root.
The path may be relative or absolute, with or without a project specification.
getPropFromPath
in interface IGProp<VALUE>
path
- the path name of the property to locate in the tree.null
for uninitialized container
or the property with specified name is not found.public final GProp<?> getPropFromPath(GProp<?> requestor, String path)
The "part" as ".." specifies the parent property, if any, otherwise null
is returned.
The path may start with "project:/path" (for the Designer) or "/path", in which case the path is taken from the root.
The path may be relative or absolute, with or without a project specification.
requestor
- The requestor.path
- The path name of the property to locate in the tree.null
for uninitialized container
or the property with specified name is not found.public final boolean isPropChildOf(IPropCnr parent)
Checks if this property is child of a parent property. The parent tree is searched.
isPropChildOf
in interface IGProp<VALUE>
parent
- The parent to check.public final void setParent(IPropCnr aParent)
public final PropCnr getParent()
public final <PROPCNR extends PropCnr> PROPCNR getParent(Class<PROPCNR> clazz)
public final PropCnr getRootParent()
getRootParent
in interface IGProp<VALUE>
protected PropCnr getRootParent(GProp<?> requestor)
requestor
- The requestor.public final boolean isProxied()
public final Atom[] getAtomPath(PropCnr stopAt)
getAtomPath
in interface IGProp<VALUE>
stopAt
- Stop at this property container. If null the root is used.stopAt
is not a grand-parent.public final PropCnr[] getPropPath(boolean includeThisPropCnr)
getPropPath
in interface IGProp<VALUE>
includeThisPropCnr
- If true and this property is an instance of PropCnr, it is added at the end of the array.public final PropCnr[] getPropPath(boolean includeThisPropCnr, IPropCnr stop)
getPropPath
in interface IGProp<VALUE>
includeThisPropCnr
- If true and this property is an instance of PropCnr, it is added at the end of the array.stop
- The property container to stop at (it will be included as the first element in the array).public EnvProps getEnvironment()
getEnvironment
in interface IGProp<VALUE>
public final int getPropIndex()
getPropIndex
in interface IGProp<VALUE>
protected void onPropParentChanged(PropCnr oldParent, PropCnr newParent)
oldParent
- The old parent (or null if none).newParent
- The new parent (or null if none).public final boolean moveProp(PropCnr moveToContainer) throws PropException
This method is only intended for the designer, and the interface "com.iizigo.prop.IPropDesigner" must be implemented in both this container as well as the receiver.
During the move, two "onPropParentChanged" calls are done to the property, first to set parent to null, then to the new parent.
Note: This method is not thread-safe, but used in an "SWT-thread-safe'd" environment, in conjunction with Eclipse Data Structure Integrity within a project in a workspace, it is safe.
moveProp
in interface IGProp<VALUE>
moveToContainer
- The container to move this container to.PropException
- If the destination container cannot receive this container due to
duplicate name or that it is read-only. It is also thrown if this
container has no parent or the parent is read-only.public final boolean moveProp(PropCnr moveToContainer, Atom newName, Atom reference, boolean isAfter) throws PropException
This method is only intended for the designer, and the interface "com.iizigo.prop.IPropDesigner" must be implemented in both this container as well as the receiver.
During the move, two "onPropParentChanged" calls are done to the property, first to set parent to null, then to the new parent.
Note: This method is not thread-safe, but used in an "SWT-thread-safe'd" environment, in conjunction with Eclipse Data Structure Integrity within a project in a workspace, it is safe.
moveProp
in interface IGProp<VALUE>
moveToContainer
- The container to move this container to.newName
- The new name of the property, null for same.reference
- The reference atom where to place the moved property (before or after), null indicates added last.isAfter
- Flag to move the property after reference (if non-null), otherwise it's before.PropException
- If the destination container cannot receive this container due to
duplicate name or that it is read-only. It is also thrown if this
container has no parent or the parent is read-only.public final boolean moveProp(PropCnr moveToContainer, Atom newName, int destinationIndex) throws PropException
This method is only intended for the designer, and the interface "com.iizigo.prop.IPropDesigner" must be implemented in both this container as well as the receiver.
During the move, two "onPropParentChanged" calls are done to the property, first to set parent to null, then to the new parent.
Note: This method is not thread-safe, but used in an "SWT-thread-safe'd" environment, in conjunction with Eclipse Data Structure Integrity within a project in a workspace, it is safe.
moveProp
in interface IGProp<VALUE>
moveToContainer
- The container to move this container to.newName
- The new name of the property, null for same.destinationIndex
- The reference atom where to place the moved property (before or after), null indicates added last.PropException
- If the destination container cannot receive this container due to
duplicate name or that it is read-only. It is also thrown if this
container has no parent or the parent is read-only.protected void onPropDispose()
This call is done just at the end of the delete/remove routine in the container, without synchronization.
During this call, whatever components that e.g. the client needs to disposed of is done.
Subclasses needing to perform some intelligent operations upon
deletion should do it by overloading this method and always call the
super.onPropDispose()
method.
public final void setChanged()
setChanged
will propagate to the topmost parent (if any).setChanged
in interface IGProp<VALUE>
public final boolean hasChanged()
append
or since last call to
{link #resetChangedTree()}
.hasChanged
in interface IGProp<VALUE>
protected final void resetChangedTree()
resetChangedTree
for all its children properties.protected boolean isPropPrivateAtCreation()
public final boolean setPropPrivate(boolean on)
If property private flag is turned off and the property defines the property as private at creation, an error is logged and false is returned.
setPropPrivate
in interface IGProp<VALUE>
on
- flag indicating if it's private or not.protected final void setPrivateCreateRequiredProp()
public final boolean isPropPrivate()
isPropPrivate
in interface IGProp<VALUE>
public boolean isPropCommunicating()
isPropCommunicating
in interface IGProp<VALUE>
public final void setPropVolatile()
public final boolean isPropVolatile()
protected boolean isPropVolatileOrEditorOnly()
public final boolean isPropVirtualized()
isPropVirtualized
in interface IGProp<VALUE>
protected final void setPropUSER(long userValue)
userValue
- The user value to add (bitwise).protected final void removePropUSER(long userValue)
userValue
- The user value to remove (bitwise).protected final boolean isPropUSER(long userValue)
public final boolean setPropReadOnly(boolean on)
setPropReadOnly
in interface IGProp<VALUE>
on
- flag indicating if it's read-only or not.public final boolean isPropReadOnly()
isPropReadOnly
in interface IGProp<VALUE>
protected final void throwIfReadOnly() throws PropTypeException
PropTypeException
- if the property is read-only.public final boolean setPropNullable(boolean on)
setPropNullable
in interface IGProp<VALUE>
on
- flag indicating if it's nullable or not.public final boolean isPropNullable()
isPropNullable
in interface IGProp<VALUE>
public final void setPropForEditor(boolean on)
on
- flag indicating if it's for the Editor only or not.public final boolean isPropForEditor()
public ErrorsProp getErrorsProp()
getErrorsProp
in interface IGProp<VALUE>
public final boolean addPropError(IPropErrorItem item)
addPropError
in interface IGProp<VALUE>
item
- The error item.public IPropErrorItem getPropError(String id)
getPropError
in interface IGProp<VALUE>
id
- The ID for the error, can be empty string (null means default empty string).public final boolean removePropError(String id)
removePropError
in interface IGProp<VALUE>
id
- The error ID, null for default (empty string).public final PropError getPropError()
getPropError
in interface IGProp<VALUE>
public boolean setPropError(PropError error)
error
instance is non-null,
a check if done if the error
instance is empty, and if so, changed to null,
causing it to have the same effect as to call setPropError(null)
.setPropError
in interface IGProp<VALUE>
error
- The error property or null to clear the errors.public final boolean hasPropError()
hasPropError
in interface IGProp<VALUE>
public final int getPropErrorSeverity()
getPropErrorSeverity
in interface IGProp<VALUE>
public final boolean hasPropTreeError(boolean excludeExtends)
hasPropTreeError
in interface IGProp<VALUE>
excludeExtends
- Flag indicating the properties that originates from the Extends Framework
should be excluded from the search.public final int getPropTreeErrorSeverity(boolean excludeExtends)
getPropTreeErrorSeverity
in interface IGProp<VALUE>
excludeExtends
- Flag indicating the properties that originates from the Extends Framework
should be excluded from the search.public final void getErroredProps(ArrayList<GProp<?>> list, boolean excludeExtends)
getErroredProps
in interface IGProp<VALUE>
list
- The list that will be filled in with the errored properties.excludeExtends
- Flag indicating the properties that originates from the Extends Framework
should be excluded from the search.public final void getErroredPropItems(ArrayList<PropErrorItemOrigin> list, boolean excludeExtends)
getErroredPropItems
in interface IGProp<VALUE>
list
- The list that will be filled with error items.excludeExtends
- Flag indicating the properties that originates from the Extends Framework
should be excluded from the search.protected boolean setCreateRequiredProp()
The property container overrides this method by first calling
super.setCreateRequiredProp()
then setCreateRequiredProp
to all its children.
public final boolean isPropCreateRequired()
isPropCreateRequired
in interface IGProp<VALUE>
public final boolean setPrivateChangeEventProp(boolean on)
setPrivateChangeEventProp
in interface IGProp<VALUE>
on
- flag indicates this is set (true) or cleared (false).public final boolean hasPrivateChangeEventProp()
hasPrivateChangeEventProp
in interface IGProp<VALUE>
public Object setConstraints(String constraints, Element element) throws PropException
This method must be overridden by subclasses in order to load the constraints properly if the constraints-string is not sufficient, i.e. that additional settings must be loaded from the XML Element.
setConstraints
in interface IGProp<VALUE>
constraints
- The constraints string from the properties definition.element
- The Element that loads the property class from the properties
definition. Note that Element may be null
if the
constructor isn't called from the PropertyFactory.PropertyFactory
with a
subsequent setConstraints(Object)
call instead of to this method.
This method always returns null
and must be overridden by
subclasses.PropException
- For errors in the constraints definitions.public void setConstraints(Object constraints, String prevConstraints, Element prevElement) throws PropException
setConstraints(String,Element)
with the same String and Element
as this instance would require.
This method must be overridden by subclasses in order to load the constraints properly if the constraints-string is not sufficient, i.e. that additional settings must be loaded from the XML Element.
setConstraints
in interface IGProp<VALUE>
constraints
- The constraints Object from the properties definition.prevConstraints
- The previous constraints string from the properties definition.prevElement
- The previous Element that loads the property class from the
properties definition.PropException
- For errors in the constraints definitions.public String getConstraints()
This method must be overridden by subclasses in order to return something
of interest, because this method by default returns null
.
getConstraints
in interface IGProp<VALUE>
setConstraints
to initiate
the constraints for this property.public final boolean setPropValue(Object newValue) throws PropException
setPropValue
in interface IGProp<VALUE>
newValue
- the new value.PropException
- When the new value doesn't validate correctly.PropTypeException
- If the property is read-only.public final boolean setPropValue(Object newValue, IGProp<?> trigger) throws PropException
setPropValue
in interface IGProp<VALUE>
newValue
- The new value.trigger
- The trigger property, or null for none.PropException
- When the new value doesn't validate correctly.PropTypeException
- If the property is read-only.protected boolean isPropValueTreeLockNeeded()
protected final boolean setPropValue(Object newValue, PropMgr propMgr) throws PropException
newValue
- The new value.propMgr
- The property manager for remote change, null for local.PropException
- When the new value doesn't validate correctly.PropTypeException
- If the property is read-only.protected void onPropValueSet(Object oldValue)
GProp
class. This method
is typically overridden by subclasses to clear cached values of a representation of this value.
Note: this method is called during a synchronized state of the class instance!
oldValue
- The old value.protected int modifyPropValue(Object oldValue, Object newValue, PropMgr propMgr) throws PropException
oldValue
- The old value.newValue
- The new value.propMgr
- The property manager for remote change, null for local.PropException
- when the new value doesn't validate correctly.protected final void setPropValueIncognito(Object newValue)
Note: no checking is done if the property is read-only, valid type or valid value or constraints!
newValue
- the new value.NullPointerException
- when newValue is null.public final void validateProp(Object newValue) throws PropException
validateType
,
then validateValue
and finally calling an optional
validator (if set).
Note: When this method is called, synchronization is done
at the property itself, so no synchronization on the tree should be done.
This method calls validatePropertyType
and
validatePropertyValue
in the property-synchronized code, so
these methods should not synchronize the tree either.
validateProp
in interface IGProp<VALUE>
newValue
- The new value to set.PropException
- when the new value doesn't validate correctly.public abstract void validatePropType(Object newValue) throws PropTypeException
Note: When this method is called, synchronization is done at the property itself, so no synchronization on the tree should be done.
validatePropType
in interface IGProp<VALUE>
newValue
- The new value to set.PropTypeException
- when the new value isn't of the correct class.public void validatePropValue(Object newValue) throws PropException
Note: When this method is called, synchronization is done at the property itself, so no synchronization on the tree should be done.
validatePropValue
in interface IGProp<VALUE>
newValue
- The new value to set.PropException
- when the new value doesn't validate correctly.public final Object getPropValueObject()
public final VALUE getPropValue()
getPropValue
in interface IGProp<VALUE>
public final Object getPropValue(Class<?> requestedType) throws IllegalArgumentException, Exception
Subclasses overrides the method getPropertyValue0
in order to provide the appropriate conversion.
getPropValue
in interface IGProp<VALUE>
requestedType
- The requested class type of the property value, using appropriate conversion.IllegalArgumentException
- If the class is not supported by the property for conversion.Exception
- Other exceptions that could occur.protected abstract Object getPropValue0(Object value, int index) throws Exception
Subclasses overrides this method getPropertyValue0
in order to provide the appropriate conversion.
value
- The property value.index
- The index in the Class array returned by getValueClasses()
.Exception
- Other exceptions that could occur.public final void addPropListener(EventListener l)
addPropListener
in interface IGProp<VALUE>
l
- The listener to add.public final void removePropListener(EventListener l)
removePropListener
in interface IGProp<VALUE>
l
- The listener to remove.public void onEventSelf(GEvent event)
A subclass can override this method to perform appropriate processing and is
not required to call super.onEventSelf(e)
.
onEventSelf
in interface IGProp<VALUE>
event
- The property event.public void onRemoteEvent(RemoteEvent event)
A subclass can override this method to perform appropriate processing and is
not required to call super.onRemoteEvent(e)
.
The onRemoteEvent is NOT called when in a proxied property container, but rather the normal onEventSelf method.
onRemoteEvent
in interface IGProp<VALUE>
event
- The remote event.public final void onEvent(GEvent event)
If this property is disposed, no processing will take place.
This method checks the event's Operations to perform and handles it accordingly.
If, at any time, the event is canceled, the processing is stopped.
onEvent
in interface EventListener
onEvent
in interface IGProp<VALUE>
event
- The property event.protected void onReferenceEvent(ResolveReferencesEvent event)
Subclasses override this method and only subclasses extending PropCnr
needs to
call super.onReferenceEvent(ResolveReferenceEvent event)
.
event
- The resolve references event.protected abstract void appendPropValue(PropMgr propertyManager, Transaction trans, Object value)
AtomManager
.
This method must is overridden in all subclasses.
propertyManager
- the property manager instance.trans
- transaction to append the properties to.value
- the value to append to the transaction, a reference to the current property value.protected abstract boolean initializeValue(PropMgr propertyManager, Transaction trans) throws ClassNotFoundException, InstantiationException, IllegalAccessException, PropException
propertyManager
- the property manager.trans
- the transaction to initialize the property with.ClassNotFoundException
- - if the class could not be found.IllegalAccessException
- - if the class or its nullary constructor is not accessible.InstantiationException
- - if this Class represents an abstract class, an interface,
an array class, a primitive type, or void; or if the class
has no nullary constructor; or if the instantiation fails for
some other reason.ExceptionInInitializerError
- - if the initialization provoked by this method fails.SecurityException
- - If a security manager, s, is present and any of the following
conditions is met:
PropException
- - if the property cannot be initialized, because of erroneous data.public final void initializeGProp(Element element) throws PropException
Element
.
This method initializes the generic property and then calls
the initializeProperty(AtomManager atomManager,Element element)
.
The attributes following attributes are read from the Element for all properties.
These attributes are read from the Element for all property containers.
An extra error Element "propError" is also be read for the property error(s).
initializeGProp
in interface IGProp<VALUE>
element
- The Element
.PropException
- when the initialization fails.public static String getAttribute(Element element, String name)
element
- The element.name
- The attribute name.protected void initializeProp(Element element) throws PropException
Element
.
The property should initialize itself from attributes and nodes
with appropriate information.
Subclasses should override this method if custom initialization is required.
The default implementation gets the attribute "value" and calls the
methods object=convertPropertyValue(string)
followed by
setPropertyValue(object)
.
element
- The Element
.PropException
- when the initialization fails.public Object fromElementString(String string) throws PropException
initializeProperty(Element element)
method
once the element String is retrieved from the "value" attribute of the element.
Override this method to provide the appropriate String
to
Object
conversion.
The default implementation returns the String
passed as
the parameter.
fromElementString
in interface IGProp<VALUE>
string
- the String value of the object from the String value attribute.PropException
- when the conversion fails.protected final Object convertPropError(String string, Exception thrown) throws PropException
String
doesn't
convert properly into a "native" Object.string
- the string value.thrown
- the Exception that was thrown.PropException
- - always, with the exception error text.public void onPropTreeInitialized() throws IOException, PropException
This method does nothing and may be overridden by any subclasses to perform custom processing.
The PropertyContainer
calls all its children with this method in order to inform
the tree.
The ExtendablePropertyContainer
overrides this method to load all extended
containers.
onPropTreeInitialized
in interface IGProp<VALUE>
IOException
- For file errors.PropException
- When there is an initialization problem.protected boolean shouldSerializeToXML(int programType)
programType
- From PropFactory.getProgramType():
0=PropFactory.CLIENT
, 1=PropFactory.SERVER
or 2=PropFactory.EDITOR
.public final void initializeGElement(Element element)
This method initializes the generic property and then calls
the initializeElement(Element element)
.
The attributes following attributes are set for the Element for all properties as required:
These attributes are set for the Element for all property containers as required.
An extra error element "propError" may also be added for the property error(s).
initializeGElement
in interface IGProp<VALUE>
element
- The element.protected void initializeElement(Element element)
Subclasses should override this method if custom initialization is required.
element
- The Element
to initialize.public String toElementString(Object value)
initializeElement(Element element)
method.
Override this method to provide the appropriate Object
to
String
conversion.
The default implementation returns the Object value.toString()
return code. If the value is null, null is returned.
toElementString
in interface IGProp<VALUE>
value
- the value in the object to convert to a string.public final Object toNativeValue(Object value) throws NullPointerException, Exception
setPropertyValue
method
into the most preferred property value type. If the input value already is of the preferred type, the
same object is returned.
Subclasses overrides the method toNativeValue0
in order to provide the appropriate conversion.
toNativeValue
in interface IGProp<VALUE>
value
- the input value to convert to native value.NullPointerException
- If the input Object value is null.Exception
- Other exceptions.protected abstract Object toNativeValue0(Object value, int index) throws Exception
setPropertyValue
method
into the most preferred property value type. If the input value already is of the preferred type, the
same object is returned.
Subclasses overrides the method toNativeValue0
in order to provide the appropriate conversion.
value
- The input value to convert to native value.index
- The index in the array returned by getValueClasses()
, or -1 if not found.Exception
- For conversion exceptions.public VSReference getVSReference(Atom refAtom)
VSRelativeReference
to look up the VSReference
instance in order to resolve the relative path to the target property.
This method needs to be overridden by subclasses of PropCnr
that has
a VSReference as property, e.g. the JSONInProp
class in the Web Service plug-in.
The default is to re-target the call to the parent container, and if the root, a folder or
a file property is reached, null
is returned.
getVSReference
in interface IGProp<VALUE>
refAtom
- The property asking for the VSReference.VSReference
or null
if unassigned.public PropCnr getPropBaseReference()
PropRelativeReference
to look up the reference
instance in order to resolve the relative path to the target property.
This method needs to be overridden by subclasses of PropCnr
that has
a PropRelativeReference as property, e.g. the ScreenProp
class in the Terminal Core plug-in.
The default is to re-target the call to the parent container, and if the root, a folder or
a file property is reached, null
is returned.
getPropBaseReference
in interface IGProp<VALUE>
PropCnr
or null
if unassigned.public boolean verifyHasPropertyItem(String propertyItem)
verifyHasPropertyItem
in interface IGProp<VALUE>
propertyItem
- The property item name.public int getReferences(List<Reference> references)
getReferences
in interface IGProp<VALUE>
references
- The references array is filled in by this method.public void verify(PropVerification verification)
public final void setPropExtended(boolean on)
on
- flag indicates this is set (true) or cleared (false).public final boolean isPropExtended()
isPropExtended
in interface IGProp<VALUE>
public final boolean setPropExtendsPrivate(boolean on)
setPropExtendsPrivate
in interface IGProp<VALUE>
on
- flag indicating if it's Extends Private or not.public final boolean isPropExtendsPrivate()
isPropExtendsPrivate
in interface IGProp<VALUE>
public final boolean isPropExtendsPrivateInRoot()
If using this method to search for Extends Private in the Extends "Source Container",
use the method that uses a container as parameter instead:
isPropExtendsPrivateInRoot(PropCnr root)
.
isPropExtendsPrivateInRoot
in interface IGProp<VALUE>
isPropExtendsPrivate()
method would
return true. It is false if no Extends Private exists, or if the root
is not found.public final boolean isPropExtendsPrivateInRoot(IPropCnr root)
isPropExtendsPrivateInRoot
in interface IGProp<VALUE>
root
- The root to use if an alternate one is required, otherwise set to null
for root look-up (note: this works only in the target container, not
for the source container).isPropExtendsPrivate()
method would
return true. It is false if no Extends Private exists, or if the root
is not found.public final boolean setPropExtendsFinal(boolean on)
setPropExtendsFinal
in interface IGProp<VALUE>
on
- flag indicating if it's Extends Final or not.public final boolean isPropExtendsFinal()
isPropExtendsFinal
in interface IGProp<VALUE>
public PropCnr getExtendsRootContainer()
PropCnr.isExtendsRoot()
, including this property (if
it's a container).
The search is ended with a "not found" null
return code if a property
file, folder or root is found (i.e. isPropFile()
, isPropFolder()
or isPropRoot()
returns true).
getExtendsRootContainer
in interface IGProp<VALUE>
null
if such a container is not found.public int getPropExtendsFlags()
getPropExtendsFlags
in interface IGProp<VALUE>
protected String paramString()
protected String paramValue(Object value)
paramString
.
The default is to do "value.toString()" if value is not null, otherwise "[null]" is returned.public String toString()
public static String toString(IGProp<?> gp)
gp
- the property to convert to a string.public final boolean equals(Object o)
equals(Object,boolean=false)
not to include the
private properties.public final boolean equals(Object o, int how)
public final Object equalsObj(Object o, int how)
o
- The other property to compare with.how
- Flags EQC_* values for equal checking.protected boolean equalsErrors(PropError pe1, PropError pe2, int how)
pe1
and pe2
for equality if includeErrors
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.
pe1
- The first error property, may be null.pe2
- The second error property, may be null.how
- Flags EQC_* values for equal checking.includeErrors
value.protected Object equalValues(GProp<?> compareTo, VALUE thisValue, VALUE compareValue, int how)
compareTo
- The comparing-to property that contains the value.thisValue
- This property value (for synchronization reasons).compareValue
- Another property value.how
- Flags EQC_* values for equal checking.public final boolean equalsPropValue(Object otherPropValue)
otherPropValue
- The value to compare with.protected Object equalsTree(PropCnr pc, int how)
pc
- Another property container.how
- Flags EQC_* values for equal checking.public void list()
System.out
.public void list(PrintStream out)
public void list(PrintStream out, int indent)
public void list(PrintWriter out)
public void list(PrintWriter out, int indent)
public void finest(String msg)
public void finer(String msg)
public void fine(String msg)
public void info(String msg)
public void warning(String msg)
public void severe(String msg)
public void triggerRemoteEvent(int localID)
onRemoteEvent()
method
of this remote property instance.triggerRemoteEvent
in interface IGProp<VALUE>
localID
- The property-local event ID.public void triggerRemoteEvent(int localID, PropCnr params)
onRemoteEvent()
method
of this remote property instance.triggerRemoteEvent
in interface IGProp<VALUE>
localID
- The property-local event ID.params
- Parameters for the event, null for none.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.