Coverage Report - org.kuali.rice.krad.uif.field.MessageField
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageField
0%
0/19
0%
0/6
1.25
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.field;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 
 20  
 /**
 21  
  * Encapsulates a text message to be displayed
 22  
  * 
 23  
  * <p>
 24  
  * The <code>MessageField</code> is used to display static text in the user
 25  
  * interface. The message type can be used to group similar messages for styling
 26  
  * </p>
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 public class MessageField extends FieldBase {
 31  
         private static final long serialVersionUID = 4090058533452450395L;
 32  
 
 33  
         private String messageText;
 34  
         private String messageType;
 35  
 
 36  
         public MessageField() {
 37  0
                 super();
 38  0
         }
 39  
 
 40  
         /**
 41  
          * Override to render only if the message text has been given
 42  
          * 
 43  
          * @see org.kuali.rice.krad.uif.core.ComponentBase#isRender()
 44  
          */
 45  
         @Override
 46  
         public boolean isRender() {
 47  0
                 boolean render = super.isRender();
 48  
 
 49  0
         if (render) {
 50  0
             render = StringUtils.isNotBlank(messageText) && !StringUtils.equals(messageText, "&nbsp;");
 51  
         }
 52  
 
 53  0
         return render;
 54  
         }
 55  
 
 56  0
         public MessageField(String messageType) {
 57  0
                 this.messageType = messageType;
 58  0
         }
 59  
 
 60  0
         public MessageField(String messageText, String messageType) {
 61  0
                 this.messageText = messageText;
 62  0
                 this.messageType = messageType;
 63  0
         }
 64  
 
 65  
         /**
 66  
          * Text that makes up the message that will be displayed
 67  
          * 
 68  
          * @return String message text
 69  
          */
 70  
         public String getMessageText() {
 71  0
                 return this.messageText;
 72  
         }
 73  
 
 74  
         /**
 75  
          * Setter for the message text
 76  
          * 
 77  
          * @param messageText
 78  
          */
 79  
         public void setMessageText(String messageText) {
 80  0
                 this.messageText = messageText;
 81  0
         }
 82  
 
 83  
         /**
 84  
          * Type of the field's message, used to suffix the message fields id
 85  
          * 
 86  
          * <p>
 87  
          * Messages that have similar intent can be grouped by this type string. For
 88  
          * messages of the same type, their id will contain the same suffix which
 89  
          * can be used for scripting to apply additional styling or behavior to that
 90  
          * groups of messages (for example show/hide)
 91  
          * </p>
 92  
          * 
 93  
          * @return String message type
 94  
          */
 95  
         public String getMessageType() {
 96  0
                 return this.messageType;
 97  
         }
 98  
 
 99  
         /**
 100  
          * Setter for the message's type
 101  
          * 
 102  
          * @param messageType
 103  
          */
 104  
         public void setMessageType(String messageType) {
 105  0
                 this.messageType = messageType;
 106  0
         }
 107  
 
 108  
 }