Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libTools / src / org / gvsig / tools / exception / ListBaseException.java @ 23216

History | View | Annotate | Download (5.11 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Gobernment (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 */
26
package org.gvsig.tools.exception;
27

    
28
import java.util.*;
29

    
30
/**
31
 * @author Equipo de desarrollo de gvSIG
32
 *
33
 */
34
public abstract class ListBaseException extends BaseException implements List{
35
        private List exceptions = new ArrayList();
36
        
37
        /* (non-Javadoc)
38
         * @see java.util.Collection#size()
39
         */
40
        public int size() {
41
                return this.exceptions.size();
42
        }
43

    
44
        /* (non-Javadoc)
45
         * @see java.util.Collection#isEmpty()
46
         */
47
        public boolean isEmpty() {
48
                return this.exceptions.isEmpty();
49
        }
50

    
51
        /* (non-Javadoc)
52
         * @see java.util.Collection#contains(java.lang.Object)
53
         */
54
        public boolean contains(Object arg0) {
55
                return this.exceptions.contains(arg0);
56
        }
57

    
58
        /* (non-Javadoc)
59
         * @see java.util.Collection#toArray()
60
         */
61
        public Object[] toArray() {
62
                return this.exceptions.toArray();
63
        }
64

    
65
        /**
66
         * @param arg0
67
         * @return
68
         */
69
        public Object[] toArray(Object[] arg0) {
70
                return this.exceptions.toArray(arg0);
71
        }
72

    
73
        /**
74
         * @param arg0
75
         * @return
76
         */
77
        public boolean add(Object arg0) {
78
                return this.exceptions.add(arg0);
79
        }
80

    
81
        /* (non-Javadoc)
82
         * @see java.util.Collection#remove(java.lang.Object)
83
         */
84
        public boolean remove(Object arg0) {
85
                return this.exceptions.remove(arg0);
86
        }
87

    
88
        /**
89
         * @param arg0
90
         * @return
91
         */
92
        public boolean containsAll(Collection arg0) {
93
                return this.exceptions.contains(arg0);
94
        }
95

    
96
        /**
97
         * @param arg0
98
         * @return
99
         */
100
        public boolean addAll(Collection arg0) {
101
                return this.exceptions.addAll(arg0);
102
        }
103

    
104
        /**
105
         * @param arg0
106
         * @param arg1
107
         * @return
108
         */
109
        public boolean addAll(int arg0, Collection arg1) {
110
                return this.exceptions.addAll(arg0, arg1);
111
        }
112

    
113
        /**
114
         * @param arg0
115
         * @return
116
         */
117
        public boolean removeAll(Collection arg0) {
118
                return this.exceptions.removeAll(arg0);
119
        }
120

    
121
        /**
122
         * @param arg0
123
         * @return
124
         */
125
        public boolean retainAll(Collection arg0) {
126
                return this.exceptions.retainAll(arg0);
127
        }
128

    
129
        /* (non-Javadoc)
130
         * @see java.util.Collection#clear()
131
         */
132
        public void clear() {
133
                this.exceptions.clear();
134
        }
135

    
136
        /* (non-Javadoc)
137
         * @see java.util.List#get(int)
138
         */
139
        public Object get(int arg0) {
140
                return this.exceptions.get(arg0);
141
        }
142

    
143
        /**
144
         * @param arg0
145
         * @param arg1
146
         * @return
147
         */
148
        public Object set(int arg0, Object arg1) {
149
                return this.exceptions.set(arg0, arg1);
150
        }
151

    
152
        /**
153
         * @param arg0
154
         * @param arg1
155
         */
156
        public void add(int arg0, Object arg1) {
157
                this.exceptions.add(arg0, arg1);
158
        }
159

    
160
        /* (non-Javadoc)
161
         * @see java.util.List#remove(int)
162
         */
163
        public Object remove(int arg0) {
164
                return this.exceptions.remove(arg0);
165
        }
166

    
167
        /* (non-Javadoc)
168
         * @see java.util.List#indexOf(java.lang.Object)
169
         */
170
        public int indexOf(Object arg0) {
171
                return this.exceptions.indexOf(arg0);
172
        }
173

    
174
        /* (non-Javadoc)
175
         * @see java.util.List#lastIndexOf(java.lang.Object)
176
         */
177
        public int lastIndexOf(Object arg0) {
178
                return this.exceptions.lastIndexOf(arg0);
179
        }
180

    
181
        /* (non-Javadoc)
182
         * @see java.util.List#listIterator()
183
         */
184
        public ListIterator listIterator() {
185
                return this.exceptions.listIterator();
186
        }
187

    
188
        /* (non-Javadoc)
189
         * @see java.util.List#listIterator(int)
190
         */
191
        public ListIterator listIterator(int arg0) {
192
                return this.exceptions.listIterator(arg0);
193
        }
194

    
195
        /* (non-Javadoc)
196
         * @see java.util.List#subList(int, int)
197
         */
198
        public List subList(int arg0, int arg1) {
199
                return this.exceptions.subList(arg0, arg1);
200
        }
201
        
202
        /* (non-Javadoc)
203
         * @see java.lang.Throwable#getMessage()
204
         */
205
        public String getMessage() {
206
                String msg = super.getMessage();
207
                Exception bex;
208
                Iterator iter=this.exceptions.iterator();
209
                while (iter.hasNext()) {
210
                        bex = (Exception) iter.next();
211
                        msg = msg + "\n  " + bex.getMessage();
212
                }
213
                return msg;
214
        }
215
        
216
        /* (non-Javadoc)
217
         * @see org.gvsig.exceptions.IBaseException#getLocalizedMessage(org.gvsig.exceptions.IExceptionTranslator, int)
218
         */
219
        public String getLocalizedMessage(IExceptionTranslator exceptionTranslator, int indent) {
220
                String msg = super.getLocalizedMessage(exceptionTranslator, indent);
221
                Exception bex;
222
                Iterator iter=this.exceptions.iterator();
223
                while (iter.hasNext()) {
224
                        bex = (Exception) iter.next();
225
                        if( bex instanceof BaseException ) {
226
                                msg = msg + "\n  " + ((BaseException)bex).getLocalizedMessage(exceptionTranslator, indent);                                
227
                        } else {
228
                                msg = msg + "\n  " + bex.getLocalizedMessage();
229
                        }
230
                }
231
                return BaseException.insertBlanksAtStart(msg,indent);
232
        }
233

    
234
}