KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > webapp > form > core > SwitchMenuItemSetVisibilityForm


1 /*
2  * Copyright 2005 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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 com.blandware.atleap.webapp.form.core;
17
18 import java.util.Map JavaDoc;
19 import java.util.Collections JavaDoc;
20 import java.util.HashMap JavaDoc;
21
22
23 /**
24  * <p> Form bean that handles selection of menu items to change their visibility
25  * at once
26  * </p>
27  * <p><a HREF="SwitchMenuItemSetVisibilityForm.java.htm"><i>View source</i></a></p>
28  *
29  * @author Roman Puchkovskiy <a HREF="mailto:roman.puchkovskiy@blandware.com">
30  * &lt;roman.puchkovskiy@blandware.com&gt;</a>
31  * @version $Revision: 1.3 $ $Date: 2005/08/04 17:25:16 $
32  * @struts.form name="switchMenuItemSetVisibilityForm"
33  */

34 public class SwitchMenuItemSetVisibilityForm extends ProcessSetForm {
35
36     /**
37      * Maps menu item ID to its position
38      */

39     protected Map JavaDoc positions = Collections.synchronizedMap(new HashMap JavaDoc());
40
41     /**
42      * Returns a mapping from menu item IDs to positions of corresponding menu
43      * items
44      *
45      * @return mapping from menu item IDs to positions
46      */

47     public Map JavaDoc getPositions() {
48         return positions;
49     }
50
51     /**
52      * Sets a mapping from menu item IDs to positions of corresponding menu
53      * items
54      *
55      * @param positions mapping from menu item IDs to positions
56      */

57     public void setPositions(Map JavaDoc positions) {
58         this.positions = positions;
59     }
60
61     /**
62      * Returns position of menu item with specified ID
63      *
64      * @param key ID of menu item for which to get position
65      * @return position
66      */

67     public Object JavaDoc getPosition(String JavaDoc key) {
68         return positions.get(key);
69     }
70
71     /**
72      * Sets position of menu item with specified ID
73      *
74      * @param key ID of menu item for which to get position
75      * @param value position to set
76      */

77     public void setPosition(String JavaDoc key, Object JavaDoc value) {
78         positions.put(key, value);
79     }
80 }
81
Popular Tags