Package com.adobe.xfa
Class Obj
- java.lang.Object
-
- com.adobe.xfa.Obj
-
- All Implemented Interfaces:
Peer
- Direct Known Subclasses:
DataWindow
,Delta
,FormDataListener
,FormItemsDataListener
,FormListener
,InstanceManager
,ListBase
,Node
,PseudoModel
public abstract class Obj extends java.lang.Object implements Peer
A base class to represent all XFA objects, templates and data. The methods defined in this class are primarily for use in scripting environments.
-
-
Field Summary
-
Fields inherited from interface com.adobe.xfa.ut.Peer
ATTR_CHANGED, CHILD_ADDED, CHILD_REMOVED, DESCENDENT_ADDED, DESCENDENT_ATTR_CHANGED, DESCENDENT_REMOVED, DESCENDENT_VALUE_CHANGED, PARENT_CHANGED, PERMS_LOCK_CLEARED, PERMS_LOCK_SET, PROTO_ATTR_CHANGED, PROTO_CHILD_ADDED, PROTO_CHILD_REMOVED, PROTO_DESCENDENT_ADDED, PROTO_DESCENDENT_ATTR_CHANGED, PROTO_DESCENDENT_REMOVED, PROTO_DESCENDENT_VALUE_CHANGED, PROTO_VALUE_CHANGED, UPDATED, VALUE_CHANGED
-
-
Constructor Summary
Constructors Constructor Description Obj()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPeer(Peer poPeerNode)
Add a peer node to be notified of state changes.void
addPeeredNode(Peer poPeer)
void
clearPeers()
Removes this node from all peer relationships.void
deafen()
Makes this peer deaf to any updateFromPeer calls made by notifyPeersjava.lang.String
getClassAtom()
Returns the atomic name of this element's class.java.lang.String
getClassName()
Gets the name of this object's class.int
getClassTag()
Peer
getPeer(int nPeer)
Gets the requested peer.ScriptFuncObj
getScriptMethodInfo(java.lang.String sName)
Gets the information on a script method.boolean
getScriptProperty(Arg retValue, java.lang.String sPropertyName, DependencyTracker dependencyTracker, boolean bPeek, boolean bSuppressExceptions)
ScriptTable
getScriptTable()
Obj
getScriptThis()
Gets the object to be used in concert with getScriptTable() etc.boolean
invokeFunction(Arg retValue, java.lang.String sFunctionName, Arg[] parameters, DependencyTracker dependencyTracker, boolean bSuppressExceptions)
Call a scripting function (method).boolean
isDeaf()
Checks if this peer is deaf.boolean
isMute()
Checks if this peer is mute.boolean
isSameClass(int eClassTag)
Determine if the class of this object is the same as the class tag.boolean
isSameClass(Obj oClass)
Determine if the class of this object is the same as the Obj class.boolean
isSameClass(java.lang.String aClass)
Determine if the class of this object is the same as the String sClass.void
mute()
Makes this peer no longer notify its peers when notifyPeers is calledvoid
notifyPeers(int eventType, java.lang.String arg1, java.lang.Object arg2)
Sends notification to the peer nodes that this object has changed.void
peerRemoved(Peer peer)
Called when this Peer is removed frompeer
.void
removePeer(Peer peerNode)
Remove a peer node from the notification list.void
removePeeredNode(Peer peer)
void
sendMessenge(ExFull error, int eSeverity)
Send message to host so it can be loggedvoid
setClass(java.lang.String sClassName, int eClassTag)
Set the class name and class tag for this node instance.void
setClassTag(int eClassTag)
boolean
setScriptProperty(java.lang.String sPropertyName, Arg propertyValue, boolean bSuppressExceptions)
void
unDeafen()
Allows this peer to receive updateFromPeer callsvoid
unMute()
Allows this peer to notify its peers when notifyPeers is called.void
updateFromPeer(java.lang.Object peerNode, int eventType, java.lang.String arg1, java.lang.Object arg2)
This method will be called by the peer whenever its state changes.boolean
validateUsage(int nXFAVersion, int nAvailability, boolean bUpdateVersion)
Validate if the given Version and Availability flags are valid for the current documentboolean
validateUsageFailedIsFatal(int nXFAVersion, int nAvailability)
Determines if disallowing a version should be considered a fatal error.
-
-
-
Method Detail
-
addPeer
public final void addPeer(Peer poPeerNode)
Description copied from interface:Peer
Add a peer node to be notified of state changes.
-
addPeeredNode
public final void addPeeredNode(Peer poPeer)
- Specified by:
addPeeredNode
in interfacePeer
-
clearPeers
public final void clearPeers()
Description copied from interface:Peer
Removes this node from all peer relationships.- Specified by:
clearPeers
in interfacePeer
-
deafen
public final void deafen()
Description copied from interface:Peer
Makes this peer deaf to any updateFromPeer calls made by notifyPeers
-
setClass
public final void setClass(java.lang.String sClassName, int eClassTag)
Set the class name and class tag for this node instance.- Parameters:
sClassName
- This String must be interned.eClassTag
-
-
setClassTag
public final void setClassTag(int eClassTag)
-
getClassTag
public final int getClassTag()
-
getClassAtom
public java.lang.String getClassAtom()
Returns the atomic name of this element's class.- Returns:
- the class name as an interned string.
-
getClassName
public java.lang.String getClassName()
Gets the name of this object's class. Overriden by derived classes such as Element that have a local name that may be returned instead.- Returns:
- the class name.
-
getPeer
public final Peer getPeer(int nPeer)
Gets the requested peer.
-
getScriptMethodInfo
public ScriptFuncObj getScriptMethodInfo(java.lang.String sName)
Gets the information on a script method.- Parameters:
sName
- the name of the method- Returns:
- the script function object or null if not found.
-
getScriptProperty
public boolean getScriptProperty(Arg retValue, java.lang.String sPropertyName, DependencyTracker dependencyTracker, boolean bPeek, boolean bSuppressExceptions)
-
getScriptTable
public ScriptTable getScriptTable()
-
getScriptThis
public Obj getScriptThis()
Gets the object to be used in concert with getScriptTable() etc. It's almost always "this", but it needs to be overridable to support the $record pseudomodel, which redirects all script properties to the current record. Simply overriding getScriptTable and redirecting that call to the current record doesn't work, because when a callback function is invoked, the supplied object pointer would be the pseudo model, not the record.
-
invokeFunction
public boolean invokeFunction(Arg retValue, java.lang.String sFunctionName, Arg[] parameters, DependencyTracker dependencyTracker, boolean bSuppressExceptions)
Call a scripting function (method).- Parameters:
sFunctionName
- The name of the function/method to call. If this parameter is an empty string, then an attempt is made to invoke a default function.parameters
- an array of parameters to the method.- Returns:
- the return value of the function.
- Throws:
ResId.InvalidMethodException
- if the function name is unknown.ResId.BadParamCountException
- if the number of parameters in nParamCount is not valid for the specified fucntion.ResId.ArgumentMismatchException
- if one or more of the argument types in pParameters is incorrect for the specified function.ResId.NoDefaultMethodException
- if sFunctionName is an empty string, and the object doesn't have a default function.
-
isDeaf
public final boolean isDeaf()
Description copied from interface:Peer
Checks if this peer is deaf.
-
isMute
public final boolean isMute()
Description copied from interface:Peer
Checks if this peer is mute.
-
isSameClass
public final boolean isSameClass(Obj oClass)
Determine if the class of this object is the same as the Obj class.- Parameters:
oClass
- Obj to check the class with.- Returns:
- true if the classes are the same, else false.
-
isSameClass
public final boolean isSameClass(java.lang.String aClass)
Determine if the class of this object is the same as the String sClass. Note: Works only when comparing to the same actual string instance (from the XFA namespace). For example, isSameClass(XFA::nodeTag()) will work if the object in question is an Obj. However, isSameClass("node") will not work even though the two strings are equal. See theSharesImpl
method ofString
.- Parameters:
aClass
- string from the XFA namespace. This String must be interned.- Returns:
- true if the classes are the same, else false.
-
isSameClass
public final boolean isSameClass(int eClassTag)
Determine if the class of this object is the same as the class tag.- Parameters:
eClassTag
- string from the XFA namespace.- Returns:
- true if the classes are the same, else false.
-
mute
public final void mute()
Description copied from interface:Peer
Makes this peer no longer notify its peers when notifyPeers is called
-
notifyPeers
public void notifyPeers(int eventType, java.lang.String arg1, java.lang.Object arg2)
Description copied from interface:Peer
Sends notification to the peer nodes that this object has changed.- Specified by:
notifyPeers
in interfacePeer
- Parameters:
eventType
- the event type as enumerated in this classarg1
- additional event informationarg2
- additional event information
-
removePeer
public final void removePeer(Peer peerNode)
Remove a peer node from the notification list.- Specified by:
removePeer
in interfacePeer
- Parameters:
peerNode
- The reference to the peer object to be removed.
-
removePeeredNode
public final void removePeeredNode(Peer peer)
- Specified by:
removePeeredNode
in interfacePeer
-
sendMessenge
public void sendMessenge(ExFull error, int eSeverity)
Send message to host so it can be logged- Parameters:
error
- contains message Id and texteSeverity
- the message severity
-
setScriptProperty
public boolean setScriptProperty(java.lang.String sPropertyName, Arg propertyValue, boolean bSuppressExceptions)
- Parameters:
sPropertyName
- The name of the property to set. If this parameter is an empty string, then an attempt is made to set the default property.propertyValue
- The value of assign to this property.bSuppressExceptions
- If true, quietly return false on error, else throw an exception for any errors.- Throws:
NoDefaultSetPropertyException
- if sPropertyName is an empty string, and the object does not have a default property.InvalidSetPropertyException
- if sPropertyName is not a valid property for the object.
-
unDeafen
public final void unDeafen()
Description copied from interface:Peer
Allows this peer to receive updateFromPeer calls
-
unMute
public final void unMute()
Description copied from interface:Peer
Allows this peer to notify its peers when notifyPeers is called.
-
updateFromPeer
public void updateFromPeer(java.lang.Object peerNode, int eventType, java.lang.String arg1, java.lang.Object arg2)
Description copied from interface:Peer
This method will be called by the peer whenever its state changes.eventType (String)arg1 (Object)arg2 UPDATED update type (optional) ATTR_CHANGED attr name (optional) CHILD_ADDED (optional) added node CHILD_REMOVED (optional) removed node VALUE_CHANGED new data (optional) PARENT_CHANGED (optional) new parent DESCENDENT_ATTR_CHANGED attr name changed node DESCENDENT_VALUE_CHANGED (optional) changed node DESCENDENT_ADDED (optional) added node DESCENDENT_REMOVED (optional) removed node PERMS_LOCK_SET (optional) (optional) PERMS_LOCK_CLEARED (optional) (optional) PROTO_ATTR_CHANGED attr name changed node PROTO_CHILD_ADDED (optional) added node of the protoype PROTO_CHILD_REMOVED (optional) removed node from the prototype PROTO_VALUE_CHANGED new data prototype node PROTO_DESCENDENT_ATTR_CHANGED attr name changed prototype node PROTO_DESCENDENT_VALUE_CHANGED (optional) changed prototype node PROTO_DESCENDENT_ADDED (optional) added node to the prototype PROTO_DESCENDENT_REMOVED (optional) removed node from the prototype
- Specified by:
updateFromPeer
in interfacePeer
- Parameters:
peerNode
- the peer to this object.eventType
- the event type as enumerated in this classarg1
- additional event informationarg2
- additional event information
-
peerRemoved
public void peerRemoved(Peer peer)
Description copied from interface:Peer
Called when this Peer is removed frompeer
. Derived classes can override this method to receive direct notifications when a peer is removed.- Specified by:
peerRemoved
in interfacePeer
- Parameters:
peer
- the Peer from which this Peer has been removed from notification.
-
validateUsage
public boolean validateUsage(int nXFAVersion, int nAvailability, boolean bUpdateVersion)
Validate if the given Version and Availability flags are valid for the current document- Parameters:
nXFAVersion
- The target XFA VersionnAvailability
- The target Availability flags, this indicates for what clients the script is availablebUpdateVersion
- indicates if the model version can be updated by the calling code- Returns:
- if true, Version and Availability flags are valid
-
validateUsageFailedIsFatal
public boolean validateUsageFailedIsFatal(int nXFAVersion, int nAvailability)
Determines if disallowing a version should be considered a fatal error.This method is called after calling
validateUsage(int, int, boolean)
when that method returns false.- Parameters:
nXFAVersion
- The target XFA VersionnAvailability
- The target Availability flags, this indicates for what clients the script is available- Returns:
- true if disallowing nVersion should be considered a fatal error
- See Also:
validateUsage(int, int, boolean)
-
-