KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > accounts > CmsDependencyIconActionType


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/CmsDependencyIconActionType.java,v $
3  * Date : $Date: 2006/03/27 14:52:49 $
4  * Version: $Revision: 1.4 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.tools.accounts;
33
34 import org.opencms.main.CmsIllegalArgumentException;
35
36 import java.util.Arrays JavaDoc;
37 import java.util.Collections JavaDoc;
38 import java.util.Iterator JavaDoc;
39 import java.util.List JavaDoc;
40
41 /**
42  * Wrapper class for
43  * the different types of icon actions the dependency lists.<p>
44  *
45  * The possibles values are:<br>
46  * <ul>
47  * <li>{@link #RESOURCE}</li>
48  * <li>{@link #GROUP}</li>
49  * <li>{@link #USER}</li>
50  * </ul>
51  * <p>
52  *
53  * @author Michael Moossen
54  *
55  * @version $Revision: 1.4 $
56  *
57  * @since 6.0.0
58  */

59 public final class CmsDependencyIconActionType {
60
61     /** Constant for the resource icon action. */
62     public static final CmsDependencyIconActionType RESOURCE = new CmsDependencyIconActionType("r");
63
64     /** Constant for the group icon action. */
65     public static final CmsDependencyIconActionType GROUP = new CmsDependencyIconActionType("g");
66
67     /** Constant for the user icon action. */
68     public static final CmsDependencyIconActionType USER = new CmsDependencyIconActionType("u");
69
70     /** Array constant for all available align types. */
71     private static final CmsDependencyIconActionType[] VALUE_ARRAY = {
72         RESOURCE,
73         GROUP,
74         USER};
75
76     /** List of mode constants. */
77     public static final List JavaDoc VALUES = Collections.unmodifiableList(Arrays.asList(VALUE_ARRAY));
78
79     /** Internal representation. */
80     private final String JavaDoc m_mode;
81
82     /**
83      * Private constructor.<p>
84      *
85      * @param mode the view mode
86      */

87     private CmsDependencyIconActionType(String JavaDoc mode) {
88
89         m_mode = mode;
90     }
91
92     /**
93      * Parses an string into an element of this enumeration.<p>
94      *
95      * @param value the id to parse
96      *
97      * @return the enumeration element
98      *
99      * @throws CmsIllegalArgumentException if the given value could not be matched against a
100      * <code>{@link CmsDependencyIconActionType}</code> type.
101      */

102     public static CmsDependencyIconActionType valueOf(String JavaDoc value) throws CmsIllegalArgumentException {
103
104         Iterator JavaDoc iter = VALUES.iterator();
105         while (iter.hasNext()) {
106             CmsDependencyIconActionType target = (CmsDependencyIconActionType)iter.next();
107             if (value.equals(target.getId())) {
108                 return target;
109             }
110         }
111         throw new CmsIllegalArgumentException(org.opencms.db.Messages.get().container(
112             org.opencms.db.Messages.ERR_MODE_ENUM_PARSE_2,
113             value,
114             CmsDependencyIconActionType.class.getName()));
115     }
116
117     /**
118      * Returns the id string.<p>
119      *
120      * @return the id string
121      */

122     public String JavaDoc getId() {
123
124         return m_mode;
125     }
126
127     /**
128      * @see java.lang.Object#toString()
129      */

130     public String JavaDoc toString() {
131
132         return m_mode;
133     }
134 }
Popular Tags