Revision 1098 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.dynform/org.gvsig.tools.dynform.services/src/main/java/org/gvsig/tools/dynform/services/dynformset/subform/SubformJDynFormSet.java
SubformJDynFormSet.java | ||
---|---|---|
146 | 146 |
this.buttonBar.setActionActive(FormSetButtonBar.ActionNew, this.allowNew()); |
147 | 147 |
this.buttonBar.setActionActive(FormSetButtonBar.ActionSave, this.allowUpdate()); |
148 | 148 |
this.buttonBar.setActionActive(FormSetButtonBar.ActionSearch, this.allowSearch()); |
149 |
|
|
149 |
this.buttonBar.setActionActive(FormSetButtonBar.ActionClose, this.allowClose()); |
|
150 |
|
|
150 | 151 |
this.contents.add(this.buttonBar.asJComponent(), BorderLayout.NORTH); |
151 | 152 |
this.contents.add(this.form.asJComponent(), BorderLayout.CENTER); |
152 | 153 |
this.contents.add(this.getMessagesJLabel(), BorderLayout.SOUTH); |
... | ... | |
158 | 159 |
|
159 | 160 |
private void doChangeValue() throws ServiceException { |
160 | 161 |
this.current = 0; |
161 |
this.form.setValues((DynObject) this.values.get(this.current)); |
|
162 |
|
|
162 |
if(!this.values.isEmpty()){ |
|
163 |
this.form.setValues((DynObject) this.values.get(this.current)); |
|
164 |
} |
|
165 |
|
|
163 | 166 |
this.getButtonBar().setNumrecords(this.values.size()); |
164 | 167 |
this.getButtonBar().setCurrent(this.current); |
165 | 168 |
} |
... | ... | |
196 | 199 |
|
197 | 200 |
public boolean doActionFirst() { |
198 | 201 |
if ( autosave ) { |
199 |
if ( !doActionSave() ) {
|
|
202 |
if ( !doActionSave()) { |
|
200 | 203 |
return false; |
201 | 204 |
} |
202 | 205 |
} |
... | ... | |
209 | 212 |
|
210 | 213 |
public boolean doActionPrevious() { |
211 | 214 |
if ( autosave ) { |
212 |
if ( !doActionSave() ) {
|
|
215 |
if ( !doActionSave()) { |
|
213 | 216 |
return false; |
214 | 217 |
} |
215 | 218 |
} |
... | ... | |
224 | 227 |
|
225 | 228 |
public boolean doActionNext() { |
226 | 229 |
if ( autosave ) { |
227 |
if ( !doActionSave() ) {
|
|
230 |
if ( !doActionSave()) { |
|
228 | 231 |
return false; |
229 | 232 |
} |
230 | 233 |
} |
... | ... | |
239 | 242 |
|
240 | 243 |
public boolean doActionLast() { |
241 | 244 |
if ( autosave ) { |
242 |
if ( !doActionSave() ) {
|
|
245 |
if ( !doActionSave()) { |
|
243 | 246 |
return false; |
244 | 247 |
} |
245 | 248 |
} |
... | ... | |
251 | 254 |
} |
252 | 255 |
|
253 | 256 |
public boolean doActionSave() { |
254 |
if ( !this.form.isModified() ) {
|
|
257 |
if ( !this.form.isModified()) { |
|
255 | 258 |
return true; |
256 | 259 |
} |
257 | 260 |
try { |
258 | 261 |
this.listeners.accept(new Visitor() { |
259 | 262 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
260 |
((JDynFormSetListener) listener).formBeforeSave(); |
|
263 |
((JDynFormSetListener) listener).formBeforeSave(SubformJDynFormSet.this);
|
|
261 | 264 |
} |
262 | 265 |
}); |
263 | 266 |
} catch (BaseException e) { |
... | ... | |
289 | 292 |
try { |
290 | 293 |
this.listeners.accept(new Visitor() { |
291 | 294 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
292 |
((JDynFormSetListener) listener).formAfterSave(); |
|
295 |
((JDynFormSetListener) listener).formAfterSave(SubformJDynFormSet.this);
|
|
293 | 296 |
} |
294 | 297 |
}); |
295 | 298 |
} catch (BaseException e) { |
... | ... | |
302 | 305 |
try { |
303 | 306 |
this.listeners.accept(new Visitor() { |
304 | 307 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
305 |
((JDynFormSetListener) listener).formBeforeNew(); |
|
308 |
((JDynFormSetListener) listener).formBeforeNew(SubformJDynFormSet.this);
|
|
306 | 309 |
} |
307 | 310 |
}); |
308 | 311 |
} catch (BaseException e) { |
309 | 312 |
return true; |
310 | 313 |
} |
311 |
// Do new Actions |
|
314 |
|
|
315 |
this.current = this.values.size()-1; |
|
316 |
this.form.setValues((DynObject) this.values.get(this.current)); |
|
317 |
this.buttonBar.setNumrecords(this.countValues()); |
|
318 |
this.buttonBar.setCurrent(this.current); |
|
319 |
|
|
312 | 320 |
try { |
313 | 321 |
this.listeners.accept(new Visitor() { |
314 | 322 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
315 |
((JDynFormSetListener) listener).formAfterNew(); |
|
323 |
((JDynFormSetListener) listener).formAfterNew(SubformJDynFormSet.this);
|
|
316 | 324 |
} |
317 | 325 |
}); |
318 | 326 |
} catch (BaseException e) { |
... | ... | |
322 | 330 |
} |
323 | 331 |
|
324 | 332 |
public boolean doActionDelete() { |
333 |
if(this.countValues()<1){ |
|
334 |
return true; |
|
335 |
} |
|
325 | 336 |
try { |
326 | 337 |
this.listeners.accept(new Visitor() { |
327 | 338 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
328 |
((JDynFormSetListener) listener).formBeforeDelete(); |
|
339 |
((JDynFormSetListener) listener).formBeforeDelete(SubformJDynFormSet.this);
|
|
329 | 340 |
} |
330 | 341 |
}); |
331 | 342 |
} catch (BaseException e) { |
332 | 343 |
return true; |
333 | 344 |
} |
334 |
// Do new Actions |
|
345 |
|
|
346 |
if (this.current >= countValues() ) { |
|
347 |
this.current = countValues()-1; |
|
348 |
} |
|
349 |
if(this.current > -1){ |
|
350 |
this.form.setValues((DynObject) this.values.get(this.current)); |
|
351 |
} |
|
352 |
this.buttonBar.setNumrecords(this.countValues()); |
|
353 |
this.buttonBar.setCurrent(this.current); |
|
354 |
|
|
335 | 355 |
try { |
336 | 356 |
this.listeners.accept(new Visitor() { |
337 | 357 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
338 |
((JDynFormSetListener) listener).formAfterDelete(); |
|
358 |
((JDynFormSetListener) listener).formAfterDelete(SubformJDynFormSet.this);
|
|
339 | 359 |
} |
340 | 360 |
}); |
341 | 361 |
} catch (BaseException e) { |
... | ... | |
348 | 368 |
try { |
349 | 369 |
this.listeners.accept(new Visitor() { |
350 | 370 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
351 |
((JDynFormSetListener) listener).formBeforeSearch(); |
|
371 |
((JDynFormSetListener) listener).formBeforeSearch(SubformJDynFormSet.this);
|
|
352 | 372 |
} |
353 | 373 |
}); |
354 | 374 |
} catch (BaseException e) { |
... | ... | |
358 | 378 |
try { |
359 | 379 |
this.listeners.accept(new Visitor() { |
360 | 380 |
public void visit(Object listener) throws VisitCanceledException, BaseException { |
361 |
((JDynFormSetListener) listener).formBeforeSearch(); |
|
381 |
((JDynFormSetListener) listener).formBeforeSearch(SubformJDynFormSet.this);
|
|
362 | 382 |
} |
363 | 383 |
}); |
364 | 384 |
} catch (BaseException e) { |
Also available in: Unified diff