KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > jsf > impl > facesmodel > JSFConfigQNames


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.jsf.impl.facesmodel;
21
22 import java.util.Collections JavaDoc;
23 import java.util.HashSet JavaDoc;
24 import java.util.Set JavaDoc;
25 import javax.xml.namespace.QName JavaDoc;
26 import org.netbeans.modules.web.jsf.api.facesmodel.JSFVersion;
27
28 /**
29  *
30  * @author Petr Pisl
31  */

32 public enum JSFConfigQNames {
33     
34     FACES_CONFIG("faces-config"),
35     //general
36
DESCRIPTION("description"),
37     DISPLAY_NAME("display-name"),
38     ICON("icon"),
39     //managed-bean
40
MANAGED_BEAN("managed-bean"),
41     MANAGED_BEAN_NAME("managed-bean-name"),
42     MANAGED_BEAN_CLASS("managed-bean-class"),
43     MANAGED_BEAN_SCOPE("managed-bean-scope"),
44     //navigation-rule
45
NAVIGATION_RULE("navigation-rule"),
46     FROM_VIEW_ID("from-view-id"),
47     //navigation-case
48
NAVIGATION_CASE("navigation-case"),
49     FROM_OUTCOME("from-outcome"),
50     FROM_ACTION("from-action"),
51     TO_VIEW_ID("to-view-id"),
52     REDIRECT("redirect"),
53     //converter
54
CONVERTER("converter"),
55     CONVERTER_ID("converter-id"),
56     CONVERTER_FOR_CLASS("converter-for-class"),
57     CONVERTER_CLASS("converter-class");
58     
59     
60 // private static Set<QName> mappedQNames = new HashSet<QName>();
61
// static {
62
// mappedQNames.add(FACES_CONFIG.getQName());
63
// mappedQNames.add(MANAGED_BEAN.getQName());
64
// }
65

66     private QName JavaDoc qname_1_1;
67     private QName JavaDoc qname_1_2;
68     
69     
70     public static final String JavaDoc JSF_1_2_NS = "http://java.sun.com/xml/ns/javaee";
71     public static final String JavaDoc JSF_1_1_NS = javax.xml.XMLConstants.NULL_NS_URI;
72     public static final String JavaDoc JSFCONFIG_PREFIX = javax.xml.XMLConstants.DEFAULT_NS_PREFIX;
73     
74     
75     JSFConfigQNames(String JavaDoc localName) {
76         qname_1_1 = new QName JavaDoc(JSF_1_1_NS, localName, JSFCONFIG_PREFIX);
77         qname_1_2 = new QName JavaDoc(JSF_1_2_NS, localName, JSFCONFIG_PREFIX);
78     }
79     
80     public QName JavaDoc getQName(JSFVersion version) {
81         QName JavaDoc value = qname_1_1;
82         if (version.equals(JSFVersion.JSF_1_2))
83             value = qname_1_2;
84         return value;
85     }
86     
87     public String JavaDoc getLocalName() {
88         return qname_1_2.getLocalPart();
89     }
90     
91     public String JavaDoc getQualifiedName(JSFVersion version) {
92         String JavaDoc value = qname_1_1.getPrefix() + ":" + qname_1_1.getLocalPart();
93         if (version.equals(JSFVersion.JSF_1_2))
94             value = qname_1_2.getPrefix() + ":" + qname_1_2.getLocalPart();
95         return value;
96     }
97     
98 // public static Set<QName> getMappedQNames() {
99
// return Collections.unmodifiableSet(mappedQNames);
100
// }
101

102 }
103
Popular Tags