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  /***
20   * This class implements a wrapper used to implement
21   * the ordered polymorphic menu elements collection.
22   * 
23   * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
24   * @version $Id: MenuElementImpl.java 516448 2007-03-09 16:25:47Z ate $
25   */
26  public class MenuElementImpl
27  {
28      /***
29       * element - wrapped menu element
30       */
31      private Object element;
32  
33      /***
34       * MenuElementImpl - constructor
35       */
36      public MenuElementImpl()
37      {
38      }
39  
40      /***
41       * MenuElementImpl - constructor
42       */
43      public MenuElementImpl(Object element)
44      {
45          this.element = element;
46      }
47  
48      /***
49       * getOption - get wrapped menu element
50       */
51      public Object getElement()
52      {
53          return element;
54      }
55  
56      /***
57       * getOption - get wrapped menu options definition
58       */
59      public MenuOptionsDefinitionImpl getOptions()
60      {
61          if (element instanceof MenuOptionsDefinitionImpl)
62          {
63              return (MenuOptionsDefinitionImpl)element;
64          }
65          return null;
66      }
67  
68      /***
69       * setOption - set wrapped menu options definition
70       *
71       * @param options menu options definition
72       */
73      public void setOptions(MenuOptionsDefinitionImpl options)
74      {
75          this.element = options;
76      }
77  
78      /***
79       * getMenu - get wrapped menu menu definition
80       */
81      public MenuDefinitionImpl getMenu()
82      {
83          if (element instanceof MenuDefinitionImpl)
84          {
85              return (MenuDefinitionImpl)element;
86          }
87          return null;
88      }
89  
90      /***
91       * setMenu - set wrapped menu menu definition
92       *
93       * @param menu menu definition
94       */
95      public void setMenu(MenuDefinitionImpl menu)
96      {
97          this.element = menu;
98      }
99  
100     /***
101      * getSeparator - get wrapped menu separator definition
102      */
103     public MenuSeparatorDefinitionImpl getSeparator()
104     {
105         if (element instanceof MenuSeparatorDefinitionImpl)
106         {
107             return (MenuSeparatorDefinitionImpl)element;
108         }
109         return null;
110     }
111 
112     /***
113      * setSeparator - set wrapped menu separator definition
114      *
115      * @param separator menu separator definition
116      */
117     public void setSeparator(MenuSeparatorDefinitionImpl separator)
118     {
119         this.element = separator;
120     }
121 
122     /***
123      * getInclude - get wrapped menu include definition
124      */
125     public MenuIncludeDefinitionImpl getInclude()
126     {
127         if (element instanceof MenuIncludeDefinitionImpl)
128         {
129             return (MenuIncludeDefinitionImpl)element;
130         }
131         return null;
132     }
133 
134     /***
135      * setInclude - set wrapped menu include definition
136      *
137      * @param include menu include definition
138      */
139     public void setInclude(MenuIncludeDefinitionImpl include)
140     {
141         this.element = include;
142     }
143 
144     /***
145      * getExclude - get wrapped menu exclude definition
146      */
147     public MenuExcludeDefinitionImpl getExclude()
148     {
149         if (element instanceof MenuExcludeDefinitionImpl)
150         {
151             return (MenuExcludeDefinitionImpl)element;
152         }
153         return null;
154     }
155 
156     /***
157      * setExclude - set wrapped menu exclude definition
158      *
159      * @param exclude menu exclude definition
160      */
161     public void setExclude(MenuExcludeDefinitionImpl exclude)
162     {
163         this.element = exclude;
164     }
165 }