1 20 package org.enhydra.barracuda.core.comp.renderer; 21 22 import java.util.*; 23 import org.w3c.dom.*; 24 import org.w3c.dom.html.*; 25 26 import org.apache.log4j.Logger; 27 28 import org.enhydra.barracuda.core.comp.*; 29 import org.enhydra.barracuda.core.util.dom.*; 30 import org.enhydra.barracuda.plankton.*; 31 32 35 public abstract class DOMComponentRenderer implements Renderer { 36 37 56 public Node createDefaultNode(Document doc, BComponent comp, ViewContext vc) throws UnsupportedFormatException { throw new UnsupportedFormatException("Cannot create default node"); 59 } 60 61 73 public Node addChildToParent(Node parent, Node child) throws InvalidNodeException { 74 if (parent==null || child==null) throw new InvalidNodeException("Invalid node: cannot add child:"+child+" to parent:"+parent); 76 77 80 if (child!=null) parent.appendChild(child); 82 83 return parent; 85 } 86 87 98 public void renderComponent(BComponent comp, View view, ViewContext vc) throws RenderException { 99 } 101 102 103 107 public void showNodeInterfaces(View view, Logger extLogger) { 108 Node node = view.getNode(); 110 if (extLogger.isDebugEnabled()) extLogger.debug("node [id="+DOMUtil.getID(node)+"] implements the following interfaces:"); 111 Iterator it = Classes.getAllInterfaces(node).iterator(); 112 while (it.hasNext()) { 113 Object o = it.next(); 114 if (extLogger.isDebugEnabled()) extLogger.debug(" "+o.toString()); 115 } 116 } 117 } | Popular Tags |