01: /*
02: * Created on 12-Jan-2006
03: */
04: package uk.org.ponder.rsf.viewstate.support;
05:
06: import uk.org.ponder.conversion.LeafObjectParser;
07: import uk.org.ponder.rsf.viewstate.ViewParamUtil;
08: import uk.org.ponder.rsf.viewstate.ViewParameters;
09: import uk.org.ponder.rsf.viewstate.ViewParametersParser;
10: import uk.org.ponder.rsf.viewstate.ViewParamsCodec;
11:
12: /** A LeafObjectParser rendition of the ViewParametersParser bean. This parser
13: * is registered with the StaticLeafParser in the current mapping context,
14: * so that ViewParameters may be parsed in static contexts (in particular in
15: * XML components definition files)
16: * @author Antranig Basman (amb26@ponder.org.uk)
17: *
18: */
19:
20: public class ViewParamsLeafParser implements LeafObjectParser {
21:
22: private ViewParametersParser parser;
23: private ViewParamsCodec vpcodec;
24:
25: public void setViewParametersParser(ViewParametersParser parser) {
26: this .parser = parser;
27: }
28:
29: public void setViewParamsCodec(ViewParamsCodec vpcodec) {
30: this .vpcodec = vpcodec;
31: }
32:
33: public Object parse(String toparse) {
34: return ViewParamUtil.parse(parser, toparse);
35: }
36:
37: public String render(Object torender) {
38: return ViewParamUtil.toHTTPRequest(vpcodec,
39: (ViewParameters) torender);
40: }
41:
42: public Object copy(Object tocopy) {
43: ViewParameters viewparams = (ViewParameters) tocopy;
44: return viewparams.copyBase();
45: }
46:
47: }
|