OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 74 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 74 Rev 181
Line 15... Line 15...
15
    ExtensionListModel(ExtensionListPanel moduleListPanel) {
15
    ExtensionListModel(ExtensionListPanel moduleListPanel) {
16
        this.moduleListPanel = moduleListPanel;
16
        this.moduleListPanel = moduleListPanel;
17
    }
17
    }
18
 
18
 
19
    public void fill(final EditableListPanel list) {
19
    public void fill(final EditableListPanel list) {
20
        addAll(moduleListPanel.getExtensionBuilderModule().getExtensions());
20
        addAll(this.moduleListPanel.getExtensionBuilderModule().getExtensions());
21
        final int size = this.getSize();
21
        final int size = this.getSize();
22
        if (size > 0) {
22
        if (size > 0) {
23
            final Object firstElement = firstElement();
23
            final Object firstElement = firstElement();
24
            list.selectItem(firstElement);
24
            list.selectItem(firstElement);
25
        }
25
        }
Line 37... Line 37...
37
    }
37
    }
38
 
38
 
39
    @Override
39
    @Override
40
    public void addElement(Object obj) {
40
    public void addElement(Object obj) {
41
        final Extension e = (Extension) obj;
41
        final Extension e = (Extension) obj;
42
        moduleListPanel.getExtensionBuilderModule().add(e);
42
        this.moduleListPanel.getExtensionBuilderModule().add(e);
43
        e.addChangeListener(this);
43
        e.addChangeListener(this);
44
        super.addElement(obj);
44
        super.addElement(obj);
45
    }
45
    }
46
 
46
 
47
    @Override
47
    @Override
48
    public boolean removeElement(Object obj) {
48
    public boolean removeElement(Object obj) {
49
        final Extension extenstion = (Extension) obj;
49
        final Extension extenstion = (Extension) obj;
50
        final int answer = JOptionPane.showConfirmDialog(new JFrame(), "Voulez vous vraiment supprimer l'extension " + extenstion.getName() + " ?", "Suppression", JOptionPane.YES_NO_OPTION);
50
        final int answer = JOptionPane.showConfirmDialog(new JFrame(), "Voulez vous vraiment supprimer l'extension " + extenstion.getName() + " ?", "Suppression", JOptionPane.YES_NO_OPTION);
51
        if (answer == JOptionPane.OK_OPTION) {
51
        if (answer == JOptionPane.OK_OPTION) {
52
            moduleListPanel.getExtensionBuilderModule().remove(extenstion);
52
            this.moduleListPanel.getExtensionBuilderModule().remove(extenstion);
53
            extenstion.removeChangeListener(this);
53
            extenstion.removeChangeListener(this);
54
            return super.removeElement(obj);
54
            return super.removeElement(obj);
55
        }
55
        }
56
        return false;
56
        return false;
57
    }
57
    }
58
 
58
 
59
    @Override
59
    @Override
60
    public void stateChanged(ChangeEvent e) {
60
    public void stateChanged(ChangeEvent e) {
61
        moduleListPanel.modelChanged();
61
        this.moduleListPanel.modelChanged();
62
    }
62
    }
63
 
63
 
64
}
64
}