Revision 44340
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DALLocator.java | ||
---|---|---|
98 | 98 |
public static DataManager getDataManager() throws LocatorException { |
99 | 99 |
return (DataManager) getInstance().get(DATA_MANAGER_NAME); |
100 | 100 |
} |
101 |
|
|
101 |
|
|
102 |
public static DataManager getManager() throws LocatorException { |
|
103 |
return getDataManager(); |
|
104 |
} |
|
105 |
|
|
102 | 106 |
/** |
103 | 107 |
* Registers the Class implementing the DataManager interface. |
104 | 108 |
* |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/complements/Search.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
public static final String COMPLEMENT_MANE = "DAL.Search"; |
24 | 24 |
|
25 |
public static final String DAL_SEARCH_RESULT_COLUMNS = "DAL.Search.Result.Columns"; |
|
26 | 25 |
public static final String DAL_SEARCH_ATTRIBUTE_PRIORITY = "DAL.Search.Attribute.Priority"; |
27 | 26 |
|
28 | 27 |
public static Predicate<FeatureAttributeDescriptor> BASIC_TYPES_FILTER = FeatureType.BASIC_TYPES_FILTER; |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/OpenErrorHandler.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.fmap.dal; |
25 | 25 |
|
26 |
import org.gvsig.fmap.dal.DataParameters; |
|
27 |
|
|
28 | 26 |
/** |
29 | 27 |
* This class is used to handle errors that occur at not finding the data source |
30 | 28 |
* by opening a layer. |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DataManager.java | ||
---|---|---|
73 | 73 |
|
74 | 74 |
public static final String FUNCTION_FOREING_VALUE = "FOREING_VALUE"; |
75 | 75 |
|
76 |
public static final String DAL_PREFERRED_COLUMNS = "DAL.Preferred.Columns"; |
|
77 |
|
|
76 | 78 |
/** |
77 | 79 |
* |
78 | 80 |
* Returns the default DAL's temporary directory |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.lib/src/main/java/org/gvsig/fmap/dal/feature/spi/simpleprovider/SimpleSequentialReaderStoreProvider.java | ||
---|---|---|
1170 | 1170 |
readerData.setFeatureTypes(ftypes, ftype); |
1171 | 1171 |
|
1172 | 1172 |
taskStatus.terminate(); |
1173 |
} catch(IOException ex) { |
|
1174 |
taskStatus.abort(); |
|
1175 |
LOGGER.warn("Can't load features from '"+getProviderName()+"' file '" + getFullFileName() + "'.", ex); |
|
1176 |
throw ex; |
|
1173 | 1177 |
} catch (Exception ex) { |
1174 | 1178 |
taskStatus.abort(); |
1175 | 1179 |
LOGGER.warn("Can't load features from '"+getProviderName()+"' file '" + getFullFileName() + "'.", ex); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/complements/search/SearchImpl.java | ||
---|---|---|
8 | 8 |
import java.util.List; |
9 | 9 |
import java.util.function.Predicate; |
10 | 10 |
import org.apache.commons.lang3.StringUtils; |
11 |
import org.gvsig.fmap.dal.DataManager; |
|
11 | 12 |
import org.gvsig.fmap.dal.complements.Search; |
12 | 13 |
import static org.gvsig.fmap.dal.complements.Search.DAL_SEARCH_ATTRIBUTE_PRIORITY; |
13 | 14 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
... | ... | |
37 | 38 |
public List<String> getResultColumnNames() { |
38 | 39 |
FeatureType featureType = this.getObject(); |
39 | 40 |
List<String> columnNames; |
40 |
String columns = featureType.getTags().getString(DAL_SEARCH_RESULT_COLUMNS, null);
|
|
41 |
String columns = featureType.getTags().getString(DataManager.DAL_PREFERRED_COLUMNS, null);
|
|
41 | 42 |
if( StringUtils.isBlank(columns) ) { |
42 | 43 |
List<FeatureAttributeDescriptor> attributes = featureType.getFilteredAttributes( |
43 | 44 |
FeatureType.BASIC_TYPES_FILTER, |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/complements/search/SearchFactory.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.complements.search; |
2 | 2 |
|
3 |
import org.gvsig.fmap.dal.DataManager; |
|
3 | 4 |
import org.gvsig.fmap.dal.complements.Search; |
4 | 5 |
import org.gvsig.fmap.dal.feature.FeatureType; |
5 | 6 |
import org.gvsig.tools.ToolsLocator; |
... | ... | |
31 | 32 |
DynObjectManager dynObjectManager = ToolsLocator.getDynObjectManager(); |
32 | 33 |
dynObjectManager.registerTag( |
33 | 34 |
Search.DAL_SEARCH_ATTRIBUTE_PRIORITY, |
34 |
null
|
|
35 |
"Priority of the field when displaying it in the searchs field lists."
|
|
35 | 36 |
); |
36 | 37 |
dynObjectManager.registerTag( |
37 |
Search.DAL_SEARCH_RESULT_COLUMNS,
|
|
38 |
null
|
|
38 |
DataManager.DAL_PREFERRED_COLUMNS,
|
|
39 |
"Columns to be used when the data is shown in tabular form."
|
|
39 | 40 |
); |
40 | 41 |
} |
41 | 42 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/RecentUsedsAttributesImpl.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
public Collection<String> getNames(FeatureType featureType) { |
27 | 27 |
FeatureStore store = featureType.getStore(); |
28 |
if( store == null ) { |
|
29 |
return Collections.EMPTY_LIST; |
|
30 |
} |
|
28 | 31 |
CircularFifoQueue<String> recents = this.recentsForStore.get(store.getFullName()); |
29 | 32 |
if( recents==null ) { |
30 | 33 |
return Collections.EMPTY_LIST; |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/DefaultDataSwingManager.java | ||
---|---|---|
25 | 25 |
import java.util.Collection; |
26 | 26 |
import java.util.Collections; |
27 | 27 |
import java.util.LinkedHashMap; |
28 |
import java.util.List; |
|
28 | 29 |
import java.util.Map; |
29 | 30 |
import java.util.function.Predicate; |
30 | 31 |
import javax.swing.JButton; |
31 | 32 |
import javax.swing.JComboBox; |
32 | 33 |
import javax.swing.JList; |
33 | 34 |
import javax.swing.JTextField; |
35 |
import javax.swing.table.TableModel; |
|
34 | 36 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
35 | 37 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
36 | 38 |
import org.gvsig.expressionevaluator.swing.JExpressionBuilder; |
... | ... | |
80 | 82 |
import org.gvsig.tools.dynobject.DynStruct; |
81 | 83 |
import org.gvsig.tools.exception.BaseException; |
82 | 84 |
import org.gvsig.fmap.dal.swing.DALActionFactory; |
85 |
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModel; |
|
83 | 86 |
import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionDialog; |
84 | 87 |
import org.gvsig.fmap.dal.swing.impl.jdbc.JDBCConnectionPickerController; |
85 | 88 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
... | ... | |
292 | 295 |
} |
293 | 296 |
|
294 | 297 |
@Override |
298 |
public DALActionFactory getStoreAction(String name) { |
|
299 |
DALActionFactory action = this.featureStoreSearchActions.get(name.toLowerCase()); |
|
300 |
return action; |
|
301 |
} |
|
302 |
|
|
303 |
@Override |
|
295 | 304 |
public PickerController<JDBCServerExplorerParameters> createJDBCConnectionPickerController( |
296 | 305 |
JComboBox cboConnection, JButton btnConnection |
297 | 306 |
) { |
298 | 307 |
JDBCConnectionPickerController x = new JDBCConnectionPickerController(cboConnection, btnConnection); |
299 | 308 |
return x; |
300 | 309 |
} |
310 |
|
|
311 |
@Override |
|
312 |
public TableModel createSimpleFeaturesTableModel(FeatureStore store) { |
|
313 |
try { |
|
314 |
SimpleFeaturesTableModel m = new SimpleFeaturesTableModel(store); |
|
315 |
return m; |
|
316 |
} catch (DataException ex) { |
|
317 |
throw new RuntimeException("Can't creatre SimpleFeaturesTableModel.", ex); |
|
318 |
} |
|
319 |
} |
|
301 | 320 |
|
321 |
@Override |
|
322 |
public TableModel createSimpleFeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features) { |
|
323 |
SimpleFeaturesTableModel m = new SimpleFeaturesTableModel(featureType, columnNames, features); |
|
324 |
return m; |
|
325 |
} |
|
302 | 326 |
|
303 | 327 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/featuretable/SimpleFeaturesTableModel.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.swing.impl.featuretable; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.Iterator; |
|
5 |
import java.util.List; |
|
6 |
import javax.swing.table.AbstractTableModel; |
|
7 |
import org.gvsig.fmap.dal.complements.Search; |
|
8 |
import org.gvsig.fmap.dal.exception.DataException; |
|
9 |
import org.gvsig.fmap.dal.feature.Feature; |
|
10 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
11 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
12 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
13 |
import org.gvsig.tools.ToolsLocator; |
|
14 |
import org.gvsig.tools.util.UnmodifiableBasicList; |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
* @author jjdelcerro |
|
19 |
*/ |
|
20 |
public class SimpleFeaturesTableModel |
|
21 |
extends AbstractTableModel |
|
22 |
implements UnmodifiableBasicList<Feature> { |
|
23 |
|
|
24 |
private final List<Feature> features; |
|
25 |
private final List<String> columnNames; |
|
26 |
private final FeatureType featureType; |
|
27 |
|
|
28 |
public SimpleFeaturesTableModel(FeatureStore store) throws DataException { |
|
29 |
this(store.getDefaultFeatureType(), null, store.getFeatures()); |
|
30 |
} |
|
31 |
|
|
32 |
public SimpleFeaturesTableModel(FeatureType featureType) { |
|
33 |
this(featureType, null, null); |
|
34 |
} |
|
35 |
|
|
36 |
public SimpleFeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features) { |
|
37 |
this.features = features; |
|
38 |
this.featureType = featureType; |
|
39 |
if (columnNames == null || columnNames.isEmpty()) { |
|
40 |
this.columnNames = new ArrayList<>(); |
|
41 |
Search search = (Search) ToolsLocator.getComplementsManager().get( |
|
42 |
Search.COMPLEMENT_MANE, featureType |
|
43 |
); |
|
44 |
List<Search.OrderedAttribute> attributos = search.getOrderedAttributes( |
|
45 |
Search.BASIC_TYPES_FILTER, |
|
46 |
Search.STR_INT_LONG_LABEL_ORDER, |
|
47 |
12 |
|
48 |
); |
|
49 |
for (Search.OrderedAttribute attrdesc : attributos) { |
|
50 |
this.columnNames.add(attrdesc.getDescriptor().getName()); |
|
51 |
} |
|
52 |
} else { |
|
53 |
this.columnNames = columnNames; |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
public List<Feature> getFeatures() { |
|
58 |
return this.features; |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public int getRowCount() { |
|
63 |
if (this.features == null) { |
|
64 |
return 0; |
|
65 |
} |
|
66 |
return this.features.size(); |
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public int getColumnCount() { |
|
71 |
return this.columnNames.size(); |
|
72 |
} |
|
73 |
|
|
74 |
@Override |
|
75 |
public String getColumnName(int columnIndex) { |
|
76 |
String attrName = this.columnNames.get(columnIndex); |
|
77 |
if (this.featureType == null) { |
|
78 |
return attrName; |
|
79 |
} |
|
80 |
FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName); |
|
81 |
if (attrdesc == null) { |
|
82 |
return "C" + columnIndex; |
|
83 |
} |
|
84 |
return attrdesc.getLocalizedShortLabel(); |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 |
public Class<?> getColumnClass(int columnIndex) { |
|
89 |
if (this.featureType == null) { |
|
90 |
return String.class; |
|
91 |
} |
|
92 |
String attrName = this.columnNames.get(columnIndex); |
|
93 |
FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName); |
|
94 |
if (attrdesc == null) { |
|
95 |
return String.class; |
|
96 |
} |
|
97 |
if( attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList() ) { |
|
98 |
return String.class; |
|
99 |
} |
|
100 |
Class theClass = attrdesc.getDataType().getDefaultClass(); |
|
101 |
if( theClass==null ) { |
|
102 |
return String.class; |
|
103 |
} |
|
104 |
return theClass; |
|
105 |
} |
|
106 |
|
|
107 |
@Override |
|
108 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
|
109 |
return false; |
|
110 |
} |
|
111 |
|
|
112 |
@Override |
|
113 |
public Feature get(int position) { |
|
114 |
if (this.features == null) { |
|
115 |
return null; |
|
116 |
} |
|
117 |
Feature feature = this.features.get(position); |
|
118 |
return feature; |
|
119 |
} |
|
120 |
|
|
121 |
@Override |
|
122 |
public Object getValueAt(int rowIndex, int columnIndex) { |
|
123 |
if (this.features == null) { |
|
124 |
return null; |
|
125 |
} |
|
126 |
try { |
|
127 |
Feature feature = this.features.get(rowIndex); |
|
128 |
String attrName = this.columnNames.get(columnIndex); |
|
129 |
Object value = feature.get(attrName); |
|
130 |
FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName); |
|
131 |
if (attrdesc != null) { |
|
132 |
if( attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList() ) { |
|
133 |
value = attrdesc.getForeingKey().getLabelForValue(value); |
|
134 |
} |
|
135 |
} |
|
136 |
return value; |
|
137 |
} catch (Throwable th) { |
|
138 |
return null; |
|
139 |
} |
|
140 |
} |
|
141 |
|
|
142 |
@Override |
|
143 |
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
|
144 |
|
|
145 |
} |
|
146 |
|
|
147 |
@Override |
|
148 |
public List<Feature> toList() { |
|
149 |
return this.features; |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
public boolean isEmpty() { |
|
154 |
return this.features.isEmpty(); |
|
155 |
} |
|
156 |
|
|
157 |
@Override |
|
158 |
public int size() { |
|
159 |
return this.features.size(); |
|
160 |
} |
|
161 |
|
|
162 |
@Override |
|
163 |
public Iterator<Feature> iterator() { |
|
164 |
return this.features.iterator(); |
|
165 |
} |
|
166 |
|
|
167 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/searchpanel/DefaultSearchPanel.java | ||
---|---|---|
19 | 19 |
import javax.swing.SwingUtilities; |
20 | 20 |
import javax.swing.event.ListSelectionEvent; |
21 | 21 |
import javax.swing.event.ListSelectionListener; |
22 |
import javax.swing.table.AbstractTableModel; |
|
23 | 22 |
import javax.swing.table.TableModel; |
24 | 23 |
import org.apache.commons.io.FilenameUtils; |
25 | 24 |
import org.apache.commons.lang.mutable.MutableObject; |
... | ... | |
42 | 41 |
import org.gvsig.fmap.dal.swing.AbstractDALActionFactory.AbstractDALActionContext; |
43 | 42 |
import org.gvsig.fmap.dal.swing.DALActionFactory; |
44 | 43 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
44 |
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModel; |
|
45 | 45 |
import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel; |
46 | 46 |
import org.gvsig.tools.ToolsLocator; |
47 | 47 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
... | ... | |
61 | 61 |
|
62 | 62 |
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultSearchPanel.class); |
63 | 63 |
private Expression currentSearch; |
64 |
|
|
65 |
private class FeaturesTableModel extends AbstractTableModel { |
|
66 |
|
|
67 |
private final List<Feature> features; |
|
68 |
private final List<String> columnNames; |
|
69 |
private final FeatureType featureType; |
|
70 |
|
|
71 |
public FeaturesTableModel(FeatureType featureType) { |
|
72 |
this(featureType, null, null); |
|
73 |
} |
|
74 |
|
|
75 |
public FeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features) { |
|
76 |
this.features = features; |
|
77 |
this.featureType = featureType; |
|
78 |
if (columnNames == null || columnNames.isEmpty()) { |
|
79 |
this.columnNames = new ArrayList<>(); |
|
80 |
Search search = (Search) ToolsLocator.getComplementsManager().get( |
|
81 |
Search.COMPLEMENT_MANE, featureType |
|
82 |
); |
|
83 |
List<Search.OrderedAttribute> attributos = search.getOrderedAttributes( |
|
84 |
Search.BASIC_TYPES_FILTER, |
|
85 |
Search.STR_INT_LONG_LABEL_ORDER, |
|
86 |
12 |
|
87 |
); |
|
88 |
for (Search.OrderedAttribute attrdesc : attributos) { |
|
89 |
this.columnNames.add(attrdesc.getDescriptor().getName()); |
|
90 |
} |
|
91 |
} else { |
|
92 |
this.columnNames = columnNames; |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
public List<Feature> getFeatures() { |
|
97 |
return this.features; |
|
98 |
} |
|
99 |
|
|
100 |
@Override |
|
101 |
public int getRowCount() { |
|
102 |
if (this.features == null) { |
|
103 |
return 0; |
|
104 |
} |
|
105 |
return this.features.size(); |
|
106 |
} |
|
107 |
|
|
108 |
@Override |
|
109 |
public int getColumnCount() { |
|
110 |
return this.columnNames.size(); |
|
111 |
} |
|
112 |
|
|
113 |
@Override |
|
114 |
public String getColumnName(int columnIndex) { |
|
115 |
String attrName = this.columnNames.get(columnIndex); |
|
116 |
if (this.featureType == null) { |
|
117 |
return attrName; |
|
118 |
} |
|
119 |
FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName); |
|
120 |
if (attrdesc == null) { |
|
121 |
return "C" + columnIndex; |
|
122 |
} |
|
123 |
return attrdesc.getLocalizedShortLabel(); |
|
124 |
} |
|
125 |
|
|
126 |
@Override |
|
127 |
public Class<?> getColumnClass(int columnIndex) { |
|
128 |
if (this.featureType == null) { |
|
129 |
return String.class; |
|
130 |
} |
|
131 |
String attrName = this.columnNames.get(columnIndex); |
|
132 |
FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName); |
|
133 |
if (attrdesc == null) { |
|
134 |
return String.class; |
|
135 |
} |
|
136 |
if( attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList() ) { |
|
137 |
return String.class; |
|
138 |
} |
|
139 |
Class theClass = attrdesc.getDataType().getDefaultClass(); |
|
140 |
if( theClass==null ) { |
|
141 |
return String.class; |
|
142 |
} |
|
143 |
return theClass; |
|
144 |
} |
|
145 |
|
|
146 |
@Override |
|
147 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
|
148 |
return false; |
|
149 |
} |
|
150 |
|
|
151 |
@Override |
|
152 |
public Object getValueAt(int rowIndex, int columnIndex) { |
|
153 |
if (this.features == null) { |
|
154 |
return null; |
|
155 |
} |
|
156 |
try { |
|
157 |
Feature feature = this.features.get(rowIndex); |
|
158 |
String attrName = this.columnNames.get(columnIndex); |
|
159 |
Object value = feature.get(attrName); |
|
160 |
FeatureAttributeDescriptor attrdesc = this.featureType.getAttributeDescriptor(attrName); |
|
161 |
if (attrdesc != null) { |
|
162 |
if( attrdesc.isForeingKey() && attrdesc.getForeingKey().isClosedList() ) { |
|
163 |
value = attrdesc.getForeingKey().getLabelForValue(value); |
|
164 |
} |
|
165 |
} |
|
166 |
return value; |
|
167 |
} catch (Throwable th) { |
|
168 |
return null; |
|
169 |
} |
|
170 |
} |
|
171 |
|
|
172 |
@Override |
|
173 |
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
|
174 |
|
|
175 |
} |
|
176 |
} |
|
177 | 64 |
|
178 | 65 |
private class ActionButtons { |
179 | 66 |
|
... | ... | |
490 | 377 |
features = store.getFeatures(exp); |
491 | 378 |
} |
492 | 379 |
currentSearch = exp; |
493 |
model.setValue( new FeaturesTableModel( |
|
380 |
model.setValue( new SimpleFeaturesTableModel(
|
|
494 | 381 |
store.getDefaultFeatureType(), |
495 | 382 |
null, |
496 | 383 |
features |
... | ... | |
548 | 435 |
} |
549 | 436 |
} |
550 | 437 |
} |
551 |
FeaturesTableModel model = new FeaturesTableModel(this.getStore().getDefaultFeatureType());
|
|
438 |
SimpleFeaturesTableModel model = new SimpleFeaturesTableModel(this.getStore());
|
|
552 | 439 |
tblResults.setModel(model); |
553 | 440 |
lblMsg.setText(""); |
554 | 441 |
return true; |
... | ... | |
575 | 462 |
return null; |
576 | 463 |
} |
577 | 464 |
try { |
578 |
List<Feature> features = ((FeaturesTableModel) this.tblResults.getModel()).getFeatures(); |
|
465 |
List<Feature> features = ((SimpleFeaturesTableModel) this.tblResults.getModel()).getFeatures();
|
|
579 | 466 |
Feature feature = features.get(selectedRow); |
580 | 467 |
|
581 | 468 |
ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.api/src/main/java/org/gvsig/fmap/dal/swing/DALSwingLocator.java | ||
---|---|---|
70 | 70 |
* |
71 | 71 |
* @return a String with the Locator's name |
72 | 72 |
*/ |
73 |
@Override |
|
73 | 74 |
public final String getLocatorName() { |
74 | 75 |
return LOCATOR_NAME; |
75 | 76 |
} |
... | ... | |
89 | 90 |
* |
90 | 91 |
* @return {@link DataSwingManager} |
91 | 92 |
*/ |
93 |
public static DataSwingManager getManager() { |
|
94 |
return getDataSwingManager(); |
|
95 |
} |
|
96 |
|
|
92 | 97 |
public static DataSwingManager getSwingManager() { |
98 |
return getDataSwingManager(); |
|
99 |
} |
|
100 |
|
|
101 |
public static DataSwingManager getDataSwingManager() { |
|
93 | 102 |
return (DataSwingManager) getInstance() |
94 | 103 |
.get(SWING_MANAGER_NAME); |
95 | 104 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.api/src/main/java/org/gvsig/fmap/dal/swing/DataSwingManager.java | ||
---|---|---|
23 | 23 |
package org.gvsig.fmap.dal.swing; |
24 | 24 |
|
25 | 25 |
import java.util.Collection; |
26 |
import java.util.List; |
|
26 | 27 |
import java.util.function.Predicate; |
27 | 28 |
import javax.swing.JButton; |
28 | 29 |
import javax.swing.JComboBox; |
29 | 30 |
import javax.swing.JList; |
30 | 31 |
import javax.swing.JTextField; |
32 |
import javax.swing.table.TableModel; |
|
31 | 33 |
import org.cresques.cts.IProjection; |
32 | 34 |
import org.gvsig.expressionevaluator.swing.ExpressionBuilderConfig; |
33 | 35 |
import org.gvsig.expressionevaluator.swing.JExpressionBuilder; |
34 | 36 |
import org.gvsig.featureform.swing.CreateJFeatureFormException; |
35 | 37 |
import org.gvsig.featureform.swing.JFeatureForm; |
36 | 38 |
import org.gvsig.featureform.swing.JFeaturesForm; |
39 |
import org.gvsig.fmap.dal.exception.DataException; |
|
37 | 40 |
import org.gvsig.fmap.dal.feature.Feature; |
38 | 41 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
39 | 42 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
40 | 43 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
44 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
41 | 45 |
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
42 | 46 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
43 | 47 |
import org.gvsig.fmap.dal.swing.expressionevaluator.FeatureStoreElement; |
... | ... | |
106 | 110 |
|
107 | 111 |
public Collection<DALActionFactory> getStoreActions(); |
108 | 112 |
|
113 |
public DALActionFactory getStoreAction(String name); |
|
114 |
|
|
109 | 115 |
public PickerController<JDBCServerExplorerParameters> createJDBCConnectionPickerController( |
110 | 116 |
JComboBox cboConnection, JButton btnConnection |
111 | 117 |
); |
118 |
public TableModel createSimpleFeaturesTableModel(FeatureStore store); |
|
112 | 119 |
|
120 |
public TableModel createSimpleFeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features); |
|
121 |
|
|
113 | 122 |
} |
trunk/org.gvsig.desktop/pom.xml | ||
---|---|---|
2542 | 2542 |
|
2543 | 2543 |
<jython.artifactId>jython-standalone</jython.artifactId> |
2544 | 2544 |
<!-- External project versions --> |
2545 |
<gvsig.tools.version>3.0.188-SNAPSHOT</gvsig.tools.version>
|
|
2545 |
<gvsig.tools.version>3.0.189</gvsig.tools.version>
|
|
2546 | 2546 |
<gvsig.proj.version>1.0.4</gvsig.proj.version> |
2547 | 2547 |
<gvsig.projection.api.version>2.0.25</gvsig.projection.api.version> |
2548 | 2548 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultOptimizer.java | ||
---|---|---|
106 | 106 |
return this.symbolTable.iterator(); |
107 | 107 |
} |
108 | 108 |
|
109 |
@Override |
|
110 |
public Collection<String> localvariables() { |
|
111 |
return null; |
|
112 |
} |
|
113 |
|
|
109 | 114 |
} |
110 | 115 |
|
111 | 116 |
private final OptimizerSymbolTable symbolTable; |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultExpression.java | ||
---|---|---|
1 | 1 |
package org.gvsig.expressionevaluator.impl; |
2 | 2 |
|
3 | 3 |
import java.net.URI; |
4 |
import java.net.URL; |
|
4 | 5 |
import java.util.ArrayList; |
5 | 6 |
import java.util.Iterator; |
6 | 7 |
import java.util.List; |
... | ... | |
236 | 237 |
state.set("userScript_language", this.userScript.getTypeName()); |
237 | 238 |
} |
238 | 239 |
if (this.scripts != null && !this.scripts.isEmpty()) { |
239 |
List<URI> l = new ArrayList<>();
|
|
240 |
List<URL> l = new ArrayList<>();
|
|
240 | 241 |
for (Script script : this.scripts) { |
241 |
URI location = script.getURI();
|
|
242 |
URL location = script.getURL();
|
|
242 | 243 |
if (location != null) { |
243 | 244 |
l.add(location); |
244 | 245 |
} |
... | ... | |
294 | 295 |
definition.addDynFieldString("userScript_code").setMandatory(false); |
295 | 296 |
definition.addDynFieldString("userScript_language").setMandatory(false); |
296 | 297 |
definition.addDynFieldList("scripts") |
297 |
.setClassOfItems(URI.class)
|
|
298 |
.setClassOfItems(URL.class)
|
|
298 | 299 |
.setMandatory(false); |
299 | 300 |
} |
300 | 301 |
} |
... | ... | |
314 | 315 |
if (this.scripts != null && !this.scripts.isEmpty()) { |
315 | 316 |
JSONArray scriptsJson = new JSONArray(); |
316 | 317 |
for (Script script : this.scripts) { |
317 |
scriptsJson.put(script.getURI());
|
|
318 |
scriptsJson.put(script.getURL());
|
|
318 | 319 |
} |
319 | 320 |
expressionJson.put("scripts", scriptsJson); |
320 | 321 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/SimpleScript.java | ||
---|---|---|
1 | 1 |
package org.gvsig.expressionevaluator.impl; |
2 | 2 |
|
3 |
import java.net.URI; |
|
3 |
import java.net.URL; |
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Collection; |
|
6 |
import java.util.List; |
|
4 | 7 |
import org.gvsig.expressionevaluator.Code; |
5 | 8 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator; |
6 | 9 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorManager; |
7 | 10 |
import org.gvsig.expressionevaluator.ExpressionRuntimeException; |
11 |
import org.gvsig.expressionevaluator.Function; |
|
12 |
import org.gvsig.expressionevaluator.SymbolTable; |
|
8 | 13 |
import org.gvsig.tools.script.Script; |
9 | 14 |
|
10 | 15 |
/** |
... | ... | |
16 | 21 |
private final String name; |
17 | 22 |
private String source; |
18 | 23 |
private DefaultInterpreter interpreter; |
24 |
private List<String> names; |
|
19 | 25 |
|
20 | 26 |
public SimpleScript(String name, String source) { |
21 | 27 |
this.name = name; |
... | ... | |
38 | 44 |
} |
39 | 45 |
|
40 | 46 |
@Override |
41 |
public URI getURI() {
|
|
47 |
public URL getURL() {
|
|
42 | 48 |
return null; |
43 | 49 |
} |
44 | 50 |
|
... | ... | |
63 | 69 |
@Override |
64 | 70 |
public final void setCode(String source) { |
65 | 71 |
this.source = source; |
72 |
this.names = null; |
|
66 | 73 |
ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager(); |
67 | 74 |
this.interpreter = new DefaultInterpreter(); |
68 | 75 |
Code code = manager.compile(source); |
69 | 76 |
this.interpreter.run(code); |
70 | 77 |
} |
78 |
|
|
79 |
@Override |
|
80 |
public List<String> getNames() { |
|
81 |
if( this.names == null ) { |
|
82 |
List<String> theNames = new ArrayList<>(); |
|
83 |
SymbolTable symbolTable = this.interpreter.getSymbolTable(); |
|
84 |
Collection<Function> funcs = symbolTable.localfunctions(); |
|
85 |
if( funcs!=null ) { |
|
86 |
for (Function function : funcs) { |
|
87 |
theNames.add(function.name()); |
|
88 |
} |
|
89 |
} |
|
90 |
Collection<String> vars = symbolTable.localvariables(); |
|
91 |
if( vars!=null ) { |
|
92 |
for (String var : vars) { |
|
93 |
theNames.add(var); |
|
94 |
} |
|
95 |
} |
|
96 |
this.names = theNames; |
|
97 |
} |
|
98 |
return this.names; |
|
99 |
} |
|
71 | 100 |
|
101 |
|
|
72 | 102 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/spi/AbstractSymbolTable.java | ||
---|---|---|
236 | 236 |
} |
237 | 237 |
|
238 | 238 |
@Override |
239 |
public Collection<String> localvariables() { |
|
240 |
if( this.vars == null ) { |
|
241 |
return Collections.EMPTY_LIST; |
|
242 |
} |
|
243 |
return Collections.unmodifiableCollection(this.vars.keySet()); |
|
244 |
} |
|
245 |
|
|
246 |
@Override |
|
239 | 247 |
public Collection<Script> scripts() { |
240 | 248 |
Set<Script> theScripts = new HashSet<>(); |
241 | 249 |
for (SymbolTable symbolTable : this.symbolTables) { |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/SymbolTable.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
public Collection<String> variables(); |
27 | 27 |
|
28 |
public Collection<String> localvariables(); |
|
29 |
|
|
28 | 30 |
public Collection<Function> functions(); |
29 | 31 |
|
30 | 32 |
public Collection<Function> localfunctions(); |
Also available in: Unified diff