1 16 package org.apache.cocoon.woody.binding; 17 18 import org.apache.cocoon.woody.formmodel.Widget; 19 import org.apache.commons.jxpath.JXPathContext; 20 import org.w3c.dom.Document ; 21 import org.w3c.dom.DocumentFragment ; 22 import org.w3c.dom.Node ; 23 24 36 public class InsertNodeJXPathBinding extends JXPathBindingBase { 37 38 private final DocumentFragment template; 39 40 43 public InsertNodeJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, DocumentFragment domTemplate) { 44 super(commonAtts); 45 this.template = domTemplate; 46 } 47 48 51 public void doLoad(Widget frmModel, JXPathContext jxpc) { 52 } 54 55 61 public void doSave(Widget frmModel, JXPathContext jxpc) { 62 63 Node parentNode = (Node )jxpc.getContextBean(); 64 Document targetDoc = parentNode.getOwnerDocument(); 65 Node toInsert = targetDoc.importNode(this.template, true); 66 parentNode.appendChild(toInsert); 67 68 if (getLogger().isDebugEnabled()) 69 getLogger().debug("InsertNode executed."); 70 71 } 89 90 public String toString() { 91 return "InsertNodeJXPathBinding [for nested template]"; 92 } 93 } 94 | Popular Tags |