1 38 39 package org.apache.cocoon.faces.samples.components.components; 40 41 42 import org.apache.cocoon.faces.samples.components.model.ImageArea; 43 44 import javax.faces.component.UIOutput; 45 import javax.faces.context.FacesContext; 46 47 57 58 public class AreaComponent extends UIOutput { 59 60 61 63 64 private String alt = null; 65 private String coords = null; 66 private String shape = null; 67 private String targetImage = null; 68 69 70 71 73 74 77 public String getAlt() { 78 return (this.alt); 79 } 80 81 82 87 public void setAlt(String alt) { 88 this.alt = alt; 89 } 90 91 92 96 public String getCoords() { 97 return (this.coords); 98 } 99 100 101 106 public void setCoords(String coords) { 107 this.coords = coords; 108 } 109 110 111 114 public String getShape() { 115 return (this.shape); 116 } 117 118 119 124 public void setShape(String shape) { 125 this.shape = shape; 126 } 127 128 129 134 public String getTargetImage() { 135 return targetImage; 136 } 137 138 139 144 public void setTargetImage(String targetImage) { 145 this.targetImage = targetImage; 146 } 147 148 149 152 public String getFamily() { 153 154 return ("Area"); 155 156 } 157 158 160 161 165 public Object getValue() { 166 167 if (super.getValue() == null) { 168 setValue(new ImageArea(getAlt(), getCoords(), getShape())); 169 } 170 return (super.getValue()); 171 172 } 173 174 175 177 178 183 184 public Object saveState(FacesContext context) { 185 Object values[] = new Object [5]; 186 values[0] = super.saveState(context); 187 values[1] = alt; 188 values[2] = coords; 189 values[3] = shape; 190 values[4] = targetImage; 191 return (values); 192 } 193 194 195 203 public void restoreState(FacesContext context, Object state) { 204 Object values[] = (Object []) state; 205 super.restoreState(context, values[0]); 206 alt = (String ) values[1]; 207 coords = (String ) values[2]; 208 shape = (String ) values[3]; 209 targetImage = (String ) values[4]; 210 } 211 212 213 } 214 | Popular Tags |