View Javadoc

1   /**
2    * Copyright 2005-2012 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.element;
17  
18  import org.apache.commons.lang.StringUtils;
19  
20  /**
21   * Encapsulates a text message to be displayed
22   * 
23   * <p>
24   * The <code>Message</code> is used to display static text in the user
25   * interface
26   * </p>
27   * 
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class Message extends ContentElementBase {
31  	private static final long serialVersionUID = 4090058533452450395L;
32  
33  	private String messageText;
34  
35  	public Message() {
36  		super();
37  	}
38  
39  	/**
40  	 * Override to render only if the message text has been given or there is a conditional expression on the
41       * message text
42  	 *
43  	 * @see org.kuali.rice.krad.uif.component.ComponentBase#isRender()
44  	 */
45  	@Override
46  	public boolean isRender() {
47  		boolean render = super.isRender();
48  
49          if (render) {
50              render = getPropertyExpressions().containsKey("messageText") || (StringUtils.isNotBlank(messageText)
51                      && !StringUtils.equals(messageText, "&nbsp;"));
52          }
53  
54          return render;
55  	}
56  
57  	/**
58  	 * Text that makes up the message that will be displayed
59  	 * 
60  	 * @return String message text
61  	 */
62  	public String getMessageText() {
63  		return this.messageText;
64  	}
65  
66  	/**
67  	 * Setter for the message text
68  	 * 
69  	 * @param messageText
70  	 */
71  	public void setMessageText(String messageText) {
72  		this.messageText = messageText;
73  	}
74  
75  }