001/** 002 * Copyright 2005-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.uif.util; 017 018import org.kuali.rice.core.api.util.AbstractKeyValue; 019import org.kuali.rice.krad.uif.element.Message; 020 021/** 022 * KeyMessage object for key-value pairs that contain rich content in the value portion. By translating this content 023 * to message, the content will be parsed and replaced appropriately for KeyValue controls. 024 * 025 * @author Kuali Rice Team (rice.collab@kuali.org) 026 */ 027public class KeyMessage extends AbstractKeyValue { 028 private Message message; 029 030 /** 031 * Constructor for KeyMessage 032 * 033 * @param key key 034 * @param value value 035 * @param message message with messageText set to value 036 */ 037 public KeyMessage(String key, String value, Message message) { 038 super(key, value); 039 this.message = message; 040 } 041 042 /** 043 * Constructor for KeyMessage 044 * 045 * @param key key 046 * @param value value 047 * @param message message with messageText set to value 048 * @param disabled boolean whether to enable the key/value or not 049 */ 050 public KeyMessage(String key, String value, Message message, boolean disabled) { 051 this(key, value, message); 052 this.disabled = disabled; 053 } 054 055 /** 056 * Set the key 057 * 058 * @param key 059 */ 060 public void setKey(String key) { 061 this.key = key; 062 } 063 064 /** 065 * Set the value 066 * 067 * @param value 068 */ 069 public void setValue(String value) { 070 this.value = value; 071 } 072 073 /** 074 * Get the message. The message will contain the translated/parsed value after its lifecycle executes. 075 * 076 * @return message with translated structure 077 */ 078 public Message getMessage() { 079 return message; 080 } 081 082 /** 083 * Set the message. The message should have the rich message value as its messageText 084 * 085 * @param message 086 */ 087 public void setMessage(Message message) { 088 this.message = message; 089 } 090 091 092}