1 38 39 package org.apache.cocoon.faces.samples.components.taglib; 40 41 import org.apache.cocoon.faces.FacesUtils; 42 import org.apache.cocoon.faces.taglib.UIComponentTag; 43 import org.apache.cocoon.faces.samples.components.components.AreaComponent; 44 import org.apache.cocoon.faces.samples.components.renderkit.Util; 45 46 import javax.faces.component.UIComponent; 47 import javax.faces.component.ValueHolder; 48 49 50 53 54 public class AreaTag extends UIComponentTag { 55 56 57 private String alt = null; 58 59 60 public void setAlt(String alt) { 61 this.alt = alt; 62 } 63 64 65 private String targetImage = null; 66 67 68 public void setTargetImage(String targetImage) { 69 this.targetImage = targetImage; 70 } 71 72 73 private String coords = null; 74 75 76 public void setCoords(String coords) { 77 this.coords = coords; 78 } 79 80 81 private String onmouseout = null; 82 83 84 public void setOnmouseout(String newonmouseout) { 85 onmouseout = newonmouseout; 86 } 87 88 89 private String onmouseover = null; 90 91 92 public void setOnmouseover(String newonmouseover) { 93 onmouseover = newonmouseover; 94 } 95 96 97 private String shape = null; 98 99 100 public void setShape(String shape) { 101 this.shape = shape; 102 } 103 104 105 private String styleClass = null; 106 107 108 public void setStyleClass(String styleClass) { 109 this.styleClass = styleClass; 110 } 111 112 113 private String value = null; 114 115 116 public void setValue(String newValue) { 117 value = newValue; 118 } 119 120 121 public String getComponentType() { 122 return ("DemoArea"); 123 } 124 125 126 public String getRendererType() { 127 return ("DemoArea"); 128 } 129 130 131 public void recycle() { 132 super.recycle(); 133 this.alt = null; 134 this.coords = null; 135 this.onmouseout = null; 136 this.onmouseover = null; 137 this.shape = null; 138 this.styleClass = null; 139 this.value = null; 140 } 141 142 143 protected void setProperties(UIComponent component) { 144 super.setProperties(component); 145 AreaComponent area = (AreaComponent) component; 146 if (alt != null) { 147 if (FacesUtils.isExpression(alt)) { 148 area.setValueBinding("alt", Util.getValueBinding(alt)); 149 } else { 150 area.getAttributes().put("alt", alt); 151 } 152 } 153 if (coords != null) { 154 if (FacesUtils.isExpression(coords)) { 155 area.setValueBinding("coords", Util.getValueBinding(coords)); 156 } else { 157 area.getAttributes().put("coords", coords); 158 } 159 } 160 if (onmouseout != null) { 161 if (FacesUtils.isExpression(onmouseout)) { 162 area.setValueBinding("onmouseout", 163 Util.getValueBinding(onmouseout)); 164 } else { 165 area.getAttributes().put("onmouseout", onmouseout); 166 } 167 } 168 if (onmouseover != null) { 169 if (FacesUtils.isExpression(onmouseover)) { 170 area.setValueBinding("onmouseover", 171 Util.getValueBinding(onmouseover)); 172 } else { 173 area.getAttributes().put("onmouseover", onmouseover); 174 } 175 } 176 if (shape != null) { 177 if (FacesUtils.isExpression(shape)) { 178 area.setValueBinding("shape", Util.getValueBinding(shape)); 179 } else { 180 area.getAttributes().put("shape", shape); 181 } 182 } 183 if (styleClass != null) { 184 if (FacesUtils.isExpression(styleClass)) { 185 area.setValueBinding("styleClass", 186 Util.getValueBinding(styleClass)); 187 } else { 188 area.getAttributes().put("styleClass", styleClass); 189 } 190 } 191 if (area instanceof ValueHolder) { 192 ValueHolder valueHolder = (ValueHolder) component; 193 if (value != null) { 194 if (FacesUtils.isExpression(value)) { 195 area.setValueBinding("value", Util.getValueBinding(value)); 196 } else { 197 valueHolder.setValue(value); 198 } 199 } 200 } 201 area.setTargetImage(targetImage); 203 } 204 } 205 | Popular Tags |