Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
9 |
* language governing permissions and limitations under the License.
|
9 |
* language governing permissions and limitations under the License.
|
Line 12... |
Line 12... |
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.sql.view.list;
|
14 |
package org.openconcerto.sql.view.list;
|
15 |
|
15 |
|
16 |
import org.openconcerto.sql.TM;
|
16 |
import org.openconcerto.sql.TM;
|
- |
|
17 |
import org.openconcerto.sql.model.SQLField;
|
17 |
import org.openconcerto.sql.model.SQLRowValues;
|
18 |
import org.openconcerto.sql.model.SQLRowValues;
|
18 |
import org.openconcerto.sql.view.IListFrame;
|
19 |
import org.openconcerto.sql.view.IListFrame;
|
19 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
20 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
20 |
import org.openconcerto.ui.JComponentUtils;
|
21 |
import org.openconcerto.ui.JComponentUtils;
|
21 |
|
22 |
|
Line 128... |
Line 129... |
128 |
public void actionPerformed(ActionEvent event) {
|
129 |
public void actionPerformed(ActionEvent event) {
|
129 |
final TableCellEditor cellEditor = RowValuesTableControlPanel.this.table.getCellEditor();
|
130 |
final TableCellEditor cellEditor = RowValuesTableControlPanel.this.table.getCellEditor();
|
130 |
if (cellEditor != null) {
|
131 |
if (cellEditor != null) {
|
131 |
cellEditor.cancelCellEditing();
|
132 |
cellEditor.cancelCellEditing();
|
132 |
}
|
133 |
}
|
- |
|
134 |
SQLField validationField = RowValuesTableControlPanel.this.model.getValidationField();
|
- |
|
135 |
if (validationField != null) {
|
- |
|
136 |
boolean canDelete = true;
|
- |
|
137 |
for (int i : table.getSelectedRows()) {
|
- |
|
138 |
SQLRowValues rowVals = RowValuesTableControlPanel.this.model.getRowValuesAt(i);
|
- |
|
139 |
canDelete &= (!rowVals.contains(validationField.getName()) || rowVals.getObject(validationField.getName()) == null || !rowVals.getBoolean(validationField.getName()));
|
- |
|
140 |
}
|
- |
|
141 |
if (canDelete) {
|
- |
|
142 |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows());
|
- |
|
143 |
}
|
- |
|
144 |
// MAYBE show popup if can't delete
|
- |
|
145 |
} else {
|
133 |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows());
|
146 |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows());
|
- |
|
147 |
}
|
134 |
table.clearSelection();
|
148 |
table.clearSelection();
|
135 |
}
|
149 |
}
|
136 |
});
|
150 |
});
|
137 |
this.buttonSuppr.setEnabled(false);
|
151 |
this.buttonSuppr.setEnabled(false);
|
138 |
JComponentUtils.setMinimumWidth(this.buttonSuppr, 95);
|
152 |
JComponentUtils.setMinimumWidth(this.buttonSuppr, 95);
|