Class GProp<VALUE>
- java.lang.Object
- com.iizix.prop.GProp<VALUE>
- All Implemented Interfaces:
EventListener
,IGProp<VALUE>
,java.lang.Cloneable
- Direct Known Subclasses:
AbstractReference
,AnnotationsContainer
,BadgeProp
,BoolProp
,ByteArrayProp
,CharProp
,CodeItemArrayProp
,ColorProp
,DateTimeProp
,DeviceProp
,DoubleProp
,ErrorsProp
,FillProp
,FontProp
,GradientProp
,HostSessionProps
,Int32Prop
,IntProp
,KStringProp
,LongProp
,MultiProp
,PrivProp
,PropCnr
,RectProp
,RemoteHostSessionProp
,SizeProp
,StringArrayProp
,StringMapProp
,StringProp
,StringSetProp
,StrokeProp
,StylesReferences
,TableCell
,ThemesProp
,TooltipProp
,TypesContainer
,UnitProp
,ValueProp
public abstract class GProp<VALUE> extends java.lang.Object implements IGProp<VALUE>, java.lang.Cloneable, EventListener
The generic property class holds the property name, value and optionally has a parent and/or property listener(s).- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description protected static boolean
GPDEBUG
Debug mode.static java.lang.String
PROP_ATTR_STRING_EDITOR_PROP
Property attribute: Editor property.static java.lang.String
PROP_ATTR_STRING_ERRORED_NAME
Property attribute: errored property name, event value = String or null.static java.lang.String
PROP_ATTR_STRING_EXTENDS
Property attribute: extends.static java.lang.String
PROP_ATTR_STRING_EXTENDS_FINAL
Property attribute: extends private.static java.lang.String
PROP_ATTR_STRING_EXTENDS_PRIVATE
Property attribute: extends private.static java.lang.String
PROP_ATTR_STRING_NULLABLE
Property attribute: nullable.static java.lang.String
PROP_ATTR_STRING_PRIVATE
Property attribute: private.static java.lang.String
PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT
Property attribute: private change event.static java.lang.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.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
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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, SendTransaction trans, java.lang.Object value)
Appends the property value and all its children to a transaction using theAtomManager
.GProp<?>
clone()
Creates a clone out of this property.protected java.lang.Object
convertPropError(java.lang.String string, java.lang.Exception thrown)
Creates and throws a PropertyException when theString
doesn't convert properly into a "native" Object.void
dispose()
Disposes of the property, but doesn't remove it from a parent.boolean
equals(java.lang.Object o)
Checks for equality, including private properties.boolean
equals(java.lang.Object o, int how)
Checks for equality.protected boolean
equalsErrors(PropError pe1, PropError pe2, int how)
Processes error property verification.java.lang.Object
equalsObj(java.lang.Object o, int how)
Checks for equality.boolean
equalsPropValue(java.lang.Object otherPropValue)
Checks if another value is equal to the value in this object.protected java.lang.Object
equalsTree(PropCnr pc, int how)
Checks for equality in the whole container structure.protected java.lang.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(java.lang.String msg)
Logs a fine event.void
fine(java.lang.String msg, java.lang.Object... params)
Logs a fine event.void
finer(java.lang.String msg)
Logs a finer event.void
finer(java.lang.String msg, java.lang.Object... params)
Logs a finer event.void
finest(java.lang.String msg)
Logs a finest event.void
finest(java.lang.String msg, java.lang.Object... params)
Logs a finest event.java.lang.Object
fromElementString(java.lang.String string)
Called from theinitializeProperty(Element element)
method once the element String is retrieved from the "value" attribute of the element.java.lang.String
getAliasName(GProp<?> requestor, java.lang.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 java.lang.String
getAttribute(org.w3c.dom.Element element, java.lang.String name)
Gets a attribute string.java.lang.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.java.lang.String
getConstraints()
Gets the constraints string for this property.EnvProps
getEnvironment()
Gets the environment properties.void
getErroredPropItems(java.util.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(java.util.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.java.lang.String
getFullPropName()
Gets the full name of this property, i.e.java.lang.String
getFullPropName(GProp<?> requestor)
Gets the full name of this property, i.e.java.lang.String
getFullPropNameDebug()
Gets the full name of this property, i.e.java.lang.String
getFullPropNameDebug(GProp<?> requestor)
Gets the full name of this property, i.e.EventListener[]
getListeners()
Gets the listeners.FolderURIPropCnr
getModuleFolder(IPluginDescriptor<?> descriptor)
Gets the property container of specified type from the properties root.FolderURIPropCnr
getModuleFolder(java.lang.String folderName)
Gets the property container of specified type from the properties root.PropCnr
getParent()
Gets the parent of this property.<PROPCNR extends PropCnr>
PROPCNRgetParent(java.lang.Class<PROPCNR> clazz)
Gets the parent of this property with the requested type.java.lang.String
getProjectName(GProp<?> requestor, java.lang.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(java.lang.String id)
Gets the error input item with specified ID, for none specify empty string.java.lang.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, java.lang.String path)
Finds a property in the tree of the requested name from a path specification, i.e.GProp<?>
getPropFromPath(java.lang.String path)
Finds a property in the tree of the requested name from a path specification, i.e.GProp<?>
getPropFromReference(GProp<?> requestor, java.lang.String path)
Internal function for getPropFromReference(ref).GProp<?>
getPropFromReference(java.lang.String ref)
Gets a property from a reference name.int
getPropIndex()
Gets the index of this property in the parent container.java.lang.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.java.lang.Object
getPropValue(java.lang.Class<?> requestedType)
Gets the property value in another class form than the "native" one.protected abstract java.lang.Object
getPropValue0(java.lang.Object value, int index)
Gets the property value in another class form than the "native" one.java.lang.Object
getPropValueObject()
Gets the current value set, null for an uninitialized value.java.lang.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(java.util.List<Reference> references)
Gets the references of this property top others.java.lang.String
getRelativePropName(IPropCnr container)
Gets the relative name of this property to a container.PropCnr
getRootFromName(GProp<?> requestor, java.lang.String module)
Gets the module root for a name.java.lang.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.java.lang.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 java.lang.Class<?>[]
getValueClasses()
Gets the list of possible native Java classes that can be used to set a value usingsetPropertyValue
, 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 toappend
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(java.lang.String msg)
Logs an informational event.void
info(java.lang.String msg, java.lang.Object... params)
Logs an informational event.protected void
initializeElement(org.w3c.dom.Element element)
Called when the XML file for the property tree is serialized from properties.void
initializeGElement(org.w3c.dom.Element element)
Called when the XML file for the property tree is serialized from properties.void
initializeGProp(org.w3c.dom.Element element)
Called to initialize the generic property from anElement
.protected void
initializeProp(org.w3c.dom.Element element)
Called to initialize the property from anElement
.protected abstract boolean
initializeValue(PropMgr propertyManager, ReadTransaction 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 streamSystem.out
.void
list(java.io.PrintStream out)
Prints a listing of this property to the specified output stream.void
list(java.io.PrintStream out, int indent)
Prints out a list, starting at the specified indentation, to the specified print stream.void
list(java.io.PrintWriter out)
Prints a listing to the specified print writer.void
list(java.io.PrintWriter out, int indent)
Prints out a list, starting at the specified indentation, to the specified print writer.java.lang.String
mapAliasToReference(GProp<?> requestor, java.lang.String aliasReference)
Maps an alias reference name to a reference name.java.lang.String
mapAliasToReference(java.lang.String aliasReference)
Maps an alias reference name to a reference name.java.lang.String
mapReferenceToAlias(GProp<?> requestor, java.lang.String referenceName)
Maps a reference name to an alias name.java.lang.String
mapReferenceToAlias(java.lang.String referenceName)
Maps a reference name to an alias name.java.lang.String
mapReferenceToProjectRelative(java.lang.String referenceName)
Maps a reference name to project relative format, i.e.protected int
modifyPropValue(java.lang.Object oldValue, java.lang.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, int destinationIndex)
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.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, java.util.List<java.lang.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(java.lang.Object oldValue)
Called when the property value is changed by theGProp
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 java.lang.String
paramString()
Returns the parameter string representing the state of this event.protected java.lang.String
paramValue(java.lang.Object value)
Formats the value as a string to add toparamString
.void
post(Worker worker, java.lang.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).void
post(java.lang.Runnable runnable)
Post a runnable for invocation at a later stage by the worker thread (or SWT thread for the Designer).boolean
removePropError(java.lang.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(java.lang.Object constraints, java.lang.String prevConstraints, org.w3c.dom.Element prevElement)
Sets the constraints for the property previously returned from the same constraints call tosetConstraints(String,Element)
with the same String and Element as this instance would require.java.lang.Object
setConstraints(java.lang.String constraints, org.w3c.dom.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(java.lang.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(java.lang.Object newValue)
Sets a new value for this property.boolean
setPropValue(java.lang.Object newValue, IGProp<?> trigger)
Sets a new value for this property.protected boolean
setPropValue(java.lang.Object newValue, PropMgr propMgr)
Sets a new value for this property.protected void
setPropValueIncognito(java.lang.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(java.lang.String msg)
Logs a severe event.void
severe(java.lang.String msg, java.lang.Object... params)
Logs a severe event.void
severe(java.lang.String msg, java.lang.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.java.lang.String
toElementString(java.lang.Object value)
Called from theinitializeElement(Element element)
method.java.lang.Object
toNativeValue(java.lang.Object value)
Tries conversion of possibly accepted properties values using thesetPropertyValue
method into the most preferred property value type.protected abstract java.lang.Object
toNativeValue0(java.lang.Object value, int index)
Tries conversion of possibly accepted properties values using thesetPropertyValue
method into the most preferred property value type.java.lang.String
toString()
Returns a string representation of this component and its values.static java.lang.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 partyonRemoteEvent()
method of this remote property instance.void
triggerRemoteEvent(int localID, PropCnr params)
Triggers a remote event for execution at the remote partyonRemoteEvent()
method of this remote property instance.void
validateProp(java.lang.Object newValue)
Validates the value to set by first callingvalidateType
, thenvalidateValue
and finally calling an optional validator (if set).abstract void
validatePropType(java.lang.Object newValue)
Validates the newValue against the property object type.void
validatePropValue(java.lang.Object newValue)
Validates the value to set.boolean
verify(PropVerification verification)
Verifies this property.boolean
verifyHasPropertyItem(java.lang.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(java.lang.String msg)
Logs a warning event.void
warning(java.lang.String msg, java.lang.Object... params)
Logs a warning event.void
warning(java.lang.String msg, java.lang.Throwable exception)
Logs a warning event.
Field Detail
GPDEBUG
protected static final boolean GPDEBUG
Debug mode.- See Also:
- Constant Field Values
PROP_USER_1
protected static final int PROP_USER_1
Flag indicating property is a USER_1 and not written to XML.- See Also:
- Constant Field Values
PROP_USER_2
protected static final int PROP_USER_2
Flag indicating property is a USER_2 and not written to XML.- See Also:
- Constant Field Values
PROP_ATTR_STRING_READ_ONLY
public static final java.lang.String PROP_ATTR_STRING_READ_ONLY
Property attribute: read-only.- See Also:
- Constant Field Values
PROP_ATTR_STRING_PRIVATE
public static final java.lang.String PROP_ATTR_STRING_PRIVATE
Property attribute: private.- See Also:
- Constant Field Values
PROP_ATTR_STRING_NULLABLE
public static final java.lang.String PROP_ATTR_STRING_NULLABLE
Property attribute: nullable.- See Also:
- Constant Field Values
PROP_ATTR_STRING_EDITOR_PROP
public static final java.lang.String PROP_ATTR_STRING_EDITOR_PROP
Property attribute: Editor property.- See Also:
- Constant Field Values
PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT
public static final java.lang.String PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT
Property attribute: private change event.- See Also:
- Constant Field Values
PROP_ATTR_STRING_EXTENDS
public static final java.lang.String PROP_ATTR_STRING_EXTENDS
Property attribute: extends.- See Also:
- Constant Field Values
PROP_ATTR_STRING_EXTENDS_PRIVATE
public static final java.lang.String PROP_ATTR_STRING_EXTENDS_PRIVATE
Property attribute: extends private.- See Also:
- Constant Field Values
PROP_ATTR_STRING_EXTENDS_FINAL
public static final java.lang.String PROP_ATTR_STRING_EXTENDS_FINAL
Property attribute: extends private.- See Also:
- Constant Field Values
PROP_ATTR_STRING_ERRORED_NAME
public static final java.lang.String PROP_ATTR_STRING_ERRORED_NAME
Property attribute: errored property name, event value = String or null.- See Also:
- Constant Field Values
Constructor Detail
GProp
protected GProp()
Creates a generic property. This constructor should only be used by thePropertyManager
, 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.
GProp
protected GProp(Atom propertyAtom)
Creates a generic property with the specified name with a null value. Theinitialize
method must then be called.- Parameters:
propertyAtom
- the property atom.
Method Detail
dispose
public final void dispose()
Disposes of the property, but doesn't remove it from a parent. Calling the method more than once will result in a no-operation.All children of this property, if any, will also be disposed of.
This method calls the
onPropDispose()
method.
isDisposed
public final boolean isDisposed()
Checks if the property is disposed.- Specified by:
isDisposed
in interfaceIGProp<VALUE>
- Returns:
- true if property is disposed of, false otherwise.
finalize
protected void finalize() throws java.lang.Throwable
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.When called, the property is disposed of.
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
- For finalizer errors.
post
public void post(java.lang.Runnable runnable)
Post a runnable for invocation at a later stage by the worker thread (or SWT thread for the Designer).- Parameters:
runnable
- The runnable.
post
public void post(Worker worker, java.lang.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).In the server, this call MUST be done from a virtualized property if the
worker
isnull
. The worker used is the application session worker.- Parameters:
worker
- The worker to use, null for default.runnable
- The runnable.
getAppWorker
public Worker getAppWorker()
Gets the application session worker.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.
- Returns:
- The application session worker, or null if the AppSessionGyro is not found (e.g. called from Designer or not a virtualized property).
- Throws:
java.lang.IllegalStateException
- If called in the server and the AppSessionGyro cannot be retrieved AND the property is virtualized.
getClientWorker
public Worker getClientWorker()
Gets the client session worker.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.
- Returns:
- The client session worker, or null if the ClientSessionGyro is not found (e.g. called from Designer or not a virtualized property).
- Throws:
java.lang.IllegalStateException
- If called in the server and the ClientSessionGyro cannot be retrieved AND the property is virtualized.
getListeners
public EventListener[] getListeners()
Gets the listeners.- Returns:
- A new array of event listeners, never null.
getTreeLock
public final java.lang.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. Code synchronized on a single property should not synchronize on the tree, it must synchronize on the tree first, then the property itself.- Specified by:
getTreeLock
in interfaceIGProp<VALUE>
- Returns:
- The tree lock object, perhaps asking the parent for it until the root is found. This call is quite expensive in terms of CPU and should be avoided if possible.
isPropClientCreated
public final boolean isPropClientCreated()
Checks if this property is created on the client or not.- Specified by:
isPropClientCreated
in interfaceIGProp<VALUE>
- Returns:
- true for the client, false for server or editor.
onPropInvalidateCache
protected void onPropInvalidateCache()
Invalidates a potential cache in this property. This method is called during a synchronized state of the property. Subclasses override this method to provide a robust caching mechanism.
resolveRuntimeReferences
public void resolveRuntimeReferences(IRuntimeResolver resolver)
Called before transactions are prepared for sending. This method allows creation of e.g. runtime references such as Styles or Panel references that adds a virtual instance for the Client.This call is propagated in the entire client tree.
- Specified by:
resolveRuntimeReferences
in interfaceIGProp<VALUE>
- Parameters:
resolver
- The reference resolver.
getValueClasses
public abstract java.lang.Class<?>[] getValueClasses()
Gets the list of possible native Java classes that can be used to set a value usingsetPropertyValue
, in order of importance. Note that loss of precision in data if e.g. an Float property accepts a Double. However, thesetPropertyValue
throwsIllegalArgumentException
if the range in invalid, e.g. conversion of a Integer to a Byte, and the value is not -127 to 128.- Specified by:
getValueClasses
in interfaceIGProp<VALUE>
- Returns:
- The array of Java classes that can be accepted in the
setPropertyValue
method. The first type is the "native" or most preferred type. The array is at least one item in length and never null.
clone
public GProp<?> clone() throws java.lang.CloneNotSupportedException
Creates a clone out of this property. The cloning is overridden by the super classes in order to handle cloning of its class variables appropriately.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!
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
- If a subclass doesn't allow cloning, e.g. the client properties.
extendsClone
public GProp<?> extendsClone() throws java.lang.CloneNotSupportedException
Creates a clone out of this property for the Extends Framework. It is basically the same method asclone
, except that every property is marked as Extended (can be checked byisPropExtended()
), and property container do not clone the Extends Private properties (that return true toisPropExtendsPrivate()
).- Returns:
- The cloned property according to the rules specified above.
- Throws:
java.lang.CloneNotSupportedException
onPrepare
protected void onPrepare(IAppOwner appOwner, IModuleOwner moduleOwner, boolean isPostCall, java.util.List<java.lang.Throwable> errors) throws PropException
Called when the application is being prepared. The order ofonPrepare
calls is always parent first, the children. The method is called twice, first time withisPostCall
set tofalse
, then a second time withtrue
.- Parameters:
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.- Throws:
PropException
- For property errors during the application preparation to need to abort.
isPropVirtualizing
protected boolean isPropVirtualizing()
Checks if currently virtualizing during a clone operation.- Returns:
- true during the virtualization process, false otherwise (also when virtualization has completed).
virtualize
protected GProp<?> virtualize(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp) throws java.lang.CloneNotSupportedException, PropException
Call this method to "virtualize" a property tree. This method is used at runtime in the Server for the application session of virtual instances of VirtualSpace, but also virtual instances of panels, for the individual client session. The VirtualSpace is virtualized once for the application session and is shared for parallel client sessions.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.
- 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.- Returns:
- The virtualized property.
- Throws:
java.lang.CloneNotSupportedException
- If a subclass doesn't allow cloning, e.g. the client properties.PropException
- For property errors during the virtualization.
onVirtualized
protected void onVirtualized(IAppSessionGyro appGyro, IClientSessionGyro clientGyro, VirtualSpace virtualSpace, PropCnr virtualizedProp, GProp<?> clonedProp) throws PropException
Called when this property has been virtualized.Override to perform required processing.
- 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.- Throws:
PropException
- For property errors during the virtualization.
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.
- 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.
getAppSessionGyro
public IAppSessionGyro getAppSessionGyro()
Returns the Application Session Gyro instance of this virtualized property.To get the
instance from the current thread useIAppSessionGyro
, orIAppSessionGyro.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.
- Specified by:
getAppSessionGyro
in interfaceIGProp<VALUE>
- Returns:
- The Application Session Gyro if this instance is virtualized, null otherwise.
getClientSessionGyro
public IClientSessionGyro getClientSessionGyro()
Returns the Client Session Gyro instance of this virtualized property. This method only work for properties in a panel tree. Data connectors may sometimes also provide
support.IClientSessionGyro
To get the
instance from the current thread useIClientSessionGyro
, orIClientSessionGyro.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.
- Specified by:
getClientSessionGyro
in interfaceIGProp<VALUE>
- Returns:
- The Client Session Gyro if this instance is virtualized and is in a
UIPanelBase
(panels) tree (or for certain data connectors), null otherwise.
renameProp
public final boolean renameProp(Atom propertyAtom) throws PropException
Renames this property. This is allowed if the property has no parent or the parent accepts the rename.- Specified by:
renameProp
in interfaceIGProp<VALUE>
- Parameters:
propertyAtom
- The new atom name.- Returns:
- true if name has changed, false otherwise.
- Throws:
PropException
- If rename causes duplicate names in parent.java.lang.NullPointerException
- If propertyAtom is null.
renameProp2
public final boolean renameProp2(Atom propertyAtom)
Renames this property. This is allowed if the property has no parent or the parent accepts the rename.- Parameters:
propertyAtom
- The new atom name.- Returns:
- true if name has changed, false otherwise.
- Throws:
java.lang.InternalError
- If rename causes duplicate names in parent.java.lang.NullPointerException
- If propertyAtom is null.
getPropAtom
public final Atom getPropAtom()
Gets the atom used for the name of this property.- Specified by:
getPropAtom
in interfaceIGProp<VALUE>
- Returns:
- Atom, the property atom.
getPropName
public final java.lang.String getPropName()
Gets the name of this property.- Specified by:
getPropName
in interfaceIGProp<VALUE>
- Returns:
- String Name of the property, or null if no property atom is present.
getPropErroredName
public java.lang.String getPropErroredName()
Gets the errored (atom) name input by the user.- Returns:
- The errors (atom) name for the property, or null for no error.
setPropErroredName
public boolean setPropErroredName(java.lang.String name) throws PropTypeException
Sets the errored name for this property. This causes a property name event.- Parameters:
name
- The name, or null for no error.- Returns:
- true for change, false indicating no change performed and no event fired.
- Throws:
PropTypeException
- If the property is read-only.
getModuleFolder
public FolderURIPropCnr getModuleFolder(java.lang.String folderName)
Gets the property container of specified type from the properties root.- Specified by:
getModuleFolder
in interfaceIGProp<VALUE>
- Parameters:
folderName
- The folder name.- Returns:
- The folder in the project,
null
if not found.
getModuleFolder
public FolderURIPropCnr getModuleFolder(IPluginDescriptor<?> descriptor)
Gets the property container of specified type from the properties root.- Specified by:
getModuleFolder
in interfaceIGProp<VALUE>
- Parameters:
descriptor
- The folder descriptor.- Returns:
- The folder in the project,
null
if not found.
getRootName
public java.lang.String getRootName(GProp<?> requestor)
Gets and checks if this container is the root. The name returned is in the Editor"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.
- Parameters:
requestor
- The requestor of the information.- Returns:
- Name string if this is the root as "project:" for the Designer, and "" for the Server, null otherwise.
getProjectName
public java.lang.String getProjectName(GProp<?> requestor, java.lang.String alias)
Gets the project name from an alias, the alias does NOT begin with "*".- Parameters:
requestor
- The requestor of the information.alias
- The alias.- Returns:
- The project name for the alias, or null if not found.
getAliasName
public java.lang.String getAliasName(GProp<?> requestor, java.lang.String projectName)
Gets an alias name for a project name, the alias does NOT begin with "*".- Parameters:
requestor
- The requestor of the information.projectName
- The project name (without ending ':').- Returns:
- The alias name without leading '*' for the project name, or null if not found.
getRootFromName
public PropCnr getRootFromName(GProp<?> requestor, java.lang.String module)
Gets the module root for a name. In the Editor, the module is the project, and that root container is returned. In the Server, the module doesn't matter, so the real root returns itself.When running with assertions, this call throws an assertion error by default, showing that the call is directed to a non-root property container.
- Parameters:
requestor
- The requestor of the information.module
- The module name (without colon), i.e. the project name in the Designer.- Returns:
- The root property container, or null if this container is not the root, or if the module name is not found. The default implementation returns null.
getFullPropName
public java.lang.String getFullPropName()
Gets the full name of this property, i.e. concatenated with the parent names separated with slashes ("/"), and in the Designer including the project name. The difference with this method andgetReferencePropName()
is that instances ofFilePropCnr
are omitted in the path ingetReferencePropName()
, but not in this method.- Specified by:
getFullPropName
in interfaceIGProp<VALUE>
- Returns:
- A full property path string as "/path/propName" in the Server, "project:/path/propName" in the Designer.
getFullPropName
public java.lang.String getFullPropName(GProp<?> requestor)
Gets the full name of this property, i.e. concatenated with the parent names separated with slashes ("/"), and in the Designer including the project name. The difference with this method andgetReferencePropName()
is that instances ofFilePropCnr
are omitted in the path ingetReferencePropName()
, but not in this method.- Parameters:
requestor
- The requestor.- Returns:
- A full property path string as "/path/propName" in the Server, "project:/path/propName" in the Designer.
getFullPropNameDebug
public java.lang.String getFullPropNameDebug()
Gets the full name of this property, i.e. concatenated with the parent names separated with slashes ("/"), and in the Designer including the project name. The difference with this method andgetReferencePropName()
is that instances ofFilePropCnr
are omitted in the path ingetReferencePropName()
, 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.- Specified by:
getFullPropNameDebug
in interfaceIGProp<VALUE>
- Returns:
- A full property path string as "/path/propName" in the Server, "project:/path/propName" in the Designer.
getFullPropNameDebug
public java.lang.String getFullPropNameDebug(GProp<?> requestor)
Gets the full name of this property, i.e. concatenated with the parent names separated with slashes ("/"), and in the Designer including the project name. The difference with this method andgetReferencePropName()
is that instances ofFilePropCnr
are omitted in the path ingetReferencePropName()
, 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.- Parameters:
requestor
- The requestor.- Returns:
- A full property path string as "/path/propName" in the Server, "project:/path/propName" in the Designer.
getRelativePropName
public final java.lang.String getRelativePropName(IPropCnr container)
Gets the relative name of this property to a container.- Specified by:
getRelativePropName
in interfaceIGProp<VALUE>
- Parameters:
container
- The container to use as base name, null if root is required.- Returns:
- The relative property name with a path to the container as
"path/propName"
, empty string if no parent orcontainer
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.
isPropRoot
public boolean isPropRoot()
Checks if this is a root property container. It is overridden by the root property.- Specified by:
isPropRoot
in interfaceIGProp<VALUE>
- Returns:
- true for the root, false otherwise.
getPropRootPropMgr
public PropMgr getPropRootPropMgr()
Gets the Property Manager used for communication for the root container. If this is not the root container, the parent function is called upwards in tree.- Specified by:
getPropRootPropMgr
in interfaceIGProp<VALUE>
- Returns:
- The Property Manager, or null when not attached to a root.
isPropReferenceTreeValid
public boolean isPropReferenceTreeValid()
Verifies if the tree is valid for reference creation. This method is typically overridden in a root property that has a Property Manager owner that in turn is checked for a particular configuration (e.g. Client-related references such as LabelForReference that does not create references when communicating).- Specified by:
isPropReferenceTreeValid
in interfaceIGProp<VALUE>
- Returns:
- true if the root property manager is found, false otherwise.
isPropFolder
public boolean isPropFolder()
Checks if this is a Folder property container. It is overridden byFolderPropCnr
.- Specified by:
isPropFolder
in interfaceIGProp<VALUE>
- Returns:
- true for
FolderPropCnr
, false otherwise.
isPropFile
public boolean isPropFile()
Checks if this is a File property container. It is overridden byFilePropCnr
.- Specified by:
isPropFile
in interfaceIGProp<VALUE>
- Returns:
- true for
FilePropCnr
, false otherwise.
mapAliasToReference
public final java.lang.String mapAliasToReference(java.lang.String aliasReference)
Maps an alias reference name to a reference name.Alias reference names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
- Specified by:
mapAliasToReference
in interfaceIGProp<VALUE>
- Parameters:
aliasReference
- The alias reference name.- Returns:
- The default implementation is to return the same as the input
aliasReference
. If the aliasReference is not found, the same String as the inputaliasReference
is returned.
mapAliasToReference
public java.lang.String mapAliasToReference(GProp<?> requestor, java.lang.String aliasReference)
Maps an alias reference name to a reference name.Alias reference names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
- Parameters:
requestor
- The requestor.aliasReference
- The alias reference name.- Returns:
- The default implementation is to return the same as the input
aliasReference
. If the aliasReference is not found, the same String as the inputaliasReference
is returned.
mapReferenceToAlias
public final java.lang.String mapReferenceToAlias(java.lang.String referenceName)
Maps a reference name to an alias name.Alias names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
- Specified by:
mapReferenceToAlias
in interfaceIGProp<VALUE>
- Parameters:
referenceName
- The reference name.- Returns:
- The default implementation is to return the same as the input
referenceName
. If there is not alias for the project, the same String as the inputreferenceName
is returned.
mapReferenceToAlias
public java.lang.String mapReferenceToAlias(GProp<?> requestor, java.lang.String referenceName)
Maps a reference name to an alias name.Alias names have the format "*alias:/path/propName".
This method is overridden by the root container in a project.
- Parameters:
requestor
- The requestor.referenceName
- The reference name.- Returns:
- The default implementation is to return the same as the input
referenceName
. If there is not alias for the project, the same String as the inputreferenceName
is returned.
mapReferenceToProjectRelative
public final java.lang.String mapReferenceToProjectRelative(java.lang.String referenceName)
Maps a reference name to project relative format, i.e. with a project name of "." instead of the project name (if it's the current project name).- Specified by:
mapReferenceToProjectRelative
in interfaceIGProp<VALUE>
- Parameters:
referenceName
- The reference name.- Returns:
- A reference like ".:/path/propName" instead of "currentProject:/path/propName". If there is not alias for the project, the same String as the input
referenceName
is returned.
getReferencePropName
public final java.lang.String getReferencePropName()
Gets the reference property name, overridden when used in the Designer to skip the file storage property, and by the root property.- Specified by:
getReferencePropName
in interfaceIGProp<VALUE>
- Returns:
- A property reference string as "/path/propName" in the Server, "project:/path/propName" in the Designer.
getChildReferencePropName
public java.lang.String getChildReferencePropName(GProp<?> child)
Gets the child's reference property name for this property.- Parameters:
child
- The child requesting the name.- Returns:
- The default is to return getReferencePropName()+'/'+child.getPropName().
getPropFromReference
public GProp<?> getPropFromReference(java.lang.String ref)
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.- Specified by:
getPropFromReference
in interfaceIGProp<VALUE>
- Parameters:
ref
- The reference string.- Returns:
- The property with the reference in question, or null if not found.
getPropFromReference
public GProp<?> getPropFromReference(GProp<?> requestor, java.lang.String path)
Internal function for getPropFromReference(ref).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.
- Parameters:
requestor
- The requestor.path
- The reference path.- Returns:
- The property with the reference in question, or null if not found.
getPropReferenceTarget
protected GProp<?> getPropReferenceTarget()
Retargets the reference request as required. This is used e.g. by the File property container to retarget the request to the data container.- Returns:
- By default, returns
this
, should never return null.
getPropFromPath
public GProp<?> getPropFromPath(java.lang.String path)
Finds a property in the tree of the requested name from a path specification, i.e. a string divided by "/" for child properties, e.g. "component/host/flag" would perhaps find the grand child "flag" property in the child "host" property located in the "component" property.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.
- Specified by:
getPropFromPath
in interfaceIGProp<VALUE>
- Parameters:
path
- the path name of the property to locate in the tree.- Returns:
- GProp the property or
null
for uninitialized container or the property with specified name is not found.
getPropFromPath
public final GProp<?> getPropFromPath(GProp<?> requestor, java.lang.String path)
Finds a property in the tree of the requested name from a path specification, i.e. a string divided by "/" for child properties, e.g. "component/host/flag" would perhaps find the grand child "flag" property in the child "host" property located in the "component" property.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.
- Parameters:
requestor
- The requestor.path
- The path name of the property to locate in the tree.- Returns:
- GProp the property or
null
for uninitialized container or the property with specified name is not found.
isPropChildOf
public final boolean isPropChildOf(IPropCnr parent)
Checks if this property is child of a parent property. The parent tree is searched.
- Specified by:
isPropChildOf
in interfaceIGProp<VALUE>
- Parameters:
parent
- The parent to check.- Returns:
- true if this property has
setParent
public final void setParent(IPropCnr aParent)
Sets the parent for this property. To remove the parent, set the parent to null.
getParent
public final PropCnr getParent()
Gets the parent of this property.
getParent
public final <PROPCNR extends PropCnr> PROPCNR getParent(java.lang.Class<PROPCNR> clazz)
Gets the parent of this property with the requested type.
getRootParent
public final PropCnr getRootParent()
Gets the root container in the property tree.- Specified by:
getRootParent
in interfaceIGProp<VALUE>
- Returns:
- PropCnr The root parent or null for none.
getRootParent
protected PropCnr getRootParent(GProp<?> requestor)
Gets the root container in the property tree.- Parameters:
requestor
- The requestor.- Returns:
- PropCnr The root parent or null for none.
isProxied
public final boolean isProxied()
Checks if a property is a child of a proxied property container. This is used e.g. in event dispatching if a remote event is received by GProp and should call onRemoteEvent or onEvent. The onRemoteEvent is NOT called when in a proxied property container.- Returns:
- true if a child of a ProxyPropCnr, false otherwise.
getAtomPath
public final Atom[] getAtomPath(PropCnr stopAt)
Gets the atom path of this property.- Specified by:
getAtomPath
in interfaceIGProp<VALUE>
- Parameters:
stopAt
- Stop at this property container. If null the root is used.- Returns:
- An array of Atom's, null if
stopAt
is not a grand-parent.
getPropPath
public final PropCnr[] getPropPath(boolean includeThisPropCnr)
Gets the parents to the root of this property.- Specified by:
getPropPath
in interfaceIGProp<VALUE>
- Parameters:
includeThisPropCnr
- If true and this property is an instance of PropCnr, it is added at the end of the array.- Returns:
- The array of parents, first element being the root parent, last the direct parent.
getPropPath
public final PropCnr[] getPropPath(boolean includeThisPropCnr, IPropCnr stop)
Gets the parents to the input property or the root of this property.- Specified by:
getPropPath
in interfaceIGProp<VALUE>
- Parameters:
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).- Returns:
- The array of parents, first element being the input property or root parent, last the direct parent.
getEnvironment
public EnvProps getEnvironment()
Gets the environment properties. The default is to delegate the request to the parent container.- Specified by:
getEnvironment
in interfaceIGProp<VALUE>
- Returns:
- The EnvProps for the client/server environment or null if not found.
getPropIndex
public final int getPropIndex()
Gets the index of this property in the parent container.- Specified by:
getPropIndex
in interfaceIGProp<VALUE>
- Returns:
- int, the index of this property in the parent container, -1 if no parent or not found.
onPropParentChanged
protected void onPropParentChanged(PropCnr oldParent, PropCnr newParent)
Called when the parent is changed for this class. The default implementation does nothing and must be overridden by subclasses.- Parameters:
oldParent
- The old parent (or null if none).newParent
- The new parent (or null if none).
moveProp
public final boolean moveProp(PropCnr moveToContainer) throws PropException
Moves this property container to another container, without changing the listeners. The event "PropMoveEvent" is fired. For a client connection, this results in two operations: one add and one remove event.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.
- Specified by:
moveProp
in interfaceIGProp<VALUE>
- Parameters:
moveToContainer
- The container to move this container to.- Returns:
- true for success, false for failure (e.g. property not found in the parent). true is returned even if there is no change in the move operation.
- Throws:
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.
moveProp
public final boolean moveProp(PropCnr moveToContainer, Atom newName, Atom reference, boolean isAfter) throws PropException
Moves this property container to another container, without changing the listeners. The event "PropMoveEvent" is fired. For a client connection, this results in two operations: one add and one remove event.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.
- Specified by:
moveProp
in interfaceIGProp<VALUE>
- Parameters:
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.- Returns:
- true for success, false for failure (e.g. property not found in the parent). true is returned even if there is no change in the move operation.
- Throws:
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.
moveProp
public final boolean moveProp(PropCnr moveToContainer, Atom newName, int destinationIndex) throws PropException
Moves this property container to another container, without changing the listeners. The event "PropMoveEvent" is fired. For a client connection, this results in two operations: one add and one remove event.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.
- Specified by:
moveProp
in interfaceIGProp<VALUE>
- Parameters:
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.- Returns:
- true for success, false for failure (e.g. property not found in the parent). true is returned even if there is no change in the move operation.
- Throws:
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.
onPropDispose
protected void onPropDispose()
Called when a property is disposed of by delete/remove in a container, or by the dispose method.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.
setChanged
public final void setChanged()
Forces setting of the change flag. If the flag was cleared prior to this call, thesetChanged
will propagate to the topmost parent (if any).- Specified by:
setChanged
in interfaceIGProp<VALUE>
hasChanged
public final boolean hasChanged()
Checks if the value has been changed since last time the other party was updated by a call toappend
or since last call to{link #resetChangedTree()}
.- Specified by:
hasChanged
in interfaceIGProp<VALUE>
- Returns:
- true if changed, false otherwise.
resetChangedTree
protected final void resetChangedTree()
Forces clearing of the change flag for this property and all its children. The property container overrides this method and callsresetChangedTree
for all its children properties.
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.- Returns:
- true if the property should be set to private at creation, false for default.
setPropPrivate
public final boolean setPropPrivate(boolean on)
Sets the flag indicating property is private.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.
- Specified by:
setPropPrivate
in interfaceIGProp<VALUE>
- Parameters:
on
- flag indicating if it's private or not.- Returns:
- true for changed, false for no change.
setPrivateCreateRequiredProp
protected final void setPrivateCreateRequiredProp()
Sets the flag indicating property requires a "create transaction" when sent to the other party (server to client or vice versa). This method is not overridable and only sets the create property flag for this property, i.e. doesn't affect any children.
isPropPrivate
public final boolean isPropPrivate()
Checks if this property is private, i.e. is not sent to the remote party (server to client or vice versa).- Specified by:
isPropPrivate
in interfaceIGProp<VALUE>
- Returns:
- true if the property is private, false otherwise.
isPropCommunicating
public boolean isPropCommunicating()
Checks if this property container is used with the communication framework.- Specified by:
isPropCommunicating
in interfaceIGProp<VALUE>
- Returns:
- true if property is attached to a container that is communicating with a client, false otherwise.
setPropVolatile
public final void setPropVolatile()
Sets the flag indicating property is "volatile" and is not written to XML. Setting this flag does not cause an event to be fired.
isPropVolatile
public final boolean isPropVolatile()
Checks if this property is volatile, i.e. not written to XML.- Returns:
- true if the property is volatile, false otherwise.
isPropVolatileOrEditorOnly
protected boolean isPropVolatileOrEditorOnly()
Checks if this property is volatile, i.e. not written to XML, or if it is for editor-only.- Returns:
- true if the property is volatile or is used in the Editor only.
isPropVirtualized
public final boolean isPropVirtualized()
Checks if this property has been virtualized.- Specified by:
isPropVirtualized
in interfaceIGProp<VALUE>
- Returns:
- true if the property is virtualized, false otherwise.
setPropUSER
protected final void setPropUSER(long userValue)
Sets the flag indicating property is "PROP_USER_*. Setting this flag does not cause an event to be fired.- Parameters:
userValue
- The user value to add (bitwise).
removePropUSER
protected final void removePropUSER(long userValue)
Removes the flag indicating property is "PROP_USER_*. Setting this flag does not cause an event to be fired.- Parameters:
userValue
- The user value to remove (bitwise).
isPropUSER
protected final boolean isPropUSER(long userValue)
Checks if this property is "PROP_USER_*.
setPropReadOnly
public final boolean setPropReadOnly(boolean on)
Sets the flag indicating property is read-only.- Specified by:
setPropReadOnly
in interfaceIGProp<VALUE>
- Parameters:
on
- flag indicating if it's read-only or not.- Returns:
- true for changed, false for no change.
isPropReadOnly
public final boolean isPropReadOnly()
Checks if this property is read-only.- Specified by:
isPropReadOnly
in interfaceIGProp<VALUE>
- Returns:
- true if read-only, false otherwise.
throwIfReadOnly
protected final void throwIfReadOnly() throws PropTypeException
Throw an error if the property is read-only.- Throws:
PropTypeException
- if the property is read-only.
setPropNullable
public final boolean setPropNullable(boolean on)
Sets the flag indicating property is nullable with setPropValue.- Specified by:
setPropNullable
in interfaceIGProp<VALUE>
- Parameters:
on
- flag indicating if it's nullable or not.- Returns:
- true for changed, false for no change.
isPropNullable
public final boolean isPropNullable()
Checks if this property is nullable.- Specified by:
isPropNullable
in interfaceIGProp<VALUE>
- Returns:
- true if property is nullable, false otherwise.
setPropForEditor
public final void setPropForEditor(boolean on)
Sets the flag indicating property is the Editor only.- Parameters:
on
- flag indicating if it's for the Editor only or not.
isPropForEditor
public final boolean isPropForEditor()
Checks if this property is for the Editor only and should e.g. not be used or loaded in the Server.
getErrorsProp
public ErrorsProp getErrorsProp()
Gets the error property from the parent. If not found, the property up to the root is searched and if found, that error property is returned. Several property containers, such as UIComp, override this method and creates the error property in its own container, and that error property is returned.- Specified by:
getErrorsProp
in interfaceIGProp<VALUE>
- Returns:
- The error property for this property or above in the property tree.
addPropError
public final boolean addPropError(IPropErrorItem item)
Adds an error input to the property.- Specified by:
addPropError
in interfaceIGProp<VALUE>
- Parameters:
item
- The error item.- Returns:
- true for changed, false for no change.
getPropError
public IPropErrorItem getPropError(java.lang.String id)
Gets the error input item with specified ID, for none specify empty string.- Specified by:
getPropError
in interfaceIGProp<VALUE>
- Parameters:
id
- The ID for the error, can be empty string (null means default empty string).- Returns:
- The error item for the ID, or null for not found.
removePropError
public final boolean removePropError(java.lang.String id)
Removes an error input from the property.- Specified by:
removePropError
in interfaceIGProp<VALUE>
- Parameters:
id
- The error ID, null for default (empty string).- Returns:
- true for changed, false for no change or error ID not found.
getPropError
public final PropError getPropError()
Gets the property error instance.- Specified by:
getPropError
in interfaceIGProp<VALUE>
- Returns:
- The error property instance null for no error.
setPropError
public boolean setPropError(PropError error)
Sets all or clears the errors for the property. If theerror
instance is non-null, a check if done if theerror
instance is empty, and if so, changed to null, causing it to have the same effect as to callsetPropError(null)
.- Specified by:
setPropError
in interfaceIGProp<VALUE>
- Parameters:
error
- The error property or null to clear the errors.- Returns:
- true for changed, false for no change.
hasPropError
public final boolean hasPropError()
Checks if this property has an error. If this property object has a registered errors, true is returned.- Specified by:
hasPropError
in interfaceIGProp<VALUE>
- Returns:
- true if an error is registered for the property.
getPropErrorSeverity
public final int getPropErrorSeverity()
Gets the error severity of this property.- Specified by:
getPropErrorSeverity
in interfaceIGProp<VALUE>
- Returns:
- -1 for none, otherwise IPropErrorItem.INFO=0, WARNING=1, ERROR=2.
hasPropTreeError
public final boolean hasPropTreeError(boolean excludeExtends)
Checks if any property in the tree below this property has an error.- Specified by:
hasPropTreeError
in interfaceIGProp<VALUE>
- Parameters:
excludeExtends
- Flag indicating the properties that originates from the Extends Framework should be excluded from the search.- Returns:
- true if any error is present in any property or their values.
getPropTreeErrorSeverity
public final int getPropTreeErrorSeverity(boolean excludeExtends)
Gets the maximum error severity of this property or any property below.- Specified by:
getPropTreeErrorSeverity
in interfaceIGProp<VALUE>
- Parameters:
excludeExtends
- Flag indicating the properties that originates from the Extends Framework should be excluded from the search.- Returns:
- -1 for none, otherwise IPropErrorItem.INFO=0, WARNING=1, ERROR=2.
getErroredProps
public final void getErroredProps(java.util.ArrayList<GProp<?>> list, boolean excludeExtends)
Retrieves the properties containing errors.- Specified by:
getErroredProps
in interfaceIGProp<VALUE>
- Parameters:
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.
getErroredPropItems
public final void getErroredPropItems(java.util.ArrayList<PropErrorItemOrigin> list, boolean excludeExtends)
Retrieves the list of error items for this property and its children (if this property is a container).- Specified by:
getErroredPropItems
in interfaceIGProp<VALUE>
- Parameters:
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.
setCreateRequiredProp
protected boolean setCreateRequiredProp()
Sets the flag indicating property requires a "create transaction" when sent to the other party (server to client or vice versa).The property container overrides this method by first calling
super.setCreateRequiredProp()
thensetCreateRequiredProp
to all its children.- Returns:
- true for change, false for no change.
isPropCreateRequired
public final boolean isPropCreateRequired()
Checks if this property requires a "create transaction" when sent to the other party (server to client or vice versa).- Specified by:
isPropCreateRequired
in interfaceIGProp<VALUE>
- Returns:
- true if the property needs creation for transactions, false otherwise.
setPrivateChangeEventProp
public final boolean setPrivateChangeEventProp(boolean on)
Sets the flag indicating this property uses a "private" change event, i.e. doesn't inform the parent when value changes.- Specified by:
setPrivateChangeEventProp
in interfaceIGProp<VALUE>
- Parameters:
on
- flag indicates this is set (true) or cleared (false).- Returns:
- true for changed, false for no change.
hasPrivateChangeEventProp
public final boolean hasPrivateChangeEventProp()
Checks the flag indicating this property uses a "private" change event, i.e. doesn't inform the parent when value changes.- Specified by:
hasPrivateChangeEventProp
in interfaceIGProp<VALUE>
- Returns:
- true if the change event is "private", false otherwise.
setConstraints
public java.lang.Object setConstraints(java.lang.String constraints, org.w3c.dom.Element element) throws PropException
Sets the constraints for the property.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.
- Specified by:
setConstraints
in interfaceIGProp<VALUE>
- Parameters:
constraints
- The constraints string from the properties definition.element
- The Element that loads the property class from the properties definition. Note that Element may benull
if the constructor isn't called from the PropertyFactory.- Returns:
- The constraints object for reuse by the
PropertyFactory
with a subsequentsetConstraints(Object)
call instead of to this method. This method always returnsnull
and must be overridden by subclasses. - Throws:
PropException
- For errors in the constraints definitions.
setConstraints
public void setConstraints(java.lang.Object constraints, java.lang.String prevConstraints, org.w3c.dom.Element prevElement) throws PropException
Sets the constraints for the property previously returned from the same constraints call tosetConstraints(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.
- Specified by:
setConstraints
in interfaceIGProp<VALUE>
- Parameters:
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.- Throws:
PropException
- For errors in the constraints definitions.
getConstraints
public java.lang.String getConstraints()
Gets the constraints string for this property.This method must be overridden by subclasses in order to return something of interest, because this method by default returns
null
.- Specified by:
getConstraints
in interfaceIGProp<VALUE>
- Returns:
- The constraints string used to in
setConstraints
to initiate the constraints for this property.
setPropValue
public final boolean setPropValue(java.lang.Object newValue) throws PropException
Sets a new value for this property. If any listener is present and the value has changed compare to the last value, the listener is informed.- Specified by:
setPropValue
in interfaceIGProp<VALUE>
- Parameters:
newValue
- the new value.- Returns:
- boolean true for value has changed, false for same value as current value.
- Throws:
PropException
- When the new value doesn't validate correctly.PropTypeException
- If the property is read-only.
setPropValue
public final boolean setPropValue(java.lang.Object newValue, IGProp<?> trigger) throws PropException
Sets a new value for this property. If any listener is present and the value has changed compare to the last value, the listener is informed.- Specified by:
setPropValue
in interfaceIGProp<VALUE>
- Parameters:
newValue
- The new value.trigger
- The trigger property, or null for none.- Returns:
- boolean true for value has changed, false for same value as current value.
- Throws:
PropException
- When the new value doesn't validate correctly.PropTypeException
- If the property is read-only.
isPropValueTreeLockNeeded
protected boolean isPropValueTreeLockNeeded()
Checks if the tree needs to be locked when setting the property value.- Returns:
- false by default.
setPropValue
protected final boolean setPropValue(java.lang.Object newValue, PropMgr propMgr) throws PropException
Sets a new value for this property. If any listener is present and the value has changed compare to the last value, the listener is informed.- Parameters:
newValue
- The new value.propMgr
- The property manager for remote change, null for local.- Returns:
- boolean true for value has changed, false for same value as current value.
- Throws:
PropException
- When the new value doesn't validate correctly.PropTypeException
- If the property is read-only.
onPropValueSet
protected void onPropValueSet(java.lang.Object oldValue)
Called when the property value is changed by theGProp
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!
- Parameters:
oldValue
- The old value.
modifyPropValue
protected int modifyPropValue(java.lang.Object oldValue, java.lang.Object newValue, PropMgr propMgr) throws PropException
Called when setting a new value for this property. This method is normally not overridden by subclasses, but e.g. for properties containing arrays, this may be handled here, in order not modify the "oldValue" (such as an array, but rather to change it with the data from the "newValue").- Parameters:
oldValue
- The old value.newValue
- The new value.propMgr
- The property manager for remote change, null for local.- Returns:
- 1 for value has changed, 0 for same value as current value, -1 for not processed. 2 can also be returned to indicate the current value has been modified with new contents. This is e.g. the case for the StringMapProp.
- Throws:
PropException
- when the new value doesn't validate correctly.
setPropValueIncognito
protected final void setPropValueIncognito(java.lang.Object newValue)
Sets a new value for this property. Any listeners present are not informed; this method is intended for setting the property value at reception of a transaction after having created the property instance. The changed state of the property is not affected.Note: no checking is done if the property is read-only, valid type or valid value or constraints!
- Parameters:
newValue
- the new value.- Throws:
java.lang.NullPointerException
- when newValue is null.
validateProp
public final void validateProp(java.lang.Object newValue) throws PropException
Validates the value to set by first callingvalidateType
, thenvalidateValue
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
andvalidatePropertyValue
in the property-synchronized code, so these methods should not synchronize the tree either.- Specified by:
validateProp
in interfaceIGProp<VALUE>
- Parameters:
newValue
- The new value to set.- Throws:
PropException
- when the new value doesn't validate correctly.
validatePropType
public abstract void validatePropType(java.lang.Object newValue) throws PropTypeException
Validates the newValue against the property object type. Subclasses must override this method to perform optional value type validation.Note: When this method is called, synchronization is done at the property itself, so no synchronization on the tree should be done.
- Specified by:
validatePropType
in interfaceIGProp<VALUE>
- Parameters:
newValue
- The new value to set.- Throws:
PropTypeException
- when the new value isn't of the correct class.
validatePropValue
public void validatePropValue(java.lang.Object newValue) throws PropException
Validates the value to set. Subclasses can override this method to perform optional value validation. No validation is performed in this method.Note: When this method is called, synchronization is done at the property itself, so no synchronization on the tree should be done.
- Specified by:
validatePropValue
in interfaceIGProp<VALUE>
- Parameters:
newValue
- The new value to set.- Throws:
PropException
- when the new value doesn't validate correctly.
getPropValueObject
public final java.lang.Object getPropValueObject()
Gets the current value set, null for an uninitialized value.- Returns:
- Object the value or null for uninitialized value.
getPropValue
public final VALUE getPropValue()
Gets the current value set, null for an uninitialized value.- Specified by:
getPropValue
in interfaceIGProp<VALUE>
- Returns:
- Object the value or null for uninitialized value.
getPropValue
public final java.lang.Object getPropValue(java.lang.Class<?> requestedType) throws java.lang.IllegalArgumentException, java.lang.Exception
Gets the property value in another class form than the "native" one. This method tries conversion of a "native" property value into another class type. This method is used when filling in a POJO variable (Plain Old Java Object Field) from a "native" property value.Subclasses overrides the method
getPropertyValue0
in order to provide the appropriate conversion.- Specified by:
getPropValue
in interfaceIGProp<VALUE>
- Parameters:
requestedType
- The requested class type of the property value, using appropriate conversion.- Returns:
- The property value in the requested class, after conversion.
- Throws:
java.lang.IllegalArgumentException
- If the class is not supported by the property for conversion.java.lang.Exception
- Other exceptions that could occur.
getPropValue0
protected abstract java.lang.Object getPropValue0(java.lang.Object value, int index) throws java.lang.Exception
Gets the property value in another class form than the "native" one. This method tries conversion of a "native" property value into another class type. This method is used when filling in a POJO variable (Plain Old Java Object Field) from a "native" property value.Subclasses overrides this method
getPropertyValue0
in order to provide the appropriate conversion.- Parameters:
value
- The property value.index
- The index in the Class array returned bygetValueClasses()
.- Returns:
- The property value in the requested class, after conversion.
- Throws:
java.lang.Exception
- Other exceptions that could occur.
addPropListener
public final void addPropListener(EventListener l)
Adds a listener for the property.- Specified by:
addPropListener
in interfaceIGProp<VALUE>
- Parameters:
l
- The listener to add.
removePropListener
public final void removePropListener(EventListener l)
Removes a listener for the property.- Specified by:
removePropListener
in interfaceIGProp<VALUE>
- Parameters:
l
- The listener to remove.
onEventSelf
public 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<VALUE>
- Parameters:
event
- The property event.
onRemoteEvent
public void onRemoteEvent(RemoteEvent event)
Called when a remote property event should be processed by this property.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.
- Specified by:
onRemoteEvent
in interfaceIGProp<VALUE>
- Parameters:
event
- The remote event.
onEvent
public final void onEvent(GEvent event)
Called when a property event is send to this property.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.
- Specified by:
onEvent
in interfaceEventListener
- Specified by:
onEvent
in interfaceIGProp<VALUE>
- 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)
.- Parameters:
event
- The resolve references event.
appendPropValue
protected abstract void appendPropValue(PropMgr propertyManager, SendTransaction trans, java.lang.Object value)
Appends the property value and all its children to a transaction using theAtomManager
.This method must is overridden in all subclasses.
- Parameters:
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.
initializeValue
protected abstract boolean initializeValue(PropMgr propertyManager, ReadTransaction trans) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, PropException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalArgumentException
Initializes the property value from a transaction.- Parameters:
propertyManager
- the property manager.trans
- the transaction to initialize the property with.- Returns:
- true if the value has changed, false otherwise.
- Throws:
java.lang.ClassNotFoundException
- - if the class could not be found.java.lang.IllegalAccessException
- - if the class or its nullary constructor is not accessible.java.lang.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.java.lang.ExceptionInInitializerError
- - if the initialization provoked by this method fails.java.lang.SecurityException
- - If a security manager, s, is present and any of the following conditions is met:- invocation of s.checkMemberAccess(this, Member.PUBLIC) denies creation of new instances of this class,
- the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class.
PropException
- - if the property cannot be initialized, because of erroneous data.java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
java.lang.IllegalArgumentException
initializeGProp
public final void initializeGProp(org.w3c.dom.Element element) throws PropException
Called to initialize the generic property from anElement
.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.
- PROP_ATTR_STRING_READ_ONLY
- PROP_ATTR_STRING_PRIVATE
- PROP_ATTR_STRING_NULLABLE
- PROP_ATTR_STRING_EDITOR_PROP
- PROP_ATTR_STRING_INFORM_PARENT
- PROP_ATTR_STRING_ERRORED_NAME
- PROP_ATTR_STRING_EXTENDS_PRIVATE
- PROP_ATTR_STRING_EXTENDS_FINAL
These attributes are read from the Element for all property containers.
- PROP_ATTR_STRING_EXTENDS
An extra error Element "propError" is also be read for the property error(s).
- Specified by:
initializeGProp
in interfaceIGProp<VALUE>
- Parameters:
element
- TheElement
.- Throws:
PropException
- when the initialization fails.
getAttribute
public static java.lang.String getAttribute(org.w3c.dom.Element element, java.lang.String name)
Gets a attribute string.- Parameters:
element
- The element.name
- The attribute name.- Returns:
- null if not found.
initializeProp
protected void initializeProp(org.w3c.dom.Element element) throws PropException
Called to initialize the property from anElement
. 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 bysetPropertyValue(object)
.- Parameters:
element
- TheElement
.- Throws:
PropException
- when the initialization fails.
fromElementString
public java.lang.Object fromElementString(java.lang.String string) throws PropException
Called from theinitializeProperty(Element element)
method once the element String is retrieved from the "value" attribute of the element. Override this method to provide the appropriateString
toObject
conversion.The default implementation returns the
String
passed as the parameter.- Specified by:
fromElementString
in interfaceIGProp<VALUE>
- Parameters:
string
- the String value of the object from the String value attribute.- Returns:
- the Object in "native" property value form of the string value.
- Throws:
PropException
- when the conversion fails.
convertPropError
protected final java.lang.Object convertPropError(java.lang.String string, java.lang.Exception thrown) throws PropException
Creates and throws a PropertyException when theString
doesn't convert properly into a "native" Object.- Parameters:
string
- the string value.thrown
- the Exception that was thrown.- Returns:
- Never returns, but method definition returns an Object.
- Throws:
PropException
- - always, with the exception error text.
onPropTreeInitialized
public void onPropTreeInitialized() throws java.io.IOException, PropException
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.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.- Specified by:
onPropTreeInitialized
in interfaceIGProp<VALUE>
- Throws:
java.io.IOException
- For file errors.PropException
- When there is an initialization problem.
shouldSerializeToXML
protected boolean shouldSerializeToXML(int programType)
Method used to check for serialization to XML. Override this method and return false to avoid writing the property to XML. The default is to write all properties.- Parameters:
programType
- From PropFactory.getProgramType(): 0=PropFactory.CLIENT
, 1=PropFactory.SERVER
or 2=PropFactory.EDITOR
.- Returns:
- true (default if not VOLATILE) to save to XML, false to avoid writing the property to XML.
initializeGElement
public final void initializeGElement(org.w3c.dom.Element element)
Called when the XML file for the property tree is serialized from properties. The property should fill attributes and nodes with appropriate information.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:
- PROP_ATTR_STRING_READ_ONLY
- PROP_ATTR_STRING_PRIVATE
- PROP_ATTR_STRING_NULLABLE
- PROP_ATTR_STRING_EDITOR_PROP
- PROP_ATTR_STRING_INFORM_PARENT
- PROP_ATTR_STRING_ERRORED_NAME
- PROP_ATTR_STRING_EXTENDS_PRIVATE
- PROP_ATTR_STRING_EXTENDS_FINAL
These attributes are set for the Element for all property containers as required.
- PROP_ATTR_STRING_EXTENDS
An extra error element "propError" may also be added for the property error(s).
- Specified by:
initializeGElement
in interfaceIGProp<VALUE>
- Parameters:
element
- The element.
initializeElement
protected void initializeElement(org.w3c.dom.Element element)
Called when the XML file for the property tree is serialized from properties. The property should fill attributes and nodes with appropriate information.Subclasses should override this method if custom initialization is required.
- Parameters:
element
- TheElement
to initialize.
toElementString
public java.lang.String toElementString(java.lang.Object value)
Called from theinitializeElement(Element element)
method. Override this method to provide the appropriateObject
toString
conversion.The default implementation returns the
Object value.toString()
return code. If the value is null, null is returned.- Specified by:
toElementString
in interfaceIGProp<VALUE>
- Parameters:
value
- the value in the object to convert to a string.- Returns:
- the string corresponding to the object value, or null for a null value.
toNativeValue
public final java.lang.Object toNativeValue(java.lang.Object value) throws java.lang.NullPointerException, java.lang.Exception
Tries conversion of possibly accepted properties values using thesetPropertyValue
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.- Specified by:
toNativeValue
in interfaceIGProp<VALUE>
- Parameters:
value
- the input value to convert to native value.- Returns:
- The converted input value in the preferred property value object type.
- Throws:
java.lang.NullPointerException
- If the input Object value is null.java.lang.Exception
- Other exceptions.
toNativeValue0
protected abstract java.lang.Object toNativeValue0(java.lang.Object value, int index) throws java.lang.Exception
Tries conversion of possibly accepted properties values using thesetPropertyValue
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.- Parameters:
value
- The input value to convert to native value.index
- The index in the array returned bygetValueClasses()
, or -1 if not found.- Returns:
- The converted input value in the preferred property value object type.
- Throws:
java.lang.Exception
- For conversion exceptions.
getVSReference
public VSReference getVSReference(Atom refAtom)
Gets a VSReference instance from the container or any parent containers. The method is used byVSRelativeReference
to look up theVSReference
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. theJSONInProp
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.- Specified by:
getVSReference
in interfaceIGProp<VALUE>
- Parameters:
refAtom
- The property asking for the VSReference.- Returns:
- The instance of the
VSReference
ornull
if unassigned.
getPropBaseReference
public PropCnr getPropBaseReference()
Gets a base property container reference instance from the container or any parent containers. The method is used byPropRelativeReference
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. theScreenProp
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.- Specified by:
getPropBaseReference
in interfaceIGProp<VALUE>
- Returns:
- The instance of the
PropCnr
ornull
if unassigned.
verifyHasPropertyItem
public boolean verifyHasPropertyItem(java.lang.String propertyItem)
Checks if this property has the property item during validation of references. The default behavior is to return false, because a property by default doesn't have a "property item", but e.g. the Text Table has, so that property overrides this method.- Specified by:
verifyHasPropertyItem
in interfaceIGProp<VALUE>
- Parameters:
propertyItem
- The property item name.- Returns:
- false Always, unless overridden by a subclass.
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<VALUE>
- Parameters:
references
- The references array is filled in by this method.- Returns:
- The count of references added.
verify
public boolean verify(PropVerification verification)
Verifies this property. The check performed is the extension of classes and that no circular reference is present.
setPropExtended
public final void setPropExtended(boolean on)
Sets the flag indicating this property is extended. This flag means the property is originating from an Extends container initially.- Parameters:
on
- flag indicates this is set (true) or cleared (false).
isPropExtended
public final boolean isPropExtended()
Checks the flag indicating this property is a property belonging to another container. This flag means the property is originating from an Extends container initially.- Specified by:
isPropExtended
in interfaceIGProp<VALUE>
- Returns:
- true if the property originates from the Extends container, false otherwise.
setPropExtendsPrivate
public final 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. Extends Private properties are not transported to the container that extends the original container.- Specified by:
setPropExtendsPrivate
in interfaceIGProp<VALUE>
- Parameters:
on
- flag indicating if it's Extends Private or not.- Returns:
- true for changed, false for no change.
isPropExtendsPrivate
public final boolean isPropExtendsPrivate()
Checks if this property is Extends Private in regards to the Extends Framework.- Specified by:
isPropExtendsPrivate
in interfaceIGProp<VALUE>
- Returns:
- true is the property has the Extends Private attribute.
isPropExtendsPrivateInRoot
public final 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.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)
.- Specified by:
isPropExtendsPrivateInRoot
in interfaceIGProp<VALUE>
- Returns:
- true if a property in the hierarchy between the extends root (excluded), and this property, the
isPropExtendsPrivate()
method would return true. It is false if no Extends Private exists, or if the root is not found.
isPropExtendsPrivateInRoot
public final 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.- Specified by:
isPropExtendsPrivateInRoot
in interfaceIGProp<VALUE>
- Parameters:
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).- Returns:
- true if a property in the hierarchy between the extends root (excluded), and this property, the
isPropExtendsPrivate()
method would return true. It is false if no Extends Private exists, or if the root is not found.
setPropExtendsFinal
public final 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. Extends Final properties cannot be modified in containers that extends the original container, and to clarify, the Extends Final properties are set in the original container's properties or the container itself.- Specified by:
setPropExtendsFinal
in interfaceIGProp<VALUE>
- Parameters:
on
- flag indicating if it's Extends Final or not.- Returns:
- true for changed, false for no change.
isPropExtendsFinal
public final boolean isPropExtendsFinal()
Checks if this property is Extends Final in regards to the Extends Framework.- Specified by:
isPropExtendsFinal
in interfaceIGProp<VALUE>
- Returns:
- true is the property has the Extends Final attribute.
getExtendsRootContainer
public PropCnr getExtendsRootContainer()
Searches for an Extends container for a property. The parent tree is searched for a container withPropCnr.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()
orisPropRoot()
returns true).- Specified by:
getExtendsRootContainer
in interfaceIGProp<VALUE>
- Returns:
- The Extends container root, or
null
if such a container is not found.
getPropExtendsFlags
public int getPropExtendsFlags()
Checks if this property extends another property, and if so gets the extends flags. This call is only interesting to do in the Designer where the Extends Framework is used. It requires a little processing, so do not call it too often if not required.- Specified by:
getPropExtendsFlags
in interfaceIGProp<VALUE>
- Returns:
- A value with the flags in the bit-values below:
- EXT_EXTENDED - Extended property.
- EXT_PRIVATE - Private Extends.
- EXT_FINAL - Final Extends.
- EXT_OVERRIDES - Overrides a source property.
- EXT_OVERRIDES_FINAL_ERR - Overrides a source property that is final = error.
- EXT_CONTAINER_EXTENDS - Container extends another container (only for containers)
- EXT_CONTAINER_EXTENDS_VALID - Container extends another container, and reference is valid (only for containers).
paramString
protected java.lang.String paramString()
Returns the parameter string representing the state of this event. This string is useful for debugging. Subclasses adds extra information to the string by preceding it with a comma followed by the extra information.- Returns:
- the parameter string of this event.
paramValue
protected java.lang.String paramValue(java.lang.Object value)
Formats the value as a string to add toparamString
. The default is to do "value.toString()" if value is not null, otherwise "[null]" is returned.
toString
public java.lang.String toString()
Returns a string representation of this component and its values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this property.
toString
public static java.lang.String toString(IGProp<?> gp)
Returns a string representation of this component and its values.- Parameters:
gp
- the property to convert to a string.- Returns:
- a string representation of this property.
equals
public final boolean equals(java.lang.Object o)
Checks for equality, including private properties. Use the methodequals(Object,boolean=false)
not to include the private properties.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- The other property to compare with.- Returns:
- Properties are equal flag.
equals
public final boolean equals(java.lang.Object o, int how)
Checks for equality.
equalsObj
public final java.lang.Object equalsObj(java.lang.Object o, int how)
Checks for equality.- Parameters:
o
- The other property to compare with.how
- Flags EQC_* values for equal checking.- Returns:
- The non-equal object: Atom, Atom [], or 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.
- 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.
equalValues
protected java.lang.Object equalValues(GProp<?> compareTo, VALUE thisValue, VALUE compareValue, int how)
Checks for property value equality. The object is of the correct type for the respective property type. The Atoms and other properties such as Private/Extends has already been checked for equality or correctness.- Parameters:
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.- Returns:
- The property not being equal, null for equal (both values null).
equalsPropValue
public final boolean equalsPropValue(java.lang.Object otherPropValue)
Checks if another value is equal to the value in this object. Do not use this method to compare two property containers as this may not be an accurate method. This method is intended to be used for plain property value comparisons.- Parameters:
otherPropValue
- The value to compare with.- Returns:
- true if the values are equal, false otherwise.
equalsTree
protected java.lang.Object equalsTree(PropCnr pc, int how)
Checks for equality in the whole container structure.- Parameters:
pc
- Another property container.how
- Flags EQC_* values for equal checking.- Returns:
- Both atom and value are equal on all levels.
list
public void list()
Prints a listing of this property to the standard system output streamSystem.out
.
list
public void list(java.io.PrintStream out)
Prints a listing of this property to the specified output stream.
list
public void list(java.io.PrintStream out, int indent)
Prints out a list, starting at the specified indentation, to the specified print stream.
list
public void list(java.io.PrintWriter out)
Prints a listing to the specified print writer.
list
public void list(java.io.PrintWriter out, int indent)
Prints out a list, starting at the specified indentation, to the specified print writer.
finest
public void finest(java.lang.String msg)
Logs a finest event.
finest
public void finest(java.lang.String msg, java.lang.Object... params)
Logs a finest event.
finer
public void finer(java.lang.String msg)
Logs a finer event.
finer
public void finer(java.lang.String msg, java.lang.Object... params)
Logs a finer event.
fine
public void fine(java.lang.String msg)
Logs a fine event.
fine
public void fine(java.lang.String msg, java.lang.Object... params)
Logs a fine event.
info
public void info(java.lang.String msg)
Logs an informational event.
info
public void info(java.lang.String msg, java.lang.Object... params)
Logs an informational event.
warning
public void warning(java.lang.String msg)
Logs a warning event.
warning
public void warning(java.lang.String msg, java.lang.Object... params)
Logs a warning event.
warning
public void warning(java.lang.String msg, java.lang.Throwable exception)
Logs a warning event.
severe
public void severe(java.lang.String msg)
Logs a severe event.
severe
public void severe(java.lang.String msg, java.lang.Throwable exception)
Logs a severe event.
severe
public void severe(java.lang.String msg, java.lang.Object... params)
Logs a severe event.
triggerRemoteEvent
public void triggerRemoteEvent(int localID)
Triggers a remote event for execution at the remote partyonRemoteEvent()
method of this remote property instance.- Specified by:
triggerRemoteEvent
in interfaceIGProp<VALUE>
- Parameters:
localID
- The property-local event ID.
triggerRemoteEvent
public void triggerRemoteEvent(int localID, PropCnr params)
Triggers a remote event for execution at the remote partyonRemoteEvent()
method of this remote property instance.- Specified by:
triggerRemoteEvent
in interfaceIGProp<VALUE>
- Parameters:
localID
- The property-local event ID.params
- Parameters for the event, null for none.