001    /*
002     * Copyright 2010 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.osedu.org/licenses/ECL-2.0
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     */
016    package org.kuali.student.lum.common.client.lo;
017    
018    
019    import org.kuali.student.common.assembly.data.Data;
020    import org.kuali.student.common.assembly.helper.PropertyEnum;
021    
022    
023    public class RichTextInfoHelper
024    {
025            private static final long serialVersionUID = 1;
026            
027            public enum Properties implements PropertyEnum
028            {
029                    PLAIN ("plain"),
030                    FORMATTED ("formatted");
031                    
032                    private final String key;
033                    
034                    private Properties (final String key)
035                    {
036                            this.key = key;
037                    }
038                    
039                    @Override
040                    public String getKey ()
041                    {
042                            return this.key;
043                    }
044            }
045            private Data data;
046            
047            private RichTextInfoHelper (Data data)
048            {
049                    this.data = data;
050            }
051            
052            public static RichTextInfoHelper wrap (Data data)
053            {
054                    if (data == null)
055                    {
056                             return null;
057                    }
058                    return new RichTextInfoHelper (data);
059            }
060            
061            public Data getData ()
062            {
063                    return data;
064            }
065            
066            
067            public void setPlain (String value)
068            {
069                    data.set (Properties.PLAIN.getKey (), value);
070            }
071            
072            
073            public String getPlain ()
074            {
075                    return (String) data.get (Properties.PLAIN.getKey ());
076            }
077            
078            
079            public void setFormatted (String value)
080            {
081                    data.set (Properties.FORMATTED.getKey (), value);
082            }
083            
084            
085            public String getFormatted ()
086            {
087                    return (String) data.get (Properties.FORMATTED.getKey ());
088            }
089            
090    }
091