Revision 19379
trunk/extensions/extSymbology/config/config.xml | ||
---|---|---|
5 | 5 |
<resourceBundle name="text"/> |
6 | 6 |
<extensions> |
7 | 7 |
<extension class-name="org.gvsig.symbology.ExtendedSymbologyExtension" |
8 |
description="Enables the extended symbology (available since v1.2)."
|
|
8 |
description="Enables the extended symbology (available since v2.0)."
|
|
9 | 9 |
active="true" |
10 | 10 |
priority="20"> |
11 | 11 |
</extension> |
12 |
<extension class-name="org.gvsig.symbology.SingleLabelingExtension" |
|
13 |
description="Extension for show and customize labels that will |
|
14 |
pop up over the feature that is clicked over |
|
15 |
(available since v2.0)." |
|
16 |
active="true" |
|
17 |
priority="20"> |
|
18 |
<menu text="Capa/single_labeling_setup" action-command="SINGLE_LABELING_SETUP" |
|
19 |
position="8"/> |
|
20 |
<tool-bar name="Tools_Select" position="31"> |
|
21 |
<action-tool name="single labeling tool" icon="single-labeling-tool" action-command="SINGLE_LABELING_TOOL" tooltip="single_labeling" group="Capa" position="20"/> |
|
22 |
</tool-bar> |
|
23 |
</extension> |
|
12 | 24 |
</extensions> |
13 | 25 |
</plugin-config> |
trunk/extensions/extSymbology/src/org/gvsig/symbology/fmap/symbols/I3DChartSymbol.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
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. |
|
18 |
* |
|
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 |
|
40 |
*/ |
|
41 |
package org.gvsig.symbology.fmap.symbols; |
|
42 |
|
|
43 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
44 |
|
|
45 |
public interface I3DChartSymbol extends ISymbol { |
|
46 |
public boolean displayIn3D(); |
|
47 |
public double getDepth(); |
|
48 |
|
|
49 |
} |
trunk/extensions/extSymbology/src/org/gvsig/symbology/fmap/symbols/IChartSymbol.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
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. |
|
18 |
* |
|
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 |
|
40 |
*/ |
|
41 |
package org.gvsig.symbology.fmap.symbols; |
|
42 |
|
|
43 |
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol; |
|
44 |
|
|
45 |
public interface IChartSymbol extends IMarkerSymbol { |
|
46 |
public abstract double getMaxValue(); |
|
47 |
|
|
48 |
public abstract void setMaxValue(); |
|
49 |
|
|
50 |
} |
trunk/extensions/extSymbology/src/org/gvsig/symbology/fmap/labeling/placements/AbstractPlacementConstraints.java | ||
---|---|---|
108 | 108 |
// UPDATE clone() METHOD WHEN ADDING FIELDS |
109 | 109 |
|
110 | 110 |
|
111 |
|
|
111 | 112 |
public void setDuplicateLabelsMode(int mode) { |
112 | 113 |
if (mode != REMOVE_DUPLICATE_LABELS && |
113 | 114 |
mode != ONE_LABEL_PER_FEATURE && |
trunk/extensions/extSymbology/src/org/gvsig/symbology/fmap/labeling/GeneralLabelingStrategy.java | ||
---|---|---|
124 | 124 |
import org.gvsig.symbology.fmap.labeling.parse.LabelExpressionParser; |
125 | 125 |
import org.gvsig.symbology.fmap.labeling.parse.ParseException; |
126 | 126 |
import org.gvsig.symbology.fmap.labeling.placements.ILabelPlacement; |
127 |
import org.gvsig.symbology.fmap.labeling.placements.LinePlacementAtBest; |
|
127 | 128 |
import org.gvsig.symbology.fmap.labeling.placements.RemoveDuplicatesComparator; |
128 | 129 |
|
129 | 130 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
... | ... | |
190 | 191 |
ILabelPlacement placement = PlacementManager.getPlacement(getPlacementConstraints(), layer.getShapeType()); |
191 | 192 |
|
192 | 193 |
/* handle the duplicates mode */ |
193 |
int duplicateMode = getPlacementConstraints().getDuplicateLabelsMode();
|
|
194 |
int duplicateMode = getDuplicateLabelsMode(); |
|
194 | 195 |
|
195 | 196 |
/* |
196 | 197 |
* get an ordered set of the LabelClasses up on the |
... | ... | |
308 | 309 |
} |
309 | 310 |
|
310 | 311 |
|
312 |
private int getDuplicateLabelsMode() { |
|
313 |
if (getPlacementConstraints() == null) { |
|
314 |
return IPlacementConstraints.DefaultDuplicateLabelsMode; |
|
315 |
} |
|
316 |
return getPlacementConstraints().getDuplicateLabelsMode(); |
|
317 |
} |
|
318 |
|
|
311 | 319 |
private boolean lookupAndPlaceLabel(BufferedImage[] bis, Graphics2D g, ArrayList<LabelLocationMetrics> llm, ILabelPlacement placement, LabelClass lc, IGeometry geom, ViewPort viewPort, Cancellable cancel, boolean bLabelsReallocatable) { |
312 | 320 |
int i; |
313 | 321 |
for (i = 0; !cancel.isCanceled() && i < llm.size(); i++) { |
trunk/extensions/extSymbology/src/org/gvsig/symbology/gui/SingleLabelingConfigPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
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. |
|
18 |
* |
|
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 |
|
40 |
*/ |
|
41 |
package org.gvsig.symbology.gui; |
|
42 |
|
|
43 |
import java.awt.BorderLayout; |
|
44 |
import java.awt.Color; |
|
45 |
|
|
46 |
import javax.swing.BorderFactory; |
|
47 |
import javax.swing.JPanel; |
|
48 |
|
|
49 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
50 |
import org.gvsig.symbology.gui.styling.LabelClassRenderingProperties; |
|
51 |
|
|
52 |
import com.iver.andami.PluginServices; |
|
53 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
54 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
55 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelClass; |
|
56 |
|
|
57 |
public class SingleLabelingConfigPanel extends JPanel implements IWindow { |
|
58 |
private static LabelClass TheLabelUsed; |
|
59 |
private LabelClassRenderingProperties properties; |
|
60 |
private WindowInfo wii; |
|
61 |
|
|
62 |
public SingleLabelingConfigPanel() { |
|
63 |
setLayout(new BorderLayout(5, 15)); |
|
64 |
add(properties = new LabelClassRenderingProperties(), BorderLayout.CENTER); |
|
65 |
properties.setBorder(BorderFactory.createLineBorder(Color.red)); |
|
66 |
add(new AcceptCancelPanel(), BorderLayout.SOUTH); |
|
67 |
} |
|
68 |
|
|
69 |
|
|
70 |
public WindowInfo getWindowInfo() { |
|
71 |
if (wii == null) { |
|
72 |
wii = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE); |
|
73 |
wii.setTitle(PluginServices.getText(this, "simple_labeling")); |
|
74 |
wii.setWidth(630); |
|
75 |
wii.setHeight(400); |
|
76 |
} |
|
77 |
return wii; |
|
78 |
} |
|
79 |
|
|
80 |
} |
trunk/extensions/extSymbology/src/org/gvsig/symbology/gui/layerproperties/GeneralLabeling.java | ||
---|---|---|
44 | 44 |
import java.awt.Component; |
45 | 45 |
import java.awt.Dimension; |
46 | 46 |
import java.awt.FlowLayout; |
47 |
import java.awt.Font; |
|
48 |
import java.awt.GridLayout; |
|
49 | 47 |
import java.awt.event.ActionEvent; |
50 | 48 |
import java.awt.event.ActionListener; |
51 | 49 |
import java.awt.event.MouseAdapter; |
52 | 50 |
import java.awt.event.MouseEvent; |
53 | 51 |
import java.util.ArrayList; |
54 |
import java.util.Comparator; |
|
55 | 52 |
import java.util.Hashtable; |
56 | 53 |
import java.util.Iterator; |
57 | 54 |
import java.util.TreeSet; |
... | ... | |
63 | 60 |
import javax.swing.JOptionPane; |
64 | 61 |
import javax.swing.JPanel; |
65 | 62 |
import javax.swing.JScrollPane; |
66 |
import javax.swing.JTextField; |
|
67 | 63 |
|
68 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
69 | 64 |
import org.gvsig.gui.beans.controls.dnd.JDnDList; |
70 | 65 |
import org.gvsig.gui.beans.controls.dnd.JDnDListModel; |
71 | 66 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
... | ... | |
73 | 68 |
import org.gvsig.gui.beans.swing.JButton; |
74 | 69 |
import org.gvsig.symbology.fmap.labeling.GeneralLabelingStrategy; |
75 | 70 |
import org.gvsig.symbology.fmap.labeling.LabelClassComparatorByPriority; |
71 |
import org.gvsig.symbology.gui.styling.LabelClassRenderingProperties; |
|
76 | 72 |
|
77 | 73 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
78 | 74 |
import com.iver.andami.PluginServices; |
79 | 75 |
import com.iver.andami.messages.NotificationManager; |
80 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
81 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
82 |
import com.iver.cit.gvsig.fmap.core.CartographicSupport; |
|
83 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
84 |
import com.iver.cit.gvsig.fmap.core.styles.ILabelStyle; |
|
85 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
86 |
import com.iver.cit.gvsig.fmap.core.symbols.ITextSymbol; |
|
87 | 76 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
88 | 77 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
89 | 78 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.ILabelingMethod; |
... | ... | |
92 | 81 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.IZoomConstraints; |
93 | 82 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelClass; |
94 | 83 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelingFactory; |
95 |
import com.iver.cit.gvsig.gui.styling.SelectorFilter; |
|
96 |
import com.iver.cit.gvsig.gui.styling.StyleSelector; |
|
97 |
import com.iver.cit.gvsig.gui.styling.SymbolPreviewer; |
|
98 |
import com.iver.cit.gvsig.gui.styling.SymbolSelector; |
|
99 |
import com.iver.cit.gvsig.gui.utils.FontChooser; |
|
100 | 84 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.ILabelingStrategyPanel; |
101 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.ISymbolSelector; |
|
102 | 85 |
import com.iver.utiles.swing.JComboBox; |
103 | 86 |
|
104 | 87 |
public class GeneralLabeling extends JPanel implements ILabelingStrategyPanel, ActionListener { |
88 |
private static final long serialVersionUID = 8864709758980903351L; |
|
105 | 89 |
private static Hashtable<String, Class> methods = new Hashtable<String, Class>(); |
106 | 90 |
private static int newClassSuffix = 0; |
107 | 91 |
private JButton btnVisualization; |
... | ... | |
109 | 93 |
private JButton btnSQLQuery; |
110 | 94 |
private JButton btnDelClass; |
111 | 95 |
private JButton btnAddClass; |
112 |
private JComboBox cmbExpressions; |
|
113 |
private JButton btnEditExpression; |
|
114 |
private SymbolPreviewer previewer; |
|
115 |
private JButton btnFont; |
|
96 |
// private JComboBox cmbExpressions;
|
|
97 |
// private JButton btnEditExpression;
|
|
98 |
// private SymbolPreviewer previewer;
|
|
99 |
// private JButton btnFont;
|
|
116 | 100 |
private JButton btnPlacement; |
117 |
private JButton btnLabelStyles; |
|
101 |
// private JButton btnLabelStyles;
|
|
118 | 102 |
private JComboBoxLabelingMethod cmbMethod; |
119 | 103 |
private GridBagLayoutPanel classesPanel; |
120 | 104 |
private JComboBox cmbClasses; |
121 |
private ArrayList<String> expressions; |
|
105 |
// private ArrayList<String> expressions;
|
|
122 | 106 |
private IPlacementConstraints placementConstraints; |
123 | 107 |
private IZoomConstraints zoomConstraints; |
124 |
private JButton btnSymbol; |
|
108 |
// private JButton btnSymbol;
|
|
125 | 109 |
private boolean noEvent; |
126 | 110 |
private JCheckBox chkLabel; |
127 | 111 |
private JCheckBox chkTextOnly; |
... | ... | |
130 | 114 |
private JDnDList lstClassPriorities; |
131 | 115 |
private JCheckBox chkDefinePriorities; |
132 | 116 |
private JScrollPane scrlPan; |
117 |
private LabelClassRenderingProperties labelClassRenderingProperties; |
|
133 | 118 |
|
134 | 119 |
public GeneralLabeling() { |
135 | 120 |
initialize(); |
... | ... | |
165 | 150 |
left.addComponent(classesPanel); |
166 | 151 |
|
167 | 152 |
|
153 |
left.addComponent(labelClassRenderingProperties = new LabelClassRenderingProperties()); |
|
154 |
// aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0)); |
|
155 |
// aux.setBorder(BorderFactory.createTitledBorder( |
|
156 |
// null, PluginServices.getText(this, "text_string"))); |
|
157 |
// aux.add(new JLabel(PluginServices.getText(this, "expression")+":")); |
|
158 |
// aux.add(getCmbExpressions()); |
|
159 |
// aux.add(getBtnEditExpression()); |
|
160 |
// aux.setPreferredSize(new Dimension(612, 60)); |
|
161 |
// left.addComponent(aux); |
|
162 |
// |
|
163 |
// |
|
164 |
// aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0)); |
|
165 |
// aux.setBorder(BorderFactory.createTitledBorder( |
|
166 |
// null, PluginServices.getText(this, "text_symbol"))); |
|
167 |
// aux.add(getSymbolPreviewer()); |
|
168 |
// |
|
169 |
// JPanel aux2 = new JPanel(); |
|
170 |
// aux2.add(getBtnFont()); |
|
171 |
// aux2.add(getBtnSymbol()); |
|
172 |
// |
|
173 |
// aux2.setLayout(new GridLayout(aux2.getComponentCount(), 1)); |
|
174 |
// aux.add(aux2); |
|
175 |
// aux.setPreferredSize(new Dimension(612, 100)); |
|
176 |
// left.addComponent(aux); |
|
177 |
// |
|
178 |
// |
|
168 | 179 |
aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0)); |
169 | 180 |
aux.setBorder(BorderFactory.createTitledBorder( |
170 |
null, PluginServices.getText(this, "text_string"))); |
|
171 |
aux.add(new JLabel(PluginServices.getText(this, "expression")+":")); |
|
172 |
aux.add(getCmbExpressions()); |
|
173 |
aux.add(getBtnEditExpression()); |
|
174 |
aux.setPreferredSize(new Dimension(612, 60)); |
|
175 |
left.addComponent(aux); |
|
176 |
|
|
177 |
|
|
178 |
aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0)); |
|
179 |
aux.setBorder(BorderFactory.createTitledBorder( |
|
180 |
null, PluginServices.getText(this, "text_symbol"))); |
|
181 |
aux.add(getSymbolPreviewer()); |
|
182 |
|
|
183 |
JPanel aux2 = new JPanel(); |
|
184 |
aux2.add(getBtnFont()); |
|
185 |
aux2.add(getBtnSymbol()); |
|
186 |
|
|
187 |
aux2.setLayout(new GridLayout(aux2.getComponentCount(), 1)); |
|
188 |
aux.add(aux2); |
|
189 |
aux.setPreferredSize(new Dimension(612, 100)); |
|
190 |
left.addComponent(aux); |
|
191 |
|
|
192 |
|
|
193 |
aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0)); |
|
194 |
aux.setBorder(BorderFactory.createTitledBorder( |
|
195 | 181 |
null, PluginServices.getText(this, "options"))); |
196 | 182 |
aux.add(getBtnVisualization()); |
197 | 183 |
aux.add(getBtnPlacement()); |
198 |
aux.add(getBtnLabelStyles()); |
|
184 |
// aux.add(getBtnLabelStyles());
|
|
199 | 185 |
aux.setPreferredSize(new Dimension(612, 60)); |
200 | 186 |
|
201 | 187 |
left.addComponent(aux); |
... | ... | |
268 | 254 |
} |
269 | 255 |
return btnVisualization; |
270 | 256 |
} |
271 |
|
|
272 |
private JButton getBtnLabelStyles() { |
|
273 |
if (btnLabelStyles == null) { |
|
274 |
btnLabelStyles = new JButton( |
|
275 |
PluginServices.getText(this, "label_styles")+"..."); |
|
276 |
btnLabelStyles.setName("BTNLABELSTYLES"); |
|
277 |
btnLabelStyles.addActionListener(this); |
|
278 |
} |
|
279 |
return btnLabelStyles; |
|
280 |
} |
|
281 |
|
|
257 |
// |
|
258 |
// private JButton getBtnLabelStyles() {
|
|
259 |
// if (btnLabelStyles == null) {
|
|
260 |
// btnLabelStyles = new JButton(
|
|
261 |
// PluginServices.getText(this, "label_styles")+"...");
|
|
262 |
// btnLabelStyles.setName("BTNLABELSTYLES");
|
|
263 |
// btnLabelStyles.addActionListener(this);
|
|
264 |
// }
|
|
265 |
// return btnLabelStyles;
|
|
266 |
// }
|
|
267 |
// |
|
282 | 268 |
private JButton getBtnPlacement() { |
283 | 269 |
if (btnPlacement == null) { |
284 | 270 |
btnPlacement = new JButton( |
... | ... | |
289 | 275 |
return btnPlacement; |
290 | 276 |
} |
291 | 277 |
|
292 |
private JButton getBtnFont() { |
|
293 |
if (btnFont == null) { |
|
294 |
btnFont = new JButton( |
|
295 |
PluginServices.getText(this,"fuente")+"..."); |
|
296 |
btnFont.setName("BTNFONT"); |
|
297 |
btnFont.addActionListener(this); |
|
298 |
} |
|
299 |
return btnFont; |
|
300 |
} |
|
278 |
// private JButton getBtnFont() {
|
|
279 |
// if (btnFont == null) {
|
|
280 |
// btnFont = new JButton(
|
|
281 |
// PluginServices.getText(this,"fuente")+"...");
|
|
282 |
// btnFont.setName("BTNFONT");
|
|
283 |
// btnFont.addActionListener(this);
|
|
284 |
// }
|
|
285 |
// return btnFont;
|
|
286 |
// }
|
|
301 | 287 |
|
288 |
// |
|
289 |
// private Button getBtnSymbol() { |
|
290 |
// if (btnSymbol == null) { |
|
291 |
// btnSymbol = new JButton(PluginServices.getText(this, "symbol")); |
|
292 |
// btnSymbol.setName("BTNSYMBOL"); |
|
293 |
// btnSymbol.addActionListener(this); |
|
294 |
// } |
|
295 |
// |
|
296 |
// return btnSymbol; |
|
297 |
// } |
|
302 | 298 |
|
303 |
private Component getBtnSymbol() { |
|
304 |
if (btnSymbol == null) { |
|
305 |
btnSymbol = new JButton(PluginServices.getText(this, "symbol")); |
|
306 |
btnSymbol.setName("BTNSYMBOL"); |
|
307 |
btnSymbol.addActionListener(this); |
|
308 |
} |
|
299 |
// private SymbolPreviewer getSymbolPreviewer() { |
|
300 |
// if (previewer == null) { |
|
301 |
// previewer = new SymbolPreviewer(); |
|
302 |
// previewer.setPreferredSize(new Dimension(420, 65)); |
|
303 |
// } |
|
304 |
// return previewer; |
|
305 |
// } |
|
309 | 306 |
|
310 |
return btnSymbol; |
|
311 |
} |
|
312 |
|
|
313 |
private SymbolPreviewer getSymbolPreviewer() { |
|
314 |
if (previewer == null) { |
|
315 |
previewer = new SymbolPreviewer(); |
|
316 |
previewer.setPreferredSize(new Dimension(420, 65)); |
|
317 |
} |
|
318 |
return previewer; |
|
319 |
} |
|
320 |
|
|
321 | 307 |
private JComboBox getCmbMethod() { |
322 | 308 |
if (cmbMethod == null) { |
323 | 309 |
Iterator<String> it = methods.keySet().iterator(); |
... | ... | |
350 | 336 |
return cmbMethod; |
351 | 337 |
} |
352 | 338 |
|
353 |
private JButton getBtnEditExpression() { |
|
354 |
if (btnEditExpression == null) { |
|
355 |
btnEditExpression = new JButton( |
|
356 |
PluginServices.getText(this, "edit_expression")+"..."); |
|
357 |
btnEditExpression.setName("BTNEDITEXPRESSION"); |
|
358 |
btnEditExpression.addActionListener(this); |
|
359 |
} |
|
360 |
return btnEditExpression; |
|
361 |
} |
|
339 |
// private JButton getBtnEditExpression() {
|
|
340 |
// if (btnEditExpression == null) {
|
|
341 |
// btnEditExpression = new JButton(
|
|
342 |
// PluginServices.getText(this, "edit_expression")+"...");
|
|
343 |
// btnEditExpression.setName("BTNEDITEXPRESSION");
|
|
344 |
// btnEditExpression.addActionListener(this);
|
|
345 |
// }
|
|
346 |
// return btnEditExpression;
|
|
347 |
// }
|
|
362 | 348 |
|
363 |
private JComboBox getCmbExpressions() { |
|
364 |
if (cmbExpressions == null) { |
|
365 |
cmbExpressions = new JComboBox(); |
|
366 |
cmbExpressions.setPreferredSize(new Dimension(150, 20)); |
|
367 |
cmbExpressions.setName("CMBEXPRESSIONS"); |
|
368 |
cmbExpressions.addActionListener(this); |
|
369 |
} |
|
370 |
return cmbExpressions; |
|
349 |
// private JComboBox getCmbExpressions() { |
|
350 |
// if (cmbExpressions == null) { |
|
351 |
// cmbExpressions = new JComboBox(); |
|
352 |
// cmbExpressions.setPreferredSize(new Dimension(150, 20)); |
|
353 |
// cmbExpressions.setName("CMBEXPRESSIONS"); |
|
354 |
// cmbExpressions.addActionListener(this); |
|
355 |
// } |
|
356 |
// return cmbExpressions; |
|
357 |
// |
|
358 |
// } |
|
371 | 359 |
|
372 |
} |
|
373 |
|
|
374 | 360 |
private JButton getBtnSQLQuery() { |
375 | 361 |
if (btnSQLQuery == null) { |
376 | 362 |
btnSQLQuery = new JButton(PluginServices.getText(this, "SQL_query")); |
... | ... | |
444 | 430 |
FLyrVect lv = (FLyrVect) layer; |
445 | 431 |
try { |
446 | 432 |
fieldNames = lv.getRecordset().getFieldNames(); |
447 |
// |
|
448 |
// // detect the numeric fields |
|
449 |
// ArrayList<String> l = new ArrayList<String>(); |
|
450 |
// for (int i = 0; i < fieldNames.length; i++) { |
|
451 |
// switch (lv.getRecordset().getFieldType(i)) { |
|
452 |
// case Types.DECIMAL: |
|
453 |
// case Types.NUMERIC: |
|
454 |
// case Types.FLOAT: |
|
455 |
// case Types.DOUBLE: |
|
456 |
// case Types.INTEGER: |
|
457 |
// case Types.REAL: |
|
458 |
// case Types.SMALLINT: |
|
459 |
// case Types.TINYINT: |
|
460 |
// case Types.BIGINT: |
|
461 |
// l.add(fieldNames[i]); |
|
462 |
// break; |
|
463 |
// } |
|
464 |
// } |
|
465 |
// numericFieldNames = l.toArray(new String[l.size()]); |
|
466 |
|
|
433 |
labelClassRenderingProperties.setFieldNames(fieldNames); |
|
467 | 434 |
if (str instanceof GeneralLabelingStrategy) { |
468 | 435 |
setMethod(str.getLabelingMethod()); |
469 | 436 |
placementConstraints = str.getPlacementConstraints(); |
437 |
labelClassRenderingProperties.setModel(str.getLabelingMethod()); |
|
470 | 438 |
} |
439 |
|
|
440 |
|
|
471 | 441 |
refreshControls(); |
472 | 442 |
} catch (ReadDriverException e) { |
473 | 443 |
NotificationManager.addError(PluginServices.getText(this, "accessing_file_structure"), e); |
474 | 444 |
} |
475 | 445 |
} |
476 |
|
|
477 |
|
|
478 | 446 |
} |
479 | 447 |
|
480 | 448 |
|
... | ... | |
490 | 458 |
return ((MethodItem) getCmbMethod().getSelectedItem()).method; |
491 | 459 |
} |
492 | 460 |
|
493 |
private void refreshCmbExpressions() { |
|
461 |
// private void refreshCmbExpressions() { |
|
462 |
// |
|
463 |
// ArrayList<String> exp = getExpressions(); |
|
464 |
// |
|
465 |
// noEvent = true; |
|
466 |
// LabelClass lc = getActiveClass(); |
|
467 |
// if ( lc != null && |
|
468 |
// lc.getLabelExpression()!=null && |
|
469 |
// !lc.getLabelExpression().equals("") && |
|
470 |
// !exp.contains(lc.getLabelExpression())) { |
|
471 |
// exp.add(0, lc.getLabelExpression()); |
|
472 |
// } |
|
473 |
// |
|
474 |
// getCmbExpressions().removeAllItems(); |
|
475 |
// for (int i = 0; i < exp.size(); i++) { |
|
476 |
// getCmbExpressions().addItem(exp.get(i)); |
|
477 |
// } |
|
478 |
// if (lc != null) { |
|
479 |
// getCmbExpressions().setSelectedItem(lc.getLabelExpression()); |
|
480 |
// } else { |
|
481 |
// getCmbExpressions().setSelectedItem(exp.get(0)); |
|
482 |
// } |
|
483 |
// noEvent = false; |
|
484 |
// } |
|
494 | 485 |
|
495 |
ArrayList<String> exp = getExpressions(); |
|
496 |
|
|
497 |
noEvent = true; |
|
498 |
LabelClass lc = getActiveClass(); |
|
499 |
if ( lc != null && |
|
500 |
lc.getLabelExpression()!=null && |
|
501 |
!lc.getLabelExpression().equals("") && |
|
502 |
!exp.contains(lc.getLabelExpression())) { |
|
503 |
exp.add(0, lc.getLabelExpression()); |
|
504 |
} |
|
505 |
|
|
506 |
getCmbExpressions().removeAllItems(); |
|
507 |
for (int i = 0; i < exp.size(); i++) { |
|
508 |
getCmbExpressions().addItem(exp.get(i)); |
|
509 |
} |
|
510 |
if (lc != null) { |
|
511 |
getCmbExpressions().setSelectedItem(lc.getLabelExpression()); |
|
512 |
} else { |
|
513 |
getCmbExpressions().setSelectedItem(exp.get(0)); |
|
514 |
} |
|
515 |
noEvent = false; |
|
516 |
} |
|
486 |
// private ArrayList<String> getExpressions() { |
|
487 |
// if (expressions == null) { |
|
488 |
// expressions = new ArrayList<String>(); |
|
489 |
// try { |
|
490 |
// for (int i = 0; i < fieldNames.length; i++) { |
|
491 |
// expressions.add("["+fieldNames[i]+"];"); |
|
492 |
// } |
|
493 |
// } catch (Exception e) { |
|
494 |
// NotificationManager.addError( |
|
495 |
// PluginServices.getText( |
|
496 |
// this, "could_not_retreive_layer_names"), e); |
|
497 |
// } |
|
498 |
// } |
|
499 |
// return expressions; |
|
500 |
// } |
|
517 | 501 |
|
518 |
private ArrayList<String> getExpressions() { |
|
519 |
if (expressions == null) { |
|
520 |
expressions = new ArrayList<String>(); |
|
521 |
try { |
|
522 |
for (int i = 0; i < fieldNames.length; i++) { |
|
523 |
expressions.add("["+fieldNames[i]+"];"); |
|
524 |
} |
|
525 |
} catch (Exception e) { |
|
526 |
NotificationManager.addError( |
|
527 |
PluginServices.getText( |
|
528 |
this, "could_not_retreive_layer_names"), e); |
|
529 |
} |
|
530 |
} |
|
531 |
return expressions; |
|
532 |
} |
|
533 |
|
|
534 | 502 |
private void refreshClasses() { |
535 | 503 |
// label classes |
536 | 504 |
getCmbClasses().removeAllItems(); |
... | ... | |
540 | 508 |
|
541 | 509 |
} |
542 | 510 |
|
511 |
labelClassRenderingProperties.setActiveLabel( |
|
512 |
(LabelClass) getCmbClasses().getSelectedItem()); |
|
543 | 513 |
// expressions combo box |
544 |
refreshCmbExpressions(); |
|
514 |
// refreshCmbExpressions();
|
|
545 | 515 |
|
546 | 516 |
// panel priorities |
547 | 517 |
refreshPnlPriorities(); |
... | ... | |
578 | 548 |
return placementConstraints; |
579 | 549 |
} |
580 | 550 |
|
551 |
// public void actionPerformed(ActionEvent e) { |
|
552 |
// if (noEvent) return; |
|
553 |
// JComponent c = (JComponent)e.getSource(); |
|
554 |
// |
|
555 |
// if (c.equals(btnAddClass)) { |
|
556 |
// LabelClass newClass = new LabelClass(); |
|
557 |
// newClass.setName(PluginServices.getText(this, "labeling")+String.valueOf(++newClassSuffix)); |
|
558 |
// getMethod().addLabelClass(newClass); |
|
559 |
// refreshClasses(); |
|
560 |
// getCmbClasses().setSelectedItem(newClass); |
|
561 |
// } else if (c.equals(btnDelClass)) { |
|
562 |
// LabelClass clazz = getActiveClass(); |
|
563 |
// getMethod().deleteLabelClass(clazz); |
|
564 |
// refreshClasses(); |
|
565 |
// } else if (c.equals(btnEditExpression)) { |
|
566 |
// ExprEditorPanel ep = new ExprEditorPanel((String) getCmbExpressions(). |
|
567 |
// getSelectedItem()); |
|
568 |
// PluginServices.getMDIManager().addWindow( ep ); |
|
569 |
// getCmbExpressions().addItem(ep.getExpression()); |
|
570 |
// getCmbExpressions().setSelectedItem(ep.getExpression()); |
|
571 |
// } else if (c.equals(btnFont)) { |
|
572 |
// Font labelFont = getActiveClass().getTextSymbol().getFont(); |
|
573 |
// Font newFont = FontChooser.showDialog(PluginServices.getText(this, "font"), labelFont); |
|
574 |
// if (newFont != null) { |
|
575 |
// getActiveClass().getTextSymbol().setFont(newFont); |
|
576 |
// } |
|
577 |
// refreshTextSymbolPreviewer(); |
|
578 |
// } else if (c.equals(btnLabelStyles)) { |
|
579 |
// LabelClass clazz = getActiveClass(); |
|
580 |
// // here open symbol selector |
|
581 |
// |
|
582 |
// StyleSelector stySel = new StyleSelector( |
|
583 |
// clazz.getLabelStyle(), |
|
584 |
// FShape.TEXT ); |
|
585 |
// stySel.setUnit(clazz.getUnit()); |
|
586 |
// stySel.setReferenceSystem(clazz.getReferenceSystem()); |
|
587 |
// PluginServices.getMDIManager().addWindow(stySel); |
|
588 |
// ILabelStyle sty = (ILabelStyle) stySel.getSelectedObject(); |
|
589 |
// if (sty != null) { |
|
590 |
// // gather the style and apply to the class |
|
591 |
// clazz.setLabelStyle(sty); |
|
592 |
// clazz.setUnit(stySel.getUnit()); |
|
593 |
// clazz.setReferenceSystem(stySel.getReferenceSystem()); |
|
594 |
// |
|
595 |
// } |
|
596 |
// } else if (c.equals(btnPlacement)) { |
|
597 |
// |
|
598 |
// try { |
|
599 |
// PlacementProperties pp = new PlacementProperties( |
|
600 |
// (FLyrVect) layer, |
|
601 |
// getPlacementConstraints()); |
|
602 |
// PluginServices.getMDIManager().addWindow(pp); |
|
603 |
// placementConstraints = pp.getPlacementConstraints(); |
|
604 |
// } catch (ClassCastException ccEx) { |
|
605 |
// NotificationManager.addError("Placement constraints not prepared for:" |
|
606 |
// +layer.getClass().getName(), |
|
607 |
// ccEx); |
|
608 |
// } catch (ReadDriverException dEx) { |
|
609 |
// NotificationManager.addWarning("Should be unreachable code", dEx); |
|
610 |
// NotificationManager.addError(PluginServices.getText(this, "usupported_layer_type"), dEx); |
|
611 |
// } |
|
612 |
// |
|
613 |
// } else if (c.equals(btnRenameClass)) { |
|
614 |
// LabelClass clazz = getActiveClass(); |
|
615 |
// String newName = JOptionPane.showInputDialog( |
|
616 |
// PluginServices.getText(this, "enter_new_name")); |
|
617 |
// if (newName != null) |
|
618 |
// getMethod().renameLabelClass(clazz, newName); |
|
619 |
// refreshClasses(); |
|
620 |
// } else if (c.equals(btnSQLQuery)) { |
|
621 |
// LabelClass clazz = getActiveClass(); |
|
622 |
// String query = clazz.getSQLQuery(); |
|
623 |
// query = JOptionPane.showInputDialog(null, |
|
624 |
// "select from "+layer.getName()+" where ", |
|
625 |
// "SQL query", |
|
626 |
// JOptionPane.QUESTION_MESSAGE); |
|
627 |
// if (!query.equals("")) { |
|
628 |
// clazz.setSQLQuery(query); |
|
629 |
// } |
|
630 |
// |
|
631 |
// } else if (c.equals(btnVisualization)) { |
|
632 |
// |
|
633 |
// } else if (c.equals(chkLabel)) { |
|
634 |
// LabelClass lc = (LabelClass) getCmbClasses().getSelectedItem(); |
|
635 |
// if (lc == null) |
|
636 |
// lc = getMethod().getDefaultLabelClass(); |
|
637 |
// lc.setVisible(chkLabel.isSelected()); |
|
638 |
// } else if (c.equals(chkTextOnly)) { |
|
639 |
// |
|
640 |
// } else if (c.equals(cmbClasses)) { |
|
641 |
// // refresh expressions |
|
642 |
// LabelClass lc = (LabelClass) cmbClasses.getSelectedItem(); |
|
643 |
// if (lc != null && lc.getLabelExpression() != null && !getExpressions().contains(lc.getLabelExpression())) { |
|
644 |
// getExpressions().add(0, lc.getLabelExpression()); |
|
645 |
// } |
|
646 |
// refreshCmbExpressions(); |
|
647 |
// } else if (c.equals(cmbExpressions)) { |
|
648 |
// LabelClass lc = (LabelClass) getCmbClasses().getSelectedItem(); |
|
649 |
// if (lc == null) |
|
650 |
// lc = getMethod().getDefaultLabelClass(); |
|
651 |
// lc.setLabelExpression((String) cmbExpressions.getSelectedItem()); |
|
652 |
// } else if (c.equals(cmbMethod)) { |
|
653 |
// // disable components in class panel |
|
654 |
// // multiple class or not enables or disables the class panel |
|
655 |
// setComponentEnabled(classesPanel, getMethod().allowsMultipleClass()); |
|
656 |
// refreshClasses(); |
|
657 |
// |
|
658 |
// refreshTextSymbolPreviewer(); |
|
659 |
// } else if (c.equals(chkDefinePriorities)) { |
|
660 |
// getMethod().setDefinesPriorities(chkDefinePriorities.isSelected()); |
|
661 |
// refreshPnlPriorities(); |
|
662 |
// } else if (c.equals(btnSymbol)) { |
|
663 |
// LabelClass clazz = getActiveClass(); |
|
664 |
// // here open symbol selector |
|
665 |
// |
|
666 |
// ISymbolSelector symSel = SymbolSelector.createSymbolSelector(clazz.getTextSymbol(), |
|
667 |
// FShape.TEXT, |
|
668 |
// new SelectorFilter() { |
|
669 |
// public boolean accepts(Object obj) { |
|
670 |
// if (obj instanceof ISymbol) { |
|
671 |
// ISymbol sym = (ISymbol) obj; |
|
672 |
// return sym.getSymbolType() == FShape.TEXT; |
|
673 |
// } |
|
674 |
// return false; |
|
675 |
// } |
|
676 |
// }); |
|
677 |
// |
|
678 |
// PluginServices.getMDIManager().addWindow(symSel); |
|
679 |
// ISymbol sym = (ISymbol) symSel.getSelectedObject(); |
|
680 |
// if (sym != null) { |
|
681 |
// // gather the symbol and apply to the class |
|
682 |
// if (sym instanceof CartographicSupport) { |
|
683 |
// CartographicSupport csSty = (CartographicSupport) sym; |
|
684 |
// clazz.setUnit(csSty.getUnit()); |
|
685 |
// clazz.setReferenceSystem(csSty.getReferenceSystem()); |
|
686 |
// } |
|
687 |
// clazz.setTextSymbol((ITextSymbol) sym); |
|
688 |
// |
|
689 |
// } |
|
690 |
// |
|
691 |
// refreshTextSymbolPreviewer(); |
|
692 |
// } |
|
693 |
// } |
|
694 |
|
|
581 | 695 |
public void actionPerformed(ActionEvent e) { |
582 | 696 |
if (noEvent) return; |
583 | 697 |
JComponent c = (JComponent)e.getSource(); |
... | ... | |
592 | 706 |
LabelClass clazz = getActiveClass(); |
593 | 707 |
getMethod().deleteLabelClass(clazz); |
594 | 708 |
refreshClasses(); |
595 |
} else if (c.equals(btnEditExpression)) { |
|
596 |
ExprEditorPanel ep = new ExprEditorPanel((String) getCmbExpressions(). |
|
597 |
getSelectedItem()); |
|
598 |
PluginServices.getMDIManager().addWindow( ep ); |
|
599 |
getCmbExpressions().addItem(ep.getExpression()); |
|
600 |
getCmbExpressions().setSelectedItem(ep.getExpression()); |
|
601 |
} else if (c.equals(btnFont)) { |
|
602 |
Font labelFont = getActiveClass().getTextSymbol().getFont(); |
|
603 |
Font newFont = FontChooser.showDialog(PluginServices.getText(this, "font"), labelFont); |
|
604 |
if (newFont != null) { |
|
605 |
getActiveClass().getTextSymbol().setFont(newFont); |
|
606 |
} |
|
607 |
refreshTextSymbolPreviewer(); |
|
608 |
} else if (c.equals(btnLabelStyles)) { |
|
609 |
LabelClass clazz = getActiveClass(); |
|
610 |
// here open symbol selector |
|
611 |
|
|
612 |
StyleSelector stySel = new StyleSelector( |
|
613 |
clazz.getLabelStyle(), |
|
614 |
FShape.TEXT ); |
|
615 |
stySel.setUnit(clazz.getUnit()); |
|
616 |
stySel.setReferenceSystem(clazz.getReferenceSystem()); |
|
617 |
PluginServices.getMDIManager().addWindow(stySel); |
|
618 |
ILabelStyle sty = (ILabelStyle) stySel.getSelectedObject(); |
|
619 |
if (sty != null) { |
|
620 |
// gather the style and apply to the class |
|
621 |
clazz.setLabelStyle(sty); |
|
622 |
clazz.setUnit(stySel.getUnit()); |
|
623 |
clazz.setReferenceSystem(stySel.getReferenceSystem()); |
|
624 |
|
|
625 |
} |
|
626 |
} else if (c.equals(btnPlacement)) { |
|
627 |
|
|
628 |
try { |
|
629 |
PlacementProperties pp = new PlacementProperties( |
|
630 |
(FLyrVect) layer, |
|
631 |
getPlacementConstraints()); |
|
632 |
PluginServices.getMDIManager().addWindow(pp); |
|
633 |
placementConstraints = pp.getPlacementConstraints(); |
|
634 |
} catch (ClassCastException ccEx) { |
|
635 |
NotificationManager.addError("Placement constraints not prepared for:" |
|
636 |
+layer.getClass().getName(), |
|
637 |
ccEx); |
|
638 |
} catch (ReadDriverException dEx) { |
|
639 |
NotificationManager.addWarning("Should be unreachable code", dEx); |
|
640 |
NotificationManager.addError(PluginServices.getText(this, "usupported_layer_type"), dEx); |
|
641 |
} |
|
642 |
|
|
643 | 709 |
} else if (c.equals(btnRenameClass)) { |
644 | 710 |
LabelClass clazz = getActiveClass(); |
645 | 711 |
String newName = JOptionPane.showInputDialog( |
... | ... | |
658 | 724 |
clazz.setSQLQuery(query); |
659 | 725 |
} |
660 | 726 |
|
661 |
} else if (c.equals(btnVisualization)) { |
|
662 |
|
|
663 |
} else if (c.equals(chkLabel)) { |
|
727 |
} else if (c.equals(chkLabel)) { |
|
664 | 728 |
LabelClass lc = (LabelClass) getCmbClasses().getSelectedItem(); |
665 | 729 |
if (lc == null) |
666 | 730 |
lc = getMethod().getDefaultLabelClass(); |
... | ... | |
669 | 733 |
|
670 | 734 |
} else if (c.equals(cmbClasses)) { |
671 | 735 |
// refresh expressions |
672 |
LabelClass lc = (LabelClass) cmbClasses.getSelectedItem(); |
|
673 |
if (lc != null && lc.getLabelExpression() != null && !getExpressions().contains(lc.getLabelExpression())) { |
|
674 |
getExpressions().add(0, lc.getLabelExpression()); |
|
736 |
// LabelClass lc = (LabelClass) cmbClasses.getSelectedItem(); |
|
737 |
// if (lc != null && lc.getLabelExpression() != null && !getExpressions().contains(lc.getLabelExpression())) { |
|
738 |
// getExpressions().add(0, lc.getLabelExpression()); |
|
739 |
// } |
|
740 |
// refreshCmbExpressions(); |
|
741 |
} else if (c.equals(btnPlacement)) { |
|
742 |
|
|
743 |
try { |
|
744 |
PlacementProperties pp = new PlacementProperties( |
|
745 |
(FLyrVect) layer, |
|
746 |
getPlacementConstraints()); |
|
747 |
PluginServices.getMDIManager().addWindow(pp); |
|
748 |
placementConstraints = pp.getPlacementConstraints(); |
|
749 |
} catch (ClassCastException ccEx) { |
|
750 |
NotificationManager.addError("Placement constraints not prepared for:" |
|
751 |
+layer.getClass().getName(), |
|
752 |
ccEx); |
|
753 |
} catch (ReadDriverException dEx) { |
|
754 |
NotificationManager.addWarning("Should be unreachable code", dEx); |
|
755 |
NotificationManager.addError(PluginServices.getText(this, "usupported_layer_type"), dEx); |
|
675 | 756 |
} |
676 |
refreshCmbExpressions(); |
|
677 |
} else if (c.equals(cmbExpressions)) { |
|
678 |
LabelClass lc = (LabelClass) getCmbClasses().getSelectedItem(); |
|
679 |
if (lc == null) |
|
680 |
lc = getMethod().getDefaultLabelClass(); |
|
681 |
lc.setLabelExpression((String) cmbExpressions.getSelectedItem()); |
|
757 |
|
|
758 |
} else if (c.equals(btnVisualization)) { |
|
759 |
|
|
682 | 760 |
} else if (c.equals(cmbMethod)) { |
683 | 761 |
// disable components in class panel |
684 | 762 |
// multiple class or not enables or disables the class panel |
685 | 763 |
setComponentEnabled(classesPanel, getMethod().allowsMultipleClass()); |
686 | 764 |
refreshClasses(); |
687 | 765 |
|
688 |
refreshTextSymbolPreviewer(); |
|
766 |
// refreshTextSymbolPreviewer();
|
|
689 | 767 |
} else if (c.equals(chkDefinePriorities)) { |
690 | 768 |
getMethod().setDefinesPriorities(chkDefinePriorities.isSelected()); |
691 | 769 |
refreshPnlPriorities(); |
692 |
} else if (c.equals(btnSymbol)) { |
|
693 |
LabelClass clazz = getActiveClass(); |
|
694 |
// here open symbol selector |
|
695 |
|
|
696 |
ISymbolSelector symSel = SymbolSelector.createSymbolSelector(clazz.getTextSymbol(), |
|
697 |
FShape.TEXT, |
|
698 |
new SelectorFilter() { |
|
699 |
public boolean accepts(Object obj) { |
|
700 |
if (obj instanceof ISymbol) { |
|
701 |
ISymbol sym = (ISymbol) obj; |
|
702 |
return sym.getSymbolType() == FShape.TEXT; |
|
703 |
} |
|
704 |
return false; |
|
705 |
} |
|
706 |
}); |
|
707 |
|
|
708 |
PluginServices.getMDIManager().addWindow(symSel); |
|
709 |
ISymbol sym = (ISymbol) symSel.getSelectedObject(); |
|
710 |
if (sym != null) { |
|
711 |
// gather the symbol and apply to the class |
|
712 |
if (sym instanceof CartographicSupport) { |
|
713 |
CartographicSupport csSty = (CartographicSupport) sym; |
|
714 |
clazz.setUnit(csSty.getUnit()); |
|
715 |
clazz.setReferenceSystem(csSty.getReferenceSystem()); |
|
716 |
} |
|
717 |
clazz.setTextSymbol((ITextSymbol) sym); |
|
718 |
|
|
719 |
} |
|
720 |
|
|
721 |
refreshTextSymbolPreviewer(); |
|
722 | 770 |
} |
723 | 771 |
} |
772 |
// |
|
773 |
// private void refreshTextSymbolPreviewer() { |
|
774 |
// ITextSymbol textSym = getActiveClass().getTextSymbol(); |
|
775 |
// textSym.setText(PluginServices.getText(this, "GeneralLabeling.sample_text")); |
|
776 |
// getSymbolPreviewer().setSymbol(textSym); |
|
777 |
// |
|
778 |
// } |
|
724 | 779 |
|
725 |
|
|
726 |
private void refreshTextSymbolPreviewer() { |
|
727 |
ITextSymbol textSym = getActiveClass().getTextSymbol(); |
|
728 |
textSym.setText(PluginServices.getText(this, "GeneralLabeling.sample_text")); |
|
729 |
getSymbolPreviewer().setSymbol(textSym); |
|
730 |
|
|
731 |
} |
|
732 |
|
|
733 | 780 |
private void setComponentEnabled(Component c, boolean b) { |
734 | 781 |
if (c instanceof JComponent) { |
735 | 782 |
JComponent c1 = (JComponent) c; |
... | ... | |
786 | 833 |
return false; |
787 | 834 |
} |
788 | 835 |
} |
789 |
private class ExprEditorPanel extends JPanel implements IWindow { |
|
790 |
private static final long serialVersionUID = -3867224882591879900L; |
|
791 |
private ActionListener action = new ActionListener() { |
|
792 |
public void actionPerformed(ActionEvent e) { |
|
793 |
if ("OK".equals(e.getActionCommand())) { |
|
794 |
if (validateExpr()) |
|
795 |
PluginServices.getMDIManager().closeWindow( |
|
796 |
ExprEditorPanel.this); |
|
797 |
else |
|
798 |
JOptionPane.showMessageDialog(ExprEditorPanel.this, |
|
799 |
PluginServices.getText(this, "syntax_error"), |
|
800 |
PluginServices.getText(this, "error"), |
|
801 |
JOptionPane.ERROR_MESSAGE); |
|
802 |
} else { |
|
803 |
getTxtExpression().setText(lastExtression); |
|
804 |
PluginServices.getMDIManager().closeWindow( |
|
805 |
ExprEditorPanel.this); |
|
806 |
} |
|
807 |
} |
|
808 |
}; |
|
809 |
private JTextField txtExpression; |
|
810 |
private String lastExtression; |
|
811 |
|
|
812 |
public ExprEditorPanel(String currentExpression) { |
|
813 |
super(); |
|
814 |
initialize(); |
|
815 |
lastExtression = currentExpression; |
|
816 |
getTxtExpression().setText(currentExpression); |
|
817 |
|
|
818 |
} |
|
819 |
|
|
820 |
private void initialize() { |
|
821 |
GridBagLayoutPanel content = new GridBagLayoutPanel(); |
|
822 |
content.addComponent(new JLabel(" "+PluginServices.getText(this, "label_expression_help"))); |
|
823 |
content.addComponent( |
|
824 |
" "+PluginServices.getText(this, "expression")+":", |
|
825 |
getTxtExpression()); |
|
826 |
setLayout(new BorderLayout(5, 5)); |
|
827 |
|
|
828 |
add(content, BorderLayout.CENTER); |
|
829 |
add(new AcceptCancelPanel(action, action), BorderLayout.SOUTH); |
|
830 |
setSize(new Dimension(300, 80)); |
|
831 |
} |
|
832 |
|
|
833 |
private JTextField getTxtExpression() { |
|
834 |
if (txtExpression == null) { |
|
835 |
txtExpression = new JTextField(25); |
|
836 |
} |
|
837 |
return txtExpression; |
|
838 |
} |
|
839 |
|
|
840 |
public String getExpression() { |
|
841 |
return getTxtExpression().getText(); |
|
842 |
} |
|
843 |
|
|
844 |
public WindowInfo getWindowInfo() { |
|
845 |
WindowInfo viewInfo = new WindowInfo(WindowInfo.MODALDIALOG); |
|
846 |
viewInfo.setWidth(getWidth()); |
|
847 |
viewInfo.setHeight(getHeight()); |
|
848 |
viewInfo.setTitle(PluginServices.getText(this,"label_expression_editor")); |
|
849 |
return viewInfo; |
|
850 |
} |
|
851 |
|
|
852 |
private boolean validateExpr() { |
|
853 |
// TODO : implement it |
|
854 |
return true; |
|
855 |
} |
|
856 |
} |
|
836 |
|
|
857 | 837 |
} |
trunk/extensions/extSymbology/src/org/gvsig/symbology/gui/styling/LabelClassRenderingProperties.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
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. |
|
18 |
* |
|
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 |
|
40 |
*/ |
|
41 |
package org.gvsig.symbology.gui.styling; |
|
42 |
|
|
43 |
import java.awt.BorderLayout; |
|
44 |
import java.awt.Component; |
|
45 |
import java.awt.Dimension; |
|
46 |
import java.awt.FlowLayout; |
|
47 |
import java.awt.Font; |
|
48 |
import java.awt.GridLayout; |
|
49 |
import java.awt.event.ActionEvent; |
|
50 |
import java.awt.event.ActionListener; |
|
51 |
import java.util.ArrayList; |
|
52 |
|
|
53 |
import javax.swing.BorderFactory; |
|
54 |
import javax.swing.JLabel; |
|
55 |
import javax.swing.JOptionPane; |
|
56 |
import javax.swing.JPanel; |
|
57 |
import javax.swing.JTextField; |
|
58 |
|
|
59 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
60 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
|
61 |
import org.gvsig.gui.beans.swing.JButton; |
|
62 |
|
|
63 |
import com.iver.andami.PluginServices; |
|
64 |
import com.iver.andami.messages.NotificationManager; |
|
65 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
66 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
67 |
import com.iver.cit.gvsig.fmap.core.CartographicSupport; |
|
68 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
69 |
import com.iver.cit.gvsig.fmap.core.styles.ILabelStyle; |
|
70 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
71 |
import com.iver.cit.gvsig.fmap.core.symbols.ITextSymbol; |
|
72 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.ILabelingMethod; |
|
73 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelClass; |
|
74 |
import com.iver.cit.gvsig.gui.styling.SelectorFilter; |
|
75 |
import com.iver.cit.gvsig.gui.styling.StyleSelector; |
|
76 |
import com.iver.cit.gvsig.gui.styling.SymbolPreviewer; |
|
77 |
import com.iver.cit.gvsig.gui.styling.SymbolSelector; |
|
78 |
import com.iver.cit.gvsig.gui.utils.FontChooser; |
|
79 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.ISymbolSelector; |
|
80 |
import com.iver.utiles.swing.JComboBox; |
|
81 |
|
|
82 |
/** |
|
83 |
* |
|
84 |
* LabelClassRenderingProperties.java |
|
85 |
* |
|
86 |
* |
|
87 |
* @author jaume dominguez faus - jaume.dominguez@iver.es Feb 29, 2008 |
|
88 |
* |
|
89 |
*/ |
|
90 |
public class LabelClassRenderingProperties extends GridBagLayoutPanel implements ActionListener{ |
|
91 |
private SymbolPreviewer previewer; |
|
92 |
private JComboBox cmbExpressions; |
|
93 |
private JButton btnFont; |
|
94 |
private JButton btnSymbol; |
|
95 |
private JButton btnLabelStyles; |
|
96 |
private JButton btnEditExpression; |
|
97 |
private LabelClass lc; |
|
98 |
private ArrayList<String> expressions; |
|
99 |
private ILabelingMethod method; |
|
100 |
private String[] fieldNames; |
|
101 |
|
|
102 |
private class ExprEditorPanel extends JPanel implements IWindow { |
|
103 |
private static final long serialVersionUID = -3867224882591879900L; |
|
104 |
private ActionListener action = new ActionListener() { |
|
105 |
public void actionPerformed(ActionEvent e) { |
|
106 |
if ("OK".equals(e.getActionCommand())) { |
|
107 |
if (validateExpr()) |
|
108 |
PluginServices.getMDIManager().closeWindow( |
|
109 |
ExprEditorPanel.this); |
|
110 |
else |
|
111 |
JOptionPane.showMessageDialog(ExprEditorPanel.this, |
|
112 |
PluginServices.getText(this, "syntax_error"), |
|
113 |
PluginServices.getText(this, "error"), |
|
114 |
JOptionPane.ERROR_MESSAGE); |
|
115 |
} else { |
|
116 |
getTxtExpression().setText(lastExtression); |
|
117 |
PluginServices.getMDIManager().closeWindow( |
|
118 |
ExprEditorPanel.this); |
|
119 |
} |
|
120 |
} |
|
121 |
}; |
|
122 |
private JTextField txtExpression; |
|
123 |
private String lastExtression; |
|
124 |
|
|
125 |
public ExprEditorPanel(String currentExpression) { |
|
126 |
super(); |
|
127 |
initialize(); |
|
128 |
lastExtression = currentExpression; |
|
129 |
getTxtExpression().setText(currentExpression); |
|
130 |
|
|
131 |
} |
|
132 |
|
|
133 |
private void initialize() { |
|
134 |
GridBagLayoutPanel content = new GridBagLayoutPanel(); |
|
135 |
content.addComponent(new JLabel(" "+PluginServices.getText(this, "label_expression_help"))); |
|
136 |
content.addComponent( |
|
137 |
" "+PluginServices.getText(this, "expression")+":", |
|
138 |
getTxtExpression()); |
|
139 |
setLayout(new BorderLayout(5, 5)); |
|
140 |
|
|
141 |
add(content, BorderLayout.CENTER); |
|
142 |
add(new AcceptCancelPanel(action, action), BorderLayout.SOUTH); |
|
143 |
setSize(new Dimension(300, 80)); |
|
144 |
} |
|
145 |
|
|
146 |
private JTextField getTxtExpression() { |
|
147 |
if (txtExpression == null) { |
|
148 |
txtExpression = new JTextField(25); |
|
149 |
} |
|
150 |
return txtExpression; |
|
151 |
} |
|
152 |
|
|
153 |
public String getExpression() { |
|
154 |
return getTxtExpression().getText(); |
|
155 |
} |
|
156 |
|
|
157 |
public WindowInfo getWindowInfo() { |
|
158 |
WindowInfo viewInfo = new WindowInfo(WindowInfo.MODALDIALOG); |
|
159 |
viewInfo.setWidth(getWidth()); |
|
160 |
viewInfo.setHeight(getHeight()); |
|
161 |
viewInfo.setTitle(PluginServices.getText(this,"label_expression_editor")); |
|
162 |
return viewInfo; |
|
163 |
} |
|
164 |
|
|
165 |
private boolean validateExpr() { |
|
166 |
// TODO : implement it |
|
167 |
return true; |
|
168 |
} |
|
169 |
} |
|
170 |
|
|
171 |
public LabelClassRenderingProperties() { |
|
172 |
initialize(); |
|
173 |
} |
|
174 |
|
|
175 |
private void initialize() { |
|
176 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0)); |
|
177 |
aux.setBorder(BorderFactory.createTitledBorder( |
|
178 |
null, PluginServices.getText(this, "text_string"))); |
|
179 |
aux.add(new JLabel(PluginServices.getText(this, "expression")+":")); |
|
180 |
aux.add(getCmbExpressions()); |
|
181 |
aux.add(getBtnEditExpression()); |
|
182 |
aux.setPreferredSize(new Dimension(612, 60)); |
|
183 |
addComponent(aux); |
|
184 |
|
|
185 |
|
|
186 |
aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 0)); |
|
187 |
aux.setBorder(BorderFactory.createTitledBorder( |
|
188 |
null, PluginServices.getText(this, "text_symbol"))); |
|
189 |
aux.add(getSymbolPreviewer()); |
|
190 |
|
|
191 |
JPanel aux2 = new JPanel(); |
|
192 |
aux2.add(getBtnFont()); |
|
193 |
aux2.add(getBtnSymbol()); |
|
194 |
aux2.add(getBtnLabelStyles()); |
|
195 |
|
|
196 |
aux2.setLayout(new GridLayout(aux2.getComponentCount(), 1)); |
|
197 |
aux.add(aux2); |
|
198 |
aux.setPreferredSize(new Dimension(612, 100)); |
|
199 |
addComponent(aux); |
|
200 |
} |
|
201 |
|
|
202 |
|
|
203 |
public void setFieldNames(String[] fieldNames) { |
|
204 |
this.fieldNames = fieldNames; |
|
205 |
} |
|
206 |
|
|
207 |
private void refreshCmbExpressions() { |
|
208 |
|
|
209 |
ArrayList<String> exp = getExpressions(); |
|
210 |
|
|
211 |
// noEvent = true; |
|
212 |
if ( lc != null && |
|
213 |
lc.getLabelExpression()!=null && |
|
214 |
!lc.getLabelExpression().equals("") && |
|
215 |
!exp.contains(lc.getLabelExpression())) { |
|
216 |
exp.add(0, lc.getLabelExpression()); |
|
217 |
} |
|
218 |
|
|
219 |
getCmbExpressions().removeAllItems(); |
|
220 |
for (int i = 0; i < exp.size(); i++) { |
|
221 |
getCmbExpressions().addItem(exp.get(i)); |
|
222 |
} |
|
223 |
if (lc != null) { |
|
224 |
getCmbExpressions().setSelectedItem(lc.getLabelExpression()); |
|
225 |
} else { |
|
226 |
getCmbExpressions().setSelectedItem(exp.get(0)); |
|
227 |
} |
|
228 |
// noEvent = false; |
|
229 |
} |
|
230 |
|
|
231 |
private JButton getBtnEditExpression() { |
|
232 |
if (btnEditExpression == null) { |
|
233 |
btnEditExpression = new JButton( |
|
234 |
PluginServices.getText(this, "edit_expression")+"..."); |
|
235 |
btnEditExpression.setName("BTNEDITEXPRESSION"); |
|
236 |
btnEditExpression.addActionListener(this); |
|
237 |
} |
|
238 |
return btnEditExpression; |
|
239 |
} |
|
240 |
|
|
241 |
private JButton getBtnSymbol() { |
|
242 |
if (btnSymbol == null) { |
|
243 |
btnSymbol = new JButton(PluginServices.getText(this, "symbol")); |
|
244 |
btnSymbol.setName("BTNSYMBOL"); |
|
245 |
btnSymbol.addActionListener(this); |
|
246 |
} |
|
247 |
|
|
248 |
return btnSymbol; |
|
249 |
} |
|
250 |
|
|
251 |
private ArrayList<String> getExpressions() { |
|
252 |
if (expressions == null) { |
|
253 |
expressions = new ArrayList<String>(); |
|
254 |
try { |
|
255 |
for (int i = 0; i < fieldNames.length; i++) { |
|
256 |
expressions.add("["+fieldNames[i]+"];"); |
|
257 |
} |
|
258 |
} catch (Exception e) { |
|
259 |
NotificationManager.addError( |
|
260 |
PluginServices.getText( |
|
261 |
this, "could_not_retreive_layer_names"), e); |
|
262 |
} |
|
263 |
} |
|
264 |
return expressions; |
|
265 |
} |
|
266 |
private JComboBox getCmbExpressions() { |
|
267 |
if (cmbExpressions == null) { |
|
268 |
cmbExpressions = new JComboBox(); |
|
269 |
cmbExpressions.setPreferredSize(new Dimension(150, 20)); |
|
270 |
cmbExpressions.setName("CMBEXPRESSIONS"); |
|
271 |
cmbExpressions.addActionListener(this); |
|
272 |
} |
|
273 |
return cmbExpressions; |
|
274 |
|
|
275 |
} |
|
276 |
|
|
277 |
private JButton getBtnFont() { |
|
278 |
if (btnFont == null) { |
|
279 |
btnFont = new JButton( |
|
280 |
PluginServices.getText(this,"fuente")+"..."); |
|
281 |
btnFont.setName("BTNFONT"); |
|
282 |
btnFont.addActionListener(this); |
|
283 |
} |
|
284 |
return btnFont; |
|
285 |
} |
|
286 |
|
|
287 |
private SymbolPreviewer getSymbolPreviewer() { |
|
288 |
if (previewer == null) { |
|
289 |
previewer = new SymbolPreviewer(); |
|
290 |
previewer.setPreferredSize(new Dimension(420, 65)); |
|
291 |
} |
|
292 |
return previewer; |
|
293 |
} |
|
294 |
|
|
295 |
|
|
296 |
public void setModel(ILabelingMethod method) { |
|
297 |
this.method = method; |
|
298 |
} |
|
299 |
|
|
300 |
public void setActiveLabel(LabelClass lc) { |
|
301 |
this.lc = lc; |
|
302 |
refreshCmbExpressions(); |
|
303 |
refreshTextSymbolPreviewer(); |
|
304 |
} |
|
305 |
|
|
306 |
public void actionPerformed(ActionEvent e) { |
|
307 |
Component c = (Component) e.getSource(); |
|
308 |
if (c.equals(btnEditExpression)) { |
|
309 |
ExprEditorPanel ep = new ExprEditorPanel((String) getCmbExpressions(). |
|
310 |
getSelectedItem()); |
|
311 |
PluginServices.getMDIManager().addWindow( ep ); |
|
312 |
getCmbExpressions().addItem(ep.getExpression()); |
|
313 |
getCmbExpressions().setSelectedItem(ep.getExpression()); |
|
314 |
lc.setLabelExpression(ep.getExpression()); |
|
315 |
} else if (c.equals(btnFont)) { |
|
316 |
Font labelFont = lc.getTextSymbol().getFont(); |
|
317 |
Font newFont = FontChooser.showDialog(PluginServices.getText(this, "font"), labelFont); |
|
318 |
if (newFont != null) { |
|
319 |
lc.getTextSymbol().setFont(newFont); |
|
320 |
} |
|
321 |
refreshTextSymbolPreviewer(); |
|
322 |
} else if (c.equals(btnLabelStyles)) { |
|
323 |
// here open symbol selector |
|
324 |
|
|
325 |
StyleSelector stySel = new StyleSelector( |
|
326 |
lc.getLabelStyle(), |
|
327 |
FShape.TEXT ); |
|
328 |
stySel.setUnit(lc.getUnit()); |
|
329 |
stySel.setReferenceSystem(lc.getReferenceSystem()); |
|
330 |
PluginServices.getMDIManager().addWindow(stySel); |
|
331 |
ILabelStyle sty = (ILabelStyle) stySel.getSelectedObject(); |
|
332 |
if (sty != null) { |
|
333 |
// gather the style and apply to the class |
|
334 |
lc.setLabelStyle(sty); |
|
335 |
lc.setUnit(stySel.getUnit()); |
|
336 |
lc.setReferenceSystem(stySel.getReferenceSystem()); |
|
337 |
|
|
338 |
} |
|
339 |
} else if (c.equals(cmbExpressions)) { |
|
340 |
|
|
341 |
if (lc == null) { |
|
342 |
lc = method.getDefaultLabelClass(); |
|
343 |
System.out.println("'si que cal'"); |
|
344 |
} |
|
345 |
System.err.println("jo crec que el codi de dalt no cal, si no ix 'si que cal' dalt d'esta l?nia es que no"); |
|
346 |
lc.setLabelExpression((String) cmbExpressions.getSelectedItem()); |
|
347 |
} if (c.equals(btnSymbol)) { |
|
348 |
|
|
349 |
// here open symbol selector |
|
350 |
|
|
351 |
ISymbolSelector symSel = SymbolSelector.createSymbolSelector(lc.getTextSymbol(), |
|
352 |
FShape.TEXT, |
|
353 |
new SelectorFilter() { |
|
354 |
public boolean accepts(Object obj) { |
|
355 |
if (obj instanceof ISymbol) { |
|
356 |
ISymbol sym = (ISymbol) obj; |
|
357 |
return sym.getSymbolType() == FShape.TEXT; |
|
358 |
} |
|
359 |
return false; |
|
360 |
} |
|
361 |
}); |
|
362 |
|
|
363 |
PluginServices.getMDIManager().addWindow(symSel); |
|
364 |
ISymbol sym = (ISymbol) symSel.getSelectedObject(); |
|
365 |
if (sym != null) { |
|
366 |
// gather the symbol and apply to the class |
|
367 |
if (sym instanceof CartographicSupport) { |
|
368 |
CartographicSupport csSty = (CartographicSupport) sym; |
|
369 |
lc.setUnit(csSty.getUnit()); |
|
370 |
lc.setReferenceSystem(csSty.getReferenceSystem()); |
|
371 |
} |
|
372 |
lc.setTextSymbol((ITextSymbol) sym); |
|
373 |
|
|
374 |
} |
|
375 |
|
|
376 |
refreshTextSymbolPreviewer(); |
|
377 |
} |
|
378 |
} |
|
379 |
|
|
380 |
private JButton getBtnLabelStyles() { |
|
381 |
if (btnLabelStyles == null) { |
|
382 |
btnLabelStyles = new JButton( |
|
383 |
PluginServices.getText(this, "label_styles")+"..."); |
|
384 |
btnLabelStyles.setName("BTNLABELSTYLES"); |
|
385 |
btnLabelStyles.addActionListener(this); |
|
386 |
} |
|
387 |
return btnLabelStyles; |
|
388 |
} |
|
389 |
|
|
390 |
private void refreshTextSymbolPreviewer() { |
|
391 |
ITextSymbol textSym = lc.getTextSymbol(); |
|
392 |
textSym.setText(PluginServices.getText(this, "GeneralLabeling.sample_text")); |
Also available in: Unified diff