svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.raster.legend / org.gvsig.raster.legend.swing / org.gvsig.raster.legend.swing.impl / src / main / java / org / gvsig / raster / swing / legend / impl / colortable / selector / ColorTableSelectorPanelController.java @ 44831
History | View | Annotate | Download (19.5 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2017 gvSIG Association
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.raster.swing.legend.impl.colortable.selector; |
24 |
|
25 |
import java.awt.Color; |
26 |
import java.awt.Dimension; |
27 |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
29 |
import java.awt.event.ComponentListener; |
30 |
import java.awt.event.FocusListener; |
31 |
import java.io.File; |
32 |
import java.util.ArrayList; |
33 |
import java.util.Iterator; |
34 |
import java.util.List; |
35 |
import java.util.Locale; |
36 |
|
37 |
import javax.swing.JComponent; |
38 |
import javax.swing.JFileChooser; |
39 |
import javax.swing.ListSelectionModel; |
40 |
import javax.swing.event.ListSelectionEvent; |
41 |
import javax.swing.event.ListSelectionListener; |
42 |
import javax.swing.table.DefaultTableColumnModel; |
43 |
import javax.swing.table.TableColumn; |
44 |
import javax.swing.table.TableColumnModel; |
45 |
|
46 |
import org.apache.commons.io.FilenameUtils; |
47 |
import org.apache.commons.lang3.tuple.MutablePair; |
48 |
import org.apache.commons.lang3.tuple.Pair; |
49 |
import org.slf4j.Logger; |
50 |
import org.slf4j.LoggerFactory; |
51 |
|
52 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
53 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
54 |
import org.gvsig.raster.lib.legend.api.colortable.ColorTable; |
55 |
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIO; |
56 |
import org.gvsig.raster.lib.legend.api.colortable.ColorTableIOFactory; |
57 |
import org.gvsig.raster.lib.legend.api.colortable.MakeColorTable; |
58 |
import org.gvsig.raster.lib.legend.api.exceptions.ColorTableIOException; |
59 |
import org.gvsig.raster.swing.legend.RasterSwingLegendLocator; |
60 |
import org.gvsig.raster.swing.legend.RasterSwingLegendManager; |
61 |
import org.gvsig.raster.swing.legend.colortable.create.CreateColorTablePanel; |
62 |
import org.gvsig.raster.swing.legend.colortable.editor.ColorTableEditorPanel; |
63 |
import org.gvsig.raster.swing.legend.colortable.selector.ColorTableSelectorPanel; |
64 |
import org.gvsig.raster.swing.legend.colortable.selector.ColorTablesTableModel; |
65 |
import org.gvsig.raster.swing.legend.impl.colortable.editor.ColorTableEditorPanelController; |
66 |
import org.gvsig.tools.ToolsLocator; |
67 |
import org.gvsig.tools.i18n.I18nManager; |
68 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
69 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
70 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
71 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
72 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
73 |
|
74 |
|
75 |
/**
|
76 |
* @author fdiaz
|
77 |
*
|
78 |
*/
|
79 |
public class ColorTableSelectorPanelController extends ColorTableSelectorPanelView implements ColorTableSelectorPanel { |
80 |
|
81 |
/**
|
82 |
*
|
83 |
*/
|
84 |
private static final long serialVersionUID = -2427828721121167549L; |
85 |
private static final Logger LOG = LoggerFactory.getLogger(ColorTableSelectorPanelController.class); |
86 |
|
87 |
private List<Pair<File,ColorTable>> colorTables; |
88 |
private List<ColorTable> addedColorTables; |
89 |
private List<Pair<File,ColorTable>> modifiedColorTables; |
90 |
private List<Pair<File,ColorTable>> removedColorTables; |
91 |
private boolean editable; |
92 |
|
93 |
public ColorTableSelectorPanelController() {
|
94 |
translate(); |
95 |
this.editable = true; |
96 |
initializeComponents(); |
97 |
} |
98 |
|
99 |
/* (non-Javadoc)
|
100 |
* @see org.gvsig.tools.swing.api.Component#asJComponent()
|
101 |
*/
|
102 |
@Override
|
103 |
public JComponent asJComponent() { |
104 |
return this; |
105 |
} |
106 |
|
107 |
private void initializeComponents() { |
108 |
IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
109 |
btnNew.setIcon(iconTheme.get("new-color-table-icon"));
|
110 |
btnEdit.setIcon(iconTheme.get("edit-color-table-icon"));
|
111 |
btnExport.setIcon(iconTheme.get("export-color-table-icon"));
|
112 |
btnImport.setIcon(iconTheme.get("import-color-table-icon"));
|
113 |
btnRemove.setIcon(iconTheme.get("remove-color-table-icon"));
|
114 |
|
115 |
btnNew.addActionListener(new ActionListener() { |
116 |
@Override
|
117 |
public void actionPerformed(ActionEvent e) { |
118 |
doNewColorTable(); |
119 |
} |
120 |
}); |
121 |
|
122 |
btnEdit.addActionListener(new ActionListener() { |
123 |
@Override
|
124 |
public void actionPerformed(ActionEvent e) { |
125 |
doEditColorTable(); |
126 |
} |
127 |
}); |
128 |
|
129 |
btnExport.addActionListener(new ActionListener() { |
130 |
@Override
|
131 |
public void actionPerformed(ActionEvent e) { |
132 |
doExportColorTable(); |
133 |
} |
134 |
}); |
135 |
|
136 |
btnImport.addActionListener(new ActionListener() { |
137 |
@Override
|
138 |
public void actionPerformed(ActionEvent e) { |
139 |
doImportColorTable(); |
140 |
} |
141 |
}); |
142 |
|
143 |
btnRemove.addActionListener(new ActionListener() { |
144 |
@Override
|
145 |
public void actionPerformed(ActionEvent e) { |
146 |
doRemoveColorTable(); |
147 |
} |
148 |
}); |
149 |
|
150 |
tblColorTables.setRowSelectionAllowed(true);
|
151 |
tblColorTables.setColumnSelectionAllowed(false);
|
152 |
tblColorTables.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
153 |
tblColorTables.getSelectionModel().addListSelectionListener(new ListSelectionListener() { |
154 |
@Override
|
155 |
public void valueChanged(ListSelectionEvent e) { |
156 |
updateComponents(); |
157 |
} |
158 |
}); |
159 |
|
160 |
updateComponents(); |
161 |
|
162 |
} |
163 |
protected void doEditColorTable() { |
164 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
165 |
|
166 |
int index = this.tblColorTables.getSelectedRow(); |
167 |
ColorTable sourceColorTable = ((ColorTablesTableModel)this.tblColorTables.getModel()).getColorTable(index).getValue();
|
168 |
|
169 |
//Le pasamos una copiamos de la tabla de color al editor para que no la modifique autom?ticamente
|
170 |
ColorTable colorTable = RasterLegendLocator.getRasterLegendManager().createColorTable(); |
171 |
colorTable.copyFrom(colorTable); |
172 |
|
173 |
//FIXME: ?Al manager?
|
174 |
final ColorTableEditorPanelController panel = new ColorTableEditorPanelController(); |
175 |
|
176 |
panel.set(colorTable); |
177 |
panel.asJComponent().setPreferredSize(new Dimension(600, 400)); |
178 |
|
179 |
final WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
|
180 |
|
181 |
final Dialog dialog = |
182 |
winManager.createDialog(panel.asJComponent(), i18nManager.getTranslation("color-table-edit"),
|
183 |
null, WindowManager_v2.BUTTONS_APPLY_OK_CANCEL);
|
184 |
|
185 |
dialog.addActionListener(new ActionListener() { |
186 |
|
187 |
@Override
|
188 |
public void actionPerformed(ActionEvent e) { |
189 |
switch (dialog.getAction()) {
|
190 |
case WindowManager_v2.BUTTON_APPLY:
|
191 |
doApplyEditColorTable(panel); |
192 |
break;
|
193 |
|
194 |
case WindowManager_v2.BUTTON_OK:
|
195 |
if (doApplyEditColorTable(panel)) {
|
196 |
panel.asJComponent().setVisible(false);
|
197 |
} |
198 |
break;
|
199 |
|
200 |
case WindowManager_v2.BUTTON_CANCEL:
|
201 |
panel.asJComponent().setVisible(false);
|
202 |
break;
|
203 |
} |
204 |
|
205 |
} |
206 |
|
207 |
}); |
208 |
dialog.show(WindowManager.MODE.DIALOG); |
209 |
|
210 |
} |
211 |
|
212 |
protected boolean doApplyEditColorTable(ColorTableEditorPanel panel) { |
213 |
int selectedRow = tblColorTables.getSelectedRow();
|
214 |
ColorTable colorTableEdited = panel.getColorTable(); |
215 |
if(panel.isModified()){
|
216 |
ColorTablesTableModel colorTablesTableModel = (ColorTablesTableModel)this.tblColorTables.getModel();
|
217 |
colorTablesTableModel.setColorTable(selectedRow, colorTableEdited); |
218 |
if(!modifiedColorTables.contains(colorTablesTableModel.getColorTable(selectedRow))){
|
219 |
modifiedColorTables.add(colorTablesTableModel.getColorTable(selectedRow)); |
220 |
} |
221 |
|
222 |
tblColorTables.setRowSelectionInterval(selectedRow, selectedRow); |
223 |
} |
224 |
return true; |
225 |
} |
226 |
|
227 |
protected void doRemoveColorTable() { |
228 |
int row = tblColorTables.getSelectedRow();
|
229 |
ColorTablesTableModel colorTablesTableModel = (ColorTablesTableModel)tblColorTables.getModel(); |
230 |
Pair<File, ColorTable> pair = colorTablesTableModel.getColorTable(row);
|
231 |
removedColorTables.add(pair); |
232 |
colorTablesTableModel.removeColorTable(tblColorTables.getSelectedRow()); |
233 |
} |
234 |
|
235 |
protected void doImportColorTable() { |
236 |
RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager(); |
237 |
JFileChooser fileChooser = new JFileChooser(); |
238 |
List<ColorTableIOFactory> factories = legendManager.getColorTableIOFactories();
|
239 |
for (Iterator iterator = factories.iterator(); iterator.hasNext();) { |
240 |
ColorTableIOFactory colorTableIOFactory = (ColorTableIOFactory) iterator.next(); |
241 |
fileChooser.addChoosableFileFilter(new MyFileFilter(colorTableIOFactory));
|
242 |
} |
243 |
|
244 |
fileChooser.setMultiSelectionEnabled(true);
|
245 |
fileChooser.setAcceptAllFileFilterUsed(false);
|
246 |
|
247 |
int result = fileChooser.showOpenDialog(this); |
248 |
|
249 |
if (result == JFileChooser.APPROVE_OPTION) { |
250 |
File[] files = fileChooser.getSelectedFiles(); |
251 |
for (File file : files) { |
252 |
for (Iterator iterator = factories.iterator(); iterator.hasNext();) { |
253 |
ColorTableIOFactory colorTableIOFactory = (ColorTableIOFactory) iterator.next(); |
254 |
if(colorTableIOFactory.accept(file)){
|
255 |
ColorTableIO colorTableIO = colorTableIOFactory.create(); |
256 |
ColorTable colorTable; |
257 |
try {
|
258 |
colorTable = colorTableIO.read(file); |
259 |
} catch (ColorTableIOException e) {
|
260 |
LOG.warn("Can't read color table '"+file.getName()+"'.", e); |
261 |
//FIXME: mostrar aviso al usuario
|
262 |
throw new RuntimeException("Can't read color table '"+file.getName()+"'.", e); |
263 |
} |
264 |
addedColorTables.add(colorTable); |
265 |
((ColorTablesTableModel)tblColorTables.getModel()).addColorTable(new MutablePair<File, ColorTable>(null,colorTable)); |
266 |
continue;
|
267 |
} |
268 |
} |
269 |
} |
270 |
} |
271 |
} |
272 |
|
273 |
protected void doExportColorTable() { |
274 |
ColorTable colorTable = |
275 |
((ColorTablesTableModel) tblColorTables.getModel()).getColorTable(tblColorTables.getSelectedRow()) |
276 |
.getValue(); |
277 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
278 |
RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager(); |
279 |
JFileChooser fileChooser = new JFileChooser(); |
280 |
List<ColorTableIOFactory> factories = legendManager.getColorTableIOFactories();
|
281 |
for (Iterator iterator = factories.iterator(); iterator.hasNext();) { |
282 |
ColorTableIOFactory colorTableIOFactory = (ColorTableIOFactory) iterator.next(); |
283 |
fileChooser.addChoosableFileFilter(new MyFileFilter(colorTableIOFactory));
|
284 |
} |
285 |
|
286 |
fileChooser.setMultiSelectionEnabled(false);
|
287 |
fileChooser.setAcceptAllFileFilterUsed(false);
|
288 |
|
289 |
int result = fileChooser.showSaveDialog(this); |
290 |
|
291 |
if (result == JFileChooser.APPROVE_OPTION) { |
292 |
File file = fileChooser.getSelectedFile();
|
293 |
MyFileFilter fileFilter = (MyFileFilter) fileChooser.getFileFilter(); |
294 |
File parent = file.getParentFile();
|
295 |
String filename = file.getName();
|
296 |
ColorTableIOFactory colorTableIOFactory = fileFilter.getColorTableIOFactory(); |
297 |
if (FilenameUtils.getExtension(filename).isEmpty()) {
|
298 |
file = new File(parent, filename + "." + colorTableIOFactory.getDefaultExtension()); |
299 |
} |
300 |
; |
301 |
try {
|
302 |
colorTableIOFactory.create().write(colorTable, file); |
303 |
} catch (ColorTableIOException e) {
|
304 |
LOG.warn("Can't write color table '" + file.getName() + "'.", e); |
305 |
// FIXME: mostrar aviso al usuario
|
306 |
throw new RuntimeException("Can't write color table '" + file.getName() + "'.", e); |
307 |
} |
308 |
} |
309 |
} |
310 |
|
311 |
protected void doNewColorTable() { |
312 |
RasterSwingLegendManager rasterSwingLegendManager = RasterSwingLegendLocator.getSwingManager(); |
313 |
final CreateColorTablePanel panel = rasterSwingLegendManager.createCreateColorTablePanel();
|
314 |
panel.setFromColor(new Color(0,0,0,255)); |
315 |
panel.setToColor(new Color(255,255,255,255)); |
316 |
panel.setMinimum(0);
|
317 |
panel.setMaximum(255);
|
318 |
panel.setIntervals(1);
|
319 |
panel.setMode(MakeColorTable.MODE_NUMBER_OF_INTERVALS); |
320 |
panel.setName("");
|
321 |
panel.asJComponent().setPreferredSize(new Dimension(400, 300)); |
322 |
|
323 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
324 |
|
325 |
final WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
|
326 |
|
327 |
final Dialog dialog = |
328 |
winManager.createDialog(panel.asJComponent(), i18nManager.getTranslation("color-tables-library"),
|
329 |
null, WindowManager_v2.BUTTONS_OK_CANCEL);
|
330 |
|
331 |
dialog.addActionListener(new ActionListener() { |
332 |
|
333 |
@Override
|
334 |
public void actionPerformed(ActionEvent e) { |
335 |
switch (dialog.getAction()) {
|
336 |
case WindowManager_v2.BUTTON_OK:
|
337 |
if (doMakeColorTable(panel)) {
|
338 |
panel.asJComponent().setVisible(false);
|
339 |
} |
340 |
break;
|
341 |
|
342 |
case WindowManager_v2.BUTTON_CANCEL:
|
343 |
panel.asJComponent().setVisible(false);
|
344 |
break;
|
345 |
} |
346 |
|
347 |
} |
348 |
|
349 |
}); |
350 |
dialog.show(WindowManager.MODE.WINDOW); |
351 |
} |
352 |
|
353 |
protected boolean doMakeColorTable(CreateColorTablePanel panel) { |
354 |
MakeColorTable makeColorTable = RasterLegendLocator.getRasterLegendManager().createMakeColorTable(); |
355 |
panel.fetch(makeColorTable); |
356 |
ColorTable colorTable = makeColorTable.getColorTable(); |
357 |
((ColorTablesTableModel)tblColorTables.getModel()).addColorTable(new MutablePair<File, ColorTable>(null, colorTable)); |
358 |
addedColorTables.add(colorTable); |
359 |
return true; |
360 |
} |
361 |
|
362 |
private void translate() { |
363 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
364 |
|
365 |
btnNew.setToolTipText(i18nManager.getTranslation(btnNew.getToolTipText())); |
366 |
btnImport.setToolTipText(i18nManager.getTranslation(btnImport.getToolTipText())); |
367 |
btnExport.setToolTipText(i18nManager.getTranslation(btnExport.getToolTipText())); |
368 |
btnRemove.setToolTipText(i18nManager.getTranslation(btnRemove.getToolTipText())); |
369 |
} |
370 |
|
371 |
/**
|
372 |
* @param locale
|
373 |
*
|
374 |
*/
|
375 |
public void setLocate(Locale locale) { |
376 |
Locale l = super.getLocale(); |
377 |
if (!l.equals(locale)) {
|
378 |
translate(); |
379 |
} |
380 |
super.setLocale(locale);
|
381 |
} |
382 |
|
383 |
|
384 |
/* (non-Javadoc)
|
385 |
* @see org.gvsig.raster.tools.swing.api.colortable.ColorTableSelector#fetch(org.gvsig.raster.lib.legend.api.ColorTable)
|
386 |
*/
|
387 |
@Override
|
388 |
public ColorTable getSelected() {
|
389 |
int row = tblColorTables.getSelectedRow();
|
390 |
if(row<0){ |
391 |
return null; |
392 |
} |
393 |
return (ColorTable)((ColorTablesTableModel)tblColorTables.getModel()).getValueAt(row, 0); |
394 |
} |
395 |
|
396 |
/* (non-Javadoc)
|
397 |
* @see org.gvsig.raster.tools.swing.api.colortable.ColorTableSelector#set(java.util.List)
|
398 |
*/
|
399 |
@Override
|
400 |
public void set(List<Pair<File,ColorTable>> colorTables) { |
401 |
if(colorTables!=null){ |
402 |
this.colorTables = colorTables;
|
403 |
} else {
|
404 |
this.colorTables = new ArrayList<Pair<File,ColorTable>>(); |
405 |
} |
406 |
this.modifiedColorTables = new ArrayList<Pair<File,ColorTable>>(); |
407 |
this.addedColorTables = new ArrayList<ColorTable>(); |
408 |
this.removedColorTables = new ArrayList<Pair<File,ColorTable>>(); |
409 |
this.init();
|
410 |
} |
411 |
|
412 |
private void init() { |
413 |
|
414 |
ColorTablesTableModel tableModel = new DefaultColorTablesTableModel(this.colorTables); |
415 |
tblColorTables.setModel(tableModel); |
416 |
|
417 |
tblColorTables.setColumnModel(new DefaultTableColumnModel()); |
418 |
TableColumnModel columnModel = tblColorTables.getColumnModel();
|
419 |
columnModel.setColumnSelectionAllowed(false);
|
420 |
for (int i = 0; i < tableModel.getColumnCount(); i++) { |
421 |
TableColumn tableColumn = new TableColumn(i); |
422 |
tableColumn.setIdentifier(tableModel.getColumnName(i)); |
423 |
tableColumn.setHeaderValue(tableModel.getColumnName(i)); |
424 |
if(i==DefaultColorTablesTableModel.COLUMN_PREVIEW){
|
425 |
tableColumn.setCellRenderer(new PreviewerColorTableCellRenderer());
|
426 |
} |
427 |
columnModel.addColumn(tableColumn); |
428 |
} |
429 |
|
430 |
} |
431 |
|
432 |
private void updateComponents() { |
433 |
boolean selected = tblColorTables.getSelectedRowCount() >= 1; |
434 |
btnExport.setEnabled(selected); |
435 |
btnRemove.setEnabled(selected && this.editable);
|
436 |
btnEdit.setEnabled(selected && this.editable);
|
437 |
|
438 |
btnEdit.setVisible(this.editable);
|
439 |
btnImport.setVisible(this.editable);
|
440 |
btnNew.setVisible(this.editable);
|
441 |
btnRemove.setVisible(this.editable);
|
442 |
btnExport.setVisible(this.editable);
|
443 |
} |
444 |
|
445 |
@Override
|
446 |
public List<Pair<File, ColorTable>> getModifiedColorTables() { |
447 |
return modifiedColorTables;
|
448 |
} |
449 |
|
450 |
@Override
|
451 |
public List<Pair<File, ColorTable>> getRemovedColorTables() { |
452 |
return removedColorTables;
|
453 |
} |
454 |
|
455 |
@Override
|
456 |
public List<ColorTable> getAddedColorTables() { |
457 |
return addedColorTables;
|
458 |
} |
459 |
|
460 |
@Override
|
461 |
public void setEditable(boolean editable) { |
462 |
this.editable = editable;
|
463 |
updateComponents(); |
464 |
} |
465 |
|
466 |
/**
|
467 |
* @author fdiaz
|
468 |
*
|
469 |
*/
|
470 |
private static class MyFileFilter extends javax.swing.filechooser.FileFilter { |
471 |
|
472 |
private ColorTableIOFactory factory;
|
473 |
|
474 |
/**
|
475 |
*/
|
476 |
public MyFileFilter(ColorTableIOFactory factory) {
|
477 |
this.factory = factory;
|
478 |
} |
479 |
|
480 |
@Override
|
481 |
public boolean accept(File f) { |
482 |
if (f.isDirectory()) {
|
483 |
return true; |
484 |
} |
485 |
return this.getColorTableIOFactory().accept(f); |
486 |
} |
487 |
|
488 |
@Override
|
489 |
public String getDescription() { |
490 |
return this.getColorTableIOFactory().getName(); |
491 |
} |
492 |
|
493 |
/**
|
494 |
* @return the fileFilter
|
495 |
*/
|
496 |
public ColorTableIOFactory getColorTableIOFactory() {
|
497 |
return this.factory; |
498 |
} |
499 |
} |
500 |
|
501 |
@Override
|
502 |
public synchronized void addFocusListener(FocusListener l) { |
503 |
// TODO Auto-generated method stub
|
504 |
super.addFocusListener(l);
|
505 |
} |
506 |
|
507 |
@Override
|
508 |
public void addListSelectionListener(ListSelectionListener listener) { |
509 |
tblColorTables.getSelectionModel().addListSelectionListener(listener); |
510 |
} |
511 |
|
512 |
@Override
|
513 |
public void select(int i) { |
514 |
tblColorTables.getSelectionModel().setValueIsAdjusting(true);
|
515 |
tblColorTables.getSelectionModel().setSelectionInterval(i, i); |
516 |
tblColorTables.getSelectionModel().setValueIsAdjusting(false);
|
517 |
} |
518 |
} |