OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 174 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 180
Line 82... Line 82...
82
import java.util.LinkedHashSet;
82
import java.util.LinkedHashSet;
83
import java.util.List;
83
import java.util.List;
84
import java.util.Map;
84
import java.util.Map;
85
import java.util.Map.Entry;
85
import java.util.Map.Entry;
86
import java.util.Set;
86
import java.util.Set;
-
 
87
import java.util.function.Supplier;
87
 
88
 
88
import javax.swing.JCheckBox;
89
import javax.swing.JCheckBox;
89
import javax.swing.JComponent;
90
import javax.swing.JComponent;
90
import javax.swing.JLabel;
91
import javax.swing.JLabel;
91
import javax.swing.JPanel;
92
import javax.swing.JPanel;
Line 427... Line 428...
427
        final Set<String> fieldsNames = new SQLFieldsSet(v.getFields()).getFieldsNames(getTable());
428
        final Set<String> fieldsNames = new SQLFieldsSet(v.getFields()).getFieldsNames(getTable());
428
        return this.getMode() == Mode.READ_ONLY || CollectionUtils.containsAny(this.getElement().getReadOnlyFields(), fieldsNames)
429
        return this.getMode() == Mode.READ_ONLY || CollectionUtils.containsAny(this.getElement().getReadOnlyFields(), fieldsNames)
429
                || (this.getMode() != Mode.INSERTION && CollectionUtils.containsAny(this.getElement().getInsertOnlyFields(), fieldsNames));
430
                || (this.getMode() != Mode.INSERTION && CollectionUtils.containsAny(this.getElement().getInsertOnlyFields(), fieldsNames));
430
    }
431
    }
431
 
432
 
-
 
433
    @Override
432
    protected final void inited() {
434
    protected final void inited() {
433
        super.inited();
435
        super.inited();
434
        if (!(this instanceof GroupSQLComponent)) {
436
        if (!(this instanceof GroupSQLComponent)) {
435
 
-
 
436
            for (final Entry<String, JComponent> e : this.getElement().getAdditionalFields().entrySet()) {
437
            for (final Entry<String, Supplier<? extends JComponent>> e : this.getElement().getAdditionalFields().entrySet()) {
437
                final SpecParser spec;
438
                final SpecParser spec;
438
                // FIXME Required à spécifier directement depuis le module
439
                // FIXME Required à spécifier directement depuis le module
439
                if (this.requiredNames != null && this.requiredNames.contains(e.getKey())) {
440
                if (this.requiredNames != null && this.requiredNames.contains(e.getKey())) {
440
                    spec = new SpecParser(REQ, true);
441
                    spec = new SpecParser(REQ, true);
441
                } else {
442
                } else {
442
                    spec = new SpecParser(null, true);
443
                    spec = new SpecParser(null, true);
443
                }
444
                }
444
                final JComponent comp = e.getValue();
445
                final Supplier<? extends JComponent> comp = e.getValue();
445
                if (comp == null)
446
                if (comp == null) {
446
                    // infer component
447
                    // infer component
447
                    this.addViewJComponent(e.getKey(), spec);
448
                    this.addViewJComponent(e.getKey(), spec);
448
                else
449
                } else {
-
 
450
                    // create component
449
                    this.addView(comp, e.getKey(), spec);
451
                    this.addView(comp.get(), e.getKey(), spec);
-
 
452
                }
450
            }
453
            }
451
        }
454
        }
452
        // assure that added views are consistent with our editable status
455
        // assure that added views are consistent with our editable status
453
        this.updateChildrenEditable();
456
        this.updateChildrenEditable();
454
        for (final SQLRowItemView v : this.getRequest().getViews()) {
457
        for (final SQLRowItemView v : this.getRequest().getViews()) {