1 19 20 21 package org.netbeans.modules.form; 22 23 import java.util.ArrayList ; 24 25 29 public class RADContainer extends RADComponent implements ComponentContainer { 30 private ArrayList subComponents; 31 32 public RADComponent[] getSubBeans() { 33 RADComponent[] components = new RADComponent [subComponents.size()]; 34 subComponents.toArray(components); 35 return components; 36 } 37 38 public void initSubComponents(RADComponent[] initComponents) { 39 subComponents = new ArrayList (initComponents.length); 40 for (int i = 0; i < initComponents.length; i++) { 41 subComponents.add(initComponents[i]); 42 initComponents[i].setParentComponent(this); 43 } 44 } 45 46 public void reorderSubComponents(int[] perm) { 47 RADComponent[] components = new RADComponent[subComponents.size()]; 48 for (int i=0; i < perm.length; i++) 49 components[perm[i]] = (RADComponent) subComponents.get(i); 50 51 subComponents.clear(); 52 subComponents.addAll(java.util.Arrays.asList(components)); 53 } 54 55 public void add(RADComponent comp) { 56 subComponents.add(comp); 57 comp.setParentComponent(this); 58 } 59 60 public void remove(RADComponent comp) { 61 if (subComponents.remove(comp)) 62 comp.setParentComponent(null); 63 } 64 65 public int getIndexOf(RADComponent comp) { 66 return subComponents.indexOf(comp); 67 } 68 69 79 public String getContainerGenName() { 80 return ""; } 82 } 83 | Popular Tags |