1 4 package org.oddjob.designer.model; 5 6 import org.oddjob.designer.arooa.ElementWrapper; 7 8 17 public class ComponentElement { 18 19 private final ElementWrapper[] elements; 20 21 private ComponentElement(DesignComponent dc) { 22 elements = new ElementWrapper[] { 23 new ElementWrapper(dc.tag(), dc) }; 24 } 25 26 private ComponentElement(Object [] dcs) { 27 elements = new ElementWrapper[dcs.length]; 28 for (int i = 0; i < dcs.length; ++i ) { 29 elements[i] = new ElementWrapper(((DesignComponent)dcs[i]).tag(), dcs[i]); 30 } 31 } 32 33 38 public ElementWrapper[] elements() { 39 return elements; 40 } 41 42 public static ComponentElement createNested(DesignComponent dc) { 43 if (dc == null) { 44 return null; 45 } 46 return new ComponentElement(dc); 47 } 48 49 public static ComponentElement createNested(Object [] dcs) { 50 if (dcs == null) { 51 return null; 52 } 53 if (dcs.length == 0) { 54 return null; 55 } 56 return new ComponentElement(dcs); 57 } 58 59 } 60 | Popular Tags |