Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.installer / org.gvsig.installer.swing / org.gvsig.installer.swing.impl / src / main / java / org / gvsig / installer / swing / impl / execution / panel / renderers / OfficialRecommendedCellRenderer.java @ 37584

History | View | Annotate | Download (2.8 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.installer.swing.impl.execution.panel.renderers;
23

    
24
import java.awt.Component;
25
import java.net.URL;
26

    
27
import javax.swing.Icon;
28
import javax.swing.ImageIcon;
29
import javax.swing.JLabel;
30
import javax.swing.JTable;
31
import javax.swing.table.DefaultTableCellRenderer;
32

    
33
import org.gvsig.installer.swing.impl.execution.panel.model.PackagesTableModel.PackageOfficialRecommended;
34

    
35
/**
36
 * @author gvSIG Team
37
 * @version $Id$
38
 * 
39
 */
40
public class OfficialRecommendedCellRenderer extends DefaultTableCellRenderer {
41

    
42
        private static final long serialVersionUID = 1195015856704835320L;
43

    
44
        public OfficialRecommendedCellRenderer() {
45
        }
46

    
47
        @Override
48
        public Component getTableCellRendererComponent(JTable table, Object value,
49
                        boolean isSelected, boolean hasFocus, int row, int column) {
50

    
51
                Icon icon;
52
                PackageOfficialRecommended status = (PackageOfficialRecommended) value;
53
                JLabel check = new JLabel();
54
                URL resource;
55

    
56
                switch (status) {
57

    
58
                case OFFICIAL_RECOMMENDED:
59
                        resource = this.getClass().getResource(
60
                                        "/images/officialRecommended.png");
61
                        icon = new ImageIcon(resource);
62
                        check.setToolTipText("_official_recommended");
63
                        check.setIcon(icon);
64

    
65
                        return check;
66

    
67
                case OFFICIAL_NOT_RECOMMENDED:
68
                        resource = this.getClass().getResource(
69
                                        "/images/officialNotRecommended.png");
70
                        icon = new ImageIcon(resource);
71
                        check.setToolTipText("_official");
72
                        check.setIcon(icon);
73

    
74
                        return check;
75

    
76
                case NOT_OFFICIAL_RECOMMENDED:
77
                        resource = this.getClass().getResource(
78
                                        "/images/notOfficialRecommended.png");
79
                        icon = new ImageIcon(resource);
80
                        check.setIcon(icon);
81
                        check.setToolTipText("_not_official_recommended");
82
                        return check;
83

    
84
                case NOT_OFFICIAL_NOT_RECOMMENDED:
85
                        resource = this.getClass().getResource("/images/notOfficial.png");
86
                        icon = new ImageIcon(resource);
87
                        check.setIcon(icon);
88
                        check.setToolTipText("_not_official");
89
                        return check;
90

    
91
                default:
92
                        // no image as default
93
                        return check;
94

    
95
                }
96
        }
97

    
98
}