Statistics
| Revision:

root / 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 / OsAndArchitectureCellRenderer.java @ 37585

History | View | Annotate | Download (2.64 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.PackageOsAndArchitecture;
34

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

    
42
        private static final long serialVersionUID = 3767874502044161245L;
43

    
44
        public OsAndArchitectureCellRenderer() {
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
                PackageOsAndArchitecture osArch = (PackageOsAndArchitecture) value;
53
                JLabel check = new JLabel();
54
                URL resource;
55

    
56
                switch (osArch) {
57

    
58
                case LINUX_32:
59
                        resource = this.getClass().getResource("/images/linux_x86.png");
60
                        icon = new ImageIcon(resource);
61
                        check.setIcon(icon);
62
                        check.setToolTipText("Linux x86");
63
                        return check;
64

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

    
72
                case WINDOLS_32:
73
                        resource = this.getClass().getResource("/images/windows_x86.png");
74
                        icon = new ImageIcon(resource);
75
                        check.setIcon(icon);
76
                        check.setToolTipText("Windows x86");
77
                        return check;
78

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

    
86
                default:
87
                        return check;
88
                }
89

    
90
        }
91

    
92
}