Statistics
| Revision:

gvsig-tools / 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 / base / BaseJDynFormSet.java @ 2552

History | View | Annotate | Download (23.6 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License as published by the Free Software
8
 * Foundation; either version 3 of the License, or (at your option) any later
9
 * version.
10
 *
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14
 * details.
15
 *
16
 * You should have received a copy of the GNU General Public License along with
17
 * this program; if not, write to the Free Software Foundation, Inc., 51
18
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.tools.dynform.services.dynformset.base;
24

    
25
import java.awt.BorderLayout;
26
import java.awt.Color;
27
import java.awt.Component;
28
import java.awt.event.MouseAdapter;
29
import java.awt.event.MouseEvent;
30
import java.util.ArrayList;
31
import java.util.Iterator;
32
import java.util.List;
33
import javax.swing.Action;
34
import javax.swing.BorderFactory;
35
import javax.swing.BoxLayout;
36

    
37
import javax.swing.JComponent;
38
import javax.swing.JLabel;
39
import javax.swing.JOptionPane;
40
import javax.swing.JPanel;
41
import org.gvsig.tools.ToolsLocator;
42

    
43
import org.gvsig.tools.dynform.AbortActionException;
44
import org.gvsig.tools.dynform.DynFormDefinition;
45
import org.gvsig.tools.dynform.JDynForm;
46
import org.gvsig.tools.dynform.JDynForm.JDynFormListener;
47
import org.gvsig.tools.dynform.JDynFormField;
48
import org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.FormSetListener;
49
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_CANCEL_NEW;
50
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_CLOSE;
51
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_DELETE;
52
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_FIRST;
53
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_LAST;
54
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_NEW;
55
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_NEXT;
56
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_PREVIOUS;
57
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_SAVE;
58
import static org.gvsig.tools.dynform.services.dynformset.base.FormSetButtonBar.ID_ACTION_SEARCH;
59
import org.gvsig.tools.dynform.spi.dynformset.AbstractJDynFormSet;
60
import org.gvsig.tools.dynform.spi.dynformset.ActionStore;
61
import org.gvsig.tools.dynform.spi.DynFormSPIManager;
62
import org.gvsig.tools.dynform.spi.dynformset.JDynFormSetFactory;
63
import org.gvsig.tools.dynobject.DynObject;
64
import org.gvsig.tools.dynobject.DynObjectSet;
65
import org.gvsig.tools.dynobject.Tags;
66
import org.gvsig.tools.exception.BaseException;
67
import org.gvsig.tools.visitor.VisitCanceledException;
68
import org.gvsig.tools.visitor.Visitor;
69

    
70
@SuppressWarnings("UseSpecificCatch")
71
public class BaseJDynFormSet extends AbstractJDynFormSet implements FormSetListener, JDynFormListener {
72

    
73
    private JLabel jlabel_messages = null;
74
    private JDynForm form = null;
75
    private FormSetButtonBar buttonBar = null;
76
    private int current = 0;
77

    
78
    public BaseJDynFormSet(
79
            DynFormSPIManager manager, 
80
            JDynFormSetFactory factory,
81
            JDynForm.DynFormContext context,
82
            DynFormDefinition definition,
83
            Tags contextTags
84
        ) {
85
        super(manager, factory,context, definition, contextTags);
86
    }
87

    
88
    @Override
89
    public JComponent asJComponent() {
90
        if (this.contents == null) {
91
            this.initComponents();
92
            if (this.buttonBar != null) {
93
                this.buttonBar.setReadOnly(this.isReadOnly());
94
            }
95
            if (this.form != null) {
96
                this.form.setReadOnly(this.isReadOnly());
97
            }
98
        }
99
        this.fireFormMovedToEvent(current);
100
        return this.contents;
101
    }
102
    
103
    public JDynForm getForm() {
104
        return this.form;
105
    }
106

    
107
    public JLabel getMessagesJLabel() {
108
        if (this.jlabel_messages == null) {
109
            this.jlabel_messages = new JLabel();
110
//                        this.jlabel_messages.setBorder( BorderFactory.createLoweredBevelBorder());
111
            this.jlabel_messages.setText(" ");
112
            this.jlabel_messages.addMouseListener(new MouseAdapter() {
113
                @Override
114
                public void mouseClicked(MouseEvent evt) {
115
                    int count = evt.getClickCount();
116
                    if (count == 2) {
117
                        JOptionPane.showMessageDialog(contents, jlabel_messages.getText(), "Status", JOptionPane.INFORMATION_MESSAGE);
118
                    }
119
                }
120
            });
121
        }
122
        return this.jlabel_messages;
123
    }
124

    
125
    @Override
126
    public void message() {
127
        this.getMessagesJLabel().setText(" ");
128
    }
129

    
130
    @Override
131
    public void message(String msg) {
132
        this.getMessagesJLabel().setText(msg);
133
    }
134

    
135
    private FormSetButtonBar getButtonBar() {
136
        if (this.buttonBar == null) {
137
            initComponents();
138
        }
139
        return this.buttonBar;
140
    }
141

    
142
    private void initComponents() {
143
        this.contents = new JPanel();
144
        this.contents.setBorder(BorderFactory.createLineBorder(Color.GRAY));
145
        this.contents.setLayout(new BorderLayout());
146

    
147
        this.form = this.getManager().getDynFormManager().createJDynForm(this.getContext(), this.getDefinition());
148
        this.form.setReadOnly(this.isReadOnly());
149
        this.form.setLayoutMode(this.getLayoutMode());
150
        this.form.setUseScrollBars(this.getUseScrollBars());
151
        this.form.addListener(this);
152

    
153
        if (!actionsBuffer.isEmpty()) {
154
            for (ActionStore actStore : actionsBuffer) {
155
                if (actStore.isSeparator()) {
156
                    form.addSeparatorToPopupMenu(
157
                            actStore.getDataType());
158
                } else {
159
                    form.addActionToPopupMenu(
160
                            actStore.getDataType(),
161
                            actStore.getActionName(),
162
                            actStore.getAction());
163
                }
164
            }
165
        }
166
        if (this.getUseScrollBars()) {
167
            if (this.formHeight > -1 && this.formWidth > -1) {
168
                this.setFormSize(this.formWidth, this.formHeight);
169
            }
170
        }
171
        this.form.setShowMessageStatus(false);
172
        //this.form.setLayoutMode(this.layoutMode);
173
        this.form.addListener(this);
174

    
175
        this.buttonBar = new FormSetButtonBar();
176
        this.buttonBar.addListener(this);
177
        this.buttonBar.setActionActive(ID_ACTION_DELETE, this.allowDelete());
178
        this.buttonBar.setActionActive(ID_ACTION_NEW, this.allowNew());
179
        this.buttonBar.setActionActive(ID_ACTION_CANCEL_NEW, this.allowNew());
180
        this.buttonBar.setActionActive(ID_ACTION_SAVE, this.allowUpdate());
181
        this.buttonBar.setActionActive(ID_ACTION_SEARCH, this.allowSearch());
182
        this.buttonBar.setActionActive(ID_ACTION_CLOSE, this.allowClose());
183
        this.buttonBar.setVisible(ID_ACTION_CANCEL_NEW, false);
184
        this.buttonBar.setReadOnly(this.isReadOnly());
185
        this.contents.add(this.form.asJComponent(), BorderLayout.CENTER);
186
        
187
        JPanel p = new JPanel();
188
        p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
189
        this.buttonBar.asJComponent().setAlignmentX(Component.LEFT_ALIGNMENT);
190
        this.getMessagesJLabel().setAlignmentX(Component.LEFT_ALIGNMENT);
191
        p.add(this.buttonBar.asJComponent());
192
        p.add(this.getMessagesJLabel());
193
        this.contents.add(p, BorderLayout.SOUTH);
194
        
195
        doChangeValues();
196
    }
197

    
198
    @Override
199
    public void setAllowDelete(boolean allowDelete) {
200
        super.setAllowDelete(allowDelete);
201
        if( this.buttonBar!=null ) {
202
            this.buttonBar.setActionActive(ID_ACTION_DELETE, this.allowDelete());
203
        }
204
    }
205

    
206
    @Override
207
    public void setAllowNew(boolean allowNew) {
208
        super.setAllowNew(allowNew);
209
        if( this.buttonBar!=null ) {
210
            this.buttonBar.setActionActive(ID_ACTION_NEW, this.allowNew());
211
        }
212
    }
213
    
214
    private void doChangeValues() {
215
        this.current = 0;
216
        if (this.values == null || this.values.isEmpty()) {
217
            this.form.setReadOnly(true);
218
            this.getButtonBar().setEnabled(ID_ACTION_DELETE, false);
219
            this.getButtonBar().setEnabled(ID_ACTION_SAVE, false);
220
            this.getButtonBar().setEnabled(ID_ACTION_NEW,
221
                    this.allowNew() && !this.isReadOnly());
222
            this.getButtonBar().setNumrecords(0);
223
            this.form.clear();
224
        } else {
225
            this.form.setValues((DynObject) this.values.get(this.current));
226
            this.getButtonBar().setEnabled(ID_ACTION_DELETE,
227
                    this.allowDelete() && !this.isReadOnly());
228
            this.getButtonBar().setEnabled(ID_ACTION_SAVE,
229
                    this.allowUpdate() && !this.isReadOnly());
230
            this.getButtonBar().setNumrecords(this.values.size());
231
        }
232
        this.getButtonBar().setCurrent(this.current);
233
    }
234

    
235
    @Override
236
    public void setValues(List values) {
237
        super.setValues(values);
238
        if (this.contents != null) {
239
            doChangeValues();
240
        }
241
    }
242

    
243
    @Override
244
    public void setValues(DynObjectSet values) {
245
        super.setValues(values);
246
        if (this.contents != null) {
247
            doChangeValues();
248
        }
249
    }
250

    
251
    @Override
252
    public void setReadOnly(boolean readOnly) {
253
//        if( this.isReadOnly() == readOnly ) {
254
//            return;
255
//        }
256
        super.setReadOnly(readOnly);
257
        if (this.buttonBar != null) {
258
            this.buttonBar.setReadOnly(readOnly);
259
        }
260
        if (this.form != null) {
261
            this.form.setReadOnly(readOnly);
262
        }
263
    }
264

    
265
    @Override
266
    public boolean doActionFirst() {
267
        if (this.values.isEmpty()) {
268
            return false;
269
        }
270

    
271
        if (autosave) {
272
            if (this.form.isModified() || this.isInNewState() ) {
273
                if (!doActionSave()) {
274
                    return false;
275
                }
276
            }
277
        }
278
        this.current = 0;
279
        this.form.setValues((DynObject) this.values.get(this.current));
280
        this.buttonBar.setCurrent(this.current);
281
        try {
282
            this.getButtonBar().setEnabled(ID_ACTION_DELETE,
283
                    this.allowDelete() && !this.isReadOnly());
284
            this.getButtonBar().setEnabled(ID_ACTION_SAVE,
285
                    this.allowUpdate() && !this.isReadOnly());
286
        } catch (Exception ex) {
287
            LOGGER.warn("Can't enable/disable delete and save buttons",ex);
288
        }
289
        this.fireFormMovedToEvent(this.current);
290
        return true;
291
    }
292

    
293
    @Override
294
    public boolean doActionPrevious() {
295
        if (this.values.isEmpty()) {
296
            return false;
297
        }
298

    
299
        if (autosave) {
300
            if (this.form.isModified() || this.isInNewState() ) {
301
                if (!doActionSave()) {
302
                    return false;
303
                }
304
            }
305
        }
306
        if (this.current > 0) {
307
            this.current--;
308
        }
309
        this.form.setValues((DynObject) this.values.get(this.current));
310
        this.buttonBar.setCurrent(this.current);
311
        this.fireFormMovedToEvent(this.current);
312
        return true;
313
    }
314

    
315
    @Override
316
    public boolean doActionNext() {
317
        if (this.values.isEmpty()) {
318
            return false;
319
        }
320

    
321
        if (autosave) {
322
            if (this.form.isModified() || this.isInNewState() ) {
323
                if (!doActionSave()) {
324
                    return false;
325
                }
326
            }
327
        }
328
        if (this.current < this.values.size() - 1) {
329
            this.current++;
330
        }
331
        this.form.setValues((DynObject) this.values.get(this.current));
332
        this.buttonBar.setCurrent(this.current);
333
        this.fireFormMovedToEvent(this.current);
334
        return true;
335
    }
336

    
337
    @Override
338
    public boolean doActionLast() {
339
        if (this.values.isEmpty()) {
340
            return false;
341
        }
342

    
343
        if (autosave) {
344
            if (this.form.isModified() || this.isInNewState() ) {
345
                if (!doActionSave()) {
346
                    return false;
347
                }
348
            }
349
        }
350
        this.current = this.values.size() - 1;
351
        this.form.setValues((DynObject) this.values.get(this.current));
352
        this.buttonBar.setCurrent(this.current);
353
        this.fireFormMovedToEvent(this.current);
354
        return true;
355
    }
356

    
357
    @Override
358
    public boolean doActionSave() {
359
        if ( !this.isInNewState() && this.values.isEmpty()) {
360
            return false;
361
        }
362
        try {
363
            this.listeners.accept(new Visitor() {
364
                @Override
365
                public void visit(Object listener) throws VisitCanceledException, BaseException {
366
                    ((JDynFormSetListener) listener).formBeforeSave(BaseJDynFormSet.this);
367
                }
368
            });
369
        } catch (AbortActionException e) {
370
            return false;
371
        } catch (BaseException e) {
372
            LOGGER.warn("Can't notify to listeners before save.",e);
373
            return false;
374
        }
375

    
376
        List<String> fieldsName = new ArrayList<>();
377
        if (!this.form.hasValidValues(fieldsName)) {
378
            String errores = "";
379
            Iterator<String> it = fieldsName.iterator();
380
            while (it.hasNext()) {
381
                String name = (String) it.next();
382
                errores = errores + "     - " + name + "\n";
383
            }
384
            int r = confirmDialog(
385
                    "There are incorrect data in the following fields:\n" + errores + "\nContinuing the incorrect values โ€‹will not be saved. Do you want to continue?", "warning",
386
                    JOptionPane.WARNING_MESSAGE,
387
                    JOptionPane.YES_NO_OPTION);
388
            if (r != JOptionPane.YES_OPTION) {
389
                return false;
390
            }
391
        }
392
        if( !this.isInNewState() ) {
393
            if (this.current >= 0 && this.current < this.values.size()) {
394
                this.form.getValues((DynObject) this.values.get(this.current));
395
            } else {
396
                LOGGER.warn("current out of range.");
397
            }
398
        }
399
        
400
        this.leaveTheNewState();
401
        
402
        try {
403
            this.listeners.accept(new Visitor() {
404
                @Override
405
                public void visit(Object listener) throws VisitCanceledException, BaseException {
406
                    ((JDynFormSetListener) listener).formAfterSave(BaseJDynFormSet.this);
407
                }
408
            });
409
        } catch (AbortActionException e) {
410
            return false;
411
        } catch (BaseException e) {
412
            LOGGER.warn("Can't notify to listeners after save.",e);
413
            return false;
414
        }
415
        return true;
416
    }
417

    
418
    @Override
419
    public boolean doActionNew() {
420
        try {
421
            this.listeners.accept(new Visitor() {
422
                @Override
423
                public void visit(Object listener) throws VisitCanceledException, BaseException {
424
                    ((JDynFormSetListener) listener).formBeforeNew(BaseJDynFormSet.this);
425
                }
426
            });
427
        } catch (BaseException e) {
428
            return true;
429
        }
430
        this.enterStateNew();
431
        try {
432
            this.listeners.accept(new Visitor() {
433
                @Override
434
                public void visit(Object listener) throws VisitCanceledException, BaseException {
435
                    ((JDynFormSetListener) listener).formAfterNew(BaseJDynFormSet.this);
436
                }
437
            });
438
        } catch (BaseException e) {
439
            return true;
440
        }
441
        return true;
442
    }
443

    
444
    @Override
445
    public boolean doActionCancelNew() {
446
        try {
447
            this.listeners.accept(new Visitor() {
448
                @Override
449
                public void visit(Object listener) throws VisitCanceledException, BaseException {
450
                    ((JDynFormSetListener) listener).formBeforeCancelNew(BaseJDynFormSet.this);
451
                }
452
            });
453
        } catch (BaseException e) {
454
            return true;
455
        }
456
        this.leaveTheNewState();
457
        try {
458
            this.listeners.accept(new Visitor() {
459
                @Override
460
                public void visit(Object listener) throws VisitCanceledException, BaseException {
461
                    ((JDynFormSetListener) listener).formAfterCancelNew(BaseJDynFormSet.this);
462
                }
463
            });
464
        } catch (BaseException e) {
465
            return true;
466
        }
467
        return true;
468
    }
469

    
470
    @Override
471
    protected void enterStateNew() {
472
        if( this.isInNewState() ) {
473
            return;
474
        }
475
        try {
476
            FormSetButtonBar bar = this.getButtonBar();
477
            super.enterStateNew();
478
            bar.setCurrentLabel(ToolsLocator.getI18nManager().getTranslation("nuevo"));
479
            bar.setNumrecords(this.countValues());
480

    
481
            bar.setVisible(ID_ACTION_CANCEL_NEW, true);
482
            bar.setVisible(ID_ACTION_NEW, false);
483
            
484
            bar.setEnabled(ID_ACTION_SAVE,true);
485
            bar.setEnabled(ID_ACTION_CANCEL_NEW,true);
486
            bar.setEnabled(ID_ACTION_DELETE,false);
487
            bar.setEnabled(ID_ACTION_FIRST,false);
488
            bar.setEnabled(ID_ACTION_NEXT,false);
489
            bar.setEnabled(ID_ACTION_PREVIOUS,false);
490
            bar.setEnabled(ID_ACTION_LAST,false);
491
            bar.setEnabled(ID_ACTION_SEARCH,false);
492
        } catch (Exception ex) {
493
            LOGGER.warn("Can't enable/disable delete and save buttons",ex);
494
        }
495
    }
496

    
497
    @Override
498
    protected void leaveTheNewState() {
499
        if( !(this.isInNewState()) ) {
500
            return;
501
        }
502
        super.leaveTheNewState();
503
        try {
504
            FormSetButtonBar bar = this.getButtonBar();
505

    
506
            bar.setVisible(ID_ACTION_CANCEL_NEW, false);
507
            bar.setVisible(ID_ACTION_NEW, true);
508
            
509
            bar.setEnabled(ID_ACTION_SAVE,true);
510
            bar.setEnabled(ID_ACTION_NEW,true);
511
            bar.setEnabled(ID_ACTION_DELETE,true);
512
            bar.setEnabled(ID_ACTION_SEARCH,true);
513

    
514
            bar.setCurrentLabel(null);
515
            bar.setNumrecords(this.countValues());
516
            bar.setCurrent(this.current);
517
        } catch (Exception ex) {
518
            LOGGER.warn("Can't enable/disable delete and save buttons",ex);
519
        }
520
    }
521
    
522
    @Override
523
    public boolean doActionDelete() {
524
        if (this.values.isEmpty()) {
525
            return false;
526
        }
527

    
528
        if (this.countValues() < 1) {
529
            return true;
530
        }
531
        try {
532
            this.listeners.accept(new Visitor() {
533
                @Override
534
                public void visit(Object listener) throws VisitCanceledException, BaseException {
535
                    ((JDynFormSetListener) listener).formBeforeDelete(BaseJDynFormSet.this);
536
                }
537
            });
538
        } catch (BaseException e) {
539
            return true;
540
        }
541

    
542
        if (this.current >= countValues()) {
543
            this.current = countValues() - 1;
544
        }
545
        if (this.current > -1) {
546
            this.form.setValues((DynObject) this.values.get(this.current));
547
        }
548
        this.buttonBar.setNumrecords(this.countValues());
549
        this.buttonBar.setCurrent(this.current);
550

    
551
        try {
552
            this.listeners.accept(new Visitor() {
553
                @Override
554
                public void visit(Object listener) throws VisitCanceledException, BaseException {
555
                    ((JDynFormSetListener) listener).formAfterDelete(BaseJDynFormSet.this);
556
                }
557
            });
558
        } catch (BaseException e) {
559
            return true;
560
        }
561
        return true;
562
    }
563

    
564
    @Override
565
    public boolean doActionSearch() {
566
        if (this.values.isEmpty()) {
567
            return false;
568
        }
569

    
570
        try {
571
            this.listeners.accept(new Visitor() {
572
                @Override
573
                public void visit(Object listener) throws VisitCanceledException, BaseException {
574
                    ((JDynFormSetListener) listener).formBeforeSearch(BaseJDynFormSet.this);
575
                }
576
            });
577
        } catch (BaseException e) {
578
            return true;
579
        }
580
        // Do search
581
        try {
582
            this.listeners.accept(new Visitor() {
583
                @Override
584
                public void visit(Object listener) throws VisitCanceledException, BaseException {
585
                    ((JDynFormSetListener) listener).formAfterSearch(BaseJDynFormSet.this);
586
                }
587
            });
588
        } catch (BaseException e) {
589
            return true;
590
        }
591
        return true;
592
    }
593

    
594
    @Override
595
    public boolean doActionClose() {
596
        fireCloseEvent();
597
        return true;
598
    }
599

    
600
    @Override
601
    public void doSetCurrentRecord(int index) {
602
        this.setCurrentIndex(index);
603
    }
604
    
605
    @Override
606
    public void setFormSize(int width, int height) {
607
        super.setFormSize(width, height);
608
        if (this.form != null) {
609
            this.form.setFormSize(width, height);
610
        }
611
    }
612

    
613
    @Override
614
    public int getCurrentIndex() {
615
        return this.current;
616
    }
617

    
618
    @Override
619
    public void setCurrentIndex(int index) {
620
        if (index < 0 || index > countValues()) {
621
            throw new IllegalArgumentException("Index (" + index + ") out of range [0.." + countValues() + "].");
622
        }
623
        // Don't call doActionSave, crash with stack overflow
624
        this.current = index;
625
        this.form.setValues((DynObject) this.values.get(this.current));
626
        this.buttonBar.setCurrent(this.current);
627
        this.fireFormMovedToEvent(this.current);
628
    }
629

    
630
    @Override
631
    public void fieldChanged(JDynFormField field) {
632
        LOGGER.debug("Ha cambiado el field: " + field.getName() + " con el valor => " + field.getValue());
633
    }
634

    
635
    @Override
636
    public DynObject get(int position) {
637
        LOGGER.debug("Recojo el field: " + position);
638
        return (DynObject) this.values.get(position);
639
    }
640

    
641
    @Override
642
    public List getValues() {
643
        if (this.current >= 0 && this.current < this.values.size()) {
644
            this.form.getValues((DynObject) this.values.get(this.current));
645
        }
646
        return this.values;
647
    }
648

    
649
    @Override
650
    public boolean hasValidValues() {
651
        return this.form.hasValidValues();
652
    }
653

    
654
    @Override
655
    public boolean hasValidValues(List<String> fieldsName) {
656
        return this.form.hasValidValues(fieldsName);
657
    }
658

    
659
    public void clear() {
660
        if (this.form != null) {
661
            this.form.clear();
662
        }
663
    }
664

    
665
    @Override
666
    public void getFormValues(DynObject values) {
667
        this.form.getValues(values);
668
    }
669

    
670
    @Override
671
    public void addAction(Action action) {
672
        this.getButtonBar().addAction(action);
673
    }
674

    
675
    @Override
676
    public void setActionVisible(String action, boolean visible) {
677
        this.getButtonBar().setVisible(action, visible);
678
    }
679

    
680
    @Override
681
    public void setActionEnabled(String action, boolean enabled) {
682
        this.getButtonBar().setEnabled(action, enabled);
683
    }
684

    
685
    @Override
686
    public boolean isActionEnabled(String action) {
687
        return this.getButtonBar().isEnabled(action);
688
    }
689

    
690
    @Override
691
    public boolean isActionVisible(String action) {
692
        return this.getButtonBar().isVisible(action);
693
    }
694

    
695
    @Override
696
    public JComponent getActionButton(String action) {
697
        return this.getButtonBar().getActionButton(action);
698
    }
699

    
700
    @Override
701
    public void fireEvent(String action, Object value) {
702
        this.getButtonBar().fireEvent(action, value);
703
    }
704

    
705
}