Revision 19359 trunk/extensions/extSymbology/src/org/gvsig/symbology/gui/layerproperties/PlacementProperties.java
PlacementProperties.java | ||
---|---|---|
139 | 139 |
* |
140 | 140 |
*/ |
141 | 141 |
public class PlacementProperties extends JPanel implements IWindow, ActionListener { |
142 |
private static final long serialVersionUID = 1022470370547576765L; |
|
142 | 143 |
private PointLabelPositioneer pointStyle = new PointLabelPositioneer( |
143 | 144 |
new byte[] { 2, 2, 1, 3, 2, 3, 3, 2 }, |
144 | 145 |
PluginServices.getText(this, "prefer_top_right_all_allowed") |
... | ... | |
187 | 188 |
private JLabelHTML lblPointPosDesc = new JLabelHTML(pointStyle.getDescription()); |
188 | 189 |
private IPlacementConstraints oldConstraints; |
189 | 190 |
private JCheckBox chkFitInsidePolygon; |
191 |
private boolean fireEvent = false; |
|
190 | 192 |
|
191 | 193 |
public PlacementProperties(FLyrVect layer, IPlacementConstraints constraints) throws ReadDriverException { |
192 | 194 |
this.shapeType = layer.getShapeType(); |
... | ... | |
194 | 196 |
this.constraints = constraints != null ? |
195 | 197 |
PlacementManager.createPlacementConstraints(constraints.getXMLEntity()) : |
196 | 198 |
PlacementManager.createPlacementConstraints(layer); |
199 |
|
|
197 | 200 |
initialize(); |
198 | 201 |
refreshComponents(); |
199 | 202 |
} |
200 | 203 |
|
201 | 204 |
private void refreshComponents() { |
205 |
fireEvent = false; |
|
202 | 206 |
getChkOnTheLine().setSelected(constraints.isOnTheLine()); |
203 | 207 |
getChkAbove().setSelected(constraints.isAboveTheLine()); |
204 | 208 |
getChkBelow().setSelected(constraints.isBelowTheLine()); |
... | ... | |
236 | 240 |
getRdBtnAlwaysStraight().setSelected(true); |
237 | 241 |
} |
238 | 242 |
|
243 |
|
|
244 |
// duplicates mode |
|
245 |
int dupMode = constraints.getDuplicateLabelsMode(); |
|
246 |
rdBtnRemoveDuplicates.setSelected(dupMode == IPlacementConstraints.REMOVE_DUPLICATE_LABELS); |
|
247 |
rdBtnOnePerFeature.setSelected(dupMode == IPlacementConstraints.ONE_LABEL_PER_FEATURE); |
|
248 |
rdBtnOnePerFeaturePart.setSelected(dupMode == IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART); |
|
249 |
fireEvent = true; |
|
250 |
changeIcon(); |
|
239 | 251 |
} |
240 | 252 |
|
241 | 253 |
private void initialize() { |
... | ... | |
674 | 686 |
break; |
675 | 687 |
} |
676 | 688 |
constraints.setPlacementMode(mode); |
689 |
|
|
690 |
if (rdBtnRemoveDuplicates.isSelected()) { |
|
691 |
constraints.setDuplicateLabelsMode( |
|
692 |
IPlacementConstraints.REMOVE_DUPLICATE_LABELS); |
|
693 |
} |
|
694 |
if (rdBtnOnePerFeature.isSelected()) { |
|
695 |
constraints.setDuplicateLabelsMode( |
|
696 |
IPlacementConstraints.ONE_LABEL_PER_FEATURE); |
|
697 |
} |
|
698 |
if (rdBtnOnePerFeaturePart.isSelected()) { |
|
699 |
constraints.setDuplicateLabelsMode( |
|
700 |
IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART); |
|
701 |
} |
|
677 | 702 |
} |
678 | 703 |
|
679 | 704 |
private void setComponentEnabled(Component c, boolean b) { |
... | ... | |
735 | 760 |
} |
736 | 761 |
|
737 | 762 |
private void changeIcon() { |
738 |
applyConstraints(); |
|
739 |
preview.setConstraints(constraints); |
|
763 |
if (preview != null && fireEvent) { |
|
764 |
applyConstraints(); |
|
765 |
preview.setConstraints(constraints); |
|
766 |
} |
|
740 | 767 |
} |
741 | 768 |
|
742 | 769 |
private class JLabelHTML extends JLabel { |
Also available in: Unified diff