1 15 package org.apache.tapestry.components; 16 17 import org.apache.hivemind.util.Defense; 18 import org.apache.tapestry.AbstractComponent; 19 import org.apache.tapestry.IComponent; 20 import org.apache.tapestry.IMarkupWriter; 21 import org.apache.tapestry.IRequestCycle; 22 23 40 41 public abstract class Block extends AbstractComponent 42 { 43 private IComponent _invoker; 44 45 50 51 public Object getParameter(String name) 52 { 53 return _invoker.getBinding(name).getObject(); 54 } 55 56 public void renderForComponent(IMarkupWriter writer, IRequestCycle cycle, IComponent invoker) 57 { 58 Defense.notNull(invoker, "invoker"); 59 60 IComponent oldInvoker = _invoker; 61 62 try 63 { 64 _invoker = invoker; 65 renderBody(writer, cycle); 66 } 67 finally 68 { 69 _invoker = oldInvoker; 70 71 } 72 } 73 74 78 79 protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) 80 { 81 } 83 84 87 public IComponent getInserter() 88 { 89 return _invoker; 90 } 91 92 99 public IComponent getInvoker() 100 { 101 return _invoker; 102 } 103 104 109 110 void setInvoker(IComponent invoker) 111 { 112 _invoker = invoker; 113 } 114 } | Popular Tags |