Package com.adobe.xfa.form
Class FormModel
- java.lang.Object
-
- com.adobe.xfa.Obj
-
- com.adobe.xfa.Node
-
- com.adobe.xfa.Element
-
- com.adobe.xfa.Model
-
- com.adobe.xfa.form.FormModel
-
- All Implemented Interfaces:
Element.DualDomNode,Peer
public class FormModel extends Model
A class to represent the result of joining a template and data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFormModel.ConnectHandlerstatic classFormModel.DatasetSelectorstatic classFormModel.Executestatic interfaceFormModel.PostMergeHandlerDefines the callback interface that will be invoked immediately after a merge but before any initialize events are fired.static classFormModel.ServerExchangeProvides a mechanism for FormModel to execute an event on a server.static classFormModel.Submitstatic classFormModel.ValidateA base class that an implementation can derive from to interact with the form validation process.-
Nested classes/interfaces inherited from class com.adobe.xfa.Model
Model.DualDomModel, Model.Publisher
-
Nested classes/interfaces inherited from class com.adobe.xfa.Element
Element.DualDomNode, Element.ReplaceContent
-
Nested classes/interfaces inherited from class com.adobe.xfa.Node
Node.ChangeLogger
-
-
Field Summary
-
Fields inherited from class com.adobe.xfa.Element
AttrIsDefault, AttrIsFragment, AttrIsTransient, CREATEACTION
-
Fields inherited from class com.adobe.xfa.Node
CREATE_ALWAYS_NEW, CREATE_IF_NOT_EXIST, CREATE_MUST_NOT_EXIST, CREATE_REPLACE, gsXFANamespacePrefix
-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddUseHRefNode(Element useHRefNode)Not supported on FormModelvoidaddUseNode(Element useNode)add a new new node to the useNodeListvoidclearFocus()Resets the focus.NodecreateNode(int eClassTag, Element parent, java.lang.String aNodeName, java.lang.String aNS, boolean bDoVersionCheck)Create an element with the given tag, parent, name and uri.voidcreatePanelOverlayData(int nPanel)Creates an overlayData section under dataSets.booleaneventOccurred(java.lang.String sActivity, Obj container)Notifies event listeners that an event has occurred on a container.voidexportConnectionData(java.lang.String strConnectionName, java.lang.String sDataDescriptionName)booleangetAdjustData()Determines whether the nextremerge()operation will adjust the structure of the DataModel to match the TemplateModel.java.lang.StringgetAmbientLocale()Gets the ambient locale override for the top level subform.java.lang.StringgetBaseNS()booleangetCalculationsEnabled()Determines if calculations are enabled.FormModel.ValidategetDefaultValidate()Gets the default Validate object.ObjgetDelta(Element node, java.lang.String sSOM)ObjgetDeltas(Element node)booleangetDisableFormRemerge()Disable/enable calls to remerge()FormModel.ExecutegetExecute()Gets the Execute associated with this FormModel.FormFieldgetFocus()Gets the field that has focus for the FormModel.static FormModelgetFormModel(AppModel appModel, boolean bCreateIfNotFound)Returns the FormModel held within the AppModel.booleangetFormStateRemoved()Determines if theformStatepacket has been removed.java.lang.StringgetFriendlyName(Element formNode)Gets the friendly name (to use in user-facing communication) for a form nodejava.lang.StringgetHeadNS()HostPseudoModelgetHost()booleangetOverlayDataMergeUsage()Gets the OverlayDataMerge setting.intgetPanelToMergeAgainst()Gets the panel to merge against.FormModel.PostMergeHandlergetPostMergeHandler()Gets the callback method that is to be invoked after merge but before any initialization scripts are run.java.util.List<ProtoableNode>getProtoList()Keep track of proto Nodes and 'use' tags for quick lookup later ourintgetRunScripts()Gets the runAt property that specifies where scripts should be executed (client, server or both).ScriptTablegetScriptTable()FormModel.ServerExchangegetServerExchange()Gets the ServerExchange implementation associated with this FormModel.FormModel.SubmitgetSubmit()Gets the Submit implementation associated with this FormModel.java.lang.StringgetSubmitURL()Gets the submit URL override for the top level subform.booleangetValidationsEnabled()Determines whether validations are enabled.voidimportConnectionData(java.lang.String strConnectionName)ElementimportNode(ProtoableNode templateNode, Element formParent, boolean bFull)Imports a template node into this model, while resolving any global or dataRef fields.booleaninitialize()Fires the initialize event on all containers on the form, and fires the indexChange event on all subforms.booleaninitializeNewContentNodes()Initializes the new content nodesbooleanisCompatibleNS(java.lang.String aNS)Determine if a specified namespace string is compatible with the namespace of this model.voidmerge(boolean bEmptyMerge, boolean bAdjustData, boolean bInitialize, boolean bRestoreDeltas, boolean bForceRestore)Merges the TemplateModel and the DataModel to create the FormModel.voidmerge(boolean bEmptyMerge, boolean bAdjustData, java.lang.String sConnectionName, boolean bInitialize, boolean bRestoreDeltas, boolean bForceRestore)Merges the TemplateModel and the DataModel to create the FormModel.intmergeMode()Indicates whether the current merge mode is globally consumptive (XFAEnum::CONSUME_DATA) or not (XFAEnum::MATCH_TEMPLATE).voidmergeOverlayData(Node formNode, Node overlayData)Merges overlayData with a subform (FormServer requirement)voidnormalizeNameSpaces()voidpreSave(boolean bSaveXMLScript)Prepares thisModelto be saved.booleanrecalculate(boolean bFullRecalculate, FormModel.Validate validate, boolean bIgnoreCalcEnabledFlag)Executes calculation and validation scripts.static voidrecurseConnectOnNode(Node node, java.lang.String strConnectionName, int eUsage, FormModel.ConnectHandler handler, java.lang.Object handlerData)booleanregisterNewEvents(boolean bAllow)Helper function to permit the temporary update the mbRegisterNewEvents setting This should call registerNewEvents(false) before cloning any form node to orphaned nodes being registered with the event modelvoidremerge()Forces the remerging of the DataModel and TemplateModel to recreate this FormModel.voidremove()Removes a FormModel from its parents child list.voidremoveReferences(Node node)Recursively unmaps node from any DataNode it is mapped to.voidreset()Resets this FormModel to its initial state.voidresetData(Obj container)Resets a container to its template default value.voidresolveProtos(boolean bForceExternalProtoResolve)voidrestoreValidateDisableAll(Element formNode, Node delta)restore the validate.disableAll property for a form nodevoidsetAdjustData(boolean bAdjustData)Sets whether the nextremerge()operation will adjust the structure of the DataModel to match the structure of the TemplateModel.voidsetAmbientLocale(java.lang.String sLocale)Set the ambient locale override for the top level subform.voidsetDefaultValidate(FormModel.Validate validate)Sets the default Validate.voidsetDisableFormRemerge(boolean bDisable)Disable/enable calls to remerge()voidsetEmptyMerge(boolean bEmptyMerge)Sets whether the nextremerge()operation will do an empty merge.voidsetExcludedActivities(java.lang.String sExclude)Sets event activites that are to be excluded from execution.voidsetExecute(FormModel.Execute execute)Associates an Execute object with this FormModel.voidsetFocus(FormField field)Lets the form model know which field has focus.voidsetGlobalConsumption(java.lang.Boolean bVal)voidsetPostMergeHandler(FormModel.PostMergeHandler handler, java.lang.Object clientData)Sets the callback method that is to be invoked after merge but before any initialize scripts are run.voidsetRunScripts(int eRunAtSetting)Sets the runAt property that specifies where scripts should be executed (client, server or both).voidsetServerExchange(FormModel.ServerExchange serverExchange)Sets the ServerExchange implementation with this FormModel.voidsetSubmit(FormModel.Submit submit)Associates a Submit object with this FormModel.voidsetSubmitURL(java.lang.String sSubmitURL)Sets the submit URL from the config.voidsetValidateBeforeExecute(boolean bValidate)Sets the flag for performing validations before executing.voidsetValidateBeforeSubmit(boolean bValidate)Sets the flag for performing validations before submitting.booleanwasIncrementalMerge()Returns true if the last merge was an incremental merge.-
Methods inherited from class com.adobe.xfa.Model
addErrorList, addXMLLoadErrorContext, allowUpdates, checkforCompatibleNS, clearErrorList, clone, createElement, createElement, createElement, createElement, createElement, createTextNode, createTextNode, doAttributeCleanup, getAliasNode, getAppModel, getAppModelIsTransient, getCachedLocale, getContext, getCurrentVersion, getDeltas, getDocument, getErrorContextList, getErrorList, getEventManager, getGenerator, getHeadVersion, getIDValueMap, getLegacySetting, getLogMessenger, getName, getNeedsNSNormalize, getNode, getNS, getOriginalVersion, getOriginalVersionNode, getOriginalXFAVersion, getSchema, getSourceBelow, getVersion, getXmlPeer, isContainer, isLoading, isVersionCompatible, loadNode, loadRootAttributes, loadSpecialAttribute, loadSpecialNode, modelCleanup, nodeCleanup, normalizeNameSpaces, normalizeNameSpaces, preLoadNode, publish, ready, remapTag, removeLastError, resolveNodes, serialize, setAliasNode, setAppModel, setAppModelIsTransient, setContext, setCurrentVersion, setDOMProperties, setIDValueMap, setName, setNeedsNSNormalize, setOriginalXFAVersion, setXmlPeer, shortCutName, validateUsage, validateUsageFailedIsFatal, willDirtyDoc, willDirtyDoc
-
Methods inherited from class com.adobe.xfa.Element
appendChild, appendChild, appendPI, appendPI, assignNode, clone, connectPeerToDocument, constructKey, constructKeys, copyContent, defaultAttribute, defaultElement, defaultElement, establishID, evaluate, explodeQName, findAttr, findSchemaAttr, foundBadAttribute, foundBadAttribute, getAll, getAtom, getAttr, getAttribute, getAttribute, getAttributeByName, getAttrIndex, getAttrName, getAttrNS, getAttrProp, getAttrQName, getAttrVal, getChildReln, getClassAll, getClassIndex, getClassName, getDeltas, getElement, getElement, getElementClass, getElementLocal, getEnum, getEnum, getEventTable, getFirstXFAChild, getFirstXMLChild, getID, getIndex, getInheritedNS, getInstalledLocale, getIsNull, getLastXMLChild, getLineNumber, getLocalName, getModel, getNode, getNodes, getNodeSchema, getNumAttrs, getOneOfChild, getOneOfChild, getPI, getPI, getPrefix, getProperty, getProperty, getSaveXMLSaveTransient, getSchemaType, getScriptMethodInfo, getSibling, getText, getXFAChild, getXMLChild, getXMLName, getXPath, getXsiNilAttribute, inhibitPrettyPrint, inhibitPrettyPrint, insertChild, isFragment, isHidden, isHidden, isIndexed, isInstalledLocaleAmbient, isLeaf, isNameSpaceAttr, isPropertySpecified, isPropertySpecified, isPropertyValid, isSpecified, isSpecified, isSpecified, isTransient, isTransparent, isValidAttr, isValidChild, isValidElement, loadXML, loadXML, makeDefault, makeNonDefault, newAttribute, optimizeNameSpace, peekAttribute, peekElement, peekOneOfChild, peekProperty, peekProperty, postSave, privateSetName, processTextChildrenDuringParse, removeAttr, removeAttr, removeChild, removePI, removePI, removeWhiteSpace, removeXsiNilAttribute, replaceChild, resetPostLoadXML, resolveAndEnumerateChildren, resolveNodeCreate, resolvePrefix, saveFilteredXML, saveXML, saveXML, setAttribute, setAttribute, setAttribute, setAttribute, setAttrProp, setDefaultFlag, setElement, setIsDataWindowRoot, setIsIndexed, setLineNumber, setLocalName, setModel, setNS, setOneOfChild, setProperty, setProperty, setQName, setSaveXMLSaveTransient, setTransparent, setXMLName, setXsiNilAttribute, updateFromPeer
-
Methods inherited from class com.adobe.xfa.Node
checkAncestorPerms, checkDescendentPerms, checkPerms, cleanDirtyFlags, compareVersions, getData, getFirstXMLChildElement, getLocked, getNextXFASibling, getNextXMLSibling, getNextXMLSiblingElement, getNodeAsXML, getOwnerDocument, getPIAsXML, getPIName, getPreviousXMLSibling, getPrivateName, getPropName, getSOMExpression, getSOMExpression, getSomName, getUniqueSOMName, getWillDirty, getXFAChildCount, getXFAParent, getXfaPeer, getXMLChildCount, getXMLParent, hasChanged, isDefault, isDirty, isMapped, isPermsLockSet, isTransient, locateChildByClass, locateChildByName, logValueChangeHelper, notifyPeers, performSOMAssignment, resolveNode, resolveNode, resolveNode, resolveNodes, sendMessenge, setDirty, setDocument, setLocked, setMapped, setPermsLock, setPrivateName, setWillDirty, setXfaPeer, unLock, validateSchema
-
Methods inherited from class com.adobe.xfa.Obj
addPeer, addPeeredNode, clearPeers, deafen, getClassAtom, getClassTag, getPeer, getScriptProperty, getScriptThis, invokeFunction, isDeaf, isMute, isSameClass, isSameClass, isSameClass, mute, peerRemoved, removePeer, removePeeredNode, setClass, setClassTag, setScriptProperty, unDeafen, unMute
-
-
-
-
Method Detail
-
getFormModel
public static FormModel getFormModel(AppModel appModel, boolean bCreateIfNotFound)
Returns the FormModel held within the AppModel.- Parameters:
appModel- the AppModel to searchbCreateIfNotFound- iftrue, and the FormModel does not exist, then one will be created and returned; iffalseand the FormModel does not exist,nullis returned- Returns:
- the FormModel contained within appModel;
nullif not found and bCreateIfNotFound isfalse.
-
recurseConnectOnNode
public static void recurseConnectOnNode(Node node, java.lang.String strConnectionName, int eUsage, FormModel.ConnectHandler handler, java.lang.Object handlerData)
-
addUseNode
public void addUseNode(Element useNode)
Description copied from class:Modeladd a new new node to the useNodeList- Overrides:
addUseNodein classModel
-
addUseHRefNode
public void addUseHRefNode(Element useHRefNode)
Not supported on FormModel- Overrides:
addUseHRefNodein classModel
-
clearFocus
public void clearFocus()
Resets the focus. No field will have focus after but the form model will remember which field had the focus last.
-
mergeMode
public int mergeMode()
Indicates whether the current merge mode is globally consumptive (XFAEnum::CONSUME_DATA) or not (XFAEnum::MATCH_TEMPLATE).
-
createNode
public Node createNode(int eClassTag, Element parent, java.lang.String aNodeName, java.lang.String aNS, boolean bDoVersionCheck)
Description copied from class:ModelCreate an element with the given tag, parent, name and uri.- Specified by:
createNodein classModel- Parameters:
eClassTag- the element's tag.parent- the element's parent.aNodeName- the element's name.aNS- the element's namespace.bDoVersionCheck- check the element's version.- Returns:
- a new element.
- See Also:
Model.createNode(int, Element, String, String, boolean)
-
createPanelOverlayData
public void createPanelOverlayData(int nPanel)
Creates an overlayData section under dataSets. This method is for Form Server support.- Parameters:
nPanel- the panel to create the overlayData section for
-
eventOccurred
public boolean eventOccurred(java.lang.String sActivity, Obj container)Notifies event listeners that an event has occurred on a container. This method may fire additional events before and/or after firing the event.- Parameters:
sActivity- the name of the eventcontainer- the container on which the event occurs- Returns:
trueif one or more events were dispatched.
-
exportConnectionData
public void exportConnectionData(java.lang.String strConnectionName, java.lang.String sDataDescriptionName)
-
getAdjustData
public boolean getAdjustData()
Determines whether the nextremerge()operation will adjust the structure of the DataModel to match the TemplateModel. The default value isfalse.- Returns:
trueif the nextremerge()operation will adjust the structure of the DataModel to match the TemplateModel.- See Also:
remerge(),setAdjustData(boolean)
-
getAmbientLocale
public java.lang.String getAmbientLocale()
Gets the ambient locale override for the top level subform. This will be used when resolving locales for fields and subforms. If a field/subform does not have a locale specified, then they will inherit it from their ancestory hierarchy.- Returns:
- the ambient locale (e.g. "en_US").
-
getBaseNS
public java.lang.String getBaseNS()
- Specified by:
getBaseNSin classModel- See Also:
Model.getBaseNS()
-
getCalculationsEnabled
public boolean getCalculationsEnabled()
Determines if calculations are enabled.- Returns:
trueif calculations are enabled.
-
getDefaultValidate
public FormModel.Validate getDefaultValidate()
Gets the default Validate object. The default Validate object is used whenever validation is initiated by some method that does not use a Validate parameter, or when validation is initiated byvalidate(Validate, Element, boolean, boolean)orrecalculate(boolean, Validate, boolean)andnullis passed to the validate parameter. For example, the default Validate object is used when validation is initiated by theexecValidatescripting method of the FormModel.- Returns:
- a reference to an object derived from Validate, or
nullif no default Validate object has been set. - See Also:
setDefaultValidate(Validate),validate(Validate, Element, boolean, boolean),recalculate(boolean, Validate, boolean)
-
getExecute
public FormModel.Execute getExecute()
Gets the Execute associated with this FormModel. May be null.- Returns:
- the Execute.
-
getFocus
public FormField getFocus()
Gets the field that has focus for the FormModel.- Returns:
- the field that has focus.
-
getFormStateRemoved
public boolean getFormStateRemoved()
Determines if theformStatepacket has been removed.- Returns:
trueif theformStatepacket has been removed
-
getFriendlyName
public java.lang.String getFriendlyName(Element formNode)
Gets the friendly name (to use in user-facing communication) for a form node- Parameters:
formNode- aFormSubform,FormFieldorFormExclGroupto get a user-friendly name for.- Returns:
- a string containing a user-friendly name for the form node.
-
getHeadNS
public java.lang.String getHeadNS()
- Specified by:
getHeadNSin classModel- See Also:
Model.getHeadNS()
-
getHost
public HostPseudoModel getHost()
-
getOverlayDataMergeUsage
public boolean getOverlayDataMergeUsage()
Gets the OverlayDataMerge setting.- Returns:
- true if OverlayDataMergeUsage must occur
-
getPanelToMergeAgainst
public int getPanelToMergeAgainst()
Gets the panel to merge against.- Returns:
- the panel (second-level subform) to merge against
-
getPostMergeHandler
public FormModel.PostMergeHandler getPostMergeHandler()
Gets the callback method that is to be invoked after merge but before any initialization scripts are run.
-
getProtoList
public java.util.List<ProtoableNode> getProtoList()
Description copied from class:ModelKeep track of proto Nodes and 'use' tags for quick lookup later our- Overrides:
getProtoListin classModel- Returns:
- our list of protos
- See Also:
Model.getProtoList()
-
getRunScripts
public int getRunScripts()
Gets the runAt property that specifies where scripts should be executed (client, server or both). The default is both.- Returns:
- one of:
EnumAttr.RUNSCRIPTS_CLIENT,EnumAttr.RUNSCRIPTS_SERVER,EnumAttr.RUNSCRIPTS_BOTHorEnumAttr.RUNSCRIPTS_NONE - See Also:
setRunScripts(int)
-
getScriptTable
public ScriptTable getScriptTable()
- Overrides:
getScriptTablein classModel- See Also:
Model.getScriptTable()
-
getServerExchange
public FormModel.ServerExchange getServerExchange()
Gets the ServerExchange implementation associated with this FormModel.- Returns:
- a ServerExchange implementation, or
nullif no ServerExchange has been set. - See Also:
setServerExchange(ServerExchange)
-
getSubmit
public FormModel.Submit getSubmit()
Gets the Submit implementation associated with this FormModel.- Returns:
- a pointer to a class derived from Submit.
-
getSubmitURL
public java.lang.String getSubmitURL()
Gets the submit URL override for the top level subform. This will be used to determine if we are submitting to FormServer.- Returns:
- String, the submit URL.
-
getValidationsEnabled
public boolean getValidationsEnabled()
Determines whether validations are enabled.- Returns:
trueif validations are enabled.
-
importConnectionData
public void importConnectionData(java.lang.String strConnectionName)
-
importNode
public Element importNode(ProtoableNode templateNode, Element formParent, boolean bFull)
Imports a template node into this model, while resolving any global or dataRef fields. This will simply walk the template DOM and create a form node for each one it encounters. This will also set up the appropriate proto relationships- Parameters:
templateNode- the template node to importformParent- the parent we'll add the created form node toobFull- if true, do merge and process the children.- Returns:
- the newly created Form node
-
initialize
public boolean initialize()
Fires the initialize event on all containers on the form, and fires the indexChange event on all subforms.- Returns:
trueif one or more events were dispatched.
-
initializeNewContentNodes
public boolean initializeNewContentNodes()
Initializes the new content nodes- Returns:
trueif one or more events were dispatched.
-
isCompatibleNS
public boolean isCompatibleNS(java.lang.String aNS)
Description copied from class:ModelDetermine if a specified namespace string is compatible with the namespace of this model. Essentially this determines if the two namespaces are equivalent (though the strings that represent them may not be identical).- Overrides:
isCompatibleNSin classModel- Parameters:
aNS- The namespace to compare.- See Also:
Model.isCompatibleNS(String)
-
merge
public void merge(boolean bEmptyMerge, boolean bAdjustData, boolean bInitialize, boolean bRestoreDeltas, boolean bForceRestore)Merges the TemplateModel and the DataModel to create the FormModel. The first two parameters are implicitly used to callsetEmptyMerge(boolean)andsetAdjustData(boolean)respectively.- Parameters:
bEmptyMerge- iftruethen merge against an empty DataModel, iffalseuse the DataModel found in the AppModelbAdjustData- iftrueadjust the structure of the DataModel to match the structure of the TemplateModel; iffalsedon't modify the DataModel.bInitialize- iftrueall the initialize events will be fired; iffalseno initialization is performedbRestoreDeltas- iftrueand if the restoreState property on the form's root subform is "auto" (the default is "manual"), all deltas are restored from the form packet. The locale attribute is always restored from the form packet, regardless of the value of this parameter.bForceRestore- iftrue, restore the state regardless of the the restoreState property on the form's root subform.
-
merge
public void merge(boolean bEmptyMerge, boolean bAdjustData, java.lang.String sConnectionName, boolean bInitialize, boolean bRestoreDeltas, boolean bForceRestore)Merges the TemplateModel and the DataModel to create the FormModel.- Parameters:
bEmptyMerge- iftruethen merge against an empty DataModel, iffalseuse the DataModel found in the AppModelbAdjustData- iftrue, adjust the structure of the DataModel to match the structure of the TemplateModel; iffalse, don't modify the DataModelsConnectionName- if specified get all the data for the merge from the !connectionData.sConnectionName part of the DataModel. Also, use connect elements rather than bind elements of the TemplateModelbInitialize- iftrue, all the initialize events will be fired; iffalse, no initialization is performedbRestoreDeltas- iftrueand if the restoreState property on the form's root subform is "auto" (the default is "manual"), all deltas are restored from the form packet. The locale attribute is always restored from the form packet, regardless of the value of this parameter.bForceRestore- iftrue, restore the state regardless of the the restoreState property on the form's root subform.
-
mergeOverlayData
public void mergeOverlayData(Node formNode, Node overlayData)
Merges overlayData with a subform (FormServer requirement)- Parameters:
formNode- The subform to merge withoverlayData- The data to merge with
-
normalizeNameSpaces
public void normalizeNameSpaces()
- Overrides:
normalizeNameSpacesin classModel- See Also:
Model.normalizeNameSpaces()
-
preSave
public void preSave(boolean bSaveXMLScript)
Description copied from class:ModelPrepares thisModelto be saved. Any model maintenance that may have been deferred is performed to ensure that the serialized form of theModelis correct. This method is called automatically before aModelis serialized to a stream, so it does not normally need to be called directly. The exception is when aDocumentis saved usingDocument.saveAs(java.io.OutputStream, Node, DOMSaveOptions)orDocument.saveXML(java.io.OutputStream, DOMSaveOptions).- Overrides:
preSavein classModel- See Also:
Model.preSave(boolean)
-
recalculate
public boolean recalculate(boolean bFullRecalculate, FormModel.Validate validate, boolean bIgnoreCalcEnabledFlag)Executes calculation and validation scripts. After a merge operation, a full recalculate must be done to ensure that all calculations and validations are done using current data values. If data values are changed, this should be called to re-run the calculations. The FormModel tracks changes to data values, so recalculation efficiency can be improved by setting the bFullRecalculate parameter tofalseto perform only those calculations and validations that are dependent on the changed data values.- Parameters:
bFullRecalculate- iftrueall calculations and validations are run. Iffalsecalculations and validations are run as needed (i.e. if values that the validate or calculate script are dependent on have changed since the last recalculate).validate- an object derived from Validate. Ifnullthe default Validate is used, and if the default Validate is also null, no validations are performed.bIgnoreCalcEnabledFlag- iftruethe calculations will be performed even if they are disabled on the host.- Returns:
trueif any calculations were performed- See Also:
setDefaultValidate(Validate),getDefaultValidate()
-
registerNewEvents
public boolean registerNewEvents(boolean bAllow)
Helper function to permit the temporary update the mbRegisterNewEvents setting This should call registerNewEvents(false) before cloning any form node to orphaned nodes being registered with the event model- Parameters:
bAllow- the new value of mbRegisterEvents- Returns:
- the old value of mbRegisterEvents
-
remerge
public void remerge()
Forces the remerging of the DataModel and TemplateModel to recreate this FormModel. This is equivalent to callingmerge(boolean, boolean, boolean, boolean, boolean), and specifyinggetEmptyMerge()andgetAdjustData()for the bEmptyMerge and bAdjustData parameters, and specifyingtrue,false,falsefor the bInitialize, bRestoreDeltas and bForceRestore parameters.
-
remove
public void remove()
Removes a FormModel from its parents child list. Since a FormModel can't really exist outside of the context of an AppModel (i.e., because of connections between the form and data models), the form gets reset before it is removed.- Overrides:
removein classModel- See Also:
Node.remove()
-
removeReferences
public void removeReferences(Node node)
Recursively unmaps node from any DataNode it is mapped to.- Overrides:
removeReferencesin classModel- Parameters:
node- the Node to be unmapped.
-
reset
public void reset()
Resets this FormModel to its initial state. All children are removed.
-
resetData
public void resetData(Obj container)
Resets a container to its template default value. If container is a field it will reset it. If container is a subform it will recursively reset all the containers it contains. If container isnullthen it will reset the root subform, and therefore all fields in the form.- Parameters:
container- the container to be reset
-
resolveProtos
public void resolveProtos(boolean bForceExternalProtoResolve)
- Overrides:
resolveProtosin classModel
-
restoreValidateDisableAll
public void restoreValidateDisableAll(Element formNode, Node delta)
restore the validate.disableAll property for a form node
-
setAdjustData
public void setAdjustData(boolean bAdjustData)
Sets whether the nextremerge()operation will adjust the structure of the DataModel to match the structure of the TemplateModel.- Parameters:
bAdjustData- iftruethe nextremerge()operation will adjust the structure of the DataModel to match the structure of the TemplateModel.- See Also:
getAdjustData(),remerge(),merge(boolean, boolean, boolean, boolean, boolean)
-
setAmbientLocale
public void setAmbientLocale(java.lang.String sLocale)
Set the ambient locale override for the top level subform. This will be used when resolving locales for fields and subforms. If a field/subform does not have a locale specified, then they will inherit it from their ancestory hierarchy.- Parameters:
sLocale- the ambient locale (i.e. en_US).
-
setDefaultValidate
public void setDefaultValidate(FormModel.Validate validate)
Sets the default Validate. The default Validate is used during validation when validation is initiated by some method other thanrecalculate(boolean, Validate, boolean)orvalidate(Validate, Element, boolean, boolean), or when validate or recalculate are called andnullis passed to the validate parameter. If no Validate instance is available, then no validations are performed.- Parameters:
validate- a reference to an object derived from Validate.- See Also:
getDefaultValidate()
-
setEmptyMerge
public void setEmptyMerge(boolean bEmptyMerge)
Sets whether the nextremerge()operation will do an empty merge. This property is also set implicity from the first parameter of any call tomerge(boolean, boolean, boolean, boolean, boolean).
-
setExcludedActivities
public void setExcludedActivities(java.lang.String sExclude)
Sets event activites that are to be excluded from execution.- Parameters:
sExclude- a space-delimited list of activities.
-
setExecute
public void setExecute(FormModel.Execute execute)
Associates an Execute object with this FormModel. This allows a client to execute a connection.- Parameters:
execute- an object derived from Execute. It will be cloned, so the original can be discarded. May be null.
-
setFocus
public void setFocus(FormField field)
Lets the form model know which field has focus.- Parameters:
field- the field that has focus.
-
setPostMergeHandler
public void setPostMergeHandler(FormModel.PostMergeHandler handler, java.lang.Object clientData)
Sets the callback method that is to be invoked after merge but before any initialize scripts are run.- Parameters:
handler- the PostMergeHandler implementation to be invoked after merge but before any initialize scripts are run.clientData- this value will be passed as the parameter toFormModel.PostMergeHandler.handlePostMerge(Object)when the callback method is invoked.- See Also:
getPostMergeHandler()
-
setRunScripts
public void setRunScripts(int eRunAtSetting)
Sets the runAt property that specifies where scripts should be executed (client, server or both). The default is both.- Parameters:
eRunAtSetting- one of:EnumAttr.RUNSCRIPTS_CLIENT,EnumAttr.RUNSCRIPTS_SERVER,EnumAttr.RUNSCRIPTS_BOTHorEnumAttr.RUNSCRIPTS_NONE- See Also:
getRunScripts()
-
setServerExchange
public void setServerExchange(FormModel.ServerExchange serverExchange)
Sets the ServerExchange implementation with this FormModel. This allows a form to invoke a web service.- Parameters:
serverExchange- an implementation ServerExchange. It will be cloned, so the original can be discarded. May be null.- See Also:
getServerExchange()
-
setSubmit
public void setSubmit(FormModel.Submit submit)
Associates a Submit object with this FormModel. This allows a client to submit data to the server.- Parameters:
submit- an object derived from Submit. It will be cloned, so the original can be discarded. May be null.
-
setSubmitURL
public void setSubmitURL(java.lang.String sSubmitURL)
Sets the submit URL from the config. This will be used to determine if we are submitting to FormServer.- Parameters:
sSubmitURL- the submit URL.
-
setValidateBeforeExecute
public void setValidateBeforeExecute(boolean bValidate)
Sets the flag for performing validations before executing.- Parameters:
bValidate- if true, validate before executing, don't validate otherwise.
-
setValidateBeforeSubmit
public void setValidateBeforeSubmit(boolean bValidate)
Sets the flag for performing validations before submitting.- Parameters:
bValidate- if true, validate before submitting, don't validate otherwise.
-
wasIncrementalMerge
public boolean wasIncrementalMerge()
Returns true if the last merge was an incremental merge.
-
setDisableFormRemerge
public void setDisableFormRemerge(boolean bDisable)
Disable/enable calls to remerge()
-
getDisableFormRemerge
public boolean getDisableFormRemerge()
Disable/enable calls to remerge()
-
setGlobalConsumption
public void setGlobalConsumption(java.lang.Boolean bVal)
-
-