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