svn-gvsig-desktop / trunk / libraries / libGPE-KML / src / org / gvsig / gpe / kml / warnings / WarningsContainer.java @ 11157
History | View | Annotate | Download (3.43 KB)
1 |
package org.gvsig.gpe.kml.warnings; |
---|---|
2 |
|
3 |
import org.gvsig.exceptions.BaseException; |
4 |
import org.gvsig.exceptions.ListBaseException; |
5 |
|
6 |
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
/* CVS MESSAGES:
|
48 |
*
|
49 |
* $Id: WarningsContainer.java 11157 2007-04-12 10:21:52Z jorpiell $
|
50 |
* $Log$
|
51 |
* Revision 1.1 2007-04-12 10:21:52 jorpiell
|
52 |
* Add the writers
|
53 |
*
|
54 |
* Revision 1.1 2007/03/07 08:19:10 jorpiell
|
55 |
* Pasadas las clases de KML de libGPE-GML a libGPE-KML
|
56 |
*
|
57 |
* Revision 1.1 2007/02/28 11:48:31 csanchez
|
58 |
* *** empty log message ***
|
59 |
*
|
60 |
* Revision 1.1 2007/02/20 10:53:20 jorpiell
|
61 |
* A?adidos los proyectos de kml y gml antiguos
|
62 |
*
|
63 |
* Revision 1.1 2007/02/12 13:49:18 jorpiell
|
64 |
* A?adido el driver de KML
|
65 |
*
|
66 |
*
|
67 |
*/
|
68 |
/**
|
69 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
70 |
*/
|
71 |
public class WarningsContainer implements IWarningsContainer{ |
72 |
private ListBaseException warning = null; |
73 |
|
74 |
public WarningsContainer(){
|
75 |
warning = new WarningList();
|
76 |
} |
77 |
|
78 |
/*
|
79 |
* (non-Javadoc)
|
80 |
* @see org.gvsig.remoteClient.kml.warnings.IWarningsContainer#areWarnings()
|
81 |
*/
|
82 |
public boolean areWarnings() { |
83 |
if (warning.isEmpty()){
|
84 |
return false; |
85 |
} |
86 |
return true; |
87 |
} |
88 |
|
89 |
/*
|
90 |
* (non-Javadoc)
|
91 |
* @see org.gvsig.remoteClient.kml.warnings.IWarningsContainer#getWarningList()
|
92 |
*/
|
93 |
public ListBaseException getWarningList() {
|
94 |
return warning;
|
95 |
} |
96 |
|
97 |
/*
|
98 |
* (non-Javadoc)
|
99 |
* @see org.gvsig.remoteClient.kml.warnings.IWarningsContainer#setElement(org.gvsig.exceptions.BaseException)
|
100 |
*/
|
101 |
public void setElement(BaseException war) { |
102 |
// Only we add a warning when it is new
|
103 |
if (warning.contains(war)==false) |
104 |
{ |
105 |
warning.add((war)); |
106 |
} |
107 |
} |
108 |
|
109 |
/*
|
110 |
* (non-Javadoc)
|
111 |
* @see org.gvsig.remoteClient.kml.warnings.IWarningsContainer#getElement(int, org.gvsig.exceptions.ListBaseException)
|
112 |
*/
|
113 |
public BaseException getElement(int index, ListBaseException war) { |
114 |
// it returns the int value of a warning or 0 if it doesn't exists
|
115 |
if (war.isEmpty()==false) |
116 |
{ |
117 |
if (index < war.size()){
|
118 |
return (BaseException)war.get(index);
|
119 |
} |
120 |
} |
121 |
return null; |
122 |
} |
123 |
|
124 |
/*
|
125 |
* (non-Javadoc)
|
126 |
* @see org.gvsig.remoteClient.kml.warnings.IWarningsContainer#setWarningList(org.gvsig.exceptions.ListBaseException)
|
127 |
*/
|
128 |
public void setWarningList(ListBaseException war) { |
129 |
int i=0; |
130 |
BaseException info; |
131 |
while(i < war.size()){
|
132 |
info = this.getElement(i,war);
|
133 |
if (info != null) |
134 |
{ |
135 |
this.setElement(info);
|
136 |
} |
137 |
i++; |
138 |
} |
139 |
} |
140 |
} |