Revision 27419 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/gui/styling/SymbolSelector.java
SymbolSelector.java | ||
---|---|---|
76 | 76 |
import javax.swing.tree.DefaultMutableTreeNode; |
77 | 77 |
|
78 | 78 |
import org.gvsig.fmap.geom.Geometry; |
79 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
80 |
import org.gvsig.fmap.geom.GeometryManager; |
|
81 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
82 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
79 | 83 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
80 | 84 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
81 | 85 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
... | ... | |
96 | 100 |
import org.gvsig.gui.beans.swing.JComboBoxFonts; |
97 | 101 |
import org.gvsig.gui.beans.swing.JFileChooser; |
98 | 102 |
import org.gvsig.gui.beans.swing.JIncrementalNumberField; |
103 |
import org.slf4j.Logger; |
|
104 |
import org.slf4j.LoggerFactory; |
|
99 | 105 |
|
100 | 106 |
import com.iver.andami.PluginServices; |
101 | 107 |
import com.iver.andami.messages.NotificationManager; |
... | ... | |
114 | 120 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
115 | 121 |
*/ |
116 | 122 |
public class SymbolSelector extends JPanel implements ISymbolSelector, ActionListener { |
117 |
|
|
118 |
private static final long serialVersionUID = -6405660392303659551L; |
|
119 |
private JPanel jPanel = null; |
|
120 |
protected JScrollPane jScrollPane = null; |
|
121 |
private JScrollPane jScrollPane1 = null; |
|
122 |
private WindowInfo wi; |
|
123 |
private static final long serialVersionUID = -6405660392303659551L; |
|
124 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
125 |
private static final Logger logger = LoggerFactory.getLogger(SymbolSelector.class); |
|
126 |
private JPanel jPanel = null; |
|
127 |
protected JScrollPane jScrollPane = null; |
|
128 |
private JScrollPane jScrollPane1 = null; |
|
129 |
private WindowInfo wi; |
|
123 | 130 |
private JSplitPane jSplitPane = null; |
124 | 131 |
protected AcceptCancelPanel okCancelPanel; |
125 | 132 |
private JPanel northPanel; |
... | ... | |
141 | 148 |
protected File dir; |
142 | 149 |
protected File rootDir; |
143 | 150 |
protected JComponent jPanelPreview = null; |
144 |
protected GridBagLayoutPanel jPanelOptions = null;
|
|
145 |
protected JList jListSymbols = null;
|
|
146 |
protected String treeRootName;
|
|
147 |
protected ILibraryModel library;
|
|
148 |
private JIncrementalNumberField txtWidth;
|
|
149 |
protected boolean act = true;
|
|
150 |
boolean accepted = true;
|
|
151 |
protected GridBagLayoutPanel jPanelOptions = null;
|
|
152 |
protected JList jListSymbols = null;
|
|
153 |
protected String treeRootName;
|
|
154 |
protected ILibraryModel library;
|
|
155 |
private JIncrementalNumberField txtWidth;
|
|
156 |
protected boolean act = true;
|
|
157 |
boolean accepted = true;
|
|
151 | 158 |
|
152 | 159 |
|
153 | 160 |
protected SelectorFilter sFilter = new SelectorFilter() { |
161 |
private Geometry dummyPointGeom = null; |
|
162 |
private Geometry dummyLineGeom = null; |
|
163 |
private Geometry dummyPolygonGeom = null; |
|
164 |
private boolean isInitialized = false; |
|
154 | 165 |
|
155 |
private final Geometry dummyPointGeom = UtilFunctions.createPoint(0, 0); |
|
156 |
private final Geometry dummyLineGeom = UtilFunctions |
|
157 |
.createSurface(new GeneralPathX()); |
|
158 |
private final Geometry dummyPolygonGeom = UtilFunctions |
|
159 |
.createSurface(new GeneralPathX()); |
|
166 |
public boolean accepts(Object obj) { |
|
167 |
if (!isInitialized){ |
|
168 |
try { |
|
169 |
dummyPointGeom = geomManager.createPoint(0, 0, SUBTYPES.GEOM2D); |
|
170 |
dummyLineGeom = geomManager.createSurface(new GeneralPathX(), SUBTYPES.GEOM2D); |
|
171 |
dummyPolygonGeom = geomManager.createSurface(new GeneralPathX(), SUBTYPES.GEOM2D); |
|
172 |
} catch (CreateGeometryException e) { |
|
173 |
logger.error("Error creating a geometry", e); |
|
174 |
} |
|
175 |
isInitialized = true; |
|
176 |
} |
|
160 | 177 |
|
161 |
public boolean accepts(Object obj) { |
|
162 | 178 |
if (obj instanceof ISymbol) { |
163 | 179 |
ISymbol sym = (ISymbol) obj; |
164 | 180 |
|
... | ... | |
192 | 208 |
* @param shapeType |
193 | 209 |
*/ |
194 | 210 |
private SymbolSelector(Object currentElement, int shapeType, boolean initialize) { |
195 |
super();
|
|
211 |
super();
|
|
196 | 212 |
|
197 |
// TODO 09/08/07 check the currentElement type is suitable for the shapeType specified
|
|
198 |
if (currentElement != null && currentElement instanceof ISymbol) {
|
|
199 |
ISymbol sym = (ISymbol) currentElement;
|
|
200 |
try {
|
|
213 |
// TODO 09/08/07 check the currentElement type is suitable for the shapeType specified
|
|
214 |
if (currentElement != null && currentElement instanceof ISymbol) {
|
|
215 |
ISymbol sym = (ISymbol) currentElement;
|
|
216 |
try {
|
|
201 | 217 |
currentElement = SymbologyFactory.createSymbolFromXML( |
202 | 218 |
sym.getXMLEntity(), ""); |
203 | 219 |
} catch (XMLException e) { |
204 | 220 |
NotificationManager.addWarning("Symbol layer", e); |
205 | 221 |
} |
206 |
String desc = sym.getDescription();
|
|
207 |
// desc += " ("+PluginServices.getText(this, "current")+")"; |
|
208 |
// ((ISymbol)currentElement).setDescription(desc); |
|
209 |
}
|
|
222 |
String desc = sym.getDescription();
|
|
223 |
// desc += " ("+PluginServices.getText(this, "current")+")";
|
|
224 |
// ((ISymbol)currentElement).setDescription(desc);
|
|
225 |
}
|
|
210 | 226 |
|
211 |
// for symbols MULTIPOINT is the same than POINT |
|
212 |
if (shapeType == Geometry.TYPES.MULTIPOINT) {
|
|
227 |
// for symbols MULTIPOINT is the same than POINT
|
|
228 |
if (shapeType == Geometry.TYPES.MULTIPOINT) {
|
|
213 | 229 |
shapeType = Geometry.TYPES.POINT; |
214 | 230 |
} |
215 | 231 |
|
216 |
this.shapeType = shapeType;
|
|
217 |
// Preferences prefs = Preferences.userRoot().node( "gvsig.foldering" ); |
|
232 |
this.shapeType = shapeType;
|
|
233 |
// Preferences prefs = Preferences.userRoot().node( "gvsig.foldering" );
|
|
218 | 234 |
rootDir = new File(SymbologyFactory.SymbolLibraryPath); |
219 |
// prefs.get("SymbolLibraryFolder", System.getProperty("user.home")+"/gvSIG/Symbols")); |
|
235 |
// prefs.get("SymbolLibraryFolder", System.getProperty("user.home")+"/gvSIG/Symbols"));
|
|
220 | 236 |
if (!rootDir.exists()) { |
221 | 237 |
rootDir.mkdir(); |
222 | 238 |
} |
... | ... | |
230 | 246 |
} |
231 | 247 |
|
232 | 248 |
|
233 |
}
|
|
249 |
}
|
|
234 | 250 |
|
235 | 251 |
/** |
236 | 252 |
* Constructor method, it is <b>protected</b> by convenience to let StyleSelector |
... | ... | |
240 | 256 |
* @param shapeType |
241 | 257 |
* @param filter |
242 | 258 |
*/ |
243 |
protected SymbolSelector(Object symbol, int shapeType, SelectorFilter filter, boolean initialize) {
|
|
244 |
this(symbol, shapeType, initialize);
|
|
245 |
sFilter = filter;
|
|
246 |
}
|
|
259 |
protected SymbolSelector(Object symbol, int shapeType, SelectorFilter filter, boolean initialize) {
|
|
260 |
this(symbol, shapeType, initialize);
|
|
261 |
sFilter = filter;
|
|
262 |
}
|
|
247 | 263 |
|
248 |
/**
|
|
249 |
* This method initializes this
|
|
250 |
* @param currentElement
|
|
251 |
* @throws ClassNotFoundException
|
|
252 |
*
|
|
253 |
*/
|
|
254 |
protected void initialize(Object currentElement) throws ClassNotFoundException {
|
|
255 |
library = new SymbolLibrary(rootDir);
|
|
264 |
/**
|
|
265 |
* This method initializes this
|
|
266 |
* @param currentElement
|
|
267 |
* @throws ClassNotFoundException
|
|
268 |
*
|
|
269 |
*/
|
|
270 |
protected void initialize(Object currentElement) throws ClassNotFoundException {
|
|
271 |
library = new SymbolLibrary(rootDir);
|
|
256 | 272 |
|
257 |
this.setLayout(new BorderLayout());
|
|
258 |
this.setSize(400, 221);
|
|
273 |
this.setLayout(new BorderLayout());
|
|
274 |
this.setSize(400, 221);
|
|
259 | 275 |
|
260 |
this.add(getJNorthPanel(), BorderLayout.NORTH);
|
|
261 |
this.add(getJSplitPane(), BorderLayout.CENTER);
|
|
262 |
this.add(getJEastPanel(), BorderLayout.EAST);
|
|
263 |
ActionListener okAction = new ActionListener() {
|
|
264 |
public void actionPerformed(ActionEvent e) {
|
|
265 |
PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
|
|
266 |
}
|
|
267 |
}, cancelAction = new ActionListener() {
|
|
268 |
public void actionPerformed(ActionEvent e) {
|
|
269 |
accepted = false;
|
|
276 |
this.add(getJNorthPanel(), BorderLayout.NORTH);
|
|
277 |
this.add(getJSplitPane(), BorderLayout.CENTER);
|
|
278 |
this.add(getJEastPanel(), BorderLayout.EAST);
|
|
279 |
ActionListener okAction = new ActionListener() {
|
|
280 |
public void actionPerformed(ActionEvent e) {
|
|
281 |
PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
|
|
282 |
}
|
|
283 |
}, cancelAction = new ActionListener() {
|
|
284 |
public void actionPerformed(ActionEvent e) {
|
|
285 |
accepted = false;
|
|
270 | 286 |
|
271 |
setSymbol(null);
|
|
272 |
PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
|
|
273 |
}
|
|
274 |
};
|
|
287 |
setSymbol(null);
|
|
288 |
PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
|
|
289 |
}
|
|
290 |
};
|
|
275 | 291 |
|
276 |
okCancelPanel = new AcceptCancelPanel();
|
|
277 |
okCancelPanel.setOkButtonActionListener(okAction);
|
|
278 |
okCancelPanel.setCancelButtonActionListener(cancelAction);
|
|
292 |
okCancelPanel = new AcceptCancelPanel();
|
|
293 |
okCancelPanel.setOkButtonActionListener(okAction);
|
|
294 |
okCancelPanel.setCancelButtonActionListener(cancelAction);
|
|
279 | 295 |
|
280 |
this.add(okCancelPanel, BorderLayout.SOUTH);
|
|
281 |
libraryBrowser.setSelectionRow(0);
|
|
296 |
this.add(okCancelPanel, BorderLayout.SOUTH);
|
|
297 |
libraryBrowser.setSelectionRow(0);
|
|
282 | 298 |
|
283 |
SillyDragNDropAction dndAction = new SillyDragNDropAction();
|
|
284 |
libraryBrowser.addMouseListener(dndAction);
|
|
285 |
libraryBrowser.addMouseMotionListener(dndAction);
|
|
286 |
getJListSymbols().addMouseListener(dndAction);
|
|
287 |
getJListSymbols().addMouseMotionListener(dndAction);
|
|
288 |
setSymbol(currentElement);
|
|
289 |
}
|
|
299 |
SillyDragNDropAction dndAction = new SillyDragNDropAction();
|
|
300 |
libraryBrowser.addMouseListener(dndAction);
|
|
301 |
libraryBrowser.addMouseMotionListener(dndAction);
|
|
302 |
getJListSymbols().addMouseListener(dndAction);
|
|
303 |
getJListSymbols().addMouseMotionListener(dndAction);
|
|
304 |
setSymbol(currentElement);
|
|
305 |
}
|
|
290 | 306 |
|
291 |
/**
|
|
292 |
* Creates a new symbol selector list model in order to allow the user
|
|
293 |
* to select an existing symbol previously created.
|
|
294 |
*
|
|
295 |
* @return listModel SymbolSelectorListModel
|
|
296 |
*/
|
|
297 |
protected SymbolSelectorListModel newListModel() {
|
|
298 |
SymbolSelectorListModel listModel = new SymbolSelectorListModel(
|
|
299 |
dir,
|
|
300 |
sFilter,
|
|
301 |
SymbolLibrary.SYMBOL_FILE_EXTENSION);
|
|
302 |
return listModel;
|
|
303 |
}
|
|
304 |
/**
|
|
305 |
* Initializes tha JNorthPanel.
|
|
306 |
*
|
|
307 |
* @return northPanel JPanel
|
|
308 |
* @throws IllegalArgumentException
|
|
309 |
*/
|
|
310 |
protected JPanel getJNorthPanel() throws IllegalArgumentException {
|
|
307 |
/**
|
|
308 |
* Creates a new symbol selector list model in order to allow the user
|
|
309 |
* to select an existing symbol previously created.
|
|
310 |
*
|
|
311 |
* @return listModel SymbolSelectorListModel
|
|
312 |
*/
|
|
313 |
protected SymbolSelectorListModel newListModel() {
|
|
314 |
SymbolSelectorListModel listModel = new SymbolSelectorListModel(
|
|
315 |
dir,
|
|
316 |
sFilter,
|
|
317 |
SymbolLibrary.SYMBOL_FILE_EXTENSION);
|
|
318 |
return listModel;
|
|
319 |
}
|
|
320 |
/**
|
|
321 |
* Initializes tha JNorthPanel.
|
|
322 |
*
|
|
323 |
* @return northPanel JPanel
|
|
324 |
* @throws IllegalArgumentException
|
|
325 |
*/
|
|
326 |
protected JPanel getJNorthPanel() throws IllegalArgumentException {
|
|
311 | 327 |
if (northPanel == null) { |
312 | 328 |
String text = ""; |
313 | 329 |
switch (shapeType) { |
... | ... | |
334 | 350 |
return northPanel; |
335 | 351 |
} |
336 | 352 |
|
337 |
/**
|
|
338 |
* This method initializes jList
|
|
339 |
*
|
|
340 |
* @return javax.swing.JList
|
|
341 |
*/
|
|
342 |
protected JList getJListSymbols() {
|
|
343 |
if (jListSymbols == null) {
|
|
344 |
jListSymbols = new JList() ;
|
|
345 |
jListSymbols.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
|
346 |
jListSymbols.setLayoutOrientation(JList.HORIZONTAL_WRAP);
|
|
347 |
jListSymbols.setVisibleRowCount(-1);
|
|
348 |
jListSymbols.addListSelectionListener(new ListSelectionListener() {
|
|
349 |
public void valueChanged(ListSelectionEvent e) {
|
|
350 |
if (jListSymbols.getSelectedValue()!=null) {
|
|
351 |
ISymbol selSym=null;
|
|
353 |
/**
|
|
354 |
* This method initializes jList
|
|
355 |
*
|
|
356 |
* @return javax.swing.JList
|
|
357 |
*/
|
|
358 |
protected JList getJListSymbols() {
|
|
359 |
if (jListSymbols == null) {
|
|
360 |
jListSymbols = new JList() ;
|
|
361 |
jListSymbols.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
|
362 |
jListSymbols.setLayoutOrientation(JList.HORIZONTAL_WRAP);
|
|
363 |
jListSymbols.setVisibleRowCount(-1);
|
|
364 |
jListSymbols.addListSelectionListener(new ListSelectionListener() {
|
|
365 |
public void valueChanged(ListSelectionEvent e) {
|
|
366 |
if (jListSymbols.getSelectedValue()!=null) {
|
|
367 |
ISymbol selSym=null;
|
|
352 | 368 |
try { |
353 | 369 |
selSym = SymbologyFactory.createSymbolFromXML( |
354 | 370 |
((ISymbol) jListSymbols.getSelectedValue()).getXMLEntity(), null); |
355 | 371 |
} catch (XMLException e1) { |
356 | 372 |
NotificationManager.addWarning("Symbol layer", e1); |
357 | 373 |
} |
358 |
setSymbol(selSym);
|
|
359 |
updateOptionsPanel();
|
|
360 |
}
|
|
361 |
}
|
|
362 |
});
|
|
363 |
ListCellRenderer renderer = new ListCellRenderer() {
|
|
364 |
private Color mySelectedBGColor = new Color(255,145,100,255);
|
|
365 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
|
366 |
ISymbol sym = (ISymbol) value;
|
|
367 |
JPanel pnl = new JPanel();
|
|
368 |
BoxLayout layout = new BoxLayout(pnl, BoxLayout.Y_AXIS);
|
|
369 |
pnl.setLayout(layout);
|
|
370 |
Color bgColor = (isSelected) ? mySelectedBGColor
|
|
371 |
: getJListSymbols().getBackground();
|
|
374 |
setSymbol(selSym);
|
|
375 |
updateOptionsPanel();
|
|
376 |
}
|
|
377 |
}
|
|
378 |
});
|
|
379 |
ListCellRenderer renderer = new ListCellRenderer() {
|
|
380 |
private Color mySelectedBGColor = new Color(255,145,100,255);
|
|
381 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
|
382 |
ISymbol sym = (ISymbol) value;
|
|
383 |
JPanel pnl = new JPanel();
|
|
384 |
BoxLayout layout = new BoxLayout(pnl, BoxLayout.Y_AXIS);
|
|
385 |
pnl.setLayout(layout);
|
|
386 |
Color bgColor = (isSelected) ? mySelectedBGColor
|
|
387 |
: getJListSymbols().getBackground();
|
|
372 | 388 |
|
373 |
pnl.setBackground(bgColor);
|
|
374 |
SymbolPreviewer sp = new SymbolPreviewer();
|
|
375 |
sp.setAlignmentX(Component.CENTER_ALIGNMENT);
|
|
376 |
sp.setPreferredSize(new Dimension(50, 50));
|
|
377 |
sp.setSymbol(sym);
|
|
378 |
sp.setBackground(bgColor);
|
|
379 |
pnl.add(sp);
|
|
380 |
String desc = sym.getDescription();
|
|
381 |
if (desc == null) {
|
|
382 |
desc = "["+PluginServices.getText(this, "no_desc")+"]";
|
|
383 |
}
|
|
384 |
JLabel lbl = new JLabel(desc);
|
|
385 |
lbl.setBackground(bgColor);
|
|
386 |
lbl.setAlignmentX(Component.CENTER_ALIGNMENT);
|
|
387 |
pnl.add(lbl);
|
|
389 |
pnl.setBackground(bgColor);
|
|
390 |
SymbolPreviewer sp = new SymbolPreviewer();
|
|
391 |
sp.setAlignmentX(Component.CENTER_ALIGNMENT);
|
|
392 |
sp.setPreferredSize(new Dimension(50, 50));
|
|
393 |
sp.setSymbol(sym);
|
|
394 |
sp.setBackground(bgColor);
|
|
395 |
pnl.add(sp);
|
|
396 |
String desc = sym.getDescription();
|
|
397 |
if (desc == null) {
|
|
398 |
desc = "["+PluginServices.getText(this, "no_desc")+"]";
|
|
399 |
}
|
|
400 |
JLabel lbl = new JLabel(desc);
|
|
401 |
lbl.setBackground(bgColor);
|
|
402 |
lbl.setAlignmentX(Component.CENTER_ALIGNMENT);
|
|
403 |
pnl.add(lbl);
|
|
388 | 404 |
|
389 |
return pnl;
|
|
390 |
}
|
|
405 |
return pnl;
|
|
406 |
}
|
|
391 | 407 |
|
392 |
};
|
|
393 |
jListSymbols.setCellRenderer(renderer);
|
|
394 |
}
|
|
395 |
return jListSymbols;
|
|
396 |
}
|
|
397 |
/**
|
|
398 |
* Updates the options panel depending on the type of symbol that the user
|
|
399 |
* is controlling or using to show specific options for each one.
|
|
400 |
*
|
|
401 |
*/
|
|
402 |
protected void updateOptionsPanel() throws IllegalArgumentException {
|
|
403 |
Object mySelectedElement = ((SymbolPreviewer) jPanelPreview).getSymbol();
|
|
408 |
};
|
|
409 |
jListSymbols.setCellRenderer(renderer);
|
|
410 |
}
|
|
411 |
return jListSymbols;
|
|
412 |
}
|
|
413 |
/**
|
|
414 |
* Updates the options panel depending on the type of symbol that the user
|
|
415 |
* is controlling or using to show specific options for each one.
|
|
416 |
*
|
|
417 |
*/
|
|
418 |
protected void updateOptionsPanel() throws IllegalArgumentException {
|
|
419 |
Object mySelectedElement = ((SymbolPreviewer) jPanelPreview).getSymbol();
|
|
404 | 420 |
|
405 |
if (mySelectedElement == null) {
|
|
421 |
if (mySelectedElement == null) {
|
|
406 | 422 |
return; |
407 | 423 |
} |
408 |
act = false; // disable events
|
|
424 |
act = false; // disable events
|
|
409 | 425 |
|
410 |
if (mySelectedElement instanceof CartographicSupport) {
|
|
426 |
if (mySelectedElement instanceof CartographicSupport) {
|
|
411 | 427 |
CartographicSupport cs = (CartographicSupport) mySelectedElement; |
412 | 428 |
cmbUnits.setSelectedUnitIndex(cs.getUnit()); |
413 | 429 |
cmbReferenceSystem.setSelectedIndex(cs.getReferenceSystem()); |
414 | 430 |
} |
415 | 431 |
|
416 |
if (mySelectedElement instanceof IMultiLayerSymbol){
|
|
432 |
if (mySelectedElement instanceof IMultiLayerSymbol){
|
|
417 | 433 |
if (((IMultiLayerSymbol)mySelectedElement).getLayerCount() == 1) { |
418 | 434 |
mySelectedElement = ((IMultiLayerSymbol)mySelectedElement).getLayer(0); |
419 | 435 |
} |
420 | 436 |
} |
421 | 437 |
|
422 |
try {
|
|
438 |
try {
|
|
423 | 439 |
|
424 |
jcc1.setEnabled(true);
|
|
425 |
jcc2.setEnabled(true);
|
|
440 |
jcc1.setEnabled(true);
|
|
441 |
jcc2.setEnabled(true);
|
|
426 | 442 |
|
427 |
if(mySelectedElement instanceof IMultiLayerSymbol){
|
|
428 |
jcc1.setColor(Color.WHITE);
|
|
429 |
jcc2.setColor(Color.WHITE);
|
|
430 |
jcc1.setEnabled(false);
|
|
431 |
jcc2.setEnabled(false);
|
|
432 |
}
|
|
443 |
if(mySelectedElement instanceof IMultiLayerSymbol){
|
|
444 |
jcc1.setColor(Color.WHITE);
|
|
445 |
jcc2.setColor(Color.WHITE);
|
|
446 |
jcc1.setEnabled(false);
|
|
447 |
jcc2.setEnabled(false);
|
|
448 |
}
|
|
433 | 449 |
|
434 |
if (shapeType == Geometry.TYPES.POINT) {
|
|
435 |
IMarkerSymbol m = (IMarkerSymbol) mySelectedElement;
|
|
436 |
jcc1.setColor(m.getColor());
|
|
437 |
txtSize.setDouble(m.getSize());
|
|
438 |
txtAngle.setDouble(Math.toDegrees(m.getRotation()));
|
|
439 |
}
|
|
450 |
if (shapeType == Geometry.TYPES.POINT) {
|
|
451 |
IMarkerSymbol m = (IMarkerSymbol) mySelectedElement;
|
|
452 |
jcc1.setColor(m.getColor());
|
|
453 |
txtSize.setDouble(m.getSize());
|
|
454 |
txtAngle.setDouble(Math.toDegrees(m.getRotation()));
|
|
455 |
}
|
|
440 | 456 |
|
441 |
if (shapeType == Geometry.TYPES.CURVE) {
|
|
442 |
ILineSymbol l = (ILineSymbol) mySelectedElement;
|
|
443 |
jcc1.setColor(l.getColor());
|
|
444 |
jcc1.setAlpha(l.getAlpha());
|
|
445 |
txtSize.setDouble(l.getLineWidth());
|
|
446 |
}
|
|
457 |
if (shapeType == Geometry.TYPES.CURVE) {
|
|
458 |
ILineSymbol l = (ILineSymbol) mySelectedElement;
|
|
459 |
jcc1.setColor(l.getColor());
|
|
460 |
jcc1.setAlpha(l.getAlpha());
|
|
461 |
txtSize.setDouble(l.getLineWidth());
|
|
462 |
}
|
|
447 | 463 |
|
448 |
if (shapeType == Geometry.TYPES.SURFACE) {
|
|
449 |
IFillSymbol f = (IFillSymbol) mySelectedElement;
|
|
464 |
if (shapeType == Geometry.TYPES.SURFACE) {
|
|
465 |
IFillSymbol f = (IFillSymbol) mySelectedElement;
|
|
450 | 466 |
|
451 |
txtWidth.setEnabled(true);
|
|
467 |
txtWidth.setEnabled(true);
|
|
452 | 468 |
cmbReferenceSystem.setEnabled(true); |
453 | 469 |
cmbUnits.setEnabled(true); |
454 | 470 |
|
455 |
jcc1.setUseColorIsSelected(f.hasFill());
|
|
456 |
jcc1.setColor(f.getFillColor());
|
|
457 |
jcc1.setAlpha(f.getFillAlpha());
|
|
458 |
jcc2.setUseColorIsSelected(f.hasOutline());
|
|
459 |
ILineSymbol outline = f.getOutline();
|
|
460 |
if (outline != null) { |
|
461 |
jcc2.setColor(outline.getColor()); |
|
462 |
txtWidth.setDouble(outline.getLineWidth()); |
|
463 |
} |
|
471 |
jcc1.setUseColorIsSelected(f.hasFill());
|
|
472 |
jcc1.setColor(f.getFillColor());
|
|
473 |
jcc1.setAlpha(f.getFillAlpha());
|
|
474 |
jcc2.setUseColorIsSelected(f.hasOutline());
|
|
475 |
ILineSymbol outline = f.getOutline();
|
|
476 |
if (outline != null) {
|
|
477 |
jcc2.setColor(outline.getColor());
|
|
478 |
txtWidth.setDouble(outline.getLineWidth());
|
|
479 |
}
|
|
464 | 480 |
|
465 |
if(f instanceof MultiLayerFillSymbol){ |
|
466 |
txtWidth.setEnabled(false); |
|
467 |
cmbReferenceSystem.setEnabled(false); |
|
468 |
cmbUnits.setEnabled(false); |
|
481 |
if(f instanceof MultiLayerFillSymbol){ |
|
482 |
txtWidth.setEnabled(false); |
|
483 |
cmbReferenceSystem.setEnabled(false); |
|
484 |
cmbUnits.setEnabled(false); |
|
485 |
} |
|
486 |
|
|
469 | 487 |
} |
470 | 488 |
|
471 |
} |
|
472 | 489 |
|
473 |
|
|
474 |
if (shapeType == Geometry.TYPES.TEXT) { |
|
475 |
ITextSymbol t = (ITextSymbol) mySelectedElement; |
|
476 |
jcc1.setColor(t.getTextColor()); |
|
477 |
Double s = new Double(t.getFont().getSize()); |
|
478 |
cmbFontSize.setSelectedItem(s); |
|
479 |
int i = cmbFontSize.getSelectedIndex(); |
|
480 |
if (i == -1) { |
|
481 |
cmbFontSize.addItem(s); |
|
490 |
if (shapeType == Geometry.TYPES.TEXT) { |
|
491 |
ITextSymbol t = (ITextSymbol) mySelectedElement; |
|
492 |
jcc1.setColor(t.getTextColor()); |
|
493 |
Double s = new Double(t.getFont().getSize()); |
|
482 | 494 |
cmbFontSize.setSelectedItem(s); |
495 |
int i = cmbFontSize.getSelectedIndex(); |
|
496 |
if (i == -1) { |
|
497 |
cmbFontSize.addItem(s); |
|
498 |
cmbFontSize.setSelectedItem(s); |
|
499 |
} |
|
483 | 500 |
} |
501 |
} catch (NullPointerException npEx) { |
|
502 |
throw new IllegalArgumentException(npEx); |
|
503 |
} catch (ClassCastException ccEx) { |
|
504 |
throw new IllegalArgumentException(ccEx); |
|
484 | 505 |
} |
485 |
} catch (NullPointerException npEx) { |
|
486 |
throw new IllegalArgumentException(npEx); |
|
487 |
} catch (ClassCastException ccEx) { |
|
488 |
throw new IllegalArgumentException(ccEx); |
|
489 |
} |
|
490 | 506 |
|
491 |
act = true; // enable events
|
|
507 |
act = true; // enable events
|
|
492 | 508 |
} |
493 | 509 |
|
494 | 510 |
/** |
495 |
* This method initializes jPanel
|
|
496 |
*
|
|
497 |
* @return javax.swing.JPanel
|
|
498 |
*/
|
|
499 |
protected JPanel getJEastPanel() {
|
|
500 |
if (jPanel == null) {
|
|
501 |
jPanel = new JPanel();
|
|
502 |
jPanel.setLayout(new BorderLayout());
|
|
503 |
jPanel.add(getJPanelOptions(), BorderLayout.CENTER);
|
|
504 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
505 |
aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "preview")));
|
|
506 |
aux.add(getJPanelPreview());
|
|
507 |
jPanel.add(aux, BorderLayout.NORTH);
|
|
511 |
* This method initializes jPanel
|
|
512 |
*
|
|
513 |
* @return javax.swing.JPanel
|
|
514 |
*/
|
|
515 |
protected JPanel getJEastPanel() {
|
|
516 |
if (jPanel == null) {
|
|
517 |
jPanel = new JPanel();
|
|
518 |
jPanel.setLayout(new BorderLayout());
|
|
519 |
jPanel.add(getJPanelOptions(), BorderLayout.CENTER);
|
|
520 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
|
521 |
aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "preview")));
|
|
522 |
aux.add(getJPanelPreview());
|
|
523 |
jPanel.add(aux, BorderLayout.NORTH);
|
|
508 | 524 |
|
509 |
jPanel.add(getJPanelOptions());
|
|
510 |
aux = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
|
|
511 |
aux.add(getJPanelButtons());
|
|
512 |
jPanel.add(aux, BorderLayout.SOUTH);
|
|
513 |
}
|
|
514 |
return jPanel;
|
|
515 |
}
|
|
525 |
jPanel.add(getJPanelOptions());
|
|
526 |
aux = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
|
|
527 |
aux.add(getJPanelButtons());
|
|
528 |
jPanel.add(aux, BorderLayout.SOUTH);
|
|
529 |
}
|
|
530 |
return jPanel;
|
|
531 |
}
|
|
516 | 532 |
|
517 |
private JPanel getJPanelButtons() {
|
|
533 |
private JPanel getJPanelButtons() {
|
|
518 | 534 |
if (jPanelButtons == null) { |
519 | 535 |
jPanelButtons = new JPanel(); |
520 | 536 |
GridLayout layout = new GridLayout(); |
... | ... | |
573 | 589 |
} |
574 | 590 |
|
575 | 591 |
/** |
576 |
* This method initializes jScrollPane
|
|
577 |
*
|
|
578 |
* @return javax.swing.JScrollPane
|
|
592 |
* This method initializes jScrollPane
|
|
593 |
*
|
|
594 |
* @return javax.swing.JScrollPane
|
|
579 | 595 |
* @throws ClassNotFoundException |
580 |
*/
|
|
596 |
*/
|
|
581 | 597 |
protected JScrollPane getLeftJScrollPane() throws ClassNotFoundException { |
582 | 598 |
if (jScrollPane == null) { |
583 | 599 |
jScrollPane = new JScrollPane(); |
... | ... | |
587 | 603 |
libraryBrowser.addTreeSelectionListener(new TreeSelectionListener() { |
588 | 604 |
public void valueChanged(javax.swing.event.TreeSelectionEvent e) { |
589 | 605 |
dir = (File) ((DefaultMutableTreeNode) |
590 |
libraryBrowser.getLastSelectedPathComponent()).getUserObject(); |
|
606 |
libraryBrowser.getLastSelectedPathComponent()).getUserObject();
|
|
591 | 607 |
|
592 | 608 |
if (dir == null) { |
593 | 609 |
return; |
594 | 610 |
} |
595 | 611 |
|
596 | 612 |
jListSymbols.setModel(newListModel()); |
597 |
// jListSymbols.setSelectedValue(selectedElement, true); |
|
613 |
// jListSymbols.setSelectedValue(selectedElement, true);
|
|
598 | 614 |
} |
599 | 615 |
}); |
600 | 616 |
jScrollPane.setViewportView(libraryBrowser); |
... | ... | |
602 | 618 |
return jScrollPane; |
603 | 619 |
} |
604 | 620 |
|
605 |
/**
|
|
606 |
* This method initializes jScrollPane1
|
|
607 |
*
|
|
608 |
* @return javax.swing.JScrollPane
|
|
609 |
*/
|
|
610 |
private JScrollPane getJScrollPane1() {
|
|
611 |
if (jScrollPane1 == null) {
|
|
612 |
jScrollPane1 = new JScrollPane();
|
|
613 |
jScrollPane1.setViewportView(getJListSymbols());
|
|
614 |
}
|
|
615 |
return jScrollPane1;
|
|
616 |
}
|
|
621 |
/**
|
|
622 |
* This method initializes jScrollPane1
|
|
623 |
*
|
|
624 |
* @return javax.swing.JScrollPane
|
|
625 |
*/
|
|
626 |
private JScrollPane getJScrollPane1() {
|
|
627 |
if (jScrollPane1 == null) {
|
|
628 |
jScrollPane1 = new JScrollPane();
|
|
629 |
jScrollPane1.setViewportView(getJListSymbols());
|
|
630 |
}
|
|
631 |
return jScrollPane1;
|
|
632 |
}
|
|
617 | 633 |
|
618 |
/**
|
|
619 |
* This method initializes jPanelPreview
|
|
620 |
*
|
|
621 |
* @return javax.swing.JComponent
|
|
622 |
*/
|
|
623 |
protected JComponent getJPanelPreview() {
|
|
624 |
if (jPanelPreview == null) {
|
|
625 |
jPanelPreview = new SymbolPreviewer();
|
|
626 |
jPanelPreview.setPreferredSize(new java.awt.Dimension(100,100));
|
|
627 |
jPanelPreview.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
|
|
628 |
}
|
|
629 |
return jPanelPreview;
|
|
630 |
}
|
|
631 |
/**
|
|
632 |
* This method initializes jPanelOptions
|
|
633 |
*
|
|
634 |
* @return javax.swing.JPanel
|
|
635 |
*/
|
|
636 |
protected JPanel getJPanelOptions() {
|
|
637 |
if (jPanelOptions == null) {
|
|
638 |
jPanelOptions = new GridBagLayoutPanel();
|
|
639 |
jPanelOptions.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "options")));
|
|
640 |
jcc2 = new ColorChooserPanel(true,true);
|
|
641 |
jcc2.setAlpha(255);
|
|
642 |
if (shapeType == Geometry.TYPES.POINT) {
|
|
643 |
jcc1 = new ColorChooserPanel(true);
|
|
634 |
/**
|
|
635 |
* This method initializes jPanelPreview
|
|
636 |
*
|
|
637 |
* @return javax.swing.JComponent
|
|
638 |
*/
|
|
639 |
protected JComponent getJPanelPreview() {
|
|
640 |
if (jPanelPreview == null) {
|
|
641 |
jPanelPreview = new SymbolPreviewer();
|
|
642 |
jPanelPreview.setPreferredSize(new java.awt.Dimension(100,100));
|
|
643 |
jPanelPreview.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
|
|
644 |
}
|
|
645 |
return jPanelPreview;
|
|
646 |
}
|
|
647 |
/**
|
|
648 |
* This method initializes jPanelOptions
|
|
649 |
*
|
|
650 |
* @return javax.swing.JPanel
|
|
651 |
*/
|
|
652 |
protected JPanel getJPanelOptions() {
|
|
653 |
if (jPanelOptions == null) {
|
|
654 |
jPanelOptions = new GridBagLayoutPanel();
|
|
655 |
jPanelOptions.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "options")));
|
|
656 |
jcc2 = new ColorChooserPanel(true,true);
|
|
657 |
jcc2.setAlpha(255);
|
|
658 |
if (shapeType == Geometry.TYPES.POINT) {
|
|
659 |
jcc1 = new ColorChooserPanel(true);
|
|
644 | 660 |
|
645 |
jPanelOptions.addComponent(
|
|
646 |
PluginServices.getText(this, "color")+":", jcc1);
|
|
647 |
jPanelOptions.addComponent(
|
|
648 |
PluginServices.getText(this, "size")+":",
|
|
649 |
txtSize = new JIncrementalNumberField(String.valueOf(3), 3, 0, Double.MAX_VALUE, 1));
|
|
650 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
651 |
cmbUnits = new JComboBoxUnits());
|
|
652 |
jPanelOptions.addComponent("",
|
|
653 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
654 |
jPanelOptions.addComponent(
|
|
661 |
jPanelOptions.addComponent(
|
|
662 |
PluginServices.getText(this, "color")+":", jcc1);
|
|
663 |
jPanelOptions.addComponent(
|
|
664 |
PluginServices.getText(this, "size")+":",
|
|
665 |
txtSize = new JIncrementalNumberField(String.valueOf(3), 3, 0, Double.MAX_VALUE, 1));
|
|
666 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
667 |
cmbUnits = new JComboBoxUnits());
|
|
668 |
jPanelOptions.addComponent("",
|
|
669 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
670 |
jPanelOptions.addComponent(
|
|
655 | 671 |
PluginServices.getText(this, "angle")+ " (" +PluginServices.getText(this, "degree")+"):", |
656 |
txtAngle = new JIncrementalNumberField());
|
|
672 |
txtAngle = new JIncrementalNumberField());
|
|
657 | 673 |
|
658 | 674 |
|
659 |
} else if (shapeType == Geometry.TYPES.CURVE) {
|
|
660 |
jcc1 = new ColorChooserPanel(true);
|
|
661 |
jPanelOptions.addComponent(
|
|
662 |
PluginServices.getText(this, "color")+":", jcc1);
|
|
663 |
jPanelOptions.addComponent(
|
|
664 |
PluginServices.getText(this, "width")+":",
|
|
665 |
txtSize = new JIncrementalNumberField(String.valueOf(3), 3, 0, Double.MAX_VALUE, 1));
|
|
666 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
667 |
cmbUnits = new JComboBoxUnits());
|
|
668 |
jPanelOptions.addComponent("",
|
|
669 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
675 |
} else if (shapeType == Geometry.TYPES.CURVE) {
|
|
676 |
jcc1 = new ColorChooserPanel(true);
|
|
677 |
jPanelOptions.addComponent(
|
|
678 |
PluginServices.getText(this, "color")+":", jcc1);
|
|
679 |
jPanelOptions.addComponent(
|
|
680 |
PluginServices.getText(this, "width")+":",
|
|
681 |
txtSize = new JIncrementalNumberField(String.valueOf(3), 3, 0, Double.MAX_VALUE, 1));
|
|
682 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
683 |
cmbUnits = new JComboBoxUnits());
|
|
684 |
jPanelOptions.addComponent("",
|
|
685 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
670 | 686 |
|
671 |
} else if (shapeType == Geometry.TYPES.SURFACE) {
|
|
672 |
jcc1 = new ColorChooserPanel(true, true);
|
|
673 |
jPanelOptions.addComponent(
|
|
674 |
PluginServices.getText(this, "fill_color")+":", jcc1);
|
|
675 |
jPanelOptions.addComponent(
|
|
676 |
PluginServices.getText(this, "outline_color")+":", jcc2);
|
|
677 |
jPanelOptions.addComponent(
|
|
678 |
PluginServices.getText(this, "outline_width"),
|
|
679 |
txtWidth = new JIncrementalNumberField(String.valueOf(3), 3, 0, Double.MAX_VALUE, 1));
|
|
680 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
681 |
cmbUnits = new JComboBoxUnits());
|
|
682 |
jPanelOptions.addComponent("",
|
|
683 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
687 |
} else if (shapeType == Geometry.TYPES.SURFACE) {
|
|
688 |
jcc1 = new ColorChooserPanel(true, true);
|
|
689 |
jPanelOptions.addComponent(
|
|
690 |
PluginServices.getText(this, "fill_color")+":", jcc1);
|
|
691 |
jPanelOptions.addComponent(
|
|
692 |
PluginServices.getText(this, "outline_color")+":", jcc2);
|
|
693 |
jPanelOptions.addComponent(
|
|
694 |
PluginServices.getText(this, "outline_width"),
|
|
695 |
txtWidth = new JIncrementalNumberField(String.valueOf(3), 3, 0, Double.MAX_VALUE, 1));
|
|
696 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
697 |
cmbUnits = new JComboBoxUnits());
|
|
698 |
jPanelOptions.addComponent("",
|
|
699 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
684 | 700 |
|
685 |
} else if (shapeType == Geometry.TYPES.TEXT) {
|
|
686 |
jcc1 = new ColorChooserPanel(true);
|
|
687 |
jPanelOptions.addComponent(
|
|
688 |
PluginServices.getText(this, "font")+":", getCmbFonts());
|
|
701 |
} else if (shapeType == Geometry.TYPES.TEXT) {
|
|
702 |
jcc1 = new ColorChooserPanel(true);
|
|
703 |
jPanelOptions.addComponent(
|
|
704 |
PluginServices.getText(this, "font")+":", getCmbFonts());
|
|
689 | 705 |
|
690 |
jPanelOptions.addComponent(
|
|
691 |
PluginServices.getText(this, "color")+":", jcc1);
|
|
692 |
jPanelOptions.addComponent(PluginServices.getText(this, "size")+":",
|
|
693 |
cmbFontSize = new JComboBoxFontSizes());
|
|
694 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
695 |
cmbUnits = new JComboBoxUnits());
|
|
696 |
jPanelOptions.addComponent("",
|
|
697 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
706 |
jPanelOptions.addComponent(
|
|
707 |
PluginServices.getText(this, "color")+":", jcc1);
|
|
708 |
jPanelOptions.addComponent(PluginServices.getText(this, "size")+":",
|
|
709 |
cmbFontSize = new JComboBoxFontSizes());
|
|
710 |
jPanelOptions.addComponent(PluginServices.getText(this, "units")+":",
|
|
711 |
cmbUnits = new JComboBoxUnits());
|
|
712 |
jPanelOptions.addComponent("",
|
|
713 |
cmbReferenceSystem = new JComboBoxUnitsReferenceSystem());
|
|
698 | 714 |
|
699 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING,0,1));
|
|
700 |
aux.add(getBtnBold());
|
|
701 |
aux.add(getBtnItalic());
|
|
702 |
aux.add(getBtnUnderlined());
|
|
703 |
jPanelOptions.addComponent(
|
|
704 |
PluginServices.getText(this, "style")+":", aux);
|
|
715 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING,0,1));
|
|
716 |
aux.add(getBtnBold());
|
|
717 |
aux.add(getBtnItalic());
|
|
718 |
aux.add(getBtnUnderlined());
|
|
719 |
jPanelOptions.addComponent(
|
|
720 |
PluginServices.getText(this, "style")+":", aux);
|
|
705 | 721 |
|
706 |
}
|
|
722 |
}
|
|
707 | 723 |
|
708 |
jcc1.setAlpha(255);
|
|
724 |
jcc1.setAlpha(255);
|
|
709 | 725 |
|
710 |
if (txtSize != null) {
|
|
726 |
if (txtSize != null) {
|
|
711 | 727 |
txtSize.addActionListener(this); |
712 | 728 |
} |
713 |
if (cmbUnits != null) {
|
|
729 |
if (cmbUnits != null) {
|
|
714 | 730 |
cmbUnits.addActionListener(this); |
715 | 731 |
} |
716 |
if (cmbReferenceSystem != null) {
|
|
732 |
if (cmbReferenceSystem != null) {
|
|
717 | 733 |
cmbReferenceSystem.addActionListener(this); |
718 | 734 |
} |
719 |
if (jcc1 != null) {
|
|
735 |
if (jcc1 != null) {
|
|
720 | 736 |
jcc1.addActionListener(this); |
721 | 737 |
} |
722 |
if (jcc2 != null) {
|
|
738 |
if (jcc2 != null) {
|
|
723 | 739 |
jcc2.addActionListener(this); |
724 | 740 |
} |
725 |
if (txtWidth != null) {
|
|
741 |
if (txtWidth != null) {
|
|
726 | 742 |
txtWidth.addActionListener(this); |
727 | 743 |
} |
728 |
if (cmbFontSize != null) {
|
|
744 |
if (cmbFontSize != null) {
|
|
729 | 745 |
cmbFontSize.addActionListener(this); |
730 | 746 |
} |
731 |
if (txtAngle != null) {
|
|
747 |
if (txtAngle != null) {
|
|
732 | 748 |
txtAngle.addActionListener(this); |
733 | 749 |
} |
734 |
}
|
|
735 |
return jPanelOptions;
|
|
736 |
}
|
|
750 |
}
|
|
751 |
return jPanelOptions;
|
|
752 |
}
|
|
737 | 753 |
|
738 |
private JToggleButton getBtnUnderlined() {
|
|
739 |
if (btnUnderlined == null) {
|
|
754 |
private JToggleButton getBtnUnderlined() {
|
|
755 |
if (btnUnderlined == null) {
|
|
740 | 756 |
btnUnderlined = new JToggleButton(PluginServices.getIconTheme(). |
741 | 757 |
get("underline-icon")); |
742 | 758 |
} |
743 | 759 |
return btnUnderlined; |
744 |
}
|
|
760 |
}
|
|
745 | 761 |
|
746 |
private JToggleButton getBtnItalic() {
|
|
747 |
if (btnItalic == null) {
|
|
762 |
private JToggleButton getBtnItalic() {
|
|
763 |
if (btnItalic == null) {
|
|
748 | 764 |
btnItalic = new JToggleButton(PluginServices.getIconTheme(). |
749 | 765 |
get("italic-icon")); |
750 |
}
|
|
766 |
}
|
|
751 | 767 |
return btnItalic; |
752 | 768 |
} |
753 | 769 |
|
754 | 770 |
private JToggleButton getBtnBold() { |
755 |
if (btnBold == null) {
|
|
771 |
if (btnBold == null) {
|
|
756 | 772 |
btnBold = new JToggleButton(PluginServices.getIconTheme(). |
757 | 773 |
get("bold-icon")); |
758 | 774 |
} |
... | ... | |
782 | 798 |
jSplitPane = new JSplitPane(); |
783 | 799 |
jSplitPane.setDividerLocation(200); |
784 | 800 |
jSplitPane.setResizeWeight(0.4); |
785 |
jSplitPane.setLeftComponent(getLeftJScrollPane());
|
|
786 |
jSplitPane.setRightComponent(getJScrollPane1());
|
|
801 |
jSplitPane.setLeftComponent(getLeftJScrollPane());
|
|
802 |
jSplitPane.setRightComponent(getJScrollPane1());
|
|
787 | 803 |
} |
788 | 804 |
return jSplitPane; |
789 | 805 |
} |
... | ... | |
794 | 810 |
} |
795 | 811 |
Object mySelectedElement = ((SymbolPreviewer) jPanelPreview).getSymbol(); |
796 | 812 |
|
797 |
// if this symbol only has one layer, then no multilayer is needed
|
|
813 |
// if this symbol only has one layer, then no multilayer is needed
|
|
798 | 814 |
if (mySelectedElement instanceof IMultiLayerSymbol) { |
799 | 815 |
if (((IMultiLayerSymbol) mySelectedElement).getLayerCount()==1) { |
800 | 816 |
return ((IMultiLayerSymbol) mySelectedElement).getLayer(0); |
... | ... | |
898 | 914 |
// default to file name |
899 | 915 |
String s = targetFile.getAbsolutePath(); |
900 | 916 |
desc = s.substring(s.lastIndexOf(File.separator)+1). |
901 |
replaceAll(SymbolLibrary.SYMBOL_FILE_EXTENSION, "");
|
|
917 |
replaceAll(SymbolLibrary.SYMBOL_FILE_EXTENSION, ""); |
|
902 | 918 |
} else { |
903 | 919 |
desc = txtDesc.getText().trim(); |
904 | 920 |
} |
... | ... | |
907 | 923 |
|
908 | 924 |
|
909 | 925 |
getJListSymbols().setModel(newListModel()); |
910 |
// getJListSymbols().setSelectedValue( |
|
911 |
// selectedElement, true); |
|
926 |
// getJListSymbols().setSelectedValue(
|
|
927 |
// selectedElement, true);
|
|
912 | 928 |
String symbolFileName = targetFile.getAbsolutePath().substring( |
913 | 929 |
targetFile.getAbsolutePath().lastIndexOf(File.separator)+1, |
914 | 930 |
targetFile.getAbsolutePath().length()); |
... | ... | |
1060 | 1076 |
ISymbolSelector selector = null; |
1061 | 1077 |
|
1062 | 1078 |
// patch for backwards compatibility |
1063 |
// if (currSymbol instanceof FSymbol) { |
|
1064 |
// currSymbol = SymbologyFactory.deriveFSymbol((FSymbol) currSymbol); |
|
1065 |
// } |
|
1079 |
// if (currSymbol instanceof FSymbol) {
|
|
1080 |
// currSymbol = SymbologyFactory.deriveFSymbol((FSymbol) currSymbol);
|
|
1081 |
// }
|
|
1066 | 1082 |
|
1067 | 1083 |
if (filter==null) { |
1068 | 1084 |
selector = (shapeType == Geometry.TYPES.GEOMETRY) ? |
1069 | 1085 |
new MultiShapeSymbolSelector(currSymbol) : |
1070 |
new SymbolSelector(currSymbol, shapeType, true); |
|
1086 |
new SymbolSelector(currSymbol, shapeType, true);
|
|
1071 | 1087 |
} else { |
1072 | 1088 |
selector = (shapeType == Geometry.TYPES.GEOMETRY) ? |
1073 | 1089 |
new MultiShapeSymbolSelector(currSymbol) : |
1074 |
new SymbolSelector(currSymbol, shapeType, filter, true); |
|
1090 |
new SymbolSelector(currSymbol, shapeType, filter, true);
|
|
1075 | 1091 |
} |
1076 | 1092 |
return selector; |
1077 | 1093 |
} |
... | ... | |
1105 | 1121 |
if (destFolder != null) { |
1106 | 1122 |
ISymbol sym = (ISymbol) selected; |
1107 | 1123 |
int move = InputEvent.SHIFT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK; |
1108 |
// int copy = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK; |
|
1124 |
// int copy = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON1_DOWN_MASK;
|
|
1109 | 1125 |
|
1110 | 1126 |
library.addElement(sym, sym.getDescription(), destFolder); |
1111 |
if ((e.getModifiers() & (move)) !=0) {
|
|
1112 |
library.removeElement(sym, sourceFolder);
|
|
1113 |
}
|
|
1127 |
if ((e.getModifiers() & (move)) !=0) {
|
|
1128 |
library.removeElement(sym, sourceFolder);
|
|
1129 |
}
|
|
1114 | 1130 |
|
1115 | 1131 |
} |
1116 | 1132 |
libraryBrowser.refresh(); |
Also available in: Unified diff