svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.editing.app / org.gvsig.editing.app.mainplugin / src / main / java / org / gvsig / editing / project / documents / view / legend / edition / gui / CellIconOptionRenderer.java @ 40557
History | View | Annotate | Download (3.66 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
/*
|
25 |
* Created on 27-abr-2004
|
26 |
*
|
27 |
*/
|
28 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
29 |
*
|
30 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
31 |
*
|
32 |
* This program is free software; you can redistribute it and/or
|
33 |
* modify it under the terms of the GNU General Public License
|
34 |
* as published by the Free Software Foundation; either version 2
|
35 |
* of the License, or (at your option) any later version.
|
36 |
*
|
37 |
* This program is distributed in the hope that it will be useful,
|
38 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
39 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
40 |
* GNU General Public License for more details.
|
41 |
*
|
42 |
* You should have received a copy of the GNU General Public License
|
43 |
* along with this program; if not, write to the Free Software
|
44 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
45 |
*
|
46 |
* For more information, contact:
|
47 |
*
|
48 |
* Generalitat Valenciana
|
49 |
* Conselleria d'Infraestructures i Transport
|
50 |
* Av. Blasco Ib??ez, 50
|
51 |
* 46010 VALENCIA
|
52 |
* SPAIN
|
53 |
*
|
54 |
* +34 963862235
|
55 |
* gvsig@gva.es
|
56 |
* www.gvsig.gva.es
|
57 |
*
|
58 |
* or
|
59 |
*
|
60 |
* IVER T.I. S.A
|
61 |
* Salamanca 50
|
62 |
* 46005 Valencia
|
63 |
* Spain
|
64 |
*
|
65 |
* +34 963163400
|
66 |
* dac@iver.es
|
67 |
*/
|
68 |
package org.gvsig.editing.project.documents.view.legend.edition.gui; |
69 |
|
70 |
import java.awt.Component; |
71 |
|
72 |
import javax.swing.ImageIcon; |
73 |
import javax.swing.JPanel; |
74 |
import javax.swing.JTable; |
75 |
import javax.swing.border.Border; |
76 |
import javax.swing.table.TableCellRenderer; |
77 |
|
78 |
import org.gvsig.app.project.documents.view.legend.edition.gui.PreviewIcon; |
79 |
|
80 |
|
81 |
/**
|
82 |
* Renderer para iconos.
|
83 |
*
|
84 |
* @author Vicente Caballero Navarro
|
85 |
*/
|
86 |
public class CellIconOptionRenderer extends JPanel implements TableCellRenderer { |
87 |
Border unselectedBorder = null; |
88 |
Border selectedBorder = null; |
89 |
boolean isBordered = true; |
90 |
private PreviewIcon preview = new PreviewIcon(); |
91 |
|
92 |
/**
|
93 |
* Crea un nuevo FCellRenderer.
|
94 |
*
|
95 |
* @param isBordered DOCUMENT ME!
|
96 |
*/
|
97 |
public CellIconOptionRenderer(boolean isBordered) { |
98 |
this.isBordered = isBordered;
|
99 |
setOpaque(true); //MUST do this for background to show up. |
100 |
} |
101 |
|
102 |
/**
|
103 |
* DOCUMENT ME!
|
104 |
*
|
105 |
* @param table DOCUMENT ME!
|
106 |
* @param value DOCUMENT ME!
|
107 |
* @param isSelected DOCUMENT ME!
|
108 |
* @param hasFocus DOCUMENT ME!
|
109 |
* @param row DOCUMENT ME!
|
110 |
* @param column DOCUMENT ME!
|
111 |
*
|
112 |
* @return DOCUMENT ME!
|
113 |
*/
|
114 |
public Component getTableCellRendererComponent(JTable table, Object value, |
115 |
boolean isSelected, boolean hasFocus, int row, int column) { |
116 |
preview.setIcon((ImageIcon) value);
|
117 |
if (table.getSelectedRow()==row)
|
118 |
preview.setSelected(true);
|
119 |
else
|
120 |
preview.setSelected(false);
|
121 |
return preview;
|
122 |
} |
123 |
} |