OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 74 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
74 ilm 1
package org.openconcerto.modules.extensionbuilder.component;
2
 
3
import javax.swing.event.ChangeEvent;
4
import javax.swing.event.ChangeListener;
5
 
6
import org.openconcerto.modules.extensionbuilder.Extension;
7
import org.openconcerto.ui.DefaultListModel;
8
 
9
public class CreateComponentListModel extends DefaultListModel implements ChangeListener {
10
    private final Extension extension;
11
 
12
    CreateComponentListModel(Extension extension) {
13
        this.extension = extension;
14
        addContent(extension);
15
        extension.addChangeListener(this);
16
    }
17
 
18
    private void addContent(Extension extension) {
19
        this.addAll(extension.getCreateComponentList());
20
    }
21
 
22
    @Override
23
    public void stateChanged(ChangeEvent e) {
24
        this.clear();
181 ilm 25
        addContent(this.extension);
74 ilm 26
    }
27
 
28
    public void addComponentList() {
29
        final ComponentDescritor l = new ComponentDescritor("Interface de saisie " + (this.getSize() + 1));
30
        this.addElement(l);
181 ilm 31
        this.extension.addCreateComponent(l);
74 ilm 32
    }
33
 
34
}