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;
|
... | ... | |
131 |
177 |
JPanel aux = new JPanel(new BorderLayout());
|
132 |
178 |
|
133 |
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);
|
135 |
186 |
|
136 |
187 |
aux = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
... | ... | |
229 |
280 |
|
230 |
281 |
getCmbStrategy().setSelectedItem(this.layer.getLabelingStrategy());
|
231 |
282 |
evt.setSource(getCmbStrategy());
|
232 |
|
actionPerformed(evt);
|
|
283 |
actionPerformed(evt);
|
233 |
284 |
} else {
|
234 |
285 |
setComponentEnabled(this, false);
|
235 |
286 |
}
|
... | ... | |
279 |
330 |
}
|
280 |
331 |
}
|
281 |
332 |
}
|
282 |
|
|
|
333 |
|
283 |
334 |
public void acceptAction() {
|
284 |
335 |
applyAction();
|
285 |
336 |
}
|