1 17 18 package javax.servlet.jsp.tagext; 19 20 import javax.servlet.jsp.*; 21 22 23 37 public class TagAdapter 38 implements Tag 39 { 40 41 private SimpleTag simpleTagAdaptee; 42 43 44 private Tag parent; 45 46 private boolean parentDetermined; 48 49 55 public TagAdapter( SimpleTag adaptee ) { 56 if( adaptee == null ) { 57 throw new IllegalArgumentException (); 59 } 60 this.simpleTagAdaptee = adaptee; 61 } 62 63 69 public void setPageContext(PageContext pc) { 70 throw new UnsupportedOperationException ( 71 "Illegal to invoke setPageContext() on TagAdapter wrapper" ); 72 } 73 74 75 82 public void setParent( Tag parentTag ) { 83 throw new UnsupportedOperationException ( 84 "Illegal to invoke setParent() on TagAdapter wrapper" ); 85 } 86 87 88 98 public Tag getParent() { 99 if (!parentDetermined) { 100 JspTag adapteeParent = simpleTagAdaptee.getParent(); 101 if (adapteeParent != null) { 102 if (adapteeParent instanceof Tag ) { 103 this.parent = (Tag ) adapteeParent; 104 } else { 105 this.parent = new TagAdapter ((SimpleTag ) adapteeParent); 107 } 108 } 109 parentDetermined = true; 110 } 111 112 return this.parent; 113 } 114 115 122 public JspTag getAdaptee() { 123 return this.simpleTagAdaptee; 124 } 125 126 133 public int doStartTag() throws JspException { 134 throw new UnsupportedOperationException ( 135 "Illegal to invoke doStartTag() on TagAdapter wrapper" ); 136 } 137 138 145 public int doEndTag() throws JspException { 146 throw new UnsupportedOperationException ( 147 "Illegal to invoke doEndTag() on TagAdapter wrapper" ); 148 } 149 150 155 public void release() { 156 throw new UnsupportedOperationException ( 157 "Illegal to invoke release() on TagAdapter wrapper" ); 158 } 159 } 160 | Popular Tags |