1 package com.sri.emo.wizard;
2
3 import com.jcorporate.expresso.core.dbobj.ValidValue;
4
5 /***
6 * ValidValueWithComment extends Expresso's idea of a Name/Value pair by being
7 * able to add an optional 3rd 'field' which is a comment field. This is often
8 * most used in places in emo such as Node Relations where you have the node id,
9 * the node label, and the node comment as values.
10 *
11 * @author Michael Rimov
12 * @version 1.0
13 */
14 public class ValidValueWithComment extends ValidValue {
15
16 /***
17 *
18 */
19 private static final long serialVersionUID = 1L;
20
21 /***
22 * The comment associated with the node. May be null.
23 */
24 private final String myComment;
25
26 /***
27 * Set to true if the given valid value is selected.
28 */
29 private boolean selected = false;
30
31 /***
32 * Creates a ValidValueWithComment <em>Without</em> a comment.
33 *
34 * @param newKey String the key string
35 * @param newDescrip String the value string.
36 */
37 public ValidValueWithComment(final String newKey, final String newDescrip) {
38 super(newKey, newDescrip);
39 myComment = null;
40
41 }
42
43 /***
44 * Creates a valid value witha comment attached.
45 *
46 * @param newKey String the key of the valid value.
47 * @param newDescrip String the label of the valid value.
48 * @param comment String the comment attached.
49 */
50 public ValidValueWithComment(final String newKey, final String newDescrip, final String comment) {
51 super(newKey, newDescrip);
52 myComment = comment;
53 }
54
55 /***
56 * Retrieve the comment associated with the valid value.
57 *
58 * @return String may be null.
59 */
60 public String getComment() {
61 return myComment;
62 }
63
64 /***
65 * Sets the valid value as selected.
66 *
67 * @param selected boolean
68 */
69 public void setSelected(boolean selected) {
70 this.selected = selected;
71 }
72
73 /***
74 * Returns true if the valid value is selected.
75 *
76 * @return boolean
77 */
78 public boolean isSelected() {
79 return selected;
80 }
81 }