KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > spi > ExtensibilityElementConfigurator


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.xml.wsdl.ui.spi;
21
22 import java.util.Collection JavaDoc;
23
24 import javax.xml.namespace.QName JavaDoc;
25
26 import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement;
27 import org.openide.nodes.Node;
28
29 /**
30  * This is a SPI for WSDL extensibility elements provider to implement in order to configure the way
31  * wsdl editor behaves with the extensibility elements.
32  *
33  * @author skini
34  *
35  */

36
37 public abstract class ExtensibilityElementConfigurator {
38
39
40     /**
41      * Should return the qname of the element(s) supported by this configurator.
42      *
43      * @return collection of QName(s)
44      */

45     public abstract Collection JavaDoc<QName JavaDoc> getSupportedQNames();
46     
47     
48     /**
49      * Return the Node.Property for the attribute name to be shown on the property sheet in wsdl editor.
50      * The Property.setName() should be done if a different name is to be shown.
51      * Setting value of extensibility element may result in exception if already in transaction in this method.
52      *
53      * By default, name is set as value of attributeName and the description set to the documentation provided
54      * in the schema or as the qname of the element.
55      * If both have not been provided, then it should be set on the Node.Property before returning it.
56      *
57      * @param extensibilityElement the extensibility element
58      * @param qname the qname of the element interested in
59      * @param attributeName the name of the attribute
60      * @return Node.Property instance for this attribute
61      */

62     public abstract Node.Property getProperty(ExtensibilityElement extensibilityElement, QName JavaDoc qname, String JavaDoc attributeName);
63     
64     
65     /**
66      * Specifies whether this attribute should be hidden (in the property sheet).
67      * If returns true, then the attribute is not shown on the property sheet.
68      *
69      * This method can be used to hide attributes and create a Property editor for multiple properties.
70      * For e.g. Part can have element or type but not both, so set type as hidden and create a node.property
71      * for element with name as "Element or Type" and appropriately change the setValue or getValue to set appropriate
72      * attribute.
73      *
74      * @param qname qname of the element
75      * @param attributeName name of the attribute
76      * @return true if to be hidden
77      */

78     public boolean isHidden(ExtensibilityElement extensibilityElement, QName JavaDoc qname, String JavaDoc attributeName) {
79         return false;
80     }
81     
82     /**
83      * Specifies the name of the attribute, the value of which will be as the display name for this element.
84      *
85      * @param extensibilityElement
86      * @param qname
87      * @return the attribute name.
88      */

89     public abstract String JavaDoc getDisplayAttributeName(ExtensibilityElement extensibilityElement, QName JavaDoc qname);
90     
91     /**
92      * Returns a initial value for this attribute. return a value which will be used as a prefix and
93      * unique names generated by wsdl editor. prefix1, prefix2 etc..
94      *
95      *
96      * @param qname
97      * @param attributeName
98      * @return String either default value(if boolean or enumerated), otherwise prefix
99      */

100     
101     public abstract String JavaDoc getAttributeUniqueValuePrefix(ExtensibilityElement extensibilityElement, QName JavaDoc qname, String JavaDoc attributeName);
102     
103     /**
104      * Gives a default value for the attribute.
105      *
106      *
107      * @param qname
108      * @param attributeName
109      * @return
110      */

111     public abstract String JavaDoc getDefaultValue(ExtensibilityElement extensibilityElement, QName JavaDoc qname, String JavaDoc attributeName);
112     
113     public abstract String JavaDoc getTypeDisplayName(ExtensibilityElement extensibilityElement, QName JavaDoc qname);
114     
115
116     public String JavaDoc getHtmlDisplayNameDecoration(ExtensibilityElement construct, QName JavaDoc name) {
117         return null;
118     }
119     
120 }
121
Popular Tags