17 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
|
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
|
|
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.element.SQLElement;
|
20 |
ilm |
17 |
import org.openconcerto.sql.model.SQLRowValues;
|
17 |
ilm |
18 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* A SQLTableModelSource *not* directly tied to the database.
|
|
|
22 |
*
|
|
|
23 |
* @author Sylvain
|
|
|
24 |
*/
|
|
|
25 |
public class SQLTableModelSourceOffline extends SQLTableModelSource {
|
|
|
26 |
|
|
|
27 |
private final SQLRowValuesListFetcher fetcher;
|
|
|
28 |
private final SQLElement elem;
|
|
|
29 |
|
|
|
30 |
public SQLTableModelSourceOffline(final SQLRowValuesListFetcher fetcher, final SQLElement elem) {
|
|
|
31 |
super(fetcher.getGraph());
|
93 |
ilm |
32 |
this.fetcher = fetcher.toUnmodifiable();
|
17 |
ilm |
33 |
this.elem = elem;
|
|
|
34 |
if (!this.getPrimaryTable().equals(this.elem.getTable()))
|
|
|
35 |
throw new IllegalArgumentException("not the same table: " + this.getPrimaryTable() + " != " + this.elem);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
public final SQLRowValuesListFetcher getFetcher() {
|
|
|
39 |
return this.fetcher;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
public SQLElement getElem() {
|
|
|
43 |
return this.elem;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
@Override
|
93 |
ilm |
47 |
protected SQLTableModelSourceState createState() {
|
|
|
48 |
return new SQLTableModelSourceStateOffline(this.getAllColumns(), this.getFetcher());
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
@Override
|
17 |
ilm |
52 |
protected SQLTableModelLinesSourceOffline _createLinesSource(final ITableModel model) {
|
|
|
53 |
return new SQLTableModelLinesSourceOffline(this, model);
|
|
|
54 |
}
|
20 |
ilm |
55 |
|
|
|
56 |
@Override
|
|
|
57 |
public SQLRowValues getMaxGraph() {
|
|
|
58 |
return this.getFetcher().getGraph();
|
|
|
59 |
}
|
17 |
ilm |
60 |
}
|