1 15 package org.apache.tapestry.form; 16 17 import java.util.ArrayList ; 18 import java.util.Collection ; 19 import java.util.Iterator ; 20 import java.util.List ; 21 import java.util.Map ; 22 23 import org.apache.hivemind.Location; 24 import org.apache.hivemind.Messages; 25 import org.apache.tapestry.IAsset; 26 import org.apache.tapestry.IBeanProvider; 27 import org.apache.tapestry.IBinding; 28 import org.apache.tapestry.IComponent; 29 import org.apache.tapestry.IForm; 30 import org.apache.tapestry.IMarkupWriter; 31 import org.apache.tapestry.INamespace; 32 import org.apache.tapestry.IPage; 33 import org.apache.tapestry.IRender; 34 import org.apache.tapestry.IRequestCycle; 35 import org.apache.tapestry.engine.IPageLoader; 36 import org.apache.tapestry.listener.ListenerMap; 37 import org.apache.tapestry.spec.IComponentSpecification; 38 import org.apache.tapestry.valid.IValidationDelegate; 39 40 46 public class MockForm implements IForm 47 { 48 private Location _location; 49 50 private IRender _body; 51 52 private List _deferredRunnable = new ArrayList (); 53 54 private IValidationDelegate _delegate; 55 56 public MockForm() 57 { 58 this(null, null); 59 } 60 61 public MockForm(Location location) 62 { 63 this(null, location); 64 } 65 66 public MockForm(IValidationDelegate delegate) 67 { 68 this(delegate, null); 69 } 70 71 public MockForm(IValidationDelegate delegate, Location location) 72 { 73 _delegate = delegate; 74 _location = location; 75 } 76 77 public void rewind(IMarkupWriter writer, IRequestCycle cycle) 78 { 79 } 80 81 public void addEventHandler(FormEventType type, String functionName) 82 { 83 } 84 85 public String getElementId(IFormComponent component) 86 { 87 return null; 88 } 89 90 public String getElementId(IFormComponent component, String baseId) 91 { 92 return null; 93 } 94 95 public String getName() 96 { 97 return "myform"; 98 } 99 100 public boolean isRewinding() 101 { 102 return false; 103 } 104 105 public IValidationDelegate getDelegate() 106 { 107 return _delegate; 108 } 109 110 public void setEncodingType(String encodingType) 111 { 112 } 113 114 public void addHiddenValue(String name, String value) 115 { 116 } 117 118 public void addHiddenValue(String name, String id, String value) 119 { 120 } 121 122 public boolean getRequiresSession() 123 { 124 return false; 125 } 126 127 public void addAsset(String name, IAsset asset) 128 { 129 } 130 131 public void addComponent(IComponent component) 132 { 133 } 134 135 public void addBody(IRender element) 136 { 137 } 138 139 public Map getAssets() 140 { 141 return null; 142 } 143 144 public IAsset getAsset(String name) 145 { 146 return null; 147 } 148 149 public IBinding getBinding(String name) 150 { 151 return null; 152 } 153 154 public Collection getBindingNames() 155 { 156 return null; 157 } 158 159 public Map getBindings() 160 { 161 return null; 162 } 163 164 public IComponent getComponent(String id) 165 { 166 return null; 167 } 168 169 public IComponent getContainer() 170 { 171 return null; 172 } 173 174 public void setContainer(IComponent value) 175 { 176 } 177 178 public String getExtendedId() 179 { 180 return "SomePage/myform"; 181 } 182 183 public String getId() 184 { 185 return null; 186 } 187 188 public void setId(String value) 189 { 190 } 191 192 public String getIdPath() 193 { 194 return null; 195 } 196 197 public IPage getPage() 198 { 199 return null; 200 } 201 202 public void setPage(IPage value) 203 { 204 } 205 206 public IComponentSpecification getSpecification() 207 { 208 return null; 209 } 210 211 public void renderBody(IMarkupWriter writer, IRequestCycle cycle) 212 { 213 if (_body != null) 214 _body.render(writer, cycle); 215 } 216 217 public void setBinding(String name, IBinding binding) 218 { 219 } 220 221 public Map getComponents() 222 { 223 return null; 224 } 225 226 public void finishLoad(IRequestCycle cycle, IPageLoader loader, 227 IComponentSpecification specification) 228 { 229 } 230 231 public Messages getMessages() 232 { 233 return null; 234 } 235 236 public INamespace getNamespace() 237 { 238 return null; 239 } 240 241 public void setNamespace(INamespace namespace) 242 { 243 } 244 245 public void setProperty(String propertyName, Object value) 246 { 247 } 248 249 public Object getProperty(String propertyName) 250 { 251 return null; 252 } 253 254 public boolean isRendering() 255 { 256 return false; 257 } 258 259 public void enterActiveState() 260 { 261 } 262 263 public IBeanProvider getBeans() 264 { 265 return null; 266 } 267 268 public ListenerMap getListeners() 269 { 270 return null; 271 } 272 273 public void render(IMarkupWriter writer, IRequestCycle cycle) 274 { 275 } 276 277 public void setLocation(Location arg0) 278 { 279 } 280 281 public Location getLocation() 282 { 283 return _location; 284 } 285 286 public void setBody(IRender body) 287 { 288 _body = body; 289 } 290 291 public void prerenderField(IMarkupWriter writer, IComponent field, Location location) 292 { 293 } 294 295 public boolean wasPrerendered(IMarkupWriter writer, IComponent field) 296 { 297 return false; 298 } 299 300 public void addDeferredRunnable(Runnable runnable) 301 { 302 _deferredRunnable.add(runnable); 303 } 304 305 void runDeferred() 306 { 307 Iterator i = _deferredRunnable.iterator(); 308 while (i.hasNext()) 309 { 310 Runnable r = (Runnable ) i.next(); 311 312 r.run(); 313 } 314 } 315 316 public boolean isClientValidationEnabled() 317 { 318 return false; 319 } 320 321 public String getMessage(String key) 322 { 323 return null; 324 } 325 } | Popular Tags |