01: /*
02: * Created on Nov 24, 2005
03: */
04: package uk.org.ponder.rsf.view.support;
05:
06: import uk.org.ponder.rsf.components.UIContainer;
07: import uk.org.ponder.rsf.expander.TemplateExpander;
08: import uk.org.ponder.rsf.view.ComponentChecker;
09: import uk.org.ponder.rsf.view.ViewComponentProducer;
10: import uk.org.ponder.rsf.view.ViewRoot;
11: import uk.org.ponder.rsf.viewstate.ViewParameters;
12:
13: /** A ViewComponentProducer that returns components deserialized from an
14: * XML representation (after having been subject to a process of "expansion"
15: * specified by the RSF "pseudocomponents" UISwitch and UIReplicator).
16: * @author Antranig Basman (antranig@caret.cam.ac.uk)
17: *
18: */
19: public class XMLViewComponentProducer implements ViewComponentProducer {
20: private String viewID;
21: private UIContainer templatecontainer;
22: private TemplateExpander templateexpander;
23:
24: public void setViewID(String viewID) {
25: this .viewID = viewID;
26: }
27:
28: public String getViewID() {
29: return viewID;
30: }
31:
32: public void setTemplateExpander(TemplateExpander templateexpander) {
33: this .templateexpander = templateexpander;
34: }
35:
36: public void setTemplateContainer(UIContainer templatecontainer) {
37: this .templatecontainer = templatecontainer;
38: }
39:
40: public void fillComponents(UIContainer tofill,
41: ViewParameters origviewparams, ComponentChecker checker) {
42: if (tofill instanceof ViewRoot
43: && templatecontainer instanceof ViewRoot) {
44: ViewRoot fillroot = (ViewRoot) tofill;
45: ViewRoot templateroot = (ViewRoot) templatecontainer;
46: fillroot.navigationCases = templateroot.navigationCases;
47: }
48: templateexpander.expandTemplate(tofill, templatecontainer);
49: }
50:
51: }
|