Revision 11247 trunk/libraries/libGPE/src/org/gvsig/gpe/writers/GPEWriterHandler.java
GPEWriterHandler.java | ||
---|---|---|
51 | 51 |
* |
52 | 52 |
* $Id$ |
53 | 53 |
* $Log$ |
54 |
* Revision 1.3 2007-04-14 16:06:13 jorpiell |
|
54 |
* Revision 1.4 2007-04-19 07:23:20 jorpiell |
|
55 |
* Add the add methods to teh contenhandler and change the register mode |
|
56 |
* |
|
57 |
* Revision 1.3 2007/04/14 16:06:13 jorpiell |
|
55 | 58 |
* The writer handler has been updated |
56 | 59 |
* |
57 | 60 |
* Revision 1.2 2007/04/13 13:14:55 jorpiell |
... | ... | |
73 | 76 |
*/ |
74 | 77 |
public abstract class GPEWriterHandler implements IGPEWriterHandler{ |
75 | 78 |
private String format = null; |
79 |
private String version = null; |
|
76 | 80 |
private String fileName = null; |
77 |
private File file = null;
|
|
81 |
private File outputFile = null;
|
|
78 | 82 |
private GPEErrorHandler errorHandler = null; |
79 | 83 |
|
80 |
public GPEWriterHandler(String format, GPEErrorHandler errorHandler){ |
|
81 |
this.format = format; |
|
82 |
this.errorHandler = errorHandler; |
|
84 |
public GPEWriterHandler(){ |
|
85 |
|
|
83 | 86 |
} |
84 | 87 |
|
85 | 88 |
/** |
89 |
* Gets the deafult writting version |
|
90 |
* @return |
|
91 |
*/ |
|
92 |
public abstract String getDefaultVersion(); |
|
93 |
|
|
94 |
/** |
|
95 |
* Gets the deafult format |
|
96 |
* @return |
|
97 |
*/ |
|
98 |
public abstract String getDefaultFormat(); |
|
99 |
|
|
100 |
/** |
|
101 |
* Creates the output file and |
|
102 |
* @return the file |
|
103 |
*/ |
|
104 |
public File getOutputFile() { |
|
105 |
if (outputFile == null){ |
|
106 |
if (fileName == null){ |
|
107 |
fileName = GPEDefaults.getProperty(GPEDefaults.DEFAULT_FILE_NAME); |
|
108 |
} |
|
109 |
//TODO If the file ends with the format... |
|
110 |
outputFile = new File(fileName + "." + getFormat().toLowerCase()); |
|
111 |
} |
|
112 |
return outputFile; |
|
113 |
} |
|
114 |
|
|
115 |
|
|
116 |
/** |
|
86 | 117 |
* @return the errorHandler |
87 | 118 |
*/ |
88 | 119 |
public GPEErrorHandler getErrorHandler() { |
89 | 120 |
return errorHandler; |
90 | 121 |
} |
91 | 122 |
|
123 |
/** |
|
124 |
* @param errorHandler the errorHandler to set |
|
125 |
*/ |
|
126 |
public void setErrorHandler(GPEErrorHandler errorHandler) { |
|
127 |
this.errorHandler = errorHandler; |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* @return the fileName |
|
132 |
*/ |
|
133 |
public String getFileName() { |
|
134 |
return fileName; |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* @param fileName the fileName to set |
|
139 |
*/ |
|
140 |
public void setFileName(String fileName) { |
|
141 |
this.fileName = fileName; |
|
142 |
} |
|
143 |
|
|
144 |
/** |
|
145 |
* @return the format |
|
146 |
*/ |
|
147 |
public String getFormat() { |
|
148 |
if (format == null){ |
|
149 |
return getDefaultFormat(); |
|
150 |
} |
|
151 |
return format; |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* @param format the format to set |
|
156 |
*/ |
|
157 |
public void setFormat(String format) { |
|
158 |
this.format = format; |
|
159 |
} |
|
160 |
|
|
161 |
/** |
|
162 |
* @return the version |
|
163 |
*/ |
|
164 |
public String getVersion() { |
|
165 |
if (version == null){ |
|
166 |
return getDefaultVersion(); |
|
167 |
} |
|
168 |
return version; |
|
169 |
} |
|
170 |
|
|
171 |
/** |
|
172 |
* @param version the version to set |
|
173 |
*/ |
|
174 |
public void setVersion(String version) { |
|
175 |
this.version = version; |
|
176 |
} |
|
177 |
|
|
92 | 178 |
public void close() { |
93 | 179 |
// TODO Auto-generated method stub |
94 | 180 |
|
... | ... | |
189 | 275 |
|
190 | 276 |
} |
191 | 277 |
|
192 |
/** |
|
193 |
* @return the file |
|
194 |
*/ |
|
195 |
public File getFile() { |
|
196 |
if (file == null){ |
|
197 |
if (fileName == null){ |
|
198 |
fileName = GPEDefaults.getProperty(GPEDefaults.DEFAULT_FILE_NAME); |
|
199 |
} |
|
200 |
file = new File(fileName + "." + getFormat().toLowerCase()); |
|
201 |
} |
|
202 |
return file; |
|
203 |
} |
|
204 | 278 |
|
205 |
/** |
|
206 |
* @return the format |
|
207 |
*/ |
|
208 |
public String getFormat() { |
|
209 |
return format; |
|
210 |
} |
|
211 |
|
|
212 | 279 |
public void endMuliPoint() { |
213 | 280 |
// TODO Auto-generated method stub |
214 | 281 |
|
... | ... | |
238 | 305 |
// TODO Auto-generated method stub |
239 | 306 |
|
240 | 307 |
} |
241 |
|
|
242 |
/** |
|
243 |
* @param file the file to set |
|
244 |
*/ |
|
245 |
public void setFileName(String fileName) { |
|
246 |
this.fileName = fileName; |
|
247 |
} |
|
248 |
|
|
249 | 308 |
} |
Also available in: Unified diff