View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.om.folder.psml;
18  
19  import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
20  
21  /***
22   * This class implements the MenuSeparatorDefinition
23   * interface in a persistent object form for use by
24   * the page manager component.
25   * 
26   * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
27   * @version $Id: MenuSeparatorDefinitionImpl.java 516448 2007-03-09 16:25:47Z ate $
28   */
29  public class MenuSeparatorDefinitionImpl extends MenuMetadataImpl implements MenuSeparatorDefinition 
30  {
31      /***
32       * skin - skin name for separator
33       */
34      private String skin;
35      
36      /***
37       * title - title for separator
38       */
39      private String title;
40  
41      /***
42       * text - text for separator
43       */
44      private String text;
45  
46      /***
47       * MenuSeparatorDefinitionImpl - constructor
48       */
49      public MenuSeparatorDefinitionImpl()
50      {
51      }
52  
53      /***
54       * getSkin - get skin name for separator
55       *
56       * @return skin name
57       */
58      public String getSkin()
59      {
60          return skin;
61      }
62  
63      /***
64       * setSkin - set skin name for separator
65       *
66       * @param name skin name
67       */
68      public void setSkin(String name)
69      {
70          skin = name;
71      }
72  
73      /***
74       * getTitle - get default title for separator
75       *
76       * @return title text
77       */
78      public String getTitle()
79      {
80          return title;
81      }
82  
83      /***
84       * setTitle - set default title for separator
85       *
86       * @param title title text
87       */
88      public void setTitle(String title)
89      {
90          this.title = title;
91      }
92  
93      /***
94       * getText - get default text for separator
95       *
96       * @return text
97       */
98      public String getText()
99      {
100         return text;
101     }
102 
103     /***
104      * setText - set default text for separator
105      *
106      * @param text text
107      */
108     public void setText(String text)
109     {
110         this.text = text;
111     }
112 
113     /***
114      * getTextChild - get default text for separator
115      *
116      * @return text
117      */
118     public String getTextChild()
119     {
120         // return text as child if any other child of
121         // separator is defined
122         if ((getTitle() != null) || (getMetadata() != null))
123         {
124             return getText();
125         }
126         return null;
127     }
128 
129     /***
130      * setTextChild - set default text for separator
131      *
132      * @param text text
133      */
134     public void setTextChild(String text)
135     {
136         // make sure text is non-null since it is being unmarshalled
137         if (text != null)
138         {
139             setText(text);
140         }
141     }
142 
143     /***
144      * getTextBody - get default text for separator
145      *
146      * @return text
147      */
148     public String getTextBody()
149     {
150         // return text as body only if no other child of
151         // separator is defined
152         if ((getTitle() == null) && (getMetadata() == null))
153         {
154             return getText();
155         }
156         return null;
157     }
158 
159     /***
160      * setTextBody - set default text for separator
161      *
162      * @param text text
163      */
164     public void setTextBody(String text)
165     {
166         // make sure text is non-null and non-whitespace since
167         // it is being unmarshalled
168         if (text != null)
169         {
170             text = text.trim();
171             if (text.length() > 0)
172             {
173                 setText(text);
174             }
175         }
176     }
177 }