Revision 46104 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/featurequery/DefaultFeatureQueryGroupByPanel.java
DefaultFeatureQueryGroupByPanel.java | ||
---|---|---|
7 | 7 |
import java.net.URL; |
8 | 8 |
import java.util.ArrayList; |
9 | 9 |
import java.util.Collections; |
10 |
import java.util.HashMap; |
|
10 | 11 |
import java.util.List; |
12 |
import java.util.Map; |
|
11 | 13 |
import javax.swing.DefaultComboBoxModel; |
12 | 14 |
import javax.swing.ImageIcon; |
13 | 15 |
import javax.swing.JComponent; |
... | ... | |
17 | 19 |
import javax.swing.event.ListSelectionEvent; |
18 | 20 |
import org.apache.commons.io.FilenameUtils; |
19 | 21 |
import org.apache.commons.lang3.StringUtils; |
22 |
import org.gvsig.expressionevaluator.Code; |
|
23 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
|
20 | 24 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator; |
21 | 25 |
import org.gvsig.expressionevaluator.ExpressionEvaluatorManager; |
26 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
|
22 | 27 |
import org.gvsig.expressionevaluator.Function; |
23 | 28 |
import org.gvsig.expressionevaluator.SymbolTable; |
24 | 29 |
import org.gvsig.expressionevaluator.SymbolTableFactory; |
... | ... | |
37 | 42 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
38 | 43 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
39 | 44 |
import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryGroupByPanel; |
45 |
import org.gvsig.timesupport.DataTypes; |
|
40 | 46 |
import org.gvsig.tools.swing.api.FilteredListModel; |
41 | 47 |
|
42 | 48 |
/** |
... | ... | |
47 | 53 |
extends DefaultFeatureQueryGroupByPanelView |
48 | 54 |
implements FeatureQueryGroupByPanel { |
49 | 55 |
|
50 |
private class AttributesWithAggregateRenderer extends FeatureAttributeListCellRendererImpl { |
|
56 |
private class AttributesWithAggregateRenderer extends FeatureAttributeListCellRendererImpl {
|
|
51 | 57 |
|
52 |
@Override |
|
53 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
54 |
JLabel c = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); //To change body of generated methods, choose Tools | Templates. |
|
55 |
FeatureAttributeDescriptor attrdesc = (FeatureAttributeDescriptor) value; |
|
56 |
String aggregate = query.getAggregateFunctions().get(attrdesc.getName()); |
|
57 |
if( aggregate !=null ) { |
|
58 |
c.setText(c.getText() + " ["+aggregate+"]"); |
|
59 |
} else { |
|
60 |
c.setText(c.getText() + " [<NULL>]"); |
|
61 |
} |
|
62 |
return c; |
|
58 |
@Override |
|
59 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
60 |
JLabel c = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); //To change body of generated methods, choose Tools | Templates. |
|
61 |
FeatureAttributeDescriptor attrdesc = (FeatureAttributeDescriptor) value; |
|
62 |
String aggregate = query.getAggregateFunctions().get(attrdesc.getName()); |
|
63 |
if (aggregate != null) { |
|
64 |
c.setText(c.getText() + " [" + aggregate + "]"); |
|
65 |
} else { |
|
66 |
c.setText(c.getText() + " [<NULL>]"); |
|
67 |
} |
|
68 |
return c; |
|
69 |
} |
|
63 | 70 |
} |
64 |
} |
|
65 |
|
|
66 |
private FeatureStore store; |
|
67 |
private FeatureType featureType; |
|
68 | 71 |
|
69 |
private FilteredListController aggregateFunctionsController;
|
|
70 |
private DefaultFeatureAttributesSelectionPanel groupByPanel;
|
|
72 |
private FeatureStore store;
|
|
73 |
private FeatureType featureType;
|
|
71 | 74 |
|
72 |
private FeatureQuery query; |
|
73 |
|
|
74 |
public DefaultFeatureQueryGroupByPanel() { |
|
75 |
this.initComponents(); |
|
76 |
} |
|
75 |
private FilteredListController aggregateFunctionsController; |
|
76 |
private DefaultFeatureAttributesSelectionPanel groupByPanel; |
|
77 | 77 |
|
78 |
@Override |
|
79 |
public JComponent asJComponent() { |
|
80 |
return this; |
|
81 |
} |
|
78 |
private FeatureQuery query; |
|
82 | 79 |
|
83 |
@Override |
|
84 |
public ImageIcon loadImage(String imageName) { |
|
85 |
String name = FilenameUtils.getBaseName(imageName); |
|
86 |
IconTheme theme = ToolsSwingLocator.getIconThemeManager().getDefault(); |
|
87 |
if (theme.exists(name)) { |
|
88 |
return theme.get(name); |
|
80 |
public DefaultFeatureQueryGroupByPanel() { |
|
81 |
this.initComponents(); |
|
89 | 82 |
} |
90 |
URL url = this.getClass().getResource(name + ".png"); |
|
91 |
if (url == null) { |
|
92 |
return null; |
|
83 |
|
|
84 |
@Override |
|
85 |
public JComponent asJComponent() { |
|
86 |
return this; |
|
93 | 87 |
} |
94 |
return new ImageIcon(url); |
|
95 |
} |
|
96 | 88 |
|
97 |
@Override |
|
98 |
public void setStore(FeatureStore store) { |
|
99 |
try { |
|
100 |
this.featureType = store.getDefaultFeatureType(); |
|
101 |
this.store = store; |
|
102 |
this.query = store.createFeatureQuery(); |
|
103 |
this.groupByPanel.setFeatureType(featureType); |
|
104 |
this.groupByPanel.setSelectedNames(query.getGroupByColumns()); |
|
105 |
this.updateControls(); |
|
106 |
} catch (DataException ex) { |
|
107 |
throw new RuntimeException("Can't assign store", ex); |
|
89 |
@Override |
|
90 |
public ImageIcon loadImage(String imageName) { |
|
91 |
String name = FilenameUtils.getBaseName(imageName); |
|
92 |
IconTheme theme = ToolsSwingLocator.getIconThemeManager().getDefault(); |
|
93 |
if (theme.exists(name)) { |
|
94 |
return theme.get(name); |
|
95 |
} |
|
96 |
URL url = this.getClass().getResource(name + ".png"); |
|
97 |
if (url == null) { |
|
98 |
return null; |
|
99 |
} |
|
100 |
return new ImageIcon(url); |
|
108 | 101 |
} |
109 |
} |
|
110 | 102 |
|
111 |
private void initComponents() { |
|
112 |
ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager(); |
|
113 |
|
|
114 |
toolsSwingManager.translate(this.btnAttributesFilter); |
|
115 |
toolsSwingManager.translate(this.tabGroup); |
|
116 |
|
|
117 |
this.groupByPanel = new DefaultFeatureAttributesSelectionPanel(); |
|
118 |
this.groupByPanel.allowCalculatedAttributes(true); |
|
103 |
@Override |
|
104 |
public void setStore(FeatureStore store) { |
|
105 |
try { |
|
106 |
this.featureType = store.getDefaultFeatureType(); |
|
107 |
this.store = store; |
|
108 |
this.query = store.createFeatureQuery(); |
|
109 |
this.groupByPanel.setFeatureType(featureType); |
|
110 |
this.groupByPanel.setSelectedNames(query.getGroupByColumns()); |
|
111 |
this.updateControls(); |
|
112 |
} catch (DataException ex) { |
|
113 |
throw new RuntimeException("Can't assign store", ex); |
|
114 |
} |
|
115 |
} |
|
119 | 116 |
|
120 |
this.pnlGroupByAttributes.setLayout(new BorderLayout());
|
|
121 |
this.pnlGroupByAttributes.add(this.groupByPanel, BorderLayout.CENTER);
|
|
117 |
private void initComponents() {
|
|
118 |
ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager();
|
|
122 | 119 |
|
123 |
this.lstAttributes.setCellRenderer(new AttributesWithAggregateRenderer()); |
|
124 |
this.lstAttributes.addListSelectionListener((ListSelectionEvent e) -> { |
|
120 |
toolsSwingManager.translate(this.btnAttributesFilter); |
|
121 |
toolsSwingManager.translate(this.tabGroup); |
|
122 |
|
|
123 |
this.groupByPanel = new DefaultFeatureAttributesSelectionPanel(); |
|
124 |
this.groupByPanel.allowCalculatedAttributes(true); |
|
125 |
|
|
126 |
this.pnlGroupByAttributes.setLayout(new BorderLayout()); |
|
127 |
this.pnlGroupByAttributes.add(this.groupByPanel, BorderLayout.CENTER); |
|
128 |
|
|
129 |
this.lstAttributes.setCellRenderer(new AttributesWithAggregateRenderer()); |
|
130 |
this.lstAttributes.addListSelectionListener((ListSelectionEvent e) -> { |
|
125 | 131 |
if (e.getValueIsAdjusting()) { |
126 | 132 |
return; |
127 | 133 |
} |
128 | 134 |
doSelectAttribute(); |
129 |
}); |
|
130 |
|
|
131 |
this.cboAggretateFunctions.addActionListener((ActionEvent e) -> { |
|
132 |
doSelectAttribute(); |
|
133 |
}); |
|
135 |
}); |
|
134 | 136 |
|
135 |
this.aggregateFunctionsController = toolsSwingManager.createFilteredListController( |
|
136 |
lstAttributes, |
|
137 |
txtAttributesFilter, |
|
138 |
btnAttributesFilter |
|
139 |
); |
|
140 |
this.aggregateFunctionsController.addChangeListener((ChangeEvent ce) -> { |
|
141 |
doSelectAttribute(); |
|
142 |
}); |
|
143 |
Dimension sz = this.getPreferredSize(); |
|
144 |
if (sz.width < DEFAULT_WIDTH) { |
|
145 |
sz.width = DEFAULT_WIDTH; |
|
137 |
this.cboAggretateFunctions.addActionListener((ActionEvent e) -> { |
|
138 |
doSelectAttribute(); |
|
139 |
}); |
|
140 |
|
|
141 |
this.aggregateFunctionsController = toolsSwingManager.createFilteredListController( |
|
142 |
lstAttributes, |
|
143 |
txtAttributesFilter, |
|
144 |
btnAttributesFilter |
|
145 |
); |
|
146 |
this.aggregateFunctionsController.addChangeListener((ChangeEvent ce) -> { |
|
147 |
doSelectAttribute(); |
|
148 |
}); |
|
149 |
Dimension sz = this.getPreferredSize(); |
|
150 |
if (sz.width < DEFAULT_WIDTH) { |
|
151 |
sz.width = DEFAULT_WIDTH; |
|
152 |
} |
|
153 |
if (sz.height < DEFAULT_HEIGHT) { |
|
154 |
sz.height = DEFAULT_HEIGHT; |
|
155 |
} |
|
156 |
this.setPreferredSize(sz); |
|
146 | 157 |
} |
147 |
if (sz.height < DEFAULT_HEIGHT) { |
|
148 |
sz.height = DEFAULT_HEIGHT; |
|
149 |
} |
|
150 |
this.setPreferredSize(sz); |
|
151 |
} |
|
152 | 158 |
|
153 |
private void doSelectAttribute() { |
|
154 |
String previuos = this.txtCurrentAttributeName.getText(); |
|
155 |
if( !StringUtils.isBlank(previuos) ) { |
|
156 |
String aggregate = (String) this.cboAggretateFunctions.getSelectedItem(); |
|
157 |
if( StringUtils.isBlank(aggregate) || aggregate.equalsIgnoreCase("<NULL>") ) { |
|
158 |
this.query.getAggregateFunctions().remove(previuos); |
|
159 |
} else { |
|
160 |
this.query.getAggregateFunctions().put(previuos, aggregate); |
|
161 |
} |
|
162 |
this.updateControls(); |
|
159 |
private void doSelectAttribute() { |
|
160 |
String previuos = this.txtCurrentAttributeName.getText(); |
|
161 |
if (!StringUtils.isBlank(previuos)) { |
|
162 |
String aggregate = (String) this.cboAggretateFunctions.getSelectedItem(); |
|
163 |
if (StringUtils.isBlank(aggregate) || aggregate.equalsIgnoreCase("<NULL>")) { |
|
164 |
this.query.getAggregateFunctions().remove(previuos); |
|
165 |
} else { |
|
166 |
this.query.getAggregateFunctions().put(previuos, aggregate); |
|
167 |
} |
|
168 |
this.updateControls(); |
|
169 |
} |
|
170 |
|
|
171 |
FeatureAttributeDescriptor attr = (FeatureAttributeDescriptor) this.lstAttributes.getSelectedValue(); |
|
172 |
if (attr == null) { |
|
173 |
return; |
|
174 |
} |
|
175 |
this.txtCurrentAttributeName.setText(attr.getName()); |
|
176 |
String aggregate = this.query.getAggregateFunctions().get(attr.getName()); |
|
177 |
if (StringUtils.isBlank(aggregate) || aggregate.equalsIgnoreCase("<NULL>")) { |
|
178 |
this.cboAggretateFunctions.setSelectedIndex(0); |
|
179 |
} else { |
|
180 |
this.cboAggretateFunctions.setSelectedItem(aggregate); |
|
181 |
} |
|
163 | 182 |
} |
164 |
|
|
165 |
FeatureAttributeDescriptor attr = (FeatureAttributeDescriptor) this.lstAttributes.getSelectedValue(); |
|
166 |
if( attr == null ) { |
|
167 |
return; |
|
168 |
} |
|
169 |
this.txtCurrentAttributeName.setText(attr.getName()); |
|
170 |
String aggregate = this.query.getAggregateFunctions().get(attr.getName()); |
|
171 |
if( StringUtils.isBlank(aggregate) || aggregate.equalsIgnoreCase("<NULL>") ) { |
|
172 |
this.cboAggretateFunctions.setSelectedIndex(0); |
|
173 |
} else { |
|
174 |
this.cboAggretateFunctions.setSelectedItem(aggregate); |
|
175 |
} |
|
176 |
} |
|
177 | 183 |
|
178 |
private void updateControls() { |
|
179 |
int indexAttributes = this.lstAttributes.getSelectedIndex(); |
|
180 |
if( this.cboAggretateFunctions.getModel().getSize() < 1 ) { |
|
181 |
List<String> aggregateFunctions = new ArrayList<>(); |
|
182 |
java.util.function.Function<String, Integer> isAllowed = ((FeatureStoreProviderFactory)(store.getProviderFactory())).allowFunction(); |
|
183 |
ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager(); |
|
184 |
for (SymbolTableFactory factory : manager.getSymbolTableFactories()) { |
|
185 |
if( StringUtils.equalsIgnoreCase(Function.GROUP_AGGREGATE, factory.getName()) ) { |
|
186 |
SymbolTable symbolTable = factory.create(); |
|
187 |
for (Function function : symbolTable) { |
|
188 |
if( isAllowed.apply(function.name())!=DataType.NO ) { |
|
189 |
aggregateFunctions.add(function.name()); |
|
184 |
private void updateControls() { |
|
185 |
int indexAttributes = this.lstAttributes.getSelectedIndex(); |
|
186 |
if (this.cboAggretateFunctions.getModel().getSize() < 1) { |
|
187 |
List<String> aggregateFunctions = new ArrayList<>(); |
|
188 |
java.util.function.Function<String, Integer> isAllowed = ((FeatureStoreProviderFactory) (store.getProviderFactory())).allowFunction(); |
|
189 |
ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager(); |
|
190 |
for (SymbolTableFactory factory : manager.getSymbolTableFactories()) { |
|
191 |
if (StringUtils.equalsIgnoreCase(Function.GROUP_AGGREGATE, factory.getName())) { |
|
192 |
SymbolTable symbolTable = factory.create(); |
|
193 |
for (Function function : symbolTable) { |
|
194 |
if (isAllowed.apply(function.name()) != DataType.NO) { |
|
195 |
aggregateFunctions.add(function.name()); |
|
196 |
} |
|
197 |
} |
|
198 |
break; |
|
199 |
} |
|
190 | 200 |
} |
191 |
} |
|
192 |
break; |
|
201 |
Collections.sort(aggregateFunctions); |
|
202 |
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(); |
|
203 |
model.addElement("<NULL>"); |
|
204 |
for (String functionName : aggregateFunctions) { |
|
205 |
model.addElement(functionName); |
|
206 |
} |
|
207 |
|
|
208 |
this.cboAggretateFunctions.setModel(model); |
|
209 |
this.cboAggretateFunctions.setSelectedIndex(0); |
|
210 |
this.txtCurrentAttributeName.setText(""); |
|
193 | 211 |
} |
194 |
} |
|
195 |
Collections.sort(aggregateFunctions); |
|
196 |
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(); |
|
197 |
model.addElement("<NULL>"); |
|
198 |
for (String functionName : aggregateFunctions) { |
|
199 |
model.addElement(functionName); |
|
200 |
} |
|
201 |
|
|
202 |
this.cboAggretateFunctions.setModel(model); |
|
203 |
this.cboAggretateFunctions.setSelectedIndex(0); |
|
204 |
this.txtCurrentAttributeName.setText(""); |
|
212 |
ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager(); |
|
213 |
FilteredListModel model = toolsSwingManager.createFilteredListModel(); |
|
214 |
for (FeatureAttributeDescriptor attr : featureType) { |
|
215 |
model.addElement(attr); |
|
216 |
} |
|
217 |
for (FeatureAttributeDescriptor attr : featureType.getExtraColumns().getColumns()) { |
|
218 |
model.addElement(attr); |
|
219 |
} |
|
220 |
for (EditableFeatureAttributeDescriptor attr : query.getExtraColumn().getColumns()) { |
|
221 |
model.addElement(attr); |
|
222 |
} |
|
223 |
model.setFilter(this.txtAttributesFilter.getText()); |
|
224 |
model.sort(true); |
|
225 |
this.lstAttributes.setModel(model); |
|
226 |
this.lstAttributes.setSelectedIndex(indexAttributes); |
|
227 |
this.txtCurrentAttributeName.setText(""); |
|
228 |
this.cboAggretateFunctions.setSelectedIndex(0); |
|
229 |
|
|
230 |
// |
|
231 |
//groupByPanel.setSelectedNames(query.getGroupByColumns()); |
|
205 | 232 |
} |
206 |
ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager(); |
|
207 |
FilteredListModel model = toolsSwingManager.createFilteredListModel(); |
|
208 |
for (FeatureAttributeDescriptor attr : featureType) { |
|
209 |
model.addElement(attr); |
|
233 |
|
|
234 |
public Map<String, String> getFixedConversion() { |
|
235 |
// Map<String, String> fixed = new HashMap<>(); |
|
236 |
// ExpressionBuilder builder = ExpressionUtils.createExpressionBuilder(); |
|
237 |
// |
|
238 |
// for (Map.Entry<String, String> aggregate : this.query.getAggregateFunctions().entrySet()) { |
|
239 |
// String key = aggregate.getKey(); |
|
240 |
// String value = aggregate.getValue(); |
|
241 |
// FeatureAttributeDescriptor attr = this.featureType.getAttributeDescriptorFromAll(value); |
|
242 |
// if(attr==null) { |
|
243 |
// attr = this.query.getExtraColumn().get(value); |
|
244 |
// if(attr==null) { |
|
245 |
// fixed.put(key, value); |
|
246 |
// continue; |
|
247 |
// } |
|
248 |
// } |
|
249 |
// if(StringUtils.equalsIgnoreCase(key, "SUM")) { |
|
250 |
// switch (attr.getType()) { |
|
251 |
// case DataTypes.BOOLEAN: |
|
252 |
// case DataTypes.STRING: |
|
253 |
// value = builder.let( |
|
254 |
// attr.getName(), |
|
255 |
// builder.toInteger( |
|
256 |
// builder.variable(attr.getName() |
|
257 |
// ) |
|
258 |
// ) |
|
259 |
// ).toString(); |
|
260 |
// } |
|
261 |
// } |
|
262 |
// fixed.put(key, value); |
|
263 |
// |
|
264 |
// } |
|
265 |
// |
|
266 |
// return fixed; |
|
267 |
return this.query.getAggregateFunctions(); |
|
210 | 268 |
} |
211 |
for (FeatureAttributeDescriptor attr : featureType.getExtraColumns().getColumns()) { |
|
212 |
model.addElement(attr); |
|
269 |
|
|
270 |
@Override |
|
271 |
public FeatureQuery fetch(FeatureQuery query) { |
|
272 |
if (query == null) { |
|
273 |
FeatureQuery q = this.query.getCopy(); |
|
274 |
q.getAggregateFunctions().clear(); |
|
275 |
q.getAggregateFunctions().putAll(getFixedConversion()); |
|
276 |
return q; |
|
277 |
} |
|
278 |
query.getGroupByColumns().clear(); |
|
279 |
query.getGroupByColumns().addAll(this.groupByPanel.getSelectedNames()); |
|
280 |
query.getAggregateFunctions().clear(); |
|
281 |
query.getAggregateFunctions().putAll(getFixedConversion()); |
|
282 |
|
|
283 |
return query; |
|
213 | 284 |
} |
214 |
for (EditableFeatureAttributeDescriptor attr : query.getExtraColumn().getColumns()) { |
|
215 |
model.addElement(attr); |
|
285 |
|
|
286 |
@Override |
|
287 |
public FeatureQuery fetch() { |
|
288 |
return this.fetch(null); |
|
216 | 289 |
} |
217 |
model.setFilter(this.txtAttributesFilter.getText()); |
|
218 |
model.sort(true); |
|
219 |
this.lstAttributes.setModel(model); |
|
220 |
this.lstAttributes.setSelectedIndex(indexAttributes); |
|
221 |
this.txtCurrentAttributeName.setText(""); |
|
222 |
this.cboAggretateFunctions.setSelectedIndex(0); |
|
223 |
|
|
224 |
// |
|
225 |
//groupByPanel.setSelectedNames(query.getGroupByColumns()); |
|
226 |
} |
|
227 | 290 |
|
228 |
@Override |
|
229 |
public FeatureQuery fetch(FeatureQuery query) { |
|
230 |
if( query == null ) { |
|
231 |
return this.query.getCopy(); |
|
291 |
public void removeTypeConversion() { |
|
292 |
Map<String, String> fixed = new HashMap<>(); |
|
293 |
|
|
294 |
for (Map.Entry<String, String> aggregate : this.query.getAggregateFunctions().entrySet()) { |
|
295 |
String key = aggregate.getKey(); |
|
296 |
String value = aggregate.getValue(); |
|
297 |
FeatureAttributeDescriptor attr = this.featureType.getAttributeDescriptorFromAll(value); |
|
298 |
if (attr == null) { |
|
299 |
attr = this.query.getExtraColumn().get(value); |
|
300 |
if (attr == null) { |
|
301 |
switch (key.toLowerCase()) { |
|
302 |
case "sum": |
|
303 |
Code code = ExpressionUtils.compile(value); |
|
304 |
if (code instanceof Code.Callable) { |
|
305 |
Code.Callable callable = (Code.Callable) code; |
|
306 |
switch (callable.name().toLowerCase()) { |
|
307 |
case ExpressionBuilder.FUNCTION_LET: |
|
308 |
value = ((Code.Identifier) callable.parameters().get(0)).name(); |
|
309 |
break; |
|
310 |
} |
|
311 |
} |
|
312 |
break; |
|
313 |
} |
|
314 |
|
|
315 |
} |
|
316 |
} |
|
317 |
|
|
318 |
fixed.put(key, value); |
|
319 |
|
|
320 |
} |
|
321 |
|
|
322 |
query.getAggregateFunctions().clear(); |
|
323 |
query.getAggregateFunctions().putAll(fixed); |
|
324 |
|
|
232 | 325 |
} |
233 |
query.getGroupByColumns().clear(); |
|
234 |
query.getGroupByColumns().addAll(this.groupByPanel.getSelectedNames()); |
|
235 |
query.getAggregateFunctions().clear(); |
|
236 |
query.getAggregateFunctions().putAll(this.query.getAggregateFunctions()); |
|
237 |
|
|
238 |
return query; |
|
239 |
} |
|
240 | 326 |
|
241 |
@Override |
|
242 |
public FeatureQuery fetch() { |
|
243 |
return this.fetch(null); |
|
244 |
} |
|
327 |
@Override |
|
328 |
public void put(FeatureQuery query) { |
|
329 |
this.query.copyFrom(query); |
|
330 |
// removeTypeConversion(); |
|
331 |
groupByPanel.setSelectedNames(query.getGroupByColumns()); |
|
332 |
groupByPanel.setExtraColumns(query.getExtraColumn().getColumns()); |
|
333 |
this.updateControls(); |
|
334 |
} |
|
245 | 335 |
|
246 |
@Override |
|
247 |
public void put(FeatureQuery query) { |
|
248 |
this.query.copyFrom(query); |
|
249 |
groupByPanel.setSelectedNames(query.getGroupByColumns()); |
|
250 |
groupByPanel.setExtraColumns(query.getExtraColumn().getColumns()); |
|
251 |
this.updateControls(); |
|
252 |
} |
|
336 |
public static void selfRegister() { |
|
253 | 337 |
|
254 |
public static void selfRegister() {
|
|
338 |
}
|
|
255 | 339 |
|
256 |
} |
|
257 |
|
|
258 | 340 |
} |
Also available in: Unified diff