1 19 20 package com.sslexplorer.properties.attributes; 21 22 import javax.servlet.http.HttpServletRequest ; 23 24 import org.apache.struts.util.MessageResources; 25 26 import com.sslexplorer.core.CoreUtil; 27 import com.sslexplorer.table.TableItem; 28 29 36 public class AttributeDefinitionItem implements TableItem { 37 38 40 private AttributeDefinition definition; 41 private String categoryLabel; 42 private String description; 43 private String label; 44 45 52 public AttributeDefinitionItem(AttributeDefinition definition, MessageResources messageResources) { 53 54 try { 55 this.definition = definition; 56 String s = messageResources == null ? null : messageResources.getMessage("attributeCategory." + definition.getCategory() + ".title"); 57 if (s != null && !s.equals("")) { 58 categoryLabel = s; 59 } else { 60 categoryLabel = definition.getCategoryLabel() != null && !definition.getCategoryLabel().equals("") ? definition.getCategoryLabel() : "Attributes"; 61 } 62 s = messageResources == null ? null : messageResources.getMessage("attribute." + definition.getName() + ".title"); 63 if (s != null && !s.equals("")) { 64 label = s; 65 } else { 66 label = definition.getLabel() != null && !definition.getLabel().equals("") ? definition.getLabel() : definition.getName(); 67 } 68 s = messageResources == null ? null : messageResources.getMessage("attribute." + definition.getName() + ".description"); 69 if (s != null && !s.equals("")) { 70 description = s; 71 } else { 72 description = definition.getDescription() != null && !definition.getDescription().equals("") ? definition.getDescription() : label; 73 } 74 } catch(Throwable t) { 75 t.printStackTrace(); 76 } 77 } 78 79 84 public String getDescription() { 85 return description; 86 } 87 88 93 public void setDescription(String description) { 94 this.description = description; 95 } 96 97 102 public String getLabel() { 103 return label; 104 } 105 106 111 public void setLabel(String label) { 112 this.label = label; 113 } 114 115 120 public AttributeDefinition getDefinition() { 121 return definition; 122 } 123 124 129 public String getCategoryLabel() { 130 return categoryLabel; 131 } 132 133 138 public Object getColumnValue(int col) { 139 switch (col) { 140 case 0: 141 return getDefinition().getName(); 142 default: 143 return getDefinition().getLabel(); 144 } 145 } 146 147 public String getSmallIconPath(HttpServletRequest request) { 148 return CoreUtil.getThemePath(request.getSession()) + "/images/actions/attributeDefinition.gif"; 149 } 150 151 } 152 | Popular Tags |