KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > setup > MessageTableItem


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
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 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.setup;
21
22 import com.sslexplorer.notification.Message;
23 import com.sslexplorer.notification.Notifier.MessageWrapper;
24 import com.sslexplorer.table.TableItem;
25
26 /**
27  */

28 public class MessageTableItem implements TableItem {
29     
30     private final MessageWrapper messageWrapper;
31     
32     /**
33      * @param messageWrapper
34      */

35     public MessageTableItem(MessageWrapper messageWrapper) {
36         this.messageWrapper = messageWrapper;
37     }
38     
39     /**
40      * @return String
41      */

42     public long getId() {
43         return messageWrapper.getMessage().getId();
44     }
45     
46     /**
47      * @return Message
48      */

49     public Message getMessage() {
50         return messageWrapper.getMessage();
51     }
52     
53     /**
54      * @return String
55      */

56     public String JavaDoc getAttempts() {
57         return String.valueOf(messageWrapper.getAttempt());
58     }
59     
60     /**
61      * @return String
62      */

63     public String JavaDoc getLastAttempt() {
64         return messageWrapper.getFormattedTime();
65     }
66
67     public Object JavaDoc getColumnValue(int col) {
68         switch(col) {
69             case 0:
70                 return getMessage().getSubject();
71             case 1:
72                 return new Boolean JavaDoc(getMessage().isUrgent());
73             case 2:
74                 return new Integer JavaDoc(getAttempts());
75             case 3:
76                 return messageWrapper.getTime();
77             default:
78                 return "";
79         }
80     }
81     
82     /**
83      * @return String
84      */

85     public String JavaDoc getLink() {
86         return "#";
87     }
88     
89     /**
90      * @return String
91      */

92     public String JavaDoc getOnClick() {
93         return "";
94     }
95 }
Popular Tags