Revision 44662 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
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