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 20... Line 20...
20
    ExtensionMainListPanel(final ExtensionListPanel moduleListPanel) {
20
    ExtensionMainListPanel(final ExtensionListPanel moduleListPanel) {
21
        super(new ExtensionListModel(moduleListPanel), "Vos extensions", "Créer une extension");
21
        super(new ExtensionListModel(moduleListPanel), "Vos extensions", "Créer une extension");
22
        this.moduleListPanel = moduleListPanel;
22
        this.moduleListPanel = moduleListPanel;
23
        this.list.setFixedCellHeight(new JLabel("A").getPreferredSize().height + 8);
23
        this.list.setFixedCellHeight(new JLabel("A").getPreferredSize().height + 8);
24
        this.list.setCellRenderer(new DefaultListCellRenderer() {
24
        this.list.setCellRenderer(new DefaultListCellRenderer() {
-
 
25
            @Override
25
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
26
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
26
                final JLabel listCellRendererComponent = (JLabel) super.getListCellRendererComponent(list, ((Extension) value).getName(), index, isSelected, cellHasFocus);
27
                final JLabel listCellRendererComponent = (JLabel) super.getListCellRendererComponent(list, ((Extension) value).getName(), index, isSelected, cellHasFocus);
27
                Extension e = (Extension) value;
28
                Extension e = (Extension) value;
28
                if (e.isStarted()) {
29
                if (e.isStarted()) {
29
                    listCellRendererComponent.setIcon(new ImageIcon(ExtensionMainListPanel.this.getClass().getResource("started.png")));
30
                    listCellRendererComponent.setIcon(new ImageIcon(ExtensionMainListPanel.this.getClass().getResource("started.png")));
Line 33... Line 34...
33
 
34
 
34
        });
35
        });
35
    }
36
    }
36
 
37
 
37
    public void fill() {
38
    public void fill() {
38
        ((ExtensionListModel) dataModel).fill(this);
39
        ((ExtensionListModel) this.dataModel).fill(this);
39
 
40
 
40
    }
41
    }
41
 
42
 
42
    @Override
43
    @Override
43
    public void addNewItem() {
44
    public void addNewItem() {
44
        ((ExtensionListModel) dataModel).addNewModule();
45
        ((ExtensionListModel) this.dataModel).addNewModule();
45
    }
46
    }
46
 
47
 
47
    @Override
48
    @Override
48
    public void renameItem(Object item) {
49
    public void renameItem(Object item) {
49
        final Extension e = (Extension) item;
50
        final Extension e = (Extension) item;
Line 54... Line 55...
54
        }
55
        }
55
    }
56
    }
56
 
57
 
57
    @Override
58
    @Override
58
    public void removeItem(Object item) {
59
    public void removeItem(Object item) {
59
        ((ExtensionListModel) dataModel).removeElement(item);
60
        ((ExtensionListModel) this.dataModel).removeElement(item);
60
    }
61
    }
61
 
62
 
62
    @Override
63
    @Override
63
    public void itemSelected(Object item) {
64
    public void itemSelected(Object item) {
64
        if (item != null) {
65
        if (item != null) {
65
            final ExtensionInfoPanel p = new ExtensionInfoPanel((Extension) item, moduleListPanel);
66
            final ExtensionInfoPanel p = new ExtensionInfoPanel((Extension) item, this.moduleListPanel);
66
            moduleListPanel.setRightPanel(p);
67
            this.moduleListPanel.setRightPanel(p);
67
        } else {
68
        } else {
68
            moduleListPanel.setRightPanel(new JPanel());
69
            this.moduleListPanel.setRightPanel(new JPanel());
69
        }
70
        }
70
 
71
 
71
    }
72
    }
72
 
73
 
73
    public void modelChanged() {
74
    public void modelChanged() {
74
        list.invalidate();
75
        this.list.invalidate();
75
        list.repaint();
76
        this.list.repaint();
76
    }
77
    }
77
}
78
}