View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.uif.util;
17  
18  import org.kuali.rice.core.api.util.AbstractKeyValue;
19  import org.kuali.rice.krad.uif.element.Message;
20  
21  /**
22   * KeyMessage object for key-value pairs that contain rich content in the value portion.  By translating this content
23   * to message, the content will be parsed and replaced appropriately for KeyValue controls.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public class KeyMessage extends AbstractKeyValue {
28      private Message message;
29  
30      /**
31       * Constructor for KeyMessage
32       *
33       * @param key key
34       * @param value value
35       * @param message message with messageText set to value
36       */
37      public KeyMessage(String key, String value, Message message) {
38          super(key, value);
39          this.message = message;
40      }
41  
42      /**
43       * Constructor for KeyMessage
44       *
45       * @param key key
46       * @param value value
47       * @param message message with messageText set to value
48       * @param disabled boolean whether to enable the key/value or not
49       */
50      public KeyMessage(String key, String value, Message message, boolean disabled) {
51          this(key, value, message);
52          this.disabled = disabled;
53      }
54  
55      /**
56       * Set the key
57       *
58       * @param key
59       */
60      public void setKey(String key) {
61          this.key = key;
62      }
63  
64      /**
65       * Set the value
66       *
67       * @param value
68       */
69      public void setValue(String value) {
70          this.value = value;
71      }
72  
73      /**
74       * Get the message.  The message will contain the translated/parsed value after its lifecycle executes.
75       *
76       * @return message with translated structure
77       */
78      public Message getMessage() {
79          return message;
80      }
81  
82      /**
83       * Set the message.  The message should have the rich message value as its messageText
84       *
85       * @param message
86       */
87      public void setMessage(Message message) {
88          this.message = message;
89      }
90  
91  
92  }