View Javadoc

1   package com.melloware.jukes.util;
2   
3   import com.jgoodies.validation.Severity;
4   import com.jgoodies.validation.ValidationMessage;
5   
6   /**
7    * Basic validation message to assign an icon, and object, a tooltip,
8    * and message.
9    * <p>
10   * Copyright (c) 1999-2007 Melloware, Inc. <http://www.melloware.com>
11   * @author Emil A. Lefkof III <info@melloware.com>
12   * @version 4.0
13   */
14  public class JukesValidationMessage
15      implements ValidationMessage {
16      private Object domainObject;
17  
18      private Severity severity;
19      private String message;
20      private String toolTip;
21  
22      /**
23       * Default Constructor
24       */
25      public JukesValidationMessage(String aMessage, Severity aSeverity) {
26          super();
27          this.message = aMessage;
28          this.severity = aSeverity;
29          this.domainObject = null;
30      }
31  
32      public JukesValidationMessage(String aMessage, Severity aSeverity, Object aObject) {
33          super();
34          this.message = aMessage;
35          this.severity = aSeverity;
36          this.domainObject = aObject;
37      }
38  
39      /**
40       * Gets the domainObject.
41       * <p>
42       * @return Returns the domainObject.
43       */
44      public Object getDomainObject() {
45          return this.domainObject;
46      }
47  
48      /**
49       * Gets the message.
50       * <p>
51       * @return Returns the message.
52       */
53      public String getMessage() {
54          return this.message;
55      }
56  
57      /**
58       * Gets the severity.
59       * <p>
60       * @return Returns the severity.
61       */
62      public Severity getSeverity() {
63          return this.severity;
64      }
65  
66      /**
67       * Gets the toolTip.
68       * <p>
69       * @return Returns the toolTip.
70       */
71      public String getToolTip() {
72          return this.toolTip;
73      }
74  
75      /**
76       * Sets the domainObject.
77       * <p>
78       * @param aDomainObject The domainObject to set.
79       */
80      public void setDomainObject(Object aDomainObject) {
81          this.domainObject = aDomainObject;
82      }
83  
84      /**
85       * Sets the message.
86       * <p>
87       * @param aMessage The message to set.
88       */
89      public void setMessage(String aMessage) {
90          this.message = aMessage;
91      }
92  
93      /**
94       * Sets the severity.
95       * <p>
96       * @param aSeverity The severity to set.
97       */
98      public void setSeverity(Severity aSeverity) {
99          this.severity = aSeverity;
100     }
101 
102     /**
103      * Sets the toolTip.
104      * <p>
105      * @param aToolTip The toolTip to set.
106      */
107     public void setToolTip(String aToolTip) {
108         this.toolTip = aToolTip;
109     }
110 
111     /* (non-Javadoc)
112      * @see com.jgoodies.validation.ValidationMessage#formattedText()
113      */
114     public String formattedText() {
115         return this.message.trim();
116     }
117 
118     /* (non-Javadoc)
119      * @see com.jgoodies.validation.ValidationMessage#key()
120      */
121     public Object key() {
122         return null;
123     }
124 
125     /* (non-Javadoc)
126      * @see com.jgoodies.validation.ValidationMessage#severity()
127      */
128     public Severity severity() {
129         return this.severity;
130     }
131 
132     /* (non-Javadoc)
133      * @see java.lang.Object#toString()
134      */
135     public String toString() {
136         return this.message.trim();
137     }
138 }