Revision 47476 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.swing/org.gvsig.symbology.swing.api/src/main/java/org/gvsig/app/gui/styling/MarkerFill.java
MarkerFill.java | ||
---|---|---|
30 | 30 |
import java.awt.event.ActionEvent; |
31 | 31 |
import java.awt.event.ActionListener; |
32 | 32 |
import java.util.ArrayList; |
33 |
|
|
34 | 33 |
import javax.swing.ButtonGroup; |
35 | 34 |
import javax.swing.JCheckBox; |
36 | 35 |
import javax.swing.JComponent; |
... | ... | |
39 | 38 |
import javax.swing.JSlider; |
40 | 39 |
import javax.swing.event.ChangeEvent; |
41 | 40 |
import javax.swing.event.ChangeListener; |
42 |
|
|
43 | 41 |
import org.gvsig.andami.PluginServices; |
44 | 42 |
import org.gvsig.andami.messages.NotificationManager; |
45 | 43 |
import org.gvsig.app.gui.panels.ColorChooserPanel; |
... | ... | |
54 | 52 |
import org.gvsig.gui.beans.swing.JNumberSpinner; |
55 | 53 |
import org.gvsig.i18n.Messages; |
56 | 54 |
import org.gvsig.symbology.SymbologyLocator; |
55 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
|
57 | 56 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IMarkerFillSymbol; |
58 | 57 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
59 | 58 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol; |
... | ... | |
77 | 76 |
* |
78 | 77 |
*@see MarkerFillProperties |
79 | 78 |
*@see AbstractTypeSymbolEditor |
80 |
*@author jaume dominguez faus - jaume.dominguez@iver.es
|
|
79 |
*@author gvSIG Team
|
|
81 | 80 |
*/ |
82 | 81 |
public class MarkerFill extends AbstractTypeSymbolEditor implements ActionListener,ChangeListener { |
83 |
private ArrayList<JPanel> tabs = new ArrayList<JPanel>();
|
|
82 |
private final ArrayList<JPanel> tabs = new ArrayList<>();
|
|
84 | 83 |
private ColorChooserPanel markerCC; |
85 | 84 |
private JButton btnChooseMarker; |
86 |
private MarkerFillProperties panelStyle = new MarkerFillProperties(); |
|
85 |
private final MarkerFillProperties panelStyle = new MarkerFillProperties();
|
|
87 | 86 |
private JRadioButton rdGrid; |
88 | 87 |
private JRadioButton rdRandom; |
89 | 88 |
private IMarkerSymbol marker = SymbologyLocator.getSymbologyManager().createSimpleMarkerSymbol(); |
... | ... | |
111 | 110 |
* for the different attributes. |
112 | 111 |
*/ |
113 | 112 |
private void initialize() { |
114 |
// GridLayout layout; |
|
115 | 113 |
JPanel myTab; |
116 | 114 |
// Marker fill tab |
117 | 115 |
|
... | ... | |
126 | 124 |
markerCC.addActionListener(this); |
127 | 125 |
aux.add(markerCC); |
128 | 126 |
|
129 |
p.addComponent(Messages.getText("color")+":", aux);
|
|
127 |
p.addComponent(Messages.getText("Color")+":", aux);
|
|
130 | 128 |
btnChooseMarker = new JButton(Messages.getText("choose_marker")); |
131 | 129 |
btnChooseMarker.addActionListener(this); |
132 | 130 |
aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5)); |
... | ... | |
186 | 184 |
panelStyle.addActionListener(this); |
187 | 185 |
} |
188 | 186 |
|
187 |
@Override |
|
189 | 188 |
public void refreshControls(ISymbol layer) { |
190 | 189 |
if (layer == null) { |
191 | 190 |
System.err.println(getClass().getName()+":: should be unreachable code"); |
... | ... | |
194 | 193 |
rdGrid.setSelected(true); |
195 | 194 |
rdRandom.setSelected(false); |
196 | 195 |
} else { |
197 |
|
|
196 |
if(layer instanceof IMarkerFillSymbol){ |
|
198 | 197 |
IMarkerFillSymbol mfs = (IMarkerFillSymbol) layer; |
199 | 198 |
int fillStyle = mfs.getMarkerFillProperties().getFillStyle(); |
200 | 199 |
marker = mfs.getMarker(); |
201 | 200 |
rdGrid.setSelected(fillStyle == IMarkerFillPropertiesStyle.GRID_FILL); |
202 | 201 |
rdRandom.setSelected(fillStyle == IMarkerFillPropertiesStyle.RANDOM_FILL); |
203 | 202 |
panelStyle.setModel(mfs.getMarkerFillProperties()); |
204 |
markerCC.setColor(marker.getColor()); |
|
203 |
markerCC.setColor(mfs.getFillColor()); |
|
204 |
} |
|
205 |
if(layer instanceof IFillSymbol){ |
|
206 |
IFillSymbol fs = (IFillSymbol) layer; |
|
205 | 207 |
|
206 | 208 |
//outline |
207 | 209 |
sldOutlineTransparency.removeChangeListener(this); |
208 | 210 |
|
209 |
outline=mfs.getOutline();
|
|
211 |
outline=fs.getOutline(); |
|
210 | 212 |
btnOutline.setSymbol(outline); |
211 |
useBorder.setSelected(mfs.hasOutline());
|
|
213 |
useBorder.setSelected(fs.hasOutline()); |
|
212 | 214 |
|
213 | 215 |
if (outline != null) { |
214 | 216 |
outlineAlpha = outline.getAlpha(); |
... | ... | |
219 | 221 |
} |
220 | 222 |
|
221 | 223 |
sldOutlineTransparency.addChangeListener(this); |
222 |
|
|
223 |
|
|
224 |
|
|
224 |
} |
|
225 | 225 |
} |
226 | 226 |
} |
227 | 227 |
|
228 |
@Override |
|
228 | 229 |
public String getName() { |
229 | 230 |
return Messages.getText("marker_fill_symbol"); |
230 | 231 |
} |
231 | 232 |
|
233 |
@Override |
|
232 | 234 |
public JPanel[] getTabs() { |
233 | 235 |
return (JPanel[]) tabs.toArray(new JPanel[0]); |
234 | 236 |
} |
235 | 237 |
|
238 |
@Override |
|
236 | 239 |
public void actionPerformed(ActionEvent e) { |
237 | 240 |
|
238 | 241 |
JComponent comp = (JComponent) e.getSource(); |
... | ... | |
252 | 255 |
if (comp.equals(btnOutline)) { |
253 | 256 |
ISymbol sym = btnOutline.getSymbol(); |
254 | 257 |
if (sym instanceof ILineSymbol) { |
255 |
ILineSymbol outline = (ILineSymbol) sym; |
|
256 |
if (outline != null) |
|
257 |
txtOutlineWidth.setDouble(outline.getLineWidth()); |
|
258 |
} |
|
258 |
ILineSymbol theOutline = (ILineSymbol) sym; |
|
259 |
if (theOutline != null) { |
|
260 |
txtOutlineWidth.setDouble(theOutline.getLineWidth()); |
|
261 |
} |
|
262 |
} |
|
259 | 263 |
|
260 | 264 |
} |
261 | 265 |
|
262 | 266 |
fireSymbolChangedEvent(); |
263 | 267 |
} |
264 | 268 |
|
269 |
@Override |
|
265 | 270 |
public ISymbol getLayer() { |
266 | 271 |
IMarkerFillSymbol mfs = SymbologyLocator.getSymbologyManager().createMarkerFillSymbol(); |
267 | 272 |
IMarkerFillPropertiesStyle prop = panelStyle.getMarkerFillProperties(); |
... | ... | |
277 | 282 |
"Marker Symbol does not support cloning", e); |
278 | 283 |
} |
279 | 284 |
|
285 |
mfs.setFillColor(this.markerCC.getColor()); |
|
280 | 286 |
mfs.setMarkerFillProperties(prop); |
281 | 287 |
|
282 | 288 |
mfs.setHasOutline(useBorder.isSelected()); |
... | ... | |
292 | 298 |
return mfs; |
293 | 299 |
} |
294 | 300 |
|
301 |
@Override |
|
295 | 302 |
public EditorTool[] getEditorTools() { |
296 | 303 |
return null; |
297 | 304 |
} |
298 | 305 |
|
306 |
@Override |
|
299 | 307 |
public void stateChanged(ChangeEvent e) { |
300 | 308 |
Object s = e.getSource(); |
301 | 309 |
|
... | ... | |
308 | 316 |
|
309 | 317 |
} |
310 | 318 |
|
319 |
@Override |
|
311 | 320 |
public boolean canManageSymbol(ISymbol symbol) { |
312 | 321 |
return symbol instanceof IMarkerFillSymbol; |
313 | 322 |
} |
Also available in: Unified diff