KickJava   Java API By Example, From Geeks To Geeks.

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


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

4 package org.oddjob.designer.view;
5
6 import java.util.Iterator JavaDoc;
7 import java.util.LinkedHashMap JavaDoc;
8 import java.util.Map JavaDoc;
9
10 import org.oddjob.designer.model.DesignDefinition;
11
12 public class DummyView {
13
14     Map JavaDoc children = new LinkedHashMap JavaDoc();
15     
16     protected DummyView inline(DesignDefinition dd) {
17         DummyView child = DummyViewFactory.create(dd);
18         children.put(dd.getTitle(), child);
19         return child;
20     }
21     
22     public DummyView get(String JavaDoc title) {
23         DummyView child = (DummyView) children.get(title);
24         if (child == null) {
25             throw new IllegalArgumentException JavaDoc("No [" + title + "], options are: "
26                     + options());
27         }
28         return child;
29     }
30     
31     public void attribute(String JavaDoc attribute) {
32         throw new UnsupportedOperationException JavaDoc("[" + this.getClass().getName() + "]");
33     }
34     
35     public String JavaDoc attribute() {
36         throw new UnsupportedOperationException JavaDoc("[" + this.getClass().getName() + "]");
37     }
38
39     public DummyView create(String JavaDoc type) {
40         throw new UnsupportedOperationException JavaDoc("[" + this.getClass().getName() + "]");
41     }
42     
43     public DummyView create(String JavaDoc name, String JavaDoc type) {
44         throw new UnsupportedOperationException JavaDoc("[" + this.getClass().getName() + "]");
45     }
46     
47     
48     private String JavaDoc options() {
49         String JavaDoc options = "";
50         for (Iterator JavaDoc it = children.keySet().iterator(); it.hasNext(); ) {
51             options = options + "[" + it.next() + "]";
52         }
53         return options;
54     }
55 }
56
Popular Tags