KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > config > ConfigElements


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  *
6  */

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 JavaDoc name;
21    private ArrayList members;
22
23    /**
24     * Constructor
25     *
26     * @param name The name of the element of tree
27     *
28     */

29    public ConfigElements(String JavaDoc name){
30       this.name = name;
31       members = new ArrayList();
32    }
33
34    public String JavaDoc 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 JavaDoc getMember(int index)
49   {
50     return (index >= 0 && index < members.size()) ? members.get(index) : null;
51   }
52
53   public int getMemberIndex(Object JavaDoc 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 JavaDoc elem = members.get(i);
66       try{
67          if (elem instanceof BaseConfigPane){
68           ((BaseConfigPane) elem).save();
69         }
70       } catch(Throwable JavaDoc t) { }
71     }
72    }
73
74    public void readConf(){
75     for (int i = 0; i < members.size(); i++){
76       Object JavaDoc elem = members.get(i);
77       try{
78          if (elem instanceof BaseConfigPane){
79           ((BaseConfigPane) elem).readConf();
80         }
81       } catch(Throwable JavaDoc t) { }
82     }
83    }
84
85    public void refreshLanguageDependentStrings () {
86       for (int i = 0; i < members.size(); i++){
87          Object JavaDoc elem = members.get(i);
88          try{
89             if (elem instanceof BaseConfigPane){
90                ((BaseConfigPane) elem).refreshLanguageDependentStrings();
91             }
92          } catch(Throwable JavaDoc t) { }
93       }
94    }
95
96 }
97
98
Popular Tags