svn-gvsig-desktop / branches / gvSIG_GisPlanet / applications / appgvSIG / src / com / iver / cit / gvsig / gui / legendmanager / panels / FCellRenderer.java @ 2165
History | View | Annotate | Download (3.15 KB)
1 | 445 | fjp | /*
|
---|---|---|---|
2 | * Created on 27-abr-2004
|
||
3 | *
|
||
4 | */
|
||
5 | 1103 | fjp | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 | *
|
||
7 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
8 | *
|
||
9 | * This program is free software; you can redistribute it and/or
|
||
10 | * modify it under the terms of the GNU General Public License
|
||
11 | * as published by the Free Software Foundation; either version 2
|
||
12 | * of the License, or (at your option) any later version.
|
||
13 | *
|
||
14 | * This program is distributed in the hope that it will be useful,
|
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
17 | * GNU General Public License for more details.
|
||
18 | *
|
||
19 | * You should have received a copy of the GNU General Public License
|
||
20 | * along with this program; if not, write to the Free Software
|
||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
22 | *
|
||
23 | * For more information, contact:
|
||
24 | *
|
||
25 | * Generalitat Valenciana
|
||
26 | * Conselleria d'Infraestructures i Transport
|
||
27 | * Av. Blasco Ib??ez, 50
|
||
28 | * 46010 VALENCIA
|
||
29 | * SPAIN
|
||
30 | *
|
||
31 | * +34 963862235
|
||
32 | * gvsig@gva.es
|
||
33 | * www.gvsig.gva.es
|
||
34 | *
|
||
35 | * or
|
||
36 | *
|
||
37 | * IVER T.I. S.A
|
||
38 | * Salamanca 50
|
||
39 | * 46005 Valencia
|
||
40 | * Spain
|
||
41 | *
|
||
42 | * +34 963163400
|
||
43 | * dac@iver.es
|
||
44 | */
|
||
45 | 445 | fjp | package com.iver.cit.gvsig.gui.legendmanager.panels; |
46 | |||
47 | 1079 | vcaballero | import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
48 | |||
49 | 445 | fjp | import java.awt.Component; |
50 | |||
51 | import javax.swing.BorderFactory; |
||
52 | import javax.swing.JPanel; |
||
53 | import javax.swing.JTable; |
||
54 | import javax.swing.border.Border; |
||
55 | import javax.swing.table.TableCellRenderer; |
||
56 | |||
57 | |||
58 | /**
|
||
59 | 1079 | vcaballero | * Renderer de la edici?n de un registro de la tabla de s?mbolos.
|
60 | *
|
||
61 | 445 | fjp | * @author fjp
|
62 | */
|
||
63 | public class FCellRenderer extends JPanel implements TableCellRenderer { |
||
64 | Border unselectedBorder = null; |
||
65 | Border selectedBorder = null; |
||
66 | boolean isBordered = true; |
||
67 | protected FPreviewSymbol m_previewPanel = new FPreviewSymbol(); |
||
68 | |||
69 | 1079 | vcaballero | /**
|
70 | * Crea un nuevo FCellRenderer.
|
||
71 | *
|
||
72 | * @param isBordered DOCUMENT ME!
|
||
73 | */
|
||
74 | 445 | fjp | public FCellRenderer(boolean isBordered) { |
75 | this.isBordered = isBordered;
|
||
76 | setOpaque(true); //MUST do this for background to show up. |
||
77 | } |
||
78 | |||
79 | 1079 | vcaballero | /**
|
80 | * DOCUMENT ME!
|
||
81 | *
|
||
82 | * @param table DOCUMENT ME!
|
||
83 | * @param value DOCUMENT ME!
|
||
84 | * @param isSelected DOCUMENT ME!
|
||
85 | * @param hasFocus DOCUMENT ME!
|
||
86 | * @param row DOCUMENT ME!
|
||
87 | * @param column DOCUMENT ME!
|
||
88 | *
|
||
89 | * @return DOCUMENT ME!
|
||
90 | */
|
||
91 | public Component getTableCellRendererComponent(JTable table, Object value, |
||
92 | boolean isSelected, boolean hasFocus, int row, int column) { |
||
93 | 445 | fjp | // System.out.println(value.getClass().toString());
|
94 | m_previewPanel.setSymbol((FSymbol) value); |
||
95 | 1079 | vcaballero | |
96 | 445 | fjp | // Color newColor = m_FSymbol.m_Color;
|
97 | // setBackground(newColor);
|
||
98 | if (isBordered) {
|
||
99 | if (isSelected) {
|
||
100 | if (selectedBorder == null) { |
||
101 | 1079 | vcaballero | selectedBorder = BorderFactory.createMatteBorder(2, 5, 2, |
102 | 5, table.getSelectionBackground());
|
||
103 | 445 | fjp | } |
104 | 1079 | vcaballero | |
105 | 445 | fjp | setBorder(selectedBorder); |
106 | } else {
|
||
107 | if (unselectedBorder == null) { |
||
108 | 1079 | vcaballero | unselectedBorder = BorderFactory.createMatteBorder(2, 5, 2, |
109 | 5, table.getBackground());
|
||
110 | 445 | fjp | } |
111 | 1079 | vcaballero | |
112 | 445 | fjp | setBorder(unselectedBorder); |
113 | } |
||
114 | } |
||
115 | 1079 | vcaballero | |
116 | 445 | fjp | // setToolTipText("RGB value: " + newColor.getRed() + ", " + newColor.getGreen() + ", " + newColor.getBlue());
|
117 | return m_previewPanel;
|
||
118 | } |
||
119 | } |