1 16 package org.apache.myfaces.wap.base; 17 18 import javax.faces.component.UIComponent; 19 import javax.faces.component.UIMessage; 20 import javax.faces.context.FacesContext; 21 import javax.faces.el.ValueBinding; 22 23 38 39 public abstract class MessageTagBase extends ComponentTagBase { 40 41 42 private String forComponent = null; 43 private String showDetail = null; 44 private String showSummary = null; 45 46 47 public MessageTagBase() { 48 super(); 49 } 50 51 public abstract String getRendererType(); 52 53 public void release() { 54 super.release(); 55 this.forComponent = null; 56 this.showDetail = null; 57 this.showSummary= null; 58 } 59 60 protected void setProperties(UIComponent component) { 61 super.setProperties(component); 62 63 if (getRendererType() != null) { 64 component.setRendererType(getRendererType()); 65 } 66 67 UIMessage comp = (UIMessage)component; 68 69 if (forComponent != null) { 70 if (isValueReference(forComponent)) { 71 ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding(forComponent); 72 component.setValueBinding("for", vb); 73 } else { 74 comp.setFor(forComponent); 75 } 76 } 77 78 if (showDetail != null) { 79 if (isValueReference(showDetail)) { 80 ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding(showDetail); 81 component.setValueBinding("showDetail", vb); 82 } else { 83 boolean bool = Boolean.valueOf(showDetail).booleanValue(); 84 comp.setShowDetail(bool); 85 } 86 } 87 88 if (showSummary != null) { 89 if (isValueReference(showSummary)) { 90 ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding(showSummary); 91 component.setValueBinding("showSummary", vb); 92 } else { 93 boolean bool = Boolean.valueOf(showSummary).booleanValue(); 94 comp.setShowSummary(bool); 95 } 96 } 97 } 98 99 public String getFor() { 101 return forComponent; 102 } 103 104 public void setFor(String forComponent) { 105 this.forComponent = forComponent; 106 } 107 108 public String getShowDetail() { 109 return showDetail; 110 } 111 112 public void setShowDetail(String showDetail) { 113 this.showDetail = showDetail; 114 } 115 116 public String getShowSummary() { 117 return showSummary; 118 } 119 120 public void setShowSummary(String showSummary) { 121 this.showSummary = showSummary; 122 } 123 124 } 125 | Popular Tags |