1 7 8 package org.enhydra.jawe.config; 9 10 11 12 import java.util.*; 13 14 import javax.swing.*; 15 import org.enhydra.jawe.PackageEditor; 16 17 18 public class ConfigElements{ 19 20 private String name; 21 private ArrayList members; 22 23 29 public ConfigElements(String name){ 30 this.name = name; 31 members = new ArrayList(); 32 } 33 34 public String getName(){ 35 return name; 36 } 37 38 public void addOptionPane(BaseConfigPane pane){ 39 if (members.indexOf(pane) != -1) 40 return; 41 members.add(pane); 42 } 43 44 public ArrayList getMembers(){ 45 return members; 46 } 47 48 public Object getMember(int index) 49 { 50 return (index >= 0 && index < members.size()) ? members.get(index) : null; 51 } 52 53 public int getMemberIndex(Object member) 54 { 55 return members.indexOf(member); 56 } 57 58 public int getMemberCount() 59 { 60 return members.size(); 61 } 62 63 public void save(){ 64 for (int i = 0; i < members.size(); i++){ 65 Object elem = members.get(i); 66 try{ 67 if (elem instanceof BaseConfigPane){ 68 ((BaseConfigPane) elem).save(); 69 } 70 } catch(Throwable t) { } 71 } 72 } 73 74 public void readConf(){ 75 for (int i = 0; i < members.size(); i++){ 76 Object elem = members.get(i); 77 try{ 78 if (elem instanceof BaseConfigPane){ 79 ((BaseConfigPane) elem).readConf(); 80 } 81 } catch(Throwable t) { } 82 } 83 } 84 85 public void refreshLanguageDependentStrings () { 86 for (int i = 0; i < members.size(); i++){ 87 Object elem = members.get(i); 88 try{ 89 if (elem instanceof BaseConfigPane){ 90 ((BaseConfigPane) elem).refreshLanguageDependentStrings(); 91 } 92 } catch(Throwable t) { } 93 } 94 } 95 96 } 97 98 | Popular Tags |