01: /*
02: * Created on Nov 17, 2005
03: */
04: package uk.org.ponder.rsf.componentprocessor;
05:
06: import uk.org.ponder.rsf.components.ParameterList;
07: import uk.org.ponder.rsf.components.UICommand;
08: import uk.org.ponder.rsf.components.UIComponent;
09: import uk.org.ponder.rsf.components.UIDeletionBinding;
10: import uk.org.ponder.rsf.components.UIELBinding;
11: import uk.org.ponder.rsf.components.UIForm;
12: import uk.org.ponder.rsf.components.UIParameter;
13: import uk.org.ponder.rsf.request.FossilizedConverter;
14:
15: /** A fixer which converts deletion and EL bindings to their "raw" form
16: * as fossilized key/value pairs.
17: * @author Antranig Basman (amb26@ponder.org.uk)
18: */
19:
20: public class BindingFixer implements ComponentProcessor {
21:
22: private FossilizedConverter fossilizedconverter;
23:
24: public void setFossilizedConverter(
25: FossilizedConverter fossilizedconverter) {
26: this .fossilizedconverter = fossilizedconverter;
27: }
28:
29: public void processComponent(UIComponent toprocess) {
30: if (toprocess instanceof UIForm) {
31: processParameterList(((UIForm) toprocess).parameters);
32: } else if (toprocess instanceof UICommand) {
33: processParameterList(((UICommand) toprocess).parameters);
34: }
35: }
36:
37: private void processParameterList(ParameterList list) {
38: for (int i = 0; i < list.size(); ++i) {
39: UIParameter param = list.parameterAt(i);
40: if (param instanceof UIDeletionBinding) {
41: fossilizedconverter
42: .computeDeletionBinding((UIDeletionBinding) param);
43: } else if (param instanceof UIELBinding) {
44: fossilizedconverter
45: .computeELBinding((UIELBinding) param);
46: }
47: }
48: }
49:
50: }
|