root / branches / gvSIG_03_SLD / applications / appgvSIG / src / com / iver / cit / gvsig / gui / thememanager / legendmanager / panels / edition / FIntervalCellEditor.java @ 2076
History | View | Annotate | Download (3.31 KB)
1 |
/*
|
---|---|
2 |
* Created on 27-abr-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package com.iver.cit.gvsig.gui.thememanager.legendmanager.panels.edition; |
48 |
|
49 |
import com.iver.andami.PluginServices; |
50 |
|
51 |
import com.iver.cit.gvsig.fmap.rendering.FInterval; |
52 |
|
53 |
import java.awt.Component; |
54 |
import java.awt.event.ActionEvent; |
55 |
import java.awt.event.ActionListener; |
56 |
|
57 |
import javax.swing.AbstractCellEditor; |
58 |
import javax.swing.JButton; |
59 |
import javax.swing.JTable; |
60 |
import javax.swing.table.TableCellEditor; |
61 |
|
62 |
|
63 |
/**
|
64 |
* Cell Editor de intervalos. Controla los eventos de edici?n que se realicen
|
65 |
* sobre la columna de intervalos.
|
66 |
*
|
67 |
* @author Vicente Caballero Navarro
|
68 |
*/
|
69 |
public class FIntervalCellEditor extends AbstractCellEditor |
70 |
implements TableCellEditor, ActionListener { |
71 |
private static final long serialVersionUID = 1L; |
72 |
protected static final String EDIT = "edit"; |
73 |
private FInterval interval;
|
74 |
private PanelEditInterval editPanel;
|
75 |
private JButton button; |
76 |
|
77 |
/**
|
78 |
* Crea un nuevo FIntervalCellEditor.
|
79 |
*/
|
80 |
public FIntervalCellEditor() {
|
81 |
button = new JButton(); |
82 |
button.setActionCommand(EDIT); |
83 |
button.addActionListener(this);
|
84 |
button.setBorderPainted(false);
|
85 |
editPanel = new PanelEditInterval(this); |
86 |
} |
87 |
|
88 |
/**
|
89 |
* Action que se recoge cuando se clickea sobre la columna de intervalos.
|
90 |
*
|
91 |
* @param e ActionEvent
|
92 |
*/
|
93 |
public void actionPerformed(ActionEvent e) { |
94 |
if (EDIT.equals(e.getActionCommand())) {
|
95 |
editPanel.setFInterval(interval); |
96 |
PluginServices.getMDIManager().addView(editPanel); |
97 |
fireEditingStopped(); //Make the renderer reappear.
|
98 |
} |
99 |
} |
100 |
|
101 |
/**
|
102 |
* Inserta el intervalo.
|
103 |
*
|
104 |
* @param i DOCUMENT ME!
|
105 |
*/
|
106 |
public void setCurrentInterval(FInterval i) { |
107 |
interval = i; |
108 |
} |
109 |
|
110 |
//Implement the one CellEditor method that AbstractCellEditor doesn't.
|
111 |
public Object getCellEditorValue() { |
112 |
return interval;
|
113 |
} |
114 |
|
115 |
//Implement the one method defined by TableCellEditor.
|
116 |
public Component getTableCellEditorComponent(JTable table, Object value, |
117 |
boolean isSelected, int row, int column) { |
118 |
interval = (FInterval) value; |
119 |
editPanel.setFInterval(interval); |
120 |
|
121 |
return button;
|
122 |
} |
123 |
} |