KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > CmsHtmlIconButtonStyleEnum


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/tools/CmsHtmlIconButtonStyleEnum.java,v $
3  * Date : $Date: 2005/06/27 23:22:07 $
4  * Version: $Revision: 1.8 $
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;
33
34 import org.opencms.main.CmsIllegalArgumentException;
35 import org.opencms.workplace.list.Messages;
36
37 import java.util.Arrays JavaDoc;
38 import java.util.Collections JavaDoc;
39 import java.util.Iterator JavaDoc;
40 import java.util.List JavaDoc;
41
42 /**
43  * Wrapper class for
44  * the different style of icon buttons.<p>
45  *
46  * The possibles values are:<br>
47  * <ul>
48  * <li>BigIconText</li>
49  * <li>SmallIconText</li>
50  * <li>SmallIconOnly</li>
51  * </ul>
52  * <p>
53  *
54  * @author Michael Moossen
55  *
56  * @version $Revision: 1.8 $
57  *
58  * @since 6.0.0
59  */

60 public final class CmsHtmlIconButtonStyleEnum {
61
62     /** Constant for ascending ordering. */
63     public static final CmsHtmlIconButtonStyleEnum BIG_ICON_TEXT = new CmsHtmlIconButtonStyleEnum("bigicontext");
64
65     /** Constant for none ordering. */
66     public static final CmsHtmlIconButtonStyleEnum SMALL_ICON_ONLY = new CmsHtmlIconButtonStyleEnum("smallicononly");
67
68     /** Constant for descending ordering. */
69     public static final CmsHtmlIconButtonStyleEnum SMALL_ICON_TEXT = new CmsHtmlIconButtonStyleEnum("smallicontext");
70
71     /** Array constant for column sorting. */
72     private static final CmsHtmlIconButtonStyleEnum[] VALUE_ARRAY = {BIG_ICON_TEXT, SMALL_ICON_TEXT, SMALL_ICON_ONLY};
73
74     /** List of ordering constants. */
75     public static final List JavaDoc VALUES = Collections.unmodifiableList(Arrays.asList(VALUE_ARRAY));
76
77     /** Internal representation. */
78     private final String JavaDoc m_style;
79
80     /**
81      * Private constructor.<p>
82      *
83      * @param style internal representation
84      */

85     private CmsHtmlIconButtonStyleEnum(String JavaDoc style) {
86
87         m_style = style;
88     }
89
90     /**
91      * Parses an string into an element of this enumeration.<p>
92      *
93      * @param value the style to parse
94      *
95      * @return the enumeration element
96      *
97      * @throws CmsIllegalArgumentException if the given instance for the argument is not found
98      */

99     public static CmsHtmlIconButtonStyleEnum valueOf(String JavaDoc value) throws CmsIllegalArgumentException {
100
101         Iterator JavaDoc iter = VALUES.iterator();
102         while (iter.hasNext()) {
103             CmsHtmlIconButtonStyleEnum target = (CmsHtmlIconButtonStyleEnum)iter.next();
104             if (value == target.getStyle()) {
105                 return target;
106             }
107         }
108         throw new CmsIllegalArgumentException(Messages.get().container(
109             Messages.ERR_LIST_ENUM_PARSE_2,
110             new Integer JavaDoc(value),
111             CmsHtmlIconButtonStyleEnum.class.getName()));
112     }
113
114     /**
115      * Returns the style string.<p>
116      *
117      * @return the style string
118      */

119     public String JavaDoc getStyle() {
120
121         return m_style;
122     }
123
124     /**
125      * @see java.lang.Object#toString()
126      */

127     public String JavaDoc toString() {
128
129         return m_style;
130     }
131
132 }
Popular Tags