Revision 20905 trunk/extensions/extSymbology/src/org/gvsig/symbology/gui/layerproperties/GeneralLabeling.java
GeneralLabeling.java | ||
---|---|---|
76 | 76 |
import com.iver.andami.messages.NotificationManager; |
77 | 77 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
78 | 78 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
79 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
79 | 80 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.ILabelingMethod; |
80 | 81 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.ILabelingStrategy; |
81 | 82 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.IPlacementConstraints; |
82 | 83 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.IZoomConstraints; |
83 | 84 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelClass; |
85 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelingFactory; |
|
84 | 86 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.ILabelingStrategyPanel; |
85 | 87 |
import com.iver.utiles.swing.JComboBox; |
86 | 88 |
|
87 | 89 |
public class GeneralLabeling extends JPanel implements ILabelingStrategyPanel, ActionListener { |
88 | 90 |
private static final long serialVersionUID = 8864709758980903351L; |
89 |
private static Hashtable<String, Class> methods = new Hashtable<String, Class>(); |
|
91 |
private static Hashtable<String, Class<? extends ILabelingMethod>> methods |
|
92 |
= new Hashtable<String, Class<? extends ILabelingMethod>>(); |
|
90 | 93 |
private static int newClassSuffix = 0; |
91 | 94 |
private JButton btnVisualization; |
92 | 95 |
private JButton btnRenameClass; |
... | ... | |
251 | 254 |
while (it.hasNext()) { |
252 | 255 |
String name = it.next(); |
253 | 256 |
|
254 |
Class methodClass = (Class) methods.get(name);
|
|
257 |
Class<? extends ILabelingMethod> methodClass = (Class<? extends ILabelingMethod>) methods.get(name);
|
|
255 | 258 |
ILabelingMethod method; |
256 | 259 |
try { |
257 | 260 |
method = (ILabelingMethod) methodClass.newInstance(); |
... | ... | |
355 | 358 |
fieldNames = lv.getRecordset().getFieldNames(); |
356 | 359 |
labelClassRenderingProperties.setFieldNames(fieldNames); |
357 | 360 |
if (str instanceof GeneralLabelingStrategy) { |
358 |
GeneralLabelingStrategy gStr = (GeneralLabelingStrategy) str; |
|
359 |
setMethod(str.getLabelingMethod()); |
|
360 |
placementConstraints = str.getPlacementConstraints(); |
|
361 |
getChkAllowLabelOverlapping().setSelected(gStr.isAllowOverlapping()); |
|
362 |
minScaleView = gStr.getMinScaleView(); |
|
363 |
maxScaleView = gStr.getMaxScaleView(); |
|
361 |
try { |
|
362 |
GeneralLabelingStrategy gStr = (GeneralLabelingStrategy) LabelingFactory.createStrategyFromXML(str.getXMLEntity(), layer.cloneLayer()); |
|
363 |
setMethod(str.getLabelingMethod()); |
|
364 |
placementConstraints = str.getPlacementConstraints(); |
|
365 |
getChkAllowLabelOverlapping().setSelected(gStr.isAllowingOverlap()); |
|
366 |
minScaleView = gStr.getMinScaleView(); |
|
367 |
maxScaleView = gStr.getMaxScaleView(); |
|
368 |
|
|
369 |
} catch (ReadDriverException e) { |
|
370 |
NotificationManager.addError(PluginServices.getText(this, "accessing_file_structure"), e); |
|
371 |
} catch (Exception e) { |
|
372 |
NotificationManager.addError(PluginServices.getText(this, "accessing_file_structure"), e); |
|
373 |
} |
|
364 | 374 |
} |
365 |
|
|
375 |
|
|
366 | 376 |
refreshControls(); |
367 | 377 |
labelClassRenderingProperties.setModel(getActiveClass()); |
368 | 378 |
|
... | ... | |
373 | 383 |
} |
374 | 384 |
|
375 | 385 |
|
376 |
public static void addLabelingMethod(String name, Class iLabelingMethodClass) { |
|
386 |
public static void addLabelingMethod(String name, Class<? extends ILabelingMethod> iLabelingMethodClass) {
|
|
377 | 387 |
methods.put(name, iLabelingMethodClass); |
378 | 388 |
} |
379 | 389 |
|
... | ... | |
543 | 553 |
public void setSelectedItem(Object anObject) { |
544 | 554 |
if (anObject instanceof MethodItem) { |
545 | 555 |
MethodItem methodItem = (MethodItem) anObject; |
556 |
for (int i = 0; i < getItemCount(); i++) { |
|
557 |
MethodItem aux = (MethodItem) getItemAt(i); |
|
558 |
if (aux.equals(methodItem)) { |
|
559 |
aux.method=methodItem.method; |
|
560 |
} |
|
561 |
} |
|
546 | 562 |
super.setSelectedItem(methodItem); |
547 |
((MethodItem) super.getSelectedItem()).method = methodItem.method; |
|
563 |
// ((MethodItem) super.getSelectedItem()).method = methodItem.method;
|
|
548 | 564 |
} |
549 | 565 |
} |
550 | 566 |
} |
Also available in: Unified diff