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 |
|
142 |
ilm |
16 |
import org.openconcerto.sql.element.SQLElement;
|
182 |
ilm |
17 |
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode;
|
17 |
ilm |
18 |
import org.openconcerto.sql.request.ListSQLRequest;
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* A SQLTableModelSource directly tied to the database. Any changes to its lines are propagated to
|
|
|
22 |
* the database without any delay.
|
|
|
23 |
*
|
|
|
24 |
* @author Sylvain
|
|
|
25 |
*/
|
|
|
26 |
public class SQLTableModelSourceOnline extends SQLTableModelSource {
|
|
|
27 |
|
182 |
ilm |
28 |
private final KeepMode keepMode;
|
|
|
29 |
|
142 |
ilm |
30 |
public SQLTableModelSourceOnline(final ListSQLRequest req, final SQLElement elem) {
|
182 |
ilm |
31 |
this(req, elem, KeepMode.GRAPH);
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public SQLTableModelSourceOnline(final ListSQLRequest req, final SQLElement elem, final KeepMode keepMode) {
|
142 |
ilm |
35 |
super(req, elem);
|
182 |
ilm |
36 |
if (keepMode == null || keepMode == KeepMode.NONE)
|
|
|
37 |
throw new IllegalArgumentException("Invalid mode : " + keepMode);
|
|
|
38 |
this.keepMode = keepMode;
|
17 |
ilm |
39 |
}
|
|
|
40 |
|
|
|
41 |
public SQLTableModelSourceOnline(SQLTableModelSourceOnline src) {
|
|
|
42 |
super(src);
|
182 |
ilm |
43 |
this.keepMode = src.keepMode;
|
17 |
ilm |
44 |
}
|
|
|
45 |
|
|
|
46 |
@Override
|
182 |
ilm |
47 |
public final KeepMode getKeepMode() {
|
|
|
48 |
return this.keepMode;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
@Override
|
142 |
ilm |
52 |
protected boolean allowBiggerGraph() {
|
|
|
53 |
return true;
|
93 |
ilm |
54 |
}
|
|
|
55 |
|
|
|
56 |
@Override
|
17 |
ilm |
57 |
protected SQLTableModelLinesSourceOnline _createLinesSource(final ITableModel model) {
|
|
|
58 |
return new SQLTableModelLinesSourceOnline(this, model);
|
|
|
59 |
}
|
|
|
60 |
}
|