|
1 |
package com.iver.cit.gvsig.fmap.layers;
|
|
2 |
|
|
3 |
import java.util.BitSet;
|
|
4 |
|
|
5 |
import com.hardcode.gdbms.engine.data.DataSource;
|
|
6 |
import com.hardcode.gdbms.engine.data.DriverException;
|
|
7 |
import com.hardcode.gdbms.engine.data.FieldNameAccess;
|
|
8 |
import com.hardcode.gdbms.engine.data.ReadDriver;
|
|
9 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException;
|
|
10 |
import com.hardcode.gdbms.engine.values.Value;
|
|
11 |
|
|
12 |
|
|
13 |
public class SelectableDataSource implements DataSource{
|
|
14 |
|
|
15 |
private SelectionSupport selectionSupport = new SelectionSupport();
|
|
16 |
private DataSource dataSource;
|
|
17 |
|
|
18 |
/**
|
|
19 |
* @param ds
|
|
20 |
*/
|
|
21 |
public SelectableDataSource(DataSource ds) {
|
|
22 |
dataSource = ds;
|
|
23 |
}
|
|
24 |
|
|
25 |
/**
|
|
26 |
* @param selectionSupport
|
|
27 |
*/
|
|
28 |
public void setSelectionSupport(SelectionSupport selectionSupport) {
|
|
29 |
this.selectionSupport = selectionSupport;
|
|
30 |
}
|
|
31 |
|
|
32 |
public String getDBMS() {
|
|
33 |
return dataSource.getDBMS();
|
|
34 |
}
|
|
35 |
public ReadDriver getDriver() {
|
|
36 |
return dataSource.getDriver();
|
|
37 |
}
|
|
38 |
public int getFieldCount() throws DriverException {
|
|
39 |
return dataSource.getFieldCount();
|
|
40 |
}
|
|
41 |
public int getFieldIndexByName(String arg0) throws DriverException,
|
|
42 |
FieldNotFoundException {
|
|
43 |
return dataSource.getFieldIndexByName(arg0);
|
|
44 |
}
|
|
45 |
public String getFieldName(int arg0) throws DriverException {
|
|
46 |
return dataSource.getFieldName(arg0);
|
|
47 |
}
|
|
48 |
public Value getFieldValue(long arg0, int arg1) throws DriverException {
|
|
49 |
return dataSource.getFieldValue(arg0, arg1);
|
|
50 |
}
|
|
51 |
public String getName() {
|
|
52 |
return dataSource.getName();
|
|
53 |
}
|
|
54 |
public long getRowCount() throws DriverException {
|
|
55 |
return dataSource.getRowCount();
|
|
56 |
}
|
|
57 |
public void start() throws DriverException {
|
|
58 |
dataSource.start();
|
|
59 |
}
|
|
60 |
public void stop() throws DriverException {
|
|
61 |
dataSource.stop();
|
|
62 |
}
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Cuando ocurre un evento de cambio en la selecci?n, ?ste puede ser uno de una gran cantidad de eventos. Con el fin de no propagar todos estos eventos, se realiza la propagaci?n de manera manual al final de la "r?faga" de eventos
|
|
66 |
*/
|
|
67 |
public void fireSelectionEvents() {
|
|
68 |
selectionSupport.fireSelectionEvents();
|
|
69 |
}
|
|
70 |
|
|
71 |
public void addSelectionListener(SelectionListener listener) {
|
|
72 |
selectionSupport.addSelectionListener(listener);
|
|
73 |
}
|
|
74 |
|
|
75 |
public void removeSelectionListener(SelectionListener listener) {
|
|
76 |
selectionSupport.removeSelectionListener(listener);
|
|
77 |
}
|
|
78 |
|
|
79 |
|
|
80 |
public void clearSelection() {
|
|
81 |
selectionSupport.clearSelection();
|
|
82 |
}
|
|
83 |
public BitSet getSelection() {
|
|
84 |
return selectionSupport.getSelection();
|
|
85 |
}
|
|
86 |
public boolean isSelected(int recordIndex) {
|
|
87 |
return selectionSupport.isSelected(recordIndex);
|
|
88 |
}
|
|
89 |
public void setSelection(BitSet selection) {
|
|
90 |
selectionSupport.setSelection(selection);
|
|
91 |
}
|
|
92 |
}
|
0 |
93 |
|