
com.adobe.xfa.template.containers.SubformSet Maven / Gradle / Ivy
package com.adobe.xfa.template.containers;
import com.adobe.xfa.Arg;
import com.adobe.xfa.DependencyTracker;
import com.adobe.xfa.Element;
import com.adobe.xfa.Node;
import com.adobe.xfa.Obj;
import com.adobe.xfa.Schema;
import com.adobe.xfa.ScriptDynamicPropObj;
import com.adobe.xfa.ScriptTable;
import com.adobe.xfa.XFA;
import com.adobe.xfa.template.InstanceManager;
/**
* An element that describes a set of related subform objects.
*
* A subformSet has an attribute called relation, that describes the
* relationship between the subforms contained in the subform set. The value of
* the relation attribute can be on of "ordered", "unordered", or "choice".
*
* When the subforms in a subformSet are dynamically created based on the data
* specified for the template, it is the relation attribute which defines in
* what order the subforms will be instantiated.
*
* Let's take the following example:
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* Example 1:
* In this example with relation set to "unordered", we can expect to see forms
* with the following structures:
*
* "abcd"
* "acbd"
* "acccbbbcbbbbbcbcbd"
*
* subforms "c" and "b" can appear in any order.<br/>
*
* Example 2:
* If the relation attribute was "ordered" we can expect to see forms with the
* following structure:<br/>
*
* "abcd"
* "abbbbbbbbbcccccccccd"
*
* subforms "b" and "c" must appear in the order they appear in the
* subform set.
*
* Example 3:
* finally, if the relation attribute was "choice", we can expect to see forms
* with the following structure:
*
* "abd"
* "acd"
* "abbbbbbbbbbbbd"
* "accccccccccccd"
*
* Where you only have a choice of "b" or "c" from the available subforms in
* the subformSet.
*
*
*
* @exclude from published api -- Mike Tardif, May 2006.
*/
public class SubformSet extends Container {
/**
*
*
* index Used
* overflowLeader[ | ]
* overflowTtrailer[ | ]
* bookendLeader[ | ]
* bookendTrailer[ | ]
*
*
*/
//private int[][] mppnUsedTable; // Doesn't appear to be used anywhere
public SubformSet(Element parent, Node prevSibling) {
super(parent, prevSibling, null, XFA.SUBFORMSET, XFA.SUBFORMSET,
null, XFA.SUBFORMSETTAG, XFA.SUBFORMSET);
//mppnUsedTable = null;
setTransparent(true);
}
/**
* @exclude from public api.
*/
public void reset() {
//mppnUsedTable = null;
}
public boolean isWidthGrowSupported() {
return false;
}
public boolean isHeightGrowSupported() {
return false;
}
public int[][] getUsedTable() {
//return mppnUsedTable;
return null;
}
/**
* @exclude from public api.
*/
protected int getInstanceIndex(DependencyTracker pDepTrack) {
// Form method only
return 0;
}
/**
* @exclude from public api.
*/
public void setInstanceIndex(int nIndex) {
// Form method only
}
/**
* @exclude from public api.
*/
public Obj getInstanceManager() {
// create a new instance manager
return new InstanceManager(this);
}
/**
* @exclude from published api.
*/
public ScriptTable getScriptTable() {
return SubformSetScript.getScriptTable();
}
/**
* @exclude from published api.
*/
protected ScriptDynamicPropObj getDynamicScriptProp(String sPropertyName,
boolean bPropertyOverride, boolean bPeek) {
// if the first char of sPropertyName is '_' check for a same name
// subform or subformset child. If we find one return the instance manager.
if (sPropertyName.length() > 0 && sPropertyName.charAt(0) == '_') {
String sNewName = sPropertyName.substring(1);
if (sNewName.length() > 0) {
Node oChild = locateChildByName(sNewName, 0);
if ((oChild instanceof Subform) ||
(oChild instanceof SubformSet)) {
return getInstanceManagerScriptObj;
}
}
}
return super.getDynamicScriptProp(sPropertyName, bPropertyOverride, bPeek);
}
private final static ScriptDynamicPropObj getInstanceManagerScriptObj =
new ScriptDynamicPropObj(Schema.XFAVERSION_21, Schema.XFAAVAILABILITY_ALL) {
public boolean invokeGetProp(Obj scriptThis, Arg retValue, String sPropertyName) {
return SubformSet.getInstanceManagerFunc(scriptThis, retValue, sPropertyName);
}
};
private static boolean getInstanceManagerFunc(Obj oObj, Arg oRetVal, String sProp) {
SubformSet oSubSet = (SubformSet)oObj;
oRetVal.setObject(oSubSet.getInstanceManager());
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy