1 19 20 package com.sslexplorer.extensions; 21 22 import javax.servlet.http.HttpServletRequest ; 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 selected; 33 private String subFormName; 34 35 public ExtensionBundleItem(ExtensionBundle bundle, boolean selected, String subFormName) { 36 this.bundle = bundle; 37 this.selected = String.valueOf(selected); 38 this.subFormName = subFormName; 39 } 40 41 44 public String getSelected() { 45 return selected; 46 } 47 48 51 public void setSelected(String selected) { 52 this.selected = selected; 53 } 54 55 59 public String getChanges() { 60 return bundle.getChanges(); 61 } 62 63 public VersionInfo.Version getVersion() { 64 return bundle.isUpdateable() ? bundle.getUpdateVersion() : bundle.getVersion(); 65 } 66 67 70 public ExtensionBundle getBundle() { 71 return bundle; 72 } 73 74 public String 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 getColumnValue(int col) { 84 return bundle.getName(); 85 } 86 87 public String getSubFormName() { 88 return subFormName; 89 } 90 91 public void setSubFormName(String subFormName) { 92 this.subFormName = subFormName; 93 } 94 95 public String getSmallIconPath(HttpServletRequest 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 |