public abstract boolean isAddChildNodesBeforeNode(Node parent,ClientDocumentStfulImpl clientDoc);
public Object getAppendNewNodeCode(Node parent,Node newNode,String parentVarName,InsertAsMarkupInfoImpl insertMarkupInfo,ClientDocumentStfulImpl clientDoc)
{
// Es a�adido al final no inserci�n en medio
CodeListImpl code = new CodeListImpl();
if (isCreateComplete(newNode))
{
code.add( getAppendCompleteChildNode(parent,newNode,parentVarName,clientDoc) );
}
else
{
if (parentVarName == null) throw new ItsNatException("INTERNAL ERROR");
String newNodeVarName = parentVarName + "_c"; // c = child (para ahorrar letras)
code.add( "var " + newNodeVarName + " = " + createNodeCode(newNode,clientDoc) + ";\n" );
if (newNode.hasAttributes())
code.add( addAttributesBeforeInsertNode(newNode,newNodeVarName,clientDoc) );
boolean hasChildNodes = newNode.hasChildNodes();
boolean beforeParent = false; // Este valor es indiferente si hasChildNodes es false
if (hasChildNodes) beforeParent = isAddChildNodesBeforeNode(newNode,clientDoc);
if (hasChildNodes && beforeParent)
code.add( appendChildNodes(newNode,newNodeVarName,beforeParent,insertMarkupInfo,clientDoc) );
code.add( getAppendCompleteChildNode(parentVarName,newNode,newNodeVarName,clientDoc) );
if (hasChildNodes && !beforeParent)
code.add( appendChildNodes(newNode,newNodeVarName,beforeParent,insertMarkupInfo,clientDoc) );
}
return code;
}