Revision 43888 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/legend/gui/LabelingManager.java
LabelingManager.java | ||
---|---|---|
35 | 35 |
import java.util.TreeMap; |
36 | 36 |
|
37 | 37 |
import javax.swing.BorderFactory; |
38 |
import javax.swing.ComboBoxModel; |
|
38 | 39 |
import javax.swing.JCheckBox; |
39 | 40 |
import javax.swing.JComponent; |
40 | 41 |
import javax.swing.JLabel; |
... | ... | |
42 | 43 |
|
43 | 44 |
import org.gvsig.andami.PluginServices; |
44 | 45 |
import org.gvsig.andami.messages.NotificationManager; |
46 |
import org.gvsig.configurableactions.ConfigurableActionsMamager; |
|
45 | 47 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
46 | 48 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable; |
47 | 49 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy; |
48 | 50 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
49 | 51 |
import org.gvsig.symbology.swing.SymbologySwingManager; |
52 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
50 | 53 |
import org.gvsig.utils.swing.JComboBox; |
51 | 54 |
|
52 | 55 |
/** |
... | ... | |
56 | 59 |
*/ |
57 | 60 |
public class LabelingManager |
58 | 61 |
extends AbstractThemeManagerPage |
59 |
implements ActionListener { |
|
62 |
implements ActionListener, LabelingPanel {
|
|
60 | 63 |
|
61 | 64 |
private static final long serialVersionUID = 856162295985695717L; |
62 | 65 |
// private static ArrayList<Class<? extends ILabelingStrategyPanel>> installedPanels = new ArrayList<Class<? extends ILabelingStrategyPanel>>(); |
... | ... | |
81 | 84 |
initialize(); |
82 | 85 |
} |
83 | 86 |
|
87 |
@Override |
|
88 |
public boolean isLabelingEnabled() { |
|
89 |
return getChkApplyLabels().isSelected(); |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public void setLabelingEnabled(boolean enabled) { |
|
94 |
getChkApplyLabels().setSelected(enabled); |
|
95 |
getCmbStrategy().setEnabled(enabled); |
|
96 |
ILabelingStrategyPanel panel = getCurrentLabelingStrategy(); |
|
97 |
((Component)panel).setEnabled(enabled); |
|
98 |
} |
|
99 |
|
|
100 |
@Override |
|
101 |
public void setCurrentLabelingStrategy(ILabelingStrategyPanel panel) { |
|
102 |
ComboBoxModel model = getCmbStrategy().getModel(); |
|
103 |
model.setSelectedItem(panel); |
|
104 |
} |
|
105 |
|
|
106 |
@Override |
|
107 |
public ILabelingStrategyPanel getCurrentLabelingStrategy() { |
|
108 |
ILabelingStrategyPanel panel = ((LabelingStrategyItem) getCmbStrategy().getSelectedItem()).strategyPanel; |
|
109 |
return panel; |
|
110 |
} |
|
111 |
|
|
112 |
@Override |
|
113 |
public FLayer getLayer() { |
|
114 |
return (FLayer) this.layer; |
|
115 |
} |
|
116 |
|
|
117 |
@Override |
|
118 |
public void setLayer(FLayer layer) { |
|
119 |
this.setModel(layer); |
|
120 |
} |
|
121 |
|
|
122 |
@Override |
|
123 |
public ILabelingStrategy getLabelingStrategy() { |
|
124 |
ILabelingStrategyPanel panel = ((LabelingStrategyItem) getCmbStrategy().getSelectedItem()).strategyPanel; |
|
125 |
ILabelingStrategy strategy = panel.getLabelingStrategy(); |
|
126 |
return strategy; |
|
127 |
} |
|
128 |
|
|
129 |
|
|
84 | 130 |
private class LabelingStrategyItem { |
85 | 131 |
|
86 | 132 |
private ILabelingStrategyPanel strategyPanel; |
... | ... | |
128 | 174 |
private JPanel getPnlNorth() { |
129 | 175 |
if( pnlNorth == null ) { |
130 | 176 |
pnlNorth = new JPanel(new BorderLayout(5, 5)); |
131 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
|
177 |
JPanel aux = new JPanel(new BorderLayout());
|
|
132 | 178 |
|
133 |
aux.add(getChkApplyLabels()); |
|
179 |
aux.add(getChkApplyLabels(), BorderLayout.LINE_START); |
|
180 |
|
|
181 |
ConfigurableActionsMamager cfgActionsManager = ToolsUtilLocator.getConfigurableActionsMamager(); |
|
182 |
JComponent c = cfgActionsManager.getConfigurableActionsComponent("labelingPropertiesPage", this); |
|
183 |
aux.add(c, BorderLayout.LINE_END); |
|
184 |
|
|
134 | 185 |
pnlNorth.add(aux, BorderLayout.NORTH); |
186 |
|
|
135 | 187 |
aux = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
136 | 188 |
aux.add(new JLabel(PluginServices.getText(this, "general") + ":")); |
137 | 189 |
aux.add(getCmbStrategy()); |
... | ... | |
228 | 280 |
|
229 | 281 |
getCmbStrategy().setSelectedItem(this.layer.getLabelingStrategy()); |
230 | 282 |
evt.setSource(getCmbStrategy()); |
231 |
actionPerformed(evt); |
|
283 |
actionPerformed(evt);
|
|
232 | 284 |
} else { |
233 | 285 |
setComponentEnabled(this, false); |
234 | 286 |
} |
... | ... | |
278 | 330 |
} |
279 | 331 |
} |
280 | 332 |
} |
281 |
|
|
333 |
|
|
282 | 334 |
public void acceptAction() { |
283 | 335 |
applyAction(); |
284 | 336 |
} |
Also available in: Unified diff