KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > designer > view > DummyViewFactory


1 /*
2  * (c) Rob Gordon 2005
3  */

4 package org.oddjob.designer.view;
5
6 import org.oddjob.designer.model.DateInput;
7 import org.oddjob.designer.model.DesignDefinition;
8 import org.oddjob.designer.model.DesignProcessor;
9 import org.oddjob.designer.model.ElementField;
10 import org.oddjob.designer.model.FieldGroup;
11 import org.oddjob.designer.model.FieldSelection;
12 import org.oddjob.designer.model.FileSelection;
13 import org.oddjob.designer.model.MultiTypeTable;
14 import org.oddjob.designer.model.MultiTypeTree;
15 import org.oddjob.designer.model.SingleTypeSelection;
16 import org.oddjob.designer.model.TextInput;
17 import org.oddjob.designer.model.SelectionList;
18
19 /**
20  *
21  */

22 public class DummyViewFactory implements DesignProcessor {
23
24     private DummyView designView;
25     
26     private DummyViewFactory() {}
27     
28     /* (non-Javadoc)
29      * @see org.oddjob.designer.model.DialogProcessor#onFieldGroup(org.oddjob.designer.model.FieldGroup)
30      */

31     public void onFieldGroup(FieldGroup fieldGroup) {
32         designView = new FieldGroupDummy(fieldGroup);
33     }
34     
35     /* (non-Javadoc)
36      * @see org.oddjob.designer.model.DesignProcessor#onFieldSelection(org.oddjob.designer.model.FieldSelection)
37      */

38     public void onFieldSelection(FieldSelection fieldSelection) {
39         designView = new FieldSelectionDummy(fieldSelection);
40     }
41     
42     /* (non-Javadoc)
43      * @see org.oddjob.designer.model.DialogProcessor#onMulipleTypeTable(org.oddjob.designer.model.MultiTypeTable)
44      */

45     public void onMulipleTypeTable(MultiTypeTable multiTypeTable) {
46         designView = new MultiTypeTableDummy(multiTypeTable);
47     }
48     
49     /* (non-Javadoc)
50      * @see org.oddjob.designer.model.DialogProcessor#onMulipleTypeTree(org.oddjob.designer.model.MultiTypeTree)
51      */

52     public void onMulipleTypeTree(MultiTypeTree multiTypeTree) {
53         designView = new MultiTypeTreeDummy(multiTypeTree);
54     }
55     
56     /*
57      * (non-Javadoc)
58      * @see org.oddjob.designer.model.DesignProcessor#onSingleTypeSelection(org.oddjob.designer.model.SingleTypeSelection)
59      */

60     public void onSingleTypeSelection(SingleTypeSelection typeSelection) {
61         designView = new TypeSelectionDummy(typeSelection);
62     }
63
64     /*
65      * (non-Javadoc)
66      * @see org.oddjob.designer.model.DesignProcessor#onSelectionList(org.oddjob.designer.model.SelectionList)
67      */

68     public void onSelectionList(SelectionList selectionList) {
69         designView = new SelectionListDummy(selectionList);
70     }
71     
72     /* (non-Javadoc)
73      * @see org.oddjob.designer.model.DialogProcessor#onTextInput(org.oddjob.designer.model.TextInput)
74      */

75     public void onTextInput(TextInput textInput) {
76         designView = new TextInputDummy(textInput);
77     }
78
79     /* (non-Javadoc)
80      * @see org.oddjob.designer.model.DesignProcessor#onFileSelection(org.oddjob.designer.model.FileSelection)
81      */

82     public void onFileSelection(FileSelection fileSelection) {
83         throw new UnsupportedOperationException JavaDoc();
84     }
85
86     /*
87      * (non-Javadoc)
88      * @see org.oddjob.designer.model.DesignProcessor#onDateInput(org.oddjob.designer.model.DateInput)
89      */

90     public void onDateInput(DateInput dateInput) {
91         designView = new DateInputDummy(dateInput);
92     }
93     
94     /* (non-Javadoc)
95      * @see org.oddjob.designer.model.DesignProcessor#onElementField(org.oddjob.designer.model.ElementField)
96      */

97     public void onElementField(ElementField elementField) {
98         designView = new ElementFieldDummy(elementField);
99     }
100     
101     public static DummyView create(DesignDefinition designDefinition) {
102         DummyViewFactory factory = new DummyViewFactory();
103         designDefinition.accept(factory);
104         return factory.designView;
105     }
106 }
107
Popular Tags