17 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
182 |
ilm |
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
17 |
ilm |
5 |
*
|
|
|
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
|
|
|
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.
|
|
|
10 |
*
|
|
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
package org.openconcerto.sql.view.list;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.sql.model.SQLTableEvent;
|
182 |
ilm |
17 |
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode;
|
93 |
ilm |
18 |
import org.openconcerto.utils.Value;
|
17 |
ilm |
19 |
|
|
|
20 |
import java.util.Collection;
|
|
|
21 |
|
|
|
22 |
final class UpdateOneRunnable extends AbstractUpdateOneRunnable {
|
|
|
23 |
private final SQLTableEvent evt;
|
|
|
24 |
|
|
|
25 |
public UpdateOneRunnable(ITableModel model, SQLTableEvent evt) {
|
73 |
ilm |
26 |
super(model, evt.getRow());
|
17 |
ilm |
27 |
this.evt = evt;
|
|
|
28 |
}
|
|
|
29 |
|
73 |
ilm |
30 |
@Override
|
17 |
ilm |
31 |
public void run() {
|
182 |
ilm |
32 |
final boolean isPrimaryTable = this.getTable() == this.getReq().getParent().getPrimaryTable();
|
|
|
33 |
if (this.getReq().getParent().getKeepMode() == KeepMode.GRAPH) {
|
|
|
34 |
if (isPrimaryTable) {
|
|
|
35 |
final Value<ListSQLLine> val = this.getReq().get(this.getID());
|
|
|
36 |
if (!val.hasValue())
|
|
|
37 |
return;
|
|
|
38 |
updateLines(this.getAffectedPaths(), val);
|
|
|
39 |
} else {
|
|
|
40 |
// eg CONTACT[3] has changed
|
|
|
41 |
updateLines(this.getAffectedPaths());
|
|
|
42 |
}
|
17 |
ilm |
43 |
} else {
|
182 |
ilm |
44 |
this.updateLines(this.getUpdateQ().getAffectedLines(this.getRow()), isPrimaryTable ? this.getID() : null);
|
17 |
ilm |
45 |
}
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
@Override
|
|
|
49 |
protected Collection<String> getModifedFields() {
|
|
|
50 |
return this.evt.getFieldNames();
|
|
|
51 |
}
|
|
|
52 |
}
|