1 4 package org.oddjob.designer.components; 5 6 import org.oddjob.Structural; 7 import org.oddjob.designer.arooa.ElementWrapper; 8 import org.oddjob.designer.model.DesignComponent; 9 import org.oddjob.designer.model.StructuralDesignComponent; 10 import org.oddjob.structural.ChildHelper; 11 import org.oddjob.structural.StructuralListener; 12 13 16 abstract public class StructuralDC extends BaseDC 17 implements Structural, StructuralDesignComponent { 18 19 protected transient ChildHelper childHelper 20 = new ChildHelper(this); 21 22 25 public void addStructuralListener(StructuralListener listener) { 26 childHelper.addStructuralListener(listener); 27 } 28 29 32 public void removeStructuralListener(StructuralListener listener) { 33 childHelper.removeStructuralListener(listener); 34 } 35 36 public void deleteChild(DesignComponent child) { 37 childHelper.removeChild(child); 38 } 39 40 public void replaceChild(DesignComponent child, DesignComponent replacement) { 41 childHelper.replaceChild(child, replacement); 42 } 43 44 protected ElementWrapper[] childElements() { 45 Object [] children = childHelper.getChildren(); 46 ElementWrapper[] results = new ElementWrapper[children.length]; 47 for (int i = 0; i < children.length; ++i) { 48 DesignComponent dc = (DesignComponent) children[i]; 49 ElementWrapper wrapper = new ElementWrapper( 50 dc.tag(), dc); 51 results[i] = wrapper; 52 } 53 return results; 54 } 55 } 56 | Popular Tags |