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 51... Line 51...
51
        this.add(createAllTableList(extension), c);
51
        this.add(createAllTableList(extension), c);
52
    }
52
    }
53
 
53
 
54
    private JComponent createModifiedTableList(final Extension extension) {
54
    private JComponent createModifiedTableList(final Extension extension) {
55
        final ModifiedTableListModel dataModel = new ModifiedTableListModel(extension);
55
        final ModifiedTableListModel dataModel = new ModifiedTableListModel(extension);
56
        listTableModified = new JList(dataModel);
56
        this.listTableModified = new JList(dataModel);
57
        listTableModified.addListSelectionListener(new ListSelectionListener() {
57
        this.listTableModified.addListSelectionListener(new ListSelectionListener() {
58
 
58
 
59
            @Override
59
            @Override
60
            public void valueChanged(ListSelectionEvent e) {
60
            public void valueChanged(ListSelectionEvent e) {
61
                if (!e.getValueIsAdjusting()) {
61
                if (!e.getValueIsAdjusting()) {
62
                    final TableDescritor tableDesc = (TableDescritor) listTableModified.getSelectedValue();
62
                    final TableDescritor tableDesc = (TableDescritor) TableModifyLeftPanel.this.listTableModified.getSelectedValue();
63
                    if (tableDesc != null) {
63
                    if (tableDesc != null) {
64
                        System.out.println("TableModifyLeftPanel.createModifiedTableList.valueChanged():" + tableDesc);
64
                        System.out.println("TableModifyLeftPanel.createModifiedTableList.valueChanged():" + tableDesc);
65
                        final TableModifyPanel p = new TableModifyPanel(extension.getSQLTable(tableDesc), tableDesc, extension, TableModifyLeftPanel.this);
65
                        final TableModifyPanel p = new TableModifyPanel(extension.getSQLTable(tableDesc), tableDesc, extension, TableModifyLeftPanel.this);
66
                        tableModifyMainPanel.setRightPanel(p);
66
                        TableModifyLeftPanel.this.tableModifyMainPanel.setRightPanel(p);
67
                        listTableAll.clearSelection();
67
                        TableModifyLeftPanel.this.listTableAll.clearSelection();
68
                    }
68
                    }
69
                }
69
                }
70
 
70
 
71
            }
71
            }
72
        });
72
        });
73
        final JScrollPane comp2 = new JScrollPane(listTableModified);
73
        final JScrollPane comp2 = new JScrollPane(this.listTableModified);
74
        comp2.setMinimumSize(new Dimension(250, 150));
74
        comp2.setMinimumSize(new Dimension(250, 150));
75
        comp2.setPreferredSize(new Dimension(250, 150));
75
        comp2.setPreferredSize(new Dimension(250, 150));
76
        return comp2;
76
        return comp2;
77
    }
77
    }
78
 
78
 
79
    private JComponent createAllTableList(final Extension extension) {
79
    private JComponent createAllTableList(final Extension extension) {
80
        final AllTableListModel dataModel = new AllTableListModel(extension);
80
        final AllTableListModel dataModel = new AllTableListModel(extension);
81
        listTableAll = new JList(dataModel);
81
        this.listTableAll = new JList(dataModel);
82
        listTableAll.addListSelectionListener(new ListSelectionListener() {
82
        this.listTableAll.addListSelectionListener(new ListSelectionListener() {
83
 
83
 
84
            @Override
84
            @Override
85
            public void valueChanged(ListSelectionEvent e) {
85
            public void valueChanged(ListSelectionEvent e) {
86
                if (!e.getValueIsAdjusting()) {
86
                if (!e.getValueIsAdjusting()) {
87
                    final SQLTable table = (SQLTable) listTableAll.getSelectedValue();
87
                    final SQLTable table = (SQLTable) TableModifyLeftPanel.this.listTableAll.getSelectedValue();
88
                    if (table != null) {
88
                    if (table != null) {
89
                        System.out.println("TableModifyLeftPanel.createAllTableList.valueChanged():" + table);
89
                        System.out.println("TableModifyLeftPanel.createAllTableList.valueChanged():" + table);
90
                        final TableModifyPanel p = new TableModifyPanel(table, extension.getOrCreateTableDescritor(table.getName()), extension, TableModifyLeftPanel.this);
90
                        final TableModifyPanel p = new TableModifyPanel(table, extension.getOrCreateTableDescritor(table.getName()), extension, TableModifyLeftPanel.this);
91
                        tableModifyMainPanel.setRightPanel(p);
91
                        TableModifyLeftPanel.this.tableModifyMainPanel.setRightPanel(p);
92
                        listTableModified.clearSelection();
92
                        TableModifyLeftPanel.this.listTableModified.clearSelection();
93
                    }
93
                    }
94
                }
94
                }
95
 
95
 
96
            }
96
            }
97
        });
97
        });
98
        listTableAll.setCellRenderer(new SQLTableListCellRenderer());
98
        this.listTableAll.setCellRenderer(new SQLTableListCellRenderer());
99
        final JScrollPane comp2 = new JScrollPane(listTableAll);
99
        final JScrollPane comp2 = new JScrollPane(this.listTableAll);
100
        comp2.setMinimumSize(new Dimension(150, 150));
100
        comp2.setMinimumSize(new Dimension(150, 150));
101
        comp2.setPreferredSize(new Dimension(150, 150));
101
        comp2.setPreferredSize(new Dimension(150, 150));
102
        return comp2;
102
        return comp2;
103
    }
103
    }
104
 
104
 
105
    public void selectTable(String tableName) {
105
    public void selectTable(String tableName) {
106
        System.out.println("TableModifyLeftPanel.selectTable():" + tableName);
106
        System.out.println("TableModifyLeftPanel.selectTable():" + tableName);
107
        if (tableName != null) {
107
        if (tableName != null) {
108
            TableDescritor tableDesc = extension.getOrCreateTableDescritor(tableName);
108
            TableDescritor tableDesc = this.extension.getOrCreateTableDescritor(tableName);
109
            final TableModifyPanel p = new TableModifyPanel(extension.getSQLTable(tableDesc), tableDesc, extension, TableModifyLeftPanel.this);
109
            final TableModifyPanel p = new TableModifyPanel(this.extension.getSQLTable(tableDesc), tableDesc, this.extension, TableModifyLeftPanel.this);
110
            tableModifyMainPanel.setRightPanel(p);
110
            this.tableModifyMainPanel.setRightPanel(p);
111
            listTableAll.clearSelection();
111
            this.listTableAll.clearSelection();
112
            listTableModified.clearSelection();
112
            this.listTableModified.clearSelection();
113
        }
113
        }
114
    }
114
    }
115
 
115
 
116
}
116
}