KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > extensions > ExtensionBundleItem


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.extensions;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23
24 import com.sslexplorer.boot.VersionInfo;
25 import com.sslexplorer.core.CoreUtil;
26 import com.sslexplorer.extensions.ExtensionBundle.ExtensionBundleStatus;
27 import com.sslexplorer.table.TableItem;
28
29
30 public class ExtensionBundleItem implements TableItem {
31     private ExtensionBundle bundle;
32     private String JavaDoc selected;
33     private String JavaDoc subFormName;
34     
35     public ExtensionBundleItem(ExtensionBundle bundle, boolean selected, String JavaDoc subFormName) {
36         this.bundle = bundle;
37         this.selected = String.valueOf(selected);
38         this.subFormName = subFormName;
39     }
40
41     /**
42      * @return Returns the selected.
43      */

44     public String JavaDoc getSelected() {
45         return selected;
46     }
47
48     /**
49      * @param selected The selected to set.
50      */

51     public void setSelected(String JavaDoc selected) {
52         this.selected = selected;
53     }
54     
55     /**
56      * Get the changes for this extension bundle.
57      * @return
58      */

59     public String JavaDoc getChanges() {
60         return bundle.getChanges();
61     }
62     
63     public VersionInfo.Version getVersion() {
64         return bundle.isUpdateable() ? bundle.getUpdateVersion() : bundle.getVersion();
65     }
66
67     /**
68      * @return Returns the bundle.
69      */

70     public ExtensionBundle getBundle() {
71         return bundle;
72     }
73     
74     public String JavaDoc getBundleStatusName() {
75         if(bundle.getError() != null || bundle.getStatus().getName().equals(ExtensionBundleStatus.ERROR.getName())) {
76             return bundle.getStatus().getName();
77         }
78         else {
79             return bundle.getType() != ExtensionBundle.TYPE_INSTALLABLE && bundle.getType() != ExtensionBundle.TYPE_CONFIGUREABLE ? bundle.getStatus().getName() : "notinstalled";
80         }
81     }
82
83     public Object JavaDoc getColumnValue(int col) {
84         return bundle.getName();
85     }
86
87     public String JavaDoc getSubFormName() {
88         return subFormName;
89     }
90
91     public void setSubFormName(String JavaDoc subFormName) {
92         this.subFormName = subFormName;
93     }
94     
95     public String JavaDoc getSmallIconPath(HttpServletRequest JavaDoc request) {
96         if (getBundleStatusName().equals("activated")){
97             return CoreUtil.getThemePath(request.getSession()) + "/images/actions/start.gif";
98         }
99         else if (getBundleStatusName().equals("enabled")){
100             return CoreUtil.getThemePath(request.getSession()) + "/images/actions/stop.gif";
101         }
102         else if ((getBundleStatusName().equals("disabled") || getBundleStatusName().equals("systemDisabled"))){
103             return CoreUtil.getThemePath(request.getSession()) + "/images/actions/cancel.gif";
104         }
105         else if (getBundleStatusName().equals("error")){
106             return CoreUtil.getThemePath(request.getSession()) + "/images/error.gif";
107         }
108         else{
109             return CoreUtil.getThemePath(request.getSession()) + "/images/actions/extension.gif";
110         }
111     }
112
113 }
114
Popular Tags