Revision 44662
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 | ||
---|---|---|
33 | 33 |
import javax.swing.JTextField; |
34 | 34 |
import javax.swing.ListCellRenderer; |
35 | 35 |
import javax.swing.table.TableModel; |
36 |
import javax.swing.text.JTextComponent; |
|
36 | 37 |
import org.cresques.cts.IProjection; |
37 | 38 |
import org.gvsig.expressionevaluator.swing.ExpressionBuilderConfig; |
39 |
import org.gvsig.expressionevaluator.swing.ExpressionPickerController; |
|
38 | 40 |
import org.gvsig.expressionevaluator.swing.JExpressionBuilder; |
39 | 41 |
import org.gvsig.featureform.swing.CreateJFeatureFormException; |
40 | 42 |
import org.gvsig.featureform.swing.JFeatureForm; |
... | ... | |
108 | 110 |
public FeatureStoreElement createFeatureStoreElement(); |
109 | 111 |
|
110 | 112 |
public FeatureStoreElement createFeatureStoreElement(FeatureStore store); |
113 |
|
|
114 |
public ExpressionPickerController createExpressionPickerController(FeatureStore store, JTextComponent text, JButton button); |
|
111 | 115 |
|
112 | 116 |
public FeatureStoreSearchPanel createFeatureStoreSearchPanel(FeatureStore store); |
113 | 117 |
|
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 | ||
---|---|---|
36 | 36 |
import javax.swing.JTextField; |
37 | 37 |
import javax.swing.ListCellRenderer; |
38 | 38 |
import javax.swing.table.TableModel; |
39 |
import javax.swing.text.JTextComponent; |
|
39 | 40 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
40 | 41 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
42 |
import org.gvsig.expressionevaluator.swing.ExpressionPickerController; |
|
41 | 43 |
import org.gvsig.expressionevaluator.swing.JExpressionBuilder; |
42 | 44 |
import org.gvsig.featureform.swing.CreateJFeatureFormException; |
43 | 45 |
import org.gvsig.featureform.swing.JFeatureForm; |
... | ... | |
286 | 288 |
} |
287 | 289 |
|
288 | 290 |
@Override |
291 |
public ExpressionPickerController createExpressionPickerController(FeatureStore store, JTextComponent text, JButton button) { |
|
292 |
FeatureSymbolTable previewSymbolTable = DALLocator.getManager().createFeatureSymbolTable(); |
|
293 |
previewSymbolTable.setFeature(store.getSampleFeature()); |
|
294 |
|
|
295 |
ExpressionPickerController controller = ExpressionEvaluatorSwingLocator.getManager().createExpressionPickerController(text, button); |
|
296 |
controller.addElement(this.createFeatureStoreElement(store)); |
|
297 |
controller.setPreviewSymbolTable(previewSymbolTable); |
|
298 |
|
|
299 |
return controller; |
|
300 |
} |
|
301 |
|
|
302 |
|
|
303 |
@Override |
|
289 | 304 |
public FeatureStoreSearchPanel createFeatureStoreSearchPanel(FeatureStore store) { |
290 | 305 |
DefaultSearchPanel e = new DefaultSearchPanel(store); |
291 | 306 |
return e; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/label/FeatureDependentLabeled.java | ||
---|---|---|
197 | 197 |
*/ |
198 | 198 |
String sql_str = lc.getSQLQuery(); |
199 | 199 |
if (! LabelClassUtils.validExpression(sql_str, fsto, true)) { |
200 |
logger.error("SQL for labeling exists but is not valid: " + sql_str);
|
|
200 |
logger.warn("SQL for labeling exists but is not valid: " + sql_str);
|
|
201 | 201 |
} |
202 | 202 |
|
203 | 203 |
Evaluator eval = EvaluatorCreator.getEvaluator(sql_str); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/lang/EvaluatorCreator.java | ||
---|---|---|
1 | 1 |
package org.gvsig.labeling.lang; |
2 | 2 |
|
3 |
import java.util.HashMap; |
|
4 |
import java.util.Iterator; |
|
5 | 3 |
import java.util.Map; |
4 |
import org.apache.commons.collections.map.LRUMap; |
|
5 |
import org.gvsig.fmap.dal.DALLocator; |
|
6 | 6 |
|
7 | 7 |
import org.gvsig.tools.evaluator.EvaluatorWithDescriptions; |
8 |
import org.gvsig.tools.evaluator.sqljep.SQLJEPEvaluator; |
|
9 | 8 |
|
10 | 9 |
|
11 | 10 |
/** |
12 | 11 |
* |
13 | 12 |
* Utility class to centralize the creation of an |
14 | 13 |
* @link {@link EvaluatorWithDescriptions} |
15 |
* |
|
16 |
* TODO Perhaps create a manager in Tools to perform this operation |
|
17 |
* |
|
18 |
* @author jldominguez |
|
19 |
* |
|
20 | 14 |
*/ |
21 | 15 |
public class EvaluatorCreator { |
22 | 16 |
|
23 |
private static Map<String, EvaluatorWithDescriptions> evCache = |
|
24 |
new HashMap<String, EvaluatorWithDescriptions>(); |
|
17 |
private static final Map<String, EvaluatorWithDescriptions> EVALUATORS_CACHE = new LRUMap(100); |
|
25 | 18 |
|
26 | 19 |
/** |
27 | 20 |
* Create an {@link EvaluatorWithDescriptions} that uses |
... | ... | |
31 | 24 |
* @return |
32 | 25 |
*/ |
33 | 26 |
public static EvaluatorWithDescriptions getEvaluator(String expr) { |
34 |
|
|
35 |
EvaluatorWithDescriptions resp = evCache.get(expr); |
|
27 |
EvaluatorWithDescriptions resp = EVALUATORS_CACHE.get(expr); |
|
36 | 28 |
if (resp == null) { |
37 |
resp = new SQLJEPEvaluator(expr); |
|
38 |
if (evCache.size() > 100) { |
|
39 |
removeOne(evCache); |
|
40 |
} |
|
41 |
evCache.put(expr, resp); |
|
29 |
try { |
|
30 |
resp = (EvaluatorWithDescriptions) DALLocator.getDataManager().createFilter(expr); |
|
31 |
} catch (Exception ex) { |
|
32 |
throw new RuntimeException("Can't create evaluator for '"+expr+"'.", ex); |
|
33 |
} |
|
34 |
EVALUATORS_CACHE.put(expr, resp); |
|
42 | 35 |
} |
43 | 36 |
return resp; |
44 | 37 |
} |
45 | 38 |
|
46 |
private static void removeOne( |
|
47 |
Map<String, EvaluatorWithDescriptions> themap) { |
|
48 |
|
|
49 |
Iterator<String> iter = themap.keySet().iterator(); |
|
50 |
int count = 50; |
|
51 |
String k = null; |
|
52 |
while (iter.hasNext() && count > 0) { |
|
53 |
k = iter.next(); |
|
54 |
count--; |
|
55 |
} |
|
56 |
themap.remove(k); |
|
57 |
} |
|
58 |
|
|
59 | 39 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/lang/LabelClassUtils.java | ||
---|---|---|
90 | 90 |
try { |
91 | 91 |
dummyfeat = sto.createNewFeature(true); |
92 | 92 |
} catch (DataException e1) { |
93 |
logger.error("While getting dummy feature in labeling expression.", e1);
|
|
93 |
logger.warn("While getting dummy feature in labeling expression.", e1);
|
|
94 | 94 |
return false; |
95 | 95 |
} |
96 | 96 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/gui/layerproperties/LabelExpressionEditorPanel.java | ||
---|---|---|
1 |
package org.gvsig.labeling.gui.layerproperties; |
|
2 |
|
|
3 |
import java.awt.Component; |
|
4 |
import java.awt.GridBagConstraints; |
|
5 |
import java.awt.GridBagLayout; |
|
6 |
import java.awt.Insets; |
|
7 |
import java.awt.event.ActionEvent; |
|
8 |
import java.awt.event.ActionListener; |
|
9 |
import java.awt.event.MouseEvent; |
|
10 |
import java.awt.event.MouseListener; |
|
11 |
|
|
12 |
import javax.swing.BorderFactory; |
|
13 |
import javax.swing.JButton; |
|
14 |
import javax.swing.JList; |
|
15 |
import javax.swing.JPanel; |
|
16 |
import javax.swing.JScrollPane; |
|
17 |
import javax.swing.JTextArea; |
|
18 |
import javax.swing.ScrollPaneConstants; |
|
19 |
|
|
20 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
21 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
22 |
import org.gvsig.app.ApplicationLocator; |
|
23 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
24 |
import org.gvsig.i18n.Messages; |
|
25 |
|
|
26 |
public class LabelExpressionEditorPanel extends JPanel implements |
|
27 |
IWindow, ActionListener, MouseListener { |
|
28 |
private static final String CANCEL_ACTION = "CANCEL"; |
|
29 |
private static final String ACCEPT_ACTION = "ACCEPT"; |
|
30 |
private static final String ADDFIELD_ACTION = "ADD_FIELD"; |
|
31 |
private String originalValue; |
|
32 |
private String value; |
|
33 |
private WindowInfo wInfo = null; |
|
34 |
private String[] fieldNames; |
|
35 |
private int[] fieldTypes; |
|
36 |
private JButton botCancel; |
|
37 |
private JButton botAccept; |
|
38 |
private JButton botAddField; |
|
39 |
private JScrollPane spExpression; |
|
40 |
private JTextArea txtExpression; |
|
41 |
private JScrollPane spFieldList; |
|
42 |
private JList lstFields; |
|
43 |
|
|
44 |
public LabelExpressionEditorPanel(FeatureAttributeDescriptor[] atts) { |
|
45 |
super(); |
|
46 |
|
|
47 |
int n = atts.length; |
|
48 |
this.fieldNames = new String[n]; |
|
49 |
this.fieldTypes = new int[n]; |
|
50 |
for (int i=0; i<n; i++) { |
|
51 |
this.fieldNames[i] = atts[i].getName(); |
|
52 |
this.fieldTypes[i] = atts[i].getType(); |
|
53 |
} |
|
54 |
initialize(); |
|
55 |
} |
|
56 |
|
|
57 |
private void initialize() { |
|
58 |
this.setLayout(new GridBagLayout()); |
|
59 |
|
|
60 |
GridBagConstraints baseConst = new GridBagConstraints(); |
|
61 |
baseConst.ipadx = 2; |
|
62 |
baseConst.ipady = 2; |
|
63 |
baseConst.anchor = baseConst.CENTER; |
|
64 |
baseConst.insets = new Insets(2,2,2,2); |
|
65 |
|
|
66 |
GridBagConstraints con; |
|
67 |
|
|
68 |
con = (GridBagConstraints) baseConst.clone(); |
|
69 |
|
|
70 |
con.gridx = 0; |
|
71 |
con.gridy = 0; |
|
72 |
con.gridheight = 3; |
|
73 |
con.gridwidth = 2; |
|
74 |
con.fill = con.BOTH; |
|
75 |
con.weightx = 1; |
|
76 |
con.weighty = 1; |
|
77 |
this.add(getFieldListComposition(), con); |
|
78 |
|
|
79 |
con = (GridBagConstraints) baseConst.clone(); |
|
80 |
con.gridx = 2; |
|
81 |
con.gridy = 2; |
|
82 |
con.fill = con.NONE; |
|
83 |
this.add(getBotAddField(), con); |
|
84 |
|
|
85 |
con.gridx = 0; |
|
86 |
con.gridy = 3; |
|
87 |
con.gridheight = 4; |
|
88 |
con.gridwidth = 5; |
|
89 |
con.fill = con.BOTH; |
|
90 |
con.weightx = 1; |
|
91 |
con.weighty = 1; |
|
92 |
this.add(getExpressionComposition(), con); |
|
93 |
|
|
94 |
con = (GridBagConstraints) baseConst.clone(); |
|
95 |
con.gridx = 3; |
|
96 |
con.gridy = 8; |
|
97 |
con.fill = con.NONE; |
|
98 |
this.add(getBotAccept(), con); |
|
99 |
|
|
100 |
con = (GridBagConstraints) baseConst.clone(); |
|
101 |
con.gridx = 4; |
|
102 |
con.gridy = 8; |
|
103 |
con.fill = con.NONE; |
|
104 |
this.add(getBotCancel(), con); |
|
105 |
|
|
106 |
} |
|
107 |
|
|
108 |
private JButton getBotCancel() { |
|
109 |
if (botCancel == null) { |
|
110 |
|
|
111 |
botCancel = new JButton(Messages.getText("cancel")); |
|
112 |
botCancel.setActionCommand(CANCEL_ACTION); |
|
113 |
botCancel.addActionListener(this); |
|
114 |
} |
|
115 |
return botCancel; |
|
116 |
} |
|
117 |
|
|
118 |
private JButton getBotAccept() { |
|
119 |
if (botAccept == null) { |
|
120 |
botAccept = new JButton(Messages.getText("accept")); |
|
121 |
botAccept.setActionCommand(ACCEPT_ACTION); |
|
122 |
botAccept.addActionListener(this); |
|
123 |
} |
|
124 |
return botAccept; |
|
125 |
|
|
126 |
} |
|
127 |
|
|
128 |
private Component getExpressionComposition() { |
|
129 |
if (spExpression == null) { |
|
130 |
spExpression = new JScrollPane(); |
|
131 |
spExpression.setViewportView(getTxtExpression()); |
|
132 |
spExpression.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); |
|
133 |
spExpression.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
134 |
spExpression |
|
135 |
.setBorder(BorderFactory.createTitledBorder( |
|
136 |
Messages.getText("expression"))); |
|
137 |
} |
|
138 |
return spExpression; |
|
139 |
} |
|
140 |
|
|
141 |
private JTextArea getTxtExpression() { |
|
142 |
if (txtExpression == null){ |
|
143 |
txtExpression = new JTextArea(); |
|
144 |
} |
|
145 |
return txtExpression; |
|
146 |
} |
|
147 |
|
|
148 |
public void setExpression(String expr){ |
|
149 |
this.getTxtExpression().setText(expr); |
|
150 |
} |
|
151 |
|
|
152 |
public String getExpression(){ |
|
153 |
return this.getTxtExpression().getText(); |
|
154 |
} |
|
155 |
|
|
156 |
private JButton getBotAddField() { |
|
157 |
if (botAddField == null) { |
|
158 |
botAddField = new JButton(Messages.getText("add_field")); |
|
159 |
botAddField.setActionCommand(ADDFIELD_ACTION); |
|
160 |
botAddField.addActionListener(this); |
|
161 |
} |
|
162 |
return botAddField; |
|
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
private Component getFieldListComposition() { |
|
167 |
if (spFieldList == null){ |
|
168 |
spFieldList = new JScrollPane(); |
|
169 |
spFieldList.setViewportView(getLstFields()); |
|
170 |
spFieldList.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); |
|
171 |
spFieldList.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
172 |
spFieldList |
|
173 |
.setBorder(BorderFactory.createTitledBorder( |
|
174 |
Messages.getText("fields"))); |
|
175 |
|
|
176 |
} |
|
177 |
return spFieldList; |
|
178 |
} |
|
179 |
|
|
180 |
private JList getLstFields() { |
|
181 |
if (lstFields == null){ |
|
182 |
lstFields = new JList(this.fieldNames); |
|
183 |
lstFields.addMouseListener(this); |
|
184 |
} |
|
185 |
return lstFields; |
|
186 |
} |
|
187 |
|
|
188 |
public WindowInfo getWindowInfo() { |
|
189 |
if (wInfo == null) { |
|
190 |
wInfo = new WindowInfo(WindowInfo.RESIZABLE |
|
191 |
+ WindowInfo.MODALDIALOG); |
|
192 |
wInfo.setWidth(500); |
|
193 |
wInfo.setHeight(400); |
|
194 |
wInfo.setTitle(Messages.getText("expression")); |
|
195 |
} |
|
196 |
return wInfo; |
|
197 |
} |
|
198 |
|
|
199 |
public Object getWindowProfile() { |
|
200 |
return WindowInfo.EDITOR_PROFILE; |
|
201 |
} |
|
202 |
|
|
203 |
public void setValue(String value) { |
|
204 |
this.originalValue = value; |
|
205 |
this.value = value; |
|
206 |
this.setExpression(value); |
|
207 |
} |
|
208 |
|
|
209 |
public String getValue() { |
|
210 |
return this.value; |
|
211 |
} |
|
212 |
|
|
213 |
public void actionPerformed(ActionEvent e) { |
|
214 |
doAction(e.getActionCommand()); |
|
215 |
} |
|
216 |
|
|
217 |
private void doAction(String action){ |
|
218 |
if (action.equals(ADDFIELD_ACTION)){ |
|
219 |
JTextArea txt = getTxtExpression(); |
|
220 |
StringBuffer strb = new StringBuffer(); |
|
221 |
String str = txt.getText(); |
|
222 |
int sini = txt.getSelectionStart(); |
|
223 |
int send = txt.getSelectionEnd(); |
|
224 |
if (sini > 0){ |
|
225 |
strb.append(str.substring(0, sini)); |
|
226 |
str = str.substring(sini); |
|
227 |
} |
|
228 |
// strb.append('['); |
|
229 |
strb.append((String)getLstFields().getSelectedValue()); |
|
230 |
// strb.append(']'); |
|
231 |
send = send -sini; |
|
232 |
if (send > 0){ |
|
233 |
str = str.substring(send); |
|
234 |
} |
|
235 |
strb.append(str); |
|
236 |
|
|
237 |
getTxtExpression().setText(strb.toString()); |
|
238 |
|
|
239 |
} else { |
|
240 |
// Accept or cancel |
|
241 |
if (action.equals(ACCEPT_ACTION)){ |
|
242 |
this.value = getExpression(); |
|
243 |
} else { |
|
244 |
this.value = this.originalValue; |
|
245 |
} |
|
246 |
ApplicationLocator.getManager().getUIManager().closeWindow(this); |
|
247 |
} |
|
248 |
} |
|
249 |
|
|
250 |
public void mouseClicked(MouseEvent e) { |
|
251 |
if (e.getSource() == getLstFields()){ |
|
252 |
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1){ |
|
253 |
doAction(ADDFIELD_ACTION); |
|
254 |
} |
|
255 |
} |
|
256 |
|
|
257 |
|
|
258 |
} |
|
259 |
|
|
260 |
public void mouseEntered(MouseEvent e) { |
|
261 |
// Do nothing |
|
262 |
|
|
263 |
} |
|
264 |
|
|
265 |
public void mouseExited(MouseEvent e) { |
|
266 |
// Do nothing |
|
267 |
} |
|
268 |
|
|
269 |
public void mousePressed(MouseEvent e) { |
|
270 |
// Do nothing |
|
271 |
|
|
272 |
} |
|
273 |
|
|
274 |
public void mouseReleased(MouseEvent e) { |
|
275 |
// Do nothing |
|
276 |
|
|
277 |
} |
|
278 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/gui/layerproperties/LabelClassProperties.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
|
1 |
/* gvSIG. Desktop Geographic Information System.
|
|
2 | 2 |
* |
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
|
3 |
* Copyright ? 2007-2019 gvSIG Association
|
|
4 | 4 |
* |
5 | 5 |
* This program is free software; you can redistribute it and/or |
6 | 6 |
* modify it under the terms of the GNU General Public License |
... | ... | |
14 | 14 |
* |
15 | 15 |
* You should have received a copy of the GNU General Public License |
16 | 16 |
* along with this program; if not, write to the Free Software |
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
18 | 19 |
* |
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
40 | 22 |
*/ |
41 | 23 |
package org.gvsig.labeling.gui.layerproperties; |
42 | 24 |
|
43 | 25 |
import java.awt.*; |
44 | 26 |
import java.awt.event.ActionEvent; |
45 | 27 |
import java.awt.event.ActionListener; |
46 |
import java.util.logging.Level; |
|
47 | 28 |
|
48 | 29 |
import javax.swing.AbstractCellEditor; |
49 | 30 |
import javax.swing.BorderFactory; |
... | ... | |
70 | 51 |
import org.gvsig.app.gui.styling.SingleStyleSelectorFilter; |
71 | 52 |
import org.gvsig.app.gui.styling.StylePreviewer; |
72 | 53 |
import org.gvsig.app.gui.styling.StyleSelector; |
54 |
import org.gvsig.expressionevaluator.swing.ExpressionPickerController; |
|
73 | 55 |
import org.gvsig.fmap.dal.exception.DataException; |
74 | 56 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
75 | 57 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
76 | 58 |
import org.gvsig.fmap.dal.feature.FeatureType; |
59 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
77 | 60 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass; |
78 | 61 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol; |
79 | 62 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle; |
... | ... | |
86 | 69 |
import org.gvsig.tools.ToolsLocator; |
87 | 70 |
import org.gvsig.tools.i18n.I18nManager; |
88 | 71 |
|
89 |
import org.jfree.chart.block.EmptyBlock; |
|
90 | 72 |
import org.slf4j.Logger; |
91 | 73 |
import org.slf4j.LoggerFactory; |
92 | 74 |
|
... | ... | |
131 | 113 |
private JButton btnDontUseStyle; |
132 | 114 |
private boolean accepted = true; |
133 | 115 |
private AcceptCancelPanel acceptCancelPanel; |
116 |
private JButton btnSQLBuilder; |
|
117 |
private ExpressionPickerController pickerSQL; |
|
134 | 118 |
|
135 | 119 |
/** |
136 | 120 |
* <p> |
... | ... | |
199 | 183 |
// aux.setBorder(BorderFactory.createTitledBorder(PluginServices.getText( |
200 | 184 |
// this, "features"))); |
201 | 185 |
rdBtnAllFeatures = new JRadioButton(Messages.getText("all_features")); |
202 |
rdBtnFilteredFeatures = new JRadioButton(Messages.getText("filtered_features").concat(" (SQL GDBMS)"));
|
|
186 |
rdBtnFilteredFeatures = new JRadioButton(Messages.getText("filtered_features")); |
|
203 | 187 |
|
204 | 188 |
|
205 | 189 |
ButtonGroup g = new ButtonGroup(); |
... | ... | |
215 | 199 |
aux.addComponent("", rdBtnFilteredFeatures); |
216 | 200 |
|
217 | 201 |
sqlPnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
218 |
sqlPnl.add(new JLabel(" SQL: SELECT * FROM ")); |
|
219 |
sqlPnl.add(new JLabel("<" + Messages.getText("layer_name") |
|
220 |
+ ">")); |
|
221 |
sqlPnl.add(new JLabel(" WHERE ")); |
|
222 |
sqlPnl.add(txtSQL = new JTextField(30)); |
|
223 |
sqlPnl.add(new JLabel(";")); |
|
202 |
txtSQL = new JTextField(30); |
|
203 |
btnSQLBuilder = new JButton("..."); |
|
204 |
sqlPnl.add(txtSQL); |
|
205 |
sqlPnl.add(btnSQLBuilder); |
|
206 |
pickerSQL = DALSwingLocator.getManager().createExpressionPickerController( |
|
207 |
featureStore, |
|
208 |
txtSQL, |
|
209 |
btnSQLBuilder |
|
210 |
); |
|
211 |
|
|
212 |
|
|
224 | 213 |
aux.addComponent("", sqlPnl); |
225 | 214 |
|
226 | 215 |
JPanel auxPanel = new JPanel(new BorderLayout()); |
... | ... | |
443 | 432 |
ApplicationLocator.getManager().getUIManager().addWindow(this); |
444 | 433 |
} |
445 | 434 |
|
446 |
private class DefaultEditor extends AbstractCellEditor implements |
|
447 |
TableCellEditor, ActionListener { |
|
435 |
private class DefaultEditor |
|
436 |
extends AbstractCellEditor |
|
437 |
implements TableCellEditor |
|
438 |
{ |
|
439 |
private final JPanel editor; |
|
440 |
private final JTextField text; |
|
441 |
private final JButton button; |
|
442 |
private final ExpressionPickerController pickerExpression; |
|
448 | 443 |
|
449 |
JPanel editor; |
|
450 |
LabelExpressionEditorPanel dialog; |
|
451 |
private JTextField text; |
|
452 |
private JButton button; |
|
453 |
protected static final String EDIT = "edit"; |
|
454 |
|
|
455 | 444 |
public DefaultEditor(FeatureAttributeDescriptor[] atts) { |
456 | 445 |
editor = new JPanel(); |
457 | 446 |
editor.setLayout(new GridBagLayout()); |
458 | 447 |
GridBagConstraints cons = new GridBagConstraints(); |
459 |
// cons.anchor = GridBagConstraints.FIRST_LINE_START; |
|
460 |
cons.fill = cons.BOTH; |
|
448 |
cons.fill = GridBagConstraints.BOTH; |
|
461 | 449 |
cons.weightx=1.0; |
462 | 450 |
cons.weighty =1.0; |
463 | 451 |
text = new JTextField(); |
464 | 452 |
editor.add(text, cons); |
465 | 453 |
|
466 | 454 |
GridBagConstraints cons1 = new GridBagConstraints(); |
467 |
// cons.anchor = GridBagConstraints.FIRST_LINE_END; |
|
468 |
cons1.fill = cons1.VERTICAL; |
|
455 |
cons1.fill = GridBagConstraints.VERTICAL; |
|
469 | 456 |
cons1.weighty =1.0; |
470 |
// cons.gridheight = GridBagConstraints.REMAINDER; |
|
471 | 457 |
button = new JButton("..."); |
472 |
button.setActionCommand(DefaultEditor.EDIT); |
|
473 |
button.addActionListener(this); |
|
474 | 458 |
editor.add(button,cons1); |
459 |
|
|
460 |
this.pickerExpression = DALSwingLocator.getManager().createExpressionPickerController( |
|
461 |
featureStore, |
|
462 |
text, |
|
463 |
button |
|
464 |
); |
|
475 | 465 |
|
476 | 466 |
editor.updateUI(); |
477 |
|
|
478 |
// Set up the dialog that the button brings up. |
|
479 |
dialog = new LabelExpressionEditorPanel(atts); |
|
480 | 467 |
} |
481 | 468 |
|
482 |
public void actionPerformed(ActionEvent e) { |
|
483 |
if (EDIT.equals(e.getActionCommand())) { |
|
484 |
|
|
485 |
dialog.setValue(text.getText()); |
|
486 |
ApplicationLocator.getManager().getUIManager().addWindow(dialog); |
|
487 |
//fireEditingStopped(); // Make the renderer reappear. |
|
488 |
text.setText(dialog.getValue()); |
|
489 |
} |
|
490 |
} |
|
491 |
|
|
492 | 469 |
// Implement the one CellEditor method that AbstractCellEditor doesn't. |
493 | 470 |
public Object getCellEditorValue() { |
494 | 471 |
return text.getText(); |
Also available in: Unified diff