KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > ui > nodes > schema > AnyNode


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.schema.ui.nodes.schema;
21
22 import org.netbeans.modules.xml.schema.model.AnyElement;
23 import org.netbeans.modules.xml.schema.model.SchemaComponentReference;
24 import org.netbeans.modules.xml.schema.ui.basic.editors.AnyNamespaceEditor;
25 import org.netbeans.modules.xml.schema.ui.basic.editors.MaxOccursEditor;
26 import org.netbeans.modules.xml.schema.ui.basic.editors.ProcessContentsEditor;
27 import org.netbeans.modules.xml.schema.ui.nodes.*;
28 import org.netbeans.modules.xml.schema.ui.nodes.schema.properties.BaseSchemaProperty;
29 import org.netbeans.modules.xml.schema.ui.nodes.schema.properties.NonNegativeIntegerProperty;
30 import org.openide.nodes.Children;
31 import org.openide.nodes.Node.Property;
32 import org.openide.nodes.Sheet;
33 import org.openide.util.NbBundle;
34 /**
35  *
36  * @author Todd Fast, todd.fast@sun.com
37  */

38 public class AnyNode extends SchemaComponentNode<AnyElement>
39 {
40     /**
41      *
42      *
43      */

44     public AnyNode(SchemaUIContext context,
45         SchemaComponentReference<AnyElement> reference,
46         Children children)
47     {
48         super(context,reference,children);
49     }
50
51
52     /**
53      *
54      *
55      */

56     @Override JavaDoc
57     public String JavaDoc getTypeDisplayName()
58     {
59         return NbBundle.getMessage(AnyNode.class,
60             "LBL_AnyNode_TypeDisplayName"); // NOI18N
61
}
62
63     @Override JavaDoc
64     protected Sheet createSheet()
65     {
66         Sheet sheet = super.createSheet();
67         Sheet.Set set = sheet.get(Sheet.PROPERTIES);
68         try {
69             
70             // maxOccurs
71
// maxOccurs
72
Property maxOccursProp = new BaseSchemaProperty(
73                         getReference().get(), // schema component
74
String JavaDoc.class,
75                         AnyElement.MAX_OCCURS_PROPERTY,
76                         NbBundle.getMessage(AnyNode.class,"PROP_MaxOccurs_DisplayName"), // display name
77
NbBundle.getMessage(AnyNode.class,"PROP_MaxOccurs_ShortDescription"), // descr
78
MaxOccursEditor.class
79                         );
80             set.put(new SchemaModelFlushWrapper(getReference().get(), maxOccursProp));
81             
82             // minOccurs
83
Property minOccursProp = new NonNegativeIntegerProperty(
84                     getReference().get(), // schema component
85
AnyElement.MIN_OCCURS_PROPERTY,
86                     NbBundle.getMessage(AnyNode.class,"PROP_MinOccurs_DisplayName"), // display name
87
NbBundle.getMessage(AnyNode.class,"PROP_MinOccurs_ShortDescription") // descr
88
);
89             set.put(new SchemaModelFlushWrapper(getReference().get(), minOccursProp));
90             
91             // processContents
92
Property processContentsProp = new BaseSchemaProperty(
93                     getReference().get(), // schema component
94
AnyElement.ProcessContents.class, // Any.ProcessContents.class as value type
95
AnyElement.PROCESS_CONTENTS_PROPERTY,
96                     NbBundle.getMessage(AnyNode.class,"PROP_ProcessContentsProp_DisplayName"), // display name
97
NbBundle.getMessage(AnyNode.class,"PROP_ProcessContentsProp_ShortDescription"), // descr
98
ProcessContentsEditor.class);
99             set.put(new SchemaModelFlushWrapper(getReference().get(), processContentsProp));
100             
101             // namespace
102
Property namespaceProp = new BaseSchemaProperty(
103                     getReference().get(), // schema component
104
String JavaDoc.class, // Any.ProcessContents.class as value type
105
AnyElement.NAMESPACE_PROPERTY,
106                     NbBundle.getMessage(AnyNode.class,"PROP_Namespace_DisplayName"), // display name
107
NbBundle.getMessage(AnyNode.class,"HINT_Namespace_ShortDesc"), // descr
108
AnyNamespaceEditor.class);
109             set.put(new SchemaModelFlushWrapper(getReference().get(), namespaceProp));
110             
111         } catch (NoSuchMethodException JavaDoc nsme) {
112             assert false : "properties should be defined";
113         }
114         
115         return sheet;
116     }
117 }
118
Popular Tags