KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > properties > attributes > forms > AttributeDefinitionInformationForm


1 package com.sslexplorer.properties.attributes.forms;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.apache.struts.util.MessageResources;
6
7 import com.sslexplorer.core.forms.CoreForm;
8 import com.sslexplorer.extensions.ExtensionBundle;
9 import com.sslexplorer.properties.attributes.AttributeDefinition;
10
11 public class AttributeDefinitionInformationForm extends CoreForm {
12     final static Log log = LogFactory.getLog(AttributeDefinitionInformationForm.class);
13     
14     private AttributeDefinition definition;
15     private String JavaDoc categoryLabel, label, description;
16     
17     public void initialise(MessageResources messageResources, AttributeDefinition definition) {
18         this.definition = definition;
19         String JavaDoc s = messageResources == null ? null : messageResources.getMessage("attributeCategory." + definition.getCategory() + ".title");
20         if (s != null && !s.equals("")) {
21             categoryLabel = s;
22         } else {
23             categoryLabel = definition.getCategoryLabel() != null && !definition.getCategoryLabel().equals("") ? definition.getCategoryLabel() : "Attributes";
24         }
25         s = messageResources == null ? null : messageResources.getMessage("attribute." + definition.getName() + ".title");
26         if (s != null && !s.equals("")) {
27             label = s;
28         } else {
29             label = definition.getLabel() != null && !definition.getLabel().equals("") ? definition.getLabel() : definition.getName();
30         }
31         s = messageResources == null ? null : messageResources.getMessage("attribute." + definition.getName() + ".description");
32         if (s != null && !s.equals("")) {
33             description = s;
34         } else {
35             description = definition.getDescription() != null && !definition.getDescription().equals("") ? definition.getDescription() : label;
36         }
37     }
38     
39     public AttributeDefinition getDefinition() {
40         return definition;
41     }
42
43     public String JavaDoc getCategoryLabel() {
44         return categoryLabel;
45     }
46
47     public String JavaDoc getDescription() {
48         return description;
49     }
50
51     public String JavaDoc getLabel() {
52         return label;
53     }
54 }
55
Popular Tags