root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / colortable / ui / library / ColorTableLibraryPanel.java @ 33213
History | View | Annotate | Download (18.3 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.rastertools.colortable.ui.library; |
23 |
|
24 |
import java.awt.BorderLayout; |
25 |
import java.awt.Dimension; |
26 |
import java.awt.FlowLayout; |
27 |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
29 |
import java.io.File; |
30 |
import java.io.IOException; |
31 |
import java.util.ArrayList; |
32 |
import java.util.EventObject; |
33 |
import java.util.Iterator; |
34 |
|
35 |
import javax.swing.ImageIcon; |
36 |
import javax.swing.JButton; |
37 |
import javax.swing.JFileChooser; |
38 |
import javax.swing.JOptionPane; |
39 |
import javax.swing.JPanel; |
40 |
import javax.swing.JScrollPane; |
41 |
|
42 |
import org.gvsig.gui.beans.listview.ListViewComponent; |
43 |
import org.gvsig.gui.beans.listview.ListViewItem; |
44 |
import org.gvsig.gui.beans.listview.ListViewListener; |
45 |
import org.gvsig.raster.datastruct.ColorTable; |
46 |
import org.gvsig.raster.datastruct.io.RasterLegendIO; |
47 |
import org.gvsig.raster.datastruct.io.exceptions.RasterLegendIONotFound; |
48 |
import org.gvsig.raster.datastruct.persistence.ColorTableLibraryPersistence; |
49 |
import org.gvsig.raster.util.BasePanel; |
50 |
import org.gvsig.raster.util.ExtendedFileFilter; |
51 |
import org.gvsig.raster.util.RasterToolsUtil; |
52 |
import org.gvsig.raster.util.RasterUtilities; |
53 |
import org.gvsig.rastertools.colortable.data.ColorTableData; |
54 |
|
55 |
import com.iver.andami.PluginServices; |
56 |
import com.iver.utiles.FileUtils; |
57 |
/**
|
58 |
* Panel que aparece en la parte inferior derecha que contiene la lista
|
59 |
* de librerias disponibles para las tablas de color, con sus botones correspondientes
|
60 |
* para importar, exportar, borrar y a?adir librerias.
|
61 |
*
|
62 |
* 19/02/2008
|
63 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
64 |
*/
|
65 |
public class ColorTableLibraryPanel extends BasePanel implements ActionListener, ListViewListener { |
66 |
private static final long serialVersionUID = 1L; |
67 |
private JPanel panelButtons = null; |
68 |
private JButton buttonAdd = null; |
69 |
private JButton buttonDel = null; |
70 |
private JButton buttonImport = null; |
71 |
private JButton buttonExport = null; |
72 |
private ListViewComponent listViewComponent = null; |
73 |
|
74 |
private boolean hasChanged = false; |
75 |
|
76 |
private ArrayList actionCommandListeners = new ArrayList(); |
77 |
private ColorTableData colorTableData = null; |
78 |
|
79 |
private ColorTable currentColorTable = null; |
80 |
|
81 |
public static String palettesPath = FileUtils.getAppHomeDir() + "colortable"; |
82 |
|
83 |
/**
|
84 |
*Inicializa componentes gr?ficos y traduce
|
85 |
*/
|
86 |
public ColorTableLibraryPanel() {
|
87 |
init(); |
88 |
translate(); |
89 |
} |
90 |
|
91 |
public ColorTableLibraryPanel(ColorTableData colorTableData){
|
92 |
this.colorTableData = colorTableData;
|
93 |
init(); |
94 |
translate(); |
95 |
} |
96 |
|
97 |
/*
|
98 |
* (non-Javadoc)
|
99 |
* @see org.gvsig.raster.util.BasePanel#init()
|
100 |
*/
|
101 |
protected void init() { |
102 |
setLayout(new BorderLayout()); |
103 |
|
104 |
JPanel panel = new JPanel(); |
105 |
panel.setLayout(new BorderLayout()); |
106 |
panel.setBorder(javax.swing.BorderFactory.createEmptyBorder(8, 8, 8, 8)); |
107 |
|
108 |
JScrollPane jScrollPane = new JScrollPane(); |
109 |
jScrollPane.setViewportView(getListViewComponent()); |
110 |
jScrollPane.setAutoscrolls(true);
|
111 |
|
112 |
panel.add(jScrollPane, BorderLayout.CENTER);
|
113 |
add(panel, BorderLayout.CENTER);
|
114 |
add(getPanelButtons(), BorderLayout.SOUTH);
|
115 |
setPreferredSize(new Dimension(0, 192)); |
116 |
|
117 |
loadDiskLibrary(); |
118 |
} |
119 |
|
120 |
/*
|
121 |
* (non-Javadoc)
|
122 |
* @see org.gvsig.raster.util.BasePanel#translate()
|
123 |
*/
|
124 |
protected void translate() { |
125 |
} |
126 |
|
127 |
private void loadDiskLibrary() { |
128 |
ArrayList fileList = ColorTableLibraryPersistence.getPaletteFileList(palettesPath);
|
129 |
for (int i = 0; i < fileList.size(); i++) { |
130 |
ArrayList paletteItems = new ArrayList(); |
131 |
String paletteName = ColorTableLibraryPersistence.loadPalette(palettesPath, (String) fileList.get(i), paletteItems); |
132 |
|
133 |
if (paletteItems.size() <= 0) |
134 |
continue;
|
135 |
|
136 |
ColorTable colorTable = new ColorTable();
|
137 |
colorTable.setName(paletteName); |
138 |
colorTable.createPaletteFromColorItems(paletteItems, true);
|
139 |
colorTable.setInterpolated(true);
|
140 |
|
141 |
ListViewItem item = new ListViewItem(new ColorTableIconPainter(colorTable), paletteName); |
142 |
item.setTag(fileList.get(i)); |
143 |
getListViewComponent().addItem(item); |
144 |
} |
145 |
getListViewComponent().setSelectedIndex(0);
|
146 |
callColorTableChanged(); |
147 |
} |
148 |
|
149 |
/**
|
150 |
* Devuelve el jButtonAdd
|
151 |
* @return
|
152 |
*/
|
153 |
private JButton getButtonAdd() { |
154 |
if (buttonAdd == null) { |
155 |
ImageIcon icon = null; |
156 |
try {
|
157 |
icon = PluginServices.getIconTheme().get("addlayer-icon");
|
158 |
} catch (NullPointerException n) { |
159 |
// No ha encontrado el icono, no lo muestra.
|
160 |
} |
161 |
|
162 |
buttonAdd = new JButton(icon); |
163 |
buttonAdd.setPreferredSize(new Dimension(22, 19)); |
164 |
buttonAdd.addActionListener(this);
|
165 |
buttonAdd.setToolTipText(getText(this, "nueva_libreria_title")); |
166 |
} |
167 |
return buttonAdd;
|
168 |
} |
169 |
|
170 |
/**
|
171 |
* Devuelve el jButtonDel
|
172 |
* @return
|
173 |
*/
|
174 |
private JButton getButtonDel() { |
175 |
if (buttonDel == null) { |
176 |
ImageIcon icon = null; |
177 |
try {
|
178 |
icon = PluginServices.getIconTheme().get("delall-icon");
|
179 |
} catch (NullPointerException n) { |
180 |
// No ha encontrado el icono, no lo muestra.
|
181 |
} |
182 |
buttonDel = new JButton(icon); |
183 |
buttonDel.setPreferredSize(new Dimension(22, 19)); |
184 |
buttonDel.addActionListener(this);
|
185 |
buttonDel.setToolTipText(getText(this, "borrar_libreria")); |
186 |
} |
187 |
return buttonDel;
|
188 |
} |
189 |
|
190 |
/**
|
191 |
* Devuelve el jButtonDel
|
192 |
* @return
|
193 |
*/
|
194 |
private JButton getButtonImport() { |
195 |
if (buttonImport == null) { |
196 |
ImageIcon icon = null; |
197 |
try {
|
198 |
icon = PluginServices.getIconTheme().get("import-icon");
|
199 |
} catch (NullPointerException n) { |
200 |
// No ha encontrado el icono, no lo muestra.
|
201 |
} |
202 |
buttonImport = new JButton(icon); |
203 |
buttonImport.setPreferredSize(new Dimension(22, 19)); |
204 |
buttonImport.addActionListener(this);
|
205 |
buttonImport.setToolTipText(getText(this, "import_libreria")); |
206 |
} |
207 |
return buttonImport;
|
208 |
} |
209 |
|
210 |
/**
|
211 |
* Devuelve el jButtonDel
|
212 |
* @return
|
213 |
*/
|
214 |
private JButton getButtonExport() { |
215 |
if (buttonExport == null) { |
216 |
ImageIcon icon = null; |
217 |
try {
|
218 |
icon = PluginServices.getIconTheme().get("export-icon");
|
219 |
} catch (NullPointerException n) { |
220 |
// No ha encontrado el icono, no lo muestra.
|
221 |
} |
222 |
buttonExport = new JButton(icon); |
223 |
buttonExport.setPreferredSize(new Dimension(22, 19)); |
224 |
buttonExport.addActionListener(this);
|
225 |
buttonExport.setToolTipText(getText(this, "export_libreria")); |
226 |
} |
227 |
return buttonExport;
|
228 |
} |
229 |
|
230 |
/**
|
231 |
* Devuelve el panel de botones de la libreria de a?adir y borrar
|
232 |
* @return
|
233 |
*/
|
234 |
private JPanel getPanelButtons() { |
235 |
if (panelButtons == null) { |
236 |
panelButtons = new JPanel(); |
237 |
panelButtons.setPreferredSize(new Dimension(0, 21)); |
238 |
|
239 |
FlowLayout flowLayout5 = new FlowLayout(); |
240 |
flowLayout5.setHgap(5);
|
241 |
flowLayout5.setVgap(0);
|
242 |
flowLayout5.setAlignment(java.awt.FlowLayout.CENTER); |
243 |
panelButtons.setLayout(flowLayout5); |
244 |
|
245 |
panelButtons.add(getButtonAdd(), null);
|
246 |
panelButtons.add(getButtonExport(), null);
|
247 |
panelButtons.add(getButtonImport(), null);
|
248 |
panelButtons.add(getButtonDel(), null);
|
249 |
} |
250 |
return panelButtons;
|
251 |
} |
252 |
|
253 |
private ListViewComponent getListViewComponent() {
|
254 |
if (listViewComponent == null) { |
255 |
listViewComponent = new ListViewComponent();
|
256 |
listViewComponent.addListSelectionListener(this);
|
257 |
listViewComponent.setEditable(true);
|
258 |
} |
259 |
return listViewComponent;
|
260 |
} |
261 |
|
262 |
private void callColorTableChanged() { |
263 |
Iterator acIterator = actionCommandListeners.iterator();
|
264 |
while (acIterator.hasNext()) {
|
265 |
ColorTableLibraryListener listener = (ColorTableLibraryListener) acIterator.next(); |
266 |
listener.actionColorTableChanged(new ColorTableLibraryEvent(this)); |
267 |
} |
268 |
} |
269 |
|
270 |
/**
|
271 |
* Accion que se ejecuta cuando se disparan los siguientes eventos:
|
272 |
* - Checkbox de interpolacion.
|
273 |
* - Checkbox de habilitacion de colortables.
|
274 |
* - Boton de a?adir un colortable nuevo.
|
275 |
* - Boton de borrar un colortable seleccionado.
|
276 |
*/
|
277 |
public void actionPerformed(ActionEvent e) { |
278 |
if (e.getSource() == getButtonAdd()) {
|
279 |
AddLibraryWindow addLibrary = new AddLibraryWindow();
|
280 |
if (addLibrary.showConfirm(this) == JOptionPane.OK_OPTION) { |
281 |
ColorTable colorTable = addLibrary.getColorTable(); |
282 |
if (colorTable != null) { |
283 |
ListViewItem item = new ListViewItem(new ColorTableIconPainter(colorTable), colorTable.getName()); |
284 |
item.setTag(item.getName() + ".xml");
|
285 |
getListViewComponent().addItem(item); |
286 |
getListViewComponent().setSelectedIndex(getListViewComponent().getItems().size() - 1);
|
287 |
((ColorTableIconPainter) item.getIcon()).getColorTable().setName(item.getName()); |
288 |
colorTable.setName(((ColorTableIconPainter) item.getIcon()).getColorTable().getName()); |
289 |
ColorTableLibraryPersistence.save_to_1_1(palettesPath, colorTable); |
290 |
callColorTableChanged(); |
291 |
} |
292 |
} |
293 |
} |
294 |
|
295 |
if (e.getSource() == getButtonExport()) {
|
296 |
JFileChooser chooser = new JFileChooser(); |
297 |
chooser.setAcceptAllFileFilterUsed(false);
|
298 |
|
299 |
String[] formats = RasterLegendIO.getFormats(); |
300 |
ExtendedFileFilter fileFilter = null;
|
301 |
ExtendedFileFilter firstFileFilter = null;
|
302 |
for (int i = 0; i < formats.length; i++) { |
303 |
fileFilter = new ExtendedFileFilter();
|
304 |
fileFilter.addExtension(formats[i]); |
305 |
|
306 |
try {
|
307 |
String desc = RasterLegendIO.getRasterLegendIO(RasterUtilities.getExtensionFromFileName(formats[i])).getDescription();
|
308 |
if (desc != null) |
309 |
fileFilter.setDescription(desc); |
310 |
} catch (RasterLegendIONotFound e1) {
|
311 |
// Si no puedo pillar la descripcion no pasa nada
|
312 |
} |
313 |
if (firstFileFilter == null) |
314 |
firstFileFilter = fileFilter; |
315 |
|
316 |
chooser.addChoosableFileFilter(fileFilter); |
317 |
} |
318 |
if (firstFileFilter != null) |
319 |
chooser.setFileFilter(firstFileFilter); |
320 |
|
321 |
int returnVal = chooser.showSaveDialog(this); |
322 |
if (returnVal == JFileChooser.APPROVE_OPTION) { |
323 |
try {
|
324 |
if (colorTableData != null){ |
325 |
ColorTableLibraryPersistence.save_to_1_1(ColorTableLibraryPanel.palettesPath, colorTableData.getColorTable()); |
326 |
} |
327 |
ExtendedFileFilter filter = (ExtendedFileFilter) chooser.getFileFilter(); |
328 |
String file = filter.getNormalizedFilename(chooser.getSelectedFile());
|
329 |
|
330 |
RasterLegendIO.getRasterLegendIO(RasterUtilities.getExtensionFromFileName(file)).write(getColorTableSelected(), new File(file)); |
331 |
} catch (IOException e1) { |
332 |
e1.printStackTrace(); |
333 |
} catch (RasterLegendIONotFound e1) {
|
334 |
e1.printStackTrace(); |
335 |
} |
336 |
} |
337 |
} |
338 |
|
339 |
if (e.getSource() == getButtonImport()) {
|
340 |
JFileChooser chooser = new JFileChooser(); |
341 |
chooser.setAcceptAllFileFilterUsed(false);
|
342 |
chooser.setMultiSelectionEnabled(true);
|
343 |
|
344 |
String[] formats = RasterLegendIO.getFormats(); |
345 |
ExtendedFileFilter allFilters = new ExtendedFileFilter();
|
346 |
ExtendedFileFilter fileFilter = null;
|
347 |
for (int i = 0; i < formats.length; i++) { |
348 |
fileFilter = new ExtendedFileFilter();
|
349 |
fileFilter.addExtension(formats[i]); |
350 |
allFilters.addExtension(formats[i]); |
351 |
|
352 |
try {
|
353 |
String desc = RasterLegendIO.getRasterLegendIO(RasterUtilities.getExtensionFromFileName(formats[i])).getDescription();
|
354 |
if (desc != null) |
355 |
fileFilter.setDescription(desc); |
356 |
} catch (RasterLegendIONotFound e1) {
|
357 |
// Si no puedo pillar la descripcion no pasa nada
|
358 |
} |
359 |
|
360 |
chooser.addChoosableFileFilter(fileFilter); |
361 |
} |
362 |
allFilters.setDescription(getText(this, "todos_soportados")); |
363 |
chooser.addChoosableFileFilter(allFilters); |
364 |
chooser.setFileFilter(allFilters); |
365 |
|
366 |
int returnVal = chooser.showOpenDialog(this); |
367 |
|
368 |
if (returnVal == JFileChooser.APPROVE_OPTION) { |
369 |
try {
|
370 |
for (int file = 0; file<chooser.getSelectedFiles().length; file++) { |
371 |
fileFilter = null;
|
372 |
for (int i = 0; i < formats.length; i++) { |
373 |
fileFilter = new ExtendedFileFilter();
|
374 |
fileFilter.addExtension(formats[i]); |
375 |
if (fileFilter.accept(chooser.getSelectedFiles()[file])) {
|
376 |
ColorTable colorTable = RasterLegendIO.getRasterLegendIO(formats[i]).read(chooser.getSelectedFiles()[file]); |
377 |
|
378 |
if (colorTable != null){ |
379 |
colorTable.setInterpolated(true);
|
380 |
|
381 |
ListViewItem item = new ListViewItem(new ColorTableIconPainter(colorTable), colorTable.getName()); |
382 |
item.setTag(item.getName() + ".xml");
|
383 |
getListViewComponent().addItem(item); |
384 |
getListViewComponent().setSelectedIndex(getListViewComponent().getItems().size() - 1);
|
385 |
((ColorTableIconPainter) item.getIcon()).getColorTable().setName(item.getName()); |
386 |
colorTable.setName(((ColorTableIconPainter) item.getIcon()).getColorTable().getName()); |
387 |
ColorTableLibraryPersistence.save_to_1_1(palettesPath, colorTable); |
388 |
callColorTableChanged(); |
389 |
} else {
|
390 |
RasterToolsUtil.messageBoxError("error_importando_tabla_color_rmf", this); |
391 |
} |
392 |
break;
|
393 |
} |
394 |
} |
395 |
} |
396 |
} catch (IOException e1) { |
397 |
e1.printStackTrace(); |
398 |
RasterToolsUtil.messageBoxError("error_importando_tabla_color_rmf", this); |
399 |
} catch (RasterLegendIONotFound e1) {
|
400 |
e1.printStackTrace(); |
401 |
} |
402 |
} |
403 |
} |
404 |
|
405 |
if (e.getSource() == getButtonDel()) {
|
406 |
if (getListViewComponent().getSelectedIndices().length > 0) { |
407 |
if (RasterToolsUtil.messageBoxYesOrNot("desea_borrar_librerias", this)) { |
408 |
File oldFile = new File(palettesPath + File.separator + getListViewComponent().getSelectedValue().getTag()); |
409 |
oldFile.delete(); |
410 |
int pos = getListViewComponent().getSelectedIndices()[0]; |
411 |
getListViewComponent().removeSelecteds(); |
412 |
|
413 |
if (getListViewComponent().getItems().size() == 0) { |
414 |
loadDiskLibrary(); |
415 |
} else {
|
416 |
getListViewComponent().setSelectedIndex(pos - 1);
|
417 |
callColorTableChanged(); |
418 |
} |
419 |
} |
420 |
} |
421 |
return;
|
422 |
} |
423 |
} |
424 |
|
425 |
/*
|
426 |
* (non-Javadoc)
|
427 |
* @see org.gvsig.gui.beans.listview.ListViewListener#actionItemNameChanged(java.util.EventObject, java.lang.String, org.gvsig.gui.beans.listview.ListViewItem)
|
428 |
*/
|
429 |
public void actionItemNameChanged(EventObject e, String oldName, ListViewItem item) { |
430 |
File oldFile = new File(palettesPath + File.separator + oldName + ".xml"); |
431 |
oldFile.delete(); |
432 |
|
433 |
getColorTableSelected().setName(item.getName()); |
434 |
item.setTag(item.getName() + ".xml");
|
435 |
|
436 |
ColorTableLibraryPersistence.save_to_1_1(palettesPath, getColorTableSelected()); |
437 |
|
438 |
callColorTableChanged(); |
439 |
} |
440 |
|
441 |
/**
|
442 |
* Comprueba si el usuario ha cambiado los valores de la tabla de colores,
|
443 |
* si es as?, le pregunta al usuario si quiere guardar los datos, y seg?n la
|
444 |
* selecci?n, restaura los datos antiguos o los machaca.
|
445 |
*/
|
446 |
private void testLibraryChanged() { |
447 |
if (hasChanged) {
|
448 |
if (RasterToolsUtil.messageBoxYesOrNot("desea_guardar_cambios", this)) { |
449 |
ColorTableLibraryPersistence.save_to_1_1(palettesPath, getColorTableSelected()); |
450 |
getListViewComponent().repaint(); |
451 |
} |
452 |
hasChanged = false;
|
453 |
} |
454 |
} |
455 |
|
456 |
/**
|
457 |
* Selecciona la tabla de color por defecto.
|
458 |
*/
|
459 |
public void selectDefault() { |
460 |
int selected = 0; |
461 |
for (int i = 0; i < getListViewComponent().getItems().size(); i++) { |
462 |
if (((ListViewItem) getListViewComponent().getItems().get(i)).getName().equals("Default")) { |
463 |
selected = i; |
464 |
break;
|
465 |
} |
466 |
} |
467 |
getListViewComponent().setSelectedIndex(selected); |
468 |
callColorTableChanged(); |
469 |
} |
470 |
|
471 |
/**
|
472 |
* Inserta una tabla de color en la posicion especificada y selecciona.
|
473 |
*/
|
474 |
public void addColorTable(int pos, ColorTable colorTable) { |
475 |
ListViewItem item = new ListViewItem(new ColorTableIconPainter(colorTable), getText(this, "tabla_actual")); |
476 |
getListViewComponent().addItem(pos, item); |
477 |
getListViewComponent().setSelectedIndex(pos); |
478 |
callColorTableChanged(); |
479 |
} |
480 |
|
481 |
/**
|
482 |
* Accion que se ejecuta cuando cambia la seleccion de un item del
|
483 |
* ListViewComponent
|
484 |
*/
|
485 |
public void actionValueChanged(EventObject e) { |
486 |
currentColorTable = ((ColorTableIconPainter) getListViewComponent().getSelectedValue().getIcon()).getColorTable(); |
487 |
testLibraryChanged(); |
488 |
callColorTableChanged(); |
489 |
} |
490 |
|
491 |
/**
|
492 |
* Define si se visualizara el componente con interpolacion o no.
|
493 |
* @param enabled
|
494 |
*/
|
495 |
public void setInterpolated(boolean enabled) { |
496 |
for (int i = 0; i < getListViewComponent().getItems().size(); i++) |
497 |
((ColorTableIconPainter) ((ListViewItem) getListViewComponent().getItems().get(i)).getIcon()).setInterpolated(enabled); |
498 |
getListViewComponent().repaint(); |
499 |
} |
500 |
|
501 |
/**
|
502 |
* A?adir un listener a la lista de eventos
|
503 |
* @param listener
|
504 |
*/
|
505 |
public void addColorTableLibraryListener(ColorTableLibraryListener listener) { |
506 |
if (!actionCommandListeners.contains(listener))
|
507 |
actionCommandListeners.add(listener); |
508 |
} |
509 |
|
510 |
/**
|
511 |
* Borrar un listener de la lista de eventos
|
512 |
* @param listener
|
513 |
*/
|
514 |
public void removeColorTableLibraryListener(ColorTableLibraryListener listener) { |
515 |
actionCommandListeners.remove(listener); |
516 |
} |
517 |
|
518 |
/**
|
519 |
* Devuelve la tabla de color que hay seleccionada en ese momento
|
520 |
* @return
|
521 |
*/
|
522 |
public ColorTable getColorTableSelected() {
|
523 |
if (getListViewComponent().getSelectedValue() != null){ |
524 |
currentColorTable = ((ColorTableIconPainter) getListViewComponent().getSelectedValue().getIcon()).getColorTable(); |
525 |
} |
526 |
return currentColorTable;
|
527 |
} |
528 |
|
529 |
/**
|
530 |
* Reescribe la tabla de color en la posicion seleccionada
|
531 |
* @param colorTable
|
532 |
*/
|
533 |
public void setColorTableSelected(ColorTable colorTable) { |
534 |
hasChanged = true;
|
535 |
((ColorTableIconPainter) getListViewComponent().getSelectedValue().getIcon()).getColorTable().createPaletteFromColorItems(colorTable.getColorItems(), false);
|
536 |
getListViewComponent().repaint(); |
537 |
} |
538 |
|
539 |
} |