1 /********************************************************************************
2 *InternetCafe is a software solution that helps the management of Cybercafes
3 * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005.
4 * Copyright (C) 2006 Guido Angelo Ingenito
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, MA 02110-1301, USA.
19 *******************************************************************************/
20
21 package base.jdbs.ui;
22
23 import javax.swing.table.AbstractTableModel;
24
25 import org.apache.log4j.Logger;
26
27 @SuppressWarnings("serial")
28 public class TransfersTableModel extends AbstractTableModel {
29
30 private static final transient Logger logger = Logger
31 .getLogger(TransfersTableModel.class.getName());
32
33 private String[] columnNames = { "Source Peer", "Destination Peer",
34 "Backup Size", "Completion Percentage", "Backup Name" };
35
36 public static final int TRANSFER_SOURCE_PEER_COLUMN = 0;
37
38 public static final int TRANSFER_DESTINATION_PEER_COLUMN = 1;
39
40 public static final int TRANSFER_BACKUP_SIZE_COLUMN = 2;
41
42 public static final int TRANSFER_COMPLETION_PERCENTAGE_COLUMN = 3;
43
44 public static final int TRANSFER_BACKUP_NAME_COLUMN = 4;
45
46 public TransfersTableModel() {
47 super();
48 }
49
50 public int getColumnCount() {
51 return columnNames.length;
52 }
53
54 public int getRowCount() {
55 return 0;
56 }
57
58 public String getColumnName(int column) {
59 return columnNames[column];
60 }
61
62 public Object getValueAt(int row, int column) {
63 if (row < 0 || column < 0)
64 return null;
65 Object result = null;
66 switch (column) {
67 case TRANSFER_SOURCE_PEER_COLUMN:
68 break;
69 case TRANSFER_DESTINATION_PEER_COLUMN:
70 break;
71 case TRANSFER_BACKUP_SIZE_COLUMN:
72 break;
73 case TRANSFER_COMPLETION_PERCENTAGE_COLUMN:
74 break;
75 case TRANSFER_BACKUP_NAME_COLUMN:
76 break;
77 }
78 return result;
79 }
80
81 @SuppressWarnings("unchecked")
82 public Class getColumnClass(int column) {
83 Class result = null;
84 switch (column) {
85 case TRANSFER_SOURCE_PEER_COLUMN:
86 break;
87 case TRANSFER_DESTINATION_PEER_COLUMN:
88 break;
89 case TRANSFER_BACKUP_SIZE_COLUMN:
90 break;
91 case TRANSFER_COMPLETION_PERCENTAGE_COLUMN:
92 break;
93 case TRANSFER_BACKUP_NAME_COLUMN:
94 break;
95 }
96 return result;
97 }
98
99
100
101
102 public boolean isCellEditable(int row, int column) {
103 if (row < 0 || column < 0)
104 return false;
105
106
107 boolean result = false;
108 switch (column) {
109 case TRANSFER_SOURCE_PEER_COLUMN:
110 result = false;
111 break;
112 case TRANSFER_DESTINATION_PEER_COLUMN:
113 result = false;
114 break;
115 case TRANSFER_BACKUP_SIZE_COLUMN:
116 result = false;
117 break;
118 case TRANSFER_COMPLETION_PERCENTAGE_COLUMN:
119 result = false;
120 break;
121 case TRANSFER_BACKUP_NAME_COLUMN:
122 result = false;
123 break;
124 }
125 return result;
126 }
127
128
129
130
131 public void setValueAt(Object value, int row, int column) {
132 if (row < 0 || column < 0)
133 return;
134 switch (column) {
135 case TRANSFER_SOURCE_PEER_COLUMN:
136 break;
137 case TRANSFER_DESTINATION_PEER_COLUMN:
138 break;
139 case TRANSFER_BACKUP_SIZE_COLUMN:
140 break;
141 case TRANSFER_COMPLETION_PERCENTAGE_COLUMN:
142 break;
143 case TRANSFER_BACKUP_NAME_COLUMN:
144 break;
145 }
146 fireTableCellUpdated(row, column);
147 }
148 }