KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > abe > nodes > AnyElementNode


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.abe.nodes;
21
22 import java.awt.event.ActionEvent JavaDoc;
23 import java.io.IOException JavaDoc;
24 import javax.swing.AbstractAction JavaDoc;
25 import org.netbeans.modules.xml.axi.AXIModel;
26 import org.netbeans.modules.xml.axi.AbstractElement;
27 import org.netbeans.modules.xml.axi.AnyElement;
28 import org.netbeans.modules.xml.axi.Element;
29 import org.netbeans.modules.xml.schema.abe.InstanceUIContext;
30 import org.netbeans.modules.xml.schema.abe.nodes.properties.*;
31 import org.openide.actions.DeleteAction;
32 import org.openide.nodes.Node.Property;
33 import org.openide.nodes.Sheet;
34 import org.openide.util.NbBundle;
35 import org.openide.util.actions.CallbackSystemAction;
36 import org.openide.util.actions.SystemAction;
37 import org.openide.windows.TopComponent;
38
39 /**
40  *
41  * @author Samaresh (Samaresh.Panda@Sun.Com)
42  */

43 public class AnyElementNode extends ABEAbstractNode {
44     
45     
46     /**
47      * Creates a new instance of ElementNode
48      */

49     public AnyElementNode(AbstractElement element, InstanceUIContext context) {
50         super(element, context);
51     }
52     
53     public AnyElementNode(AbstractElement element) {
54     super(element, new ABENodeChildren(element));
55     setIconBaseWithExtension(
56             "org/netbeans/modules/xml/schema/abe/resources/element.png");
57     
58     }
59     
60     protected void populateProperties(Sheet sheet) {
61         Sheet.Set set = sheet.get(Sheet.PROPERTIES);
62         if(set == null) {
63             set = sheet.createPropertiesSet();
64         }
65         
66         try {
67             // minOccurs
68
Property minOccursProp = new MinOccursProperty(
69                 getAXIComponent(),
70                 String JavaDoc.class,
71                 Element.PROP_MINOCCURS,
72                 NbBundle.getMessage(ElementNode.class,"PROP_MinOccurs_DisplayName"), // display name
73
NbBundle.getMessage(ElementNode.class,"PROP_MinOccurs_ShortDescription") // descr
74
);
75             set.put(new SchemaModelFlushWrapper(getAXIComponent(), minOccursProp, getContext()));
76
77             // maxOccurs
78
Property maxOccursProp = new BaseABENodeProperty(
79                 getAXIComponent(),
80                 String JavaDoc.class,
81                 Element.PROP_MAXOCCURS,
82                 NbBundle.getMessage(ElementNode.class,"PROP_MaxOccurs_DisplayName"), // display name
83
NbBundle.getMessage(ElementNode.class,"PROP_MaxOccurs_ShortDescription"), // descr
84
MaxOccursEditor.class
85             );
86             set.put(new SchemaModelFlushWrapper(getAXIComponent(), maxOccursProp, getContext()));
87             
88             // processContents
89
Property processContentsProp = new BaseABENodeProperty(
90                 getAXIComponent(), // schema component
91
org.netbeans.modules.xml.schema.model.AnyElement.ProcessContents.class, // Any.ProcessContents.class as value type
92
AnyElement.PROP_PROCESSCONTENTS,
93                 NbBundle.getMessage(AnyElementNode.class,"PROP_ProcessContentsProp_DisplayName"), // display name
94
NbBundle.getMessage(AnyElementNode.class,"PROP_ProcessContentsProp_ShortDescription"), // descr
95
ProcessContentsEditor.class);
96             set.put(new SchemaModelFlushWrapper(getAXIComponent(), processContentsProp, getContext()));
97             
98         } catch (Exception JavaDoc ex) {
99         }
100         
101         sheet.put(set);
102     }
103     
104     public String JavaDoc getName(){
105         if((AbstractElement) super.getAXIComponent() != null)
106             return ((AbstractElement) super.getAXIComponent()).getName();
107         else
108             return "";
109     }
110
111     protected String JavaDoc getTypeDisplayName() {
112     return NbBundle.getMessage(AttributeNode.class,"LBL_Any");
113     }
114     
115 }
116
Popular Tags