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 / InstallStatusCellRenderer.java @ 37584

History | View | Annotate | Download (2.93 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.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
        @Override
48
        public Component getTableCellRendererComponent(JTable table, Object value,
49
                        boolean isSelected, boolean hasFocus, int row, int column) {
50

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

    
56
                switch (status) {
57

    
58
                case INSTALLED:
59
                        resource = this.getClass().getResource("/images/installed.png");
60
                        icon = new ImageIcon(resource);
61
                        check.setIcon(icon);
62
                        check.setToolTipText("_already_installed. _check_to_reinstall");
63
                        return check;
64

    
65
                case TO_REINSTALL:
66
                        resource = this.getClass().getResource("/images/toReinstall.png");
67
                        icon = new ImageIcon(resource);
68
                        check.setIcon(icon);
69
                        check.setToolTipText("_checked_to_reinstall");
70
                        return check;
71

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

    
79
                case TO_INSTALL:
80
                        resource = this.getClass().getResource("/images/toInstall.png");
81
                        icon = new ImageIcon(resource);
82
                        check.setIcon(icon);
83
                        check.setToolTipText("_checked_to_install");
84
                        return check;
85

    
86
                case INSTALLED_NOT_INSTALLABLE:
87
                        resource = this.getClass().getResource(
88
                                        "/images/installedNotInstallable.png");
89
                        icon = new ImageIcon(resource);
90
                        check.setIcon(icon);
91
                        check.setToolTipText("_already_installed. _not_installable");
92
                        return check;
93

    
94
                default:
95
                        return check;
96
                }
97

    
98
        }
99

    
100
}