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 / selectPackages2 / Renderers / InstallStatusCellRenderer.java @ 37538

History | View | Annotate | Download (2.88 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.selectPackages2.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.selectPackages2.model.PackagesTableModel.PackageStatus;
34

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

    
42
    private static final long serialVersionUID = 1195015856704835320L;
43

    
44
    public InstallStatusCellRenderer() {
45
    }
46

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

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

    
55
        switch (status) {
56

    
57
        case INSTALLED:
58
            resource = this.getClass().getResource("/images/installed.png");
59
            icon = new ImageIcon(resource);
60
            check.setIcon(icon);
61

    
62
            return check;
63

    
64
        case TO_REINSTALL:
65
            resource = this.getClass().getResource("/images/toReinstall.png");
66
            icon = new ImageIcon(resource);
67
            check.setIcon(icon);
68

    
69
            return check;
70

    
71
        case NOT_INSTALLED:
72
            resource = this.getClass().getResource("/images/notInstalled.png");
73
            icon = new ImageIcon(resource);
74
            check.setIcon(icon);
75
            return check;
76

    
77
        case TO_INSTALL:
78
            icon = new ImageIcon("/home/nfrancisco/Imatges/to_install.png");
79
            check.setIcon(icon);
80
            return check;
81

    
82
        case INSTALLED_NOT_INSTALLABLE:
83
            icon =
84
                new ImageIcon(
85
                    "/home/nfrancisco/Imatges/installedNotInstallable.png");
86
            check.setIcon(icon);
87
            return check;
88

    
89
        default:
90
            return check;
91
        }
92

    
93
    }
94

    
95
}