1 18 package org.apache.beehive.netui.tags.html; 19 20 import org.apache.beehive.netui.tags.AbstractSimpleTag; 21 import org.apache.beehive.netui.tags.IBehaviorConsumer; 22 import org.apache.beehive.netui.util.Bundle; 23 24 import javax.servlet.jsp.JspException ; 25 import javax.servlet.jsp.tagext.JspTag ; 26 import javax.servlet.jsp.tagext.SimpleTagSupport ; 27 28 32 public class Behavior extends AbstractSimpleTag 33 { 34 private String _name = null; 35 private Object _value = null; 36 private String _facet = null; 37 38 41 public String getTagName() { 42 return "Behavior"; 43 } 44 45 54 public void setName(String name) 55 throws JspException 56 { 57 _name = setRequiredValueAttribute(name, "name"); 58 } 59 60 69 public void setValue(Object value) 70 { 71 _value = value; 72 } 73 74 83 public void setFacet(String facet) 84 throws JspException 85 { 86 _facet = setRequiredValueAttribute(facet, "facet"); 87 } 88 89 93 public void doTag() 94 throws JspException 95 { 96 if (hasErrors()) { 97 reportErrors(); 98 return; 99 } 100 101 JspTag tag = SimpleTagSupport.findAncestorWithClass(this, IBehaviorConsumer.class); 102 if (tag == null) { 103 String s = Bundle.getString("Tags_BehaviorInvalidParent"); 104 registerTagError(s, null); 105 reportErrors(); 106 return; 107 } 108 109 IBehaviorConsumer ac = (IBehaviorConsumer) tag; 110 ac.setBehavior(_name, _value, _facet); 111 return; 112 } 113 } 114 | Popular Tags |