OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 139 Rev 153
Line 107... Line 107...
107
                @Override
107
                @Override
108
                public void actionPerformed(ActionEvent e) {
108
                public void actionPerformed(ActionEvent e) {
109
                    JComboBox cb = (JComboBox) e.getSource();
109
                    JComboBox cb = (JComboBox) e.getSource();
110
                    int type = cb.getSelectedIndex();
110
                    int type = cb.getSelectedIndex();
111
                    if (type == 0) {
111
                    if (type == 0) {
-
 
112
                        // Saisie
112
                        comboActionChoice.setModel(new DefaultComboBoxModel(componentIds));
113
                        comboActionChoice.setModel(new DefaultComboBoxModel(componentIds));
113
 
114
 
114
                        MenuDescriptor desc = extension.getCreateMenuItemFromId(item.getId());
115
                        MenuDescriptor desc = extension.getCreateMenuItemFromId(item.getId());
115
                        desc.setType(MenuDescriptor.CREATE);
116
                        desc.setType(MenuDescriptor.CREATE);
116
                        desc.setListId(null);
117
                        desc.setListId(null);
Line 120... Line 121...
120
                        } else {
121
                        } else {
121
                            desc.setComponentId(null);
122
                            desc.setComponentId(null);
122
                        }
123
                        }
123
                        extension.setChanged();
124
                        extension.setChanged();
124
                    } else {
125
                    } else {
-
 
126
                        // Liste
125
                        comboActionChoice.setModel(new DefaultComboBoxModel(listIds));
127
                        comboActionChoice.setModel(new DefaultComboBoxModel(listIds));
126
                        MenuDescriptor desc = extension.getCreateMenuItemFromId(item.getId());
128
                        MenuDescriptor desc = extension.getCreateMenuItemFromId(item.getId());
127
                        desc.setType(MenuDescriptor.LIST);
129
                        desc.setType(MenuDescriptor.LIST);
128
                        if (listIds.size() > 0) {
130
                        if (listIds.size() > 0) {
129
                            comboActionChoice.setSelectedIndex(0);
131
                            comboActionChoice.setSelectedIndex(0);
Line 140... Line 142...
140
            comboActionChoice.addActionListener(new ActionListener() {
142
            comboActionChoice.addActionListener(new ActionListener() {
141
 
143
 
142
                @Override
144
                @Override
143
                public void actionPerformed(ActionEvent e) {
145
                public void actionPerformed(ActionEvent e) {
144
                    MenuDescriptor desc = extension.getCreateMenuItemFromId(item.getId());
146
                    MenuDescriptor desc = extension.getCreateMenuItemFromId(item.getId());
145
                    if (desc.getType() == MenuDescriptor.CREATE) {
147
                    if (desc.getType().equals(MenuDescriptor.CREATE)) {
146
                        desc.setComponentId(comboActionChoice.getSelectedItem().toString());
148
                        desc.setComponentId(comboActionChoice.getSelectedItem().toString());
147
                    } else if (desc.getType() == MenuDescriptor.LIST) {
149
                    } else if (desc.getType().equals(MenuDescriptor.LIST)) {
148
                        desc.setListId(comboActionChoice.getSelectedItem().toString());
150
                        desc.setListId(comboActionChoice.getSelectedItem().toString());
149
                    } else {
151
                    } else {
150
                        desc.setComponentId(null);
152
                        desc.setComponentId(null);
151
                        desc.setListId(null);
153
                        desc.setListId(null);
152
                    }
154
                    }
Line 219... Line 221...
219
                }
221
                }
220
 
222
 
221
                Collections.sort(componentIds);
223
                Collections.sort(componentIds);
222
 
224
 
223
                final List<ListDescriptor> listDescList = extension.getCreateListList();
225
                final List<ListDescriptor> listDescList = extension.getCreateListList();
224
                listIds = new Vector<String>(listDescList.size());
226
                listIds = new Vector<>(listDescList.size());
225
                for (ListDescriptor listDescritor : listDescList) {
227
                for (ListDescriptor listDescritor : listDescList) {
226
                    final String id = listDescritor.getId();
228
                    final String id = listDescritor.getId();
227
                    if (id != null) {
229
                    if (id != null) {
228
                        listIds.add(id);
230
                        listIds.add(id);
229
                    }
231
                    }