root / trunk / extensions / extSymbology / src / org / gvsig / symbology / gui / layerproperties / DuplicateLayersMode.java @ 23079
History | View | Annotate | Download (3.67 KB)
1 | 20768 | jdominguez | /* 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.layerproperties; |
||
42 | |||
43 | import javax.swing.BorderFactory; |
||
44 | import javax.swing.ButtonGroup; |
||
45 | import javax.swing.JRadioButton; |
||
46 | |||
47 | import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
||
48 | |||
49 | import com.iver.andami.PluginServices; |
||
50 | import com.iver.cit.gvsig.fmap.rendering.styling.labeling.IPlacementConstraints; |
||
51 | |||
52 | public class DuplicateLayersMode extends GridBagLayoutPanel { |
||
53 | 22082 | vcaballero | private static final long serialVersionUID = 1091963463412809652L; |
54 | 20768 | jdominguez | private JRadioButton rdBtnRemoveDuplicates; |
55 | private JRadioButton rdBtnOnePerFeature; |
||
56 | private JRadioButton rdBtnOnePerFeaturePart; |
||
57 | |||
58 | public DuplicateLayersMode() {
|
||
59 | super();
|
||
60 | initialize(); |
||
61 | } |
||
62 | private void initialize() { |
||
63 | setBorder(BorderFactory.
|
||
64 | createTitledBorder(null,
|
||
65 | PluginServices.getText(this, "duplicate_labels"))); |
||
66 | addComponent(getRdBtnRemoveDuplicates()); |
||
67 | addComponent(getRdBtnOnePerFeature()); |
||
68 | addComponent(getRdBtnOnePerFeaturePart()); |
||
69 | |||
70 | ButtonGroup group = new ButtonGroup(); |
||
71 | group.add(getRdBtnOnePerFeature()); |
||
72 | group.add(getRdBtnOnePerFeaturePart()); |
||
73 | group.add(getRdBtnRemoveDuplicates()); |
||
74 | } |
||
75 | |||
76 | |||
77 | private JRadioButton getRdBtnOnePerFeaturePart() { |
||
78 | if (rdBtnOnePerFeaturePart == null) { |
||
79 | rdBtnOnePerFeaturePart = new JRadioButton( |
||
80 | PluginServices.getText(this, "place_one_label_per_feature_part")); |
||
81 | } |
||
82 | return rdBtnOnePerFeaturePart;
|
||
83 | } |
||
84 | |||
85 | private JRadioButton getRdBtnOnePerFeature() { |
||
86 | if (rdBtnOnePerFeature == null) { |
||
87 | rdBtnOnePerFeature = new JRadioButton( |
||
88 | PluginServices.getText(this, "place_one_label_per_feature")); |
||
89 | } |
||
90 | return rdBtnOnePerFeature;
|
||
91 | } |
||
92 | |||
93 | private JRadioButton getRdBtnRemoveDuplicates() { |
||
94 | if (rdBtnRemoveDuplicates == null) { |
||
95 | rdBtnRemoveDuplicates = new JRadioButton( |
||
96 | PluginServices.getText(this, "remove_duplicate_labels")); |
||
97 | |||
98 | } |
||
99 | return rdBtnRemoveDuplicates;
|
||
100 | } |
||
101 | |||
102 | public void setMode(int dupMode) { |
||
103 | rdBtnRemoveDuplicates.setSelected(dupMode == IPlacementConstraints.REMOVE_DUPLICATE_LABELS); |
||
104 | rdBtnOnePerFeature.setSelected(dupMode == IPlacementConstraints.ONE_LABEL_PER_FEATURE); |
||
105 | rdBtnOnePerFeaturePart.setSelected(dupMode == IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART); |
||
106 | } |
||
107 | |||
108 | public int getMode() { |
||
109 | if (rdBtnRemoveDuplicates.isSelected()) {
|
||
110 | return IPlacementConstraints.REMOVE_DUPLICATE_LABELS;
|
||
111 | } |
||
112 | if (rdBtnOnePerFeature.isSelected()) {
|
||
113 | return IPlacementConstraints.ONE_LABEL_PER_FEATURE;
|
||
114 | } |
||
115 | if (rdBtnOnePerFeaturePart.isSelected()) {
|
||
116 | return IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART;
|
||
117 | } |
||
118 | |||
119 | throw new Error("Unsupported layer duplicates mode"); |
||
120 | } |
||
121 | } |