KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > sunresources > wizards > ResourceConfigHelper


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * ResourceConfigHelper.java
21  *
22  * Created on October 17, 2002, 12:11 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.ide.sunresources.wizards;
26
27
28 /**
29  *
30  * @author shirleyc
31  */

32 public class ResourceConfigHelper {
33
34     private ResourceConfigData datas[] = null;
35     private int index;
36     private boolean forEdit = false;
37
38     /** Creates a new instance of ResourceConfigHelper */
39     public ResourceConfigHelper(int size) {
40         this(size, 0);
41     }
42
43     public ResourceConfigHelper(int size, int index) {
44         datas = new ResourceConfigData[size];
45         this.index = index;
46     }
47     
48     public ResourceConfigHelper(ResourceConfigData data, int size, int index) {
49         this(size, index);
50         datas[index] = data;
51     }
52     
53     public ResourceConfigHelper(ResourceConfigData data) {
54         this(data, 1, 0);
55     }
56     
57     public int getIndex() {
58         return index;
59     }
60     
61     public void setIndex(int index) {
62         this.index = index;
63     }
64     
65     public boolean getForEdit() {
66         return forEdit;
67     }
68     
69     public ResourceConfigHelper setForEdit(boolean forEdit) {
70         this.forEdit = forEdit;
71         return this;
72     }
73         
74     public ResourceConfigData getData() {
75         ResourceConfigData data = datas[index];
76         if (data == null) {
77             data = new ResourceConfigData();
78             datas[index] = data;
79         }
80         return data;
81     }
82     
83     public String JavaDoc toString() {
84         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
85         str.append("index is " + index + "\n"); //NOI18N
86
for (int i = 0; i < datas.length; i++) {
87             if (datas[i] == null)
88                 str.append("datas[ " + i + " ] is null"); //NOI18N
89
else
90                 str.append("datas[ " + i + " ] is:\n" + datas[i].toString()); //NOI18N
91
}
92         return str.toString();
93     }
94            
95 }
96
Popular Tags