01: /*
02: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
03: * http://www.jaspersoft.com.
04: *
05: * Unless you have purchased a commercial license agreement from JasperSoft,
06: * the following license terms apply:
07: *
08: * This program is free software; you can redistribute it and/or modify
09: * it under the terms of the GNU General Public License version 2 as published by
10: * the Free Software Foundation.
11: *
12: * This program is distributed WITHOUT ANY WARRANTY; and without the
13: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14: * See the 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, see http://www.gnu.org/licenses/gpl.txt
18: * or write to:
19: *
20: * Free Software Foundation, Inc.,
21: * 59 Temple Place - Suite 330,
22: * Boston, MA USA 02111-1307
23: *
24: *
25: *
26: *
27: * ImageCellRenderer.java
28: *
29: * Created on 20 maggio 2004, 8.49
30: *
31: */
32:
33: package it.businesslogic.ireport.plugin.massivecompiler;
34:
35: /**
36: *
37: * @author Administrator
38: */
39: public class ImageCellRenderer implements
40: javax.swing.table.TableCellRenderer {
41:
42: javax.swing.Icon icon1 = null;
43: javax.swing.Icon icon2 = null;
44: javax.swing.Icon icon3 = null;
45:
46: javax.swing.JLabel label;
47:
48: /** Creates a new instance of ImageCellRenderer */
49: public ImageCellRenderer() {
50: label = new javax.swing.JLabel();
51: icon1 = new javax.swing.ImageIcon(getClass().getResource(
52: "/it/businesslogic/ireport/icons/tree/docDirty.gif"));
53: icon2 = new javax.swing.ImageIcon(getClass().getResource(
54: "/it/businesslogic/ireport/icons/tree/doc.gif"));
55: icon3 = new javax.swing.ImageIcon(getClass().getResource(
56: "/it/businesslogic/ireport/icons/tree/warning.gif"));
57:
58: label.setIcon(icon1);
59: label.setText("");
60: }
61:
62: public java.awt.Component getTableCellRendererComponent(
63: javax.swing.JTable table, Object value, boolean isSelected,
64: boolean hasFocus, int row, int column) {
65:
66: if (value instanceof FileEntry) {
67: if (((FileEntry) value).getStatus() == FileEntry.STATUS_COMPILED
68: || ((FileEntry) value).getStatus() == FileEntry.STATUS_COMPILED_GROOVY) {
69: label.setIcon(icon2);
70: } else if (((FileEntry) value).getStatus() == FileEntry.STATUS_ERROR_COMPILING) {
71: label.setIcon(icon3);
72: } else if (((FileEntry) value).getStatus() == FileEntry.STATUS_NOT_COMPILED
73: || ((FileEntry) value).getStatus() == FileEntry.STATUS_COMPILING) {
74: label.setIcon(icon1);
75: }
76: } else {
77: label.setIcon(icon1);
78: }
79: return label;
80:
81: }
82:
83: }
|