Revision 45634 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/TableInfo.java
TableInfo.java | ||
---|---|---|
7 | 7 |
|
8 | 8 |
import java.util.ArrayList; |
9 | 9 |
import java.util.List; |
10 |
import java.util.Map; |
|
10 | 11 |
import javax.swing.ComboBoxModel; |
11 | 12 |
import javax.swing.DefaultComboBoxModel; |
12 | 13 |
import javax.swing.DefaultListModel; |
... | ... | |
28 | 29 |
import org.gvsig.tools.dispose.DisposeUtils; |
29 | 30 |
import org.gvsig.tools.util.LabeledValue; |
30 | 31 |
import org.gvsig.tools.util.LabeledValueImpl; |
32 |
import org.gvsig.tools.util.PropertiesSupport; |
|
33 |
import org.gvsig.tools.util.PropertiesSupportHelper; |
|
31 | 34 |
|
32 | 35 |
/** |
33 | 36 |
* |
34 | 37 |
* @author fdiaz |
35 | 38 |
*/ |
36 |
class TableInfo extends LabeledValueImpl<JDBCStoreParameters> {
|
|
39 |
public class TableInfo extends LabeledValueImpl<JDBCStoreParameters> implements PropertiesSupport {
|
|
37 | 40 |
|
38 | 41 |
private final ListSelectionModel columnChecksModel; |
39 | 42 |
private FeatureType featureType; |
... | ... | |
50 | 53 |
private boolean isView; |
51 | 54 |
private Boolean readOnly; |
52 | 55 |
private boolean requireGeometry; |
56 |
|
|
57 |
private PropertiesSupportHelper propertiesHelper; |
|
58 |
private final String id; |
|
53 | 59 |
|
54 |
public TableInfo(JDBCStoreParameters parameters, boolean requireGeometry, boolean isView) { |
|
60 |
public TableInfo(String id, JDBCStoreParameters parameters, boolean requireGeometry, boolean isView) {
|
|
55 | 61 |
super(getLabelForTable(parameters), parameters); |
62 |
this.id = id; |
|
56 | 63 |
this.columnChecksModel = new DefaultListSelectionModel(); |
57 | 64 |
this.selected = false; |
58 | 65 |
this.documentName = parameters.getTable(); |
59 | 66 |
this.projection = parameters.getCRS(); |
60 | 67 |
this.isView = isView; |
61 | 68 |
this.readOnly = null; |
62 |
this.requireGeometry = this.requireGeometry; |
|
69 |
this.requireGeometry = requireGeometry; |
|
70 |
this.propertiesHelper = new PropertiesSupportHelper(); |
|
63 | 71 |
} |
64 | 72 |
|
65 | 73 |
private static String getLabelForTable(JDBCStoreParameters parameters) { |
... | ... | |
75 | 83 |
this.projection = parameters.getCRS(); |
76 | 84 |
} |
77 | 85 |
|
86 |
public String getId() { |
|
87 |
return id; |
|
88 |
} |
|
89 |
|
|
78 | 90 |
public String getDocumentName() { |
79 | 91 |
return this.documentName; |
80 | 92 |
} |
... | ... | |
136 | 148 |
if (this.idFieldSelected < 0) { |
137 | 149 |
return null; |
138 | 150 |
} |
139 |
return this.idFieldComboModel.getElementAt(this.idFieldSelected);
|
|
151 |
return this.getIdFieldComboModel().getElementAt(this.idFieldSelected);
|
|
140 | 152 |
} |
141 | 153 |
|
142 | 154 |
public String getGeomField() { |
... | ... | |
189 | 201 |
return this.geomFieldSelected; |
190 | 202 |
} |
191 | 203 |
|
192 |
public ComboBoxModel getIdFieldComboModel() { |
|
204 |
public ComboBoxModel<String> getIdFieldComboModel() {
|
|
193 | 205 |
if (this.idFieldComboModel == null) { |
194 | 206 |
StringBuilder pkName = new StringBuilder(); |
195 | 207 |
for (FeatureAttributeDescriptor attr : this.getAttributeDescriptors()) { |
... | ... | |
276 | 288 |
return requireGeometry; |
277 | 289 |
} |
278 | 290 |
|
279 |
boolean hasValidValues() { |
|
291 |
public boolean hasValidValues() {
|
|
280 | 292 |
if (this.getGeomFieldSelected() < 0 && requireGeometry()) { |
281 | 293 |
return false; |
282 | 294 |
} |
... | ... | |
312 | 324 |
DisposeUtils.disposeQuietly(store); |
313 | 325 |
} |
314 | 326 |
} |
327 |
|
|
328 |
@Override |
|
329 |
public Object getProperty(String name) { |
|
330 |
return this.propertiesHelper.getProperty(name); |
|
331 |
} |
|
332 |
|
|
333 |
@Override |
|
334 |
public void setProperty(String name, Object value) { |
|
335 |
this.propertiesHelper.setProperty(name, value); |
|
336 |
} |
|
337 |
|
|
338 |
@Override |
|
339 |
public Map<String, Object> getProperties() { |
|
340 |
return this.propertiesHelper.getProperties(); |
|
341 |
} |
|
315 | 342 |
|
316 | 343 |
} |
Also available in: Unified diff