KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > mdrxml > looks > RootNodeLook


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 Forte for Java, Community Edition. The Initial
16  * Developer of the Original Software is Sun Microsystems, Inc. Portions
17  * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.mdrxml.looks;
21
22 import java.util.Collection JavaDoc;
23 import java.util.Iterator JavaDoc;
24 import org.openide.nodes.*;
25 import org.openide.util.NbBundle;
26 import org.netbeans.api.looks.*;
27 import org.netbeans.spi.looks.*;
28 import org.netbeans.api.mdr.*;
29 import xmlmodel.RootNode;
30 /**
31  *
32  * @author Tomas Zezula
33  */

34 public class RootNodeLook extends ElementNodeLook {
35
36     private static final String JavaDoc ICON = "org/netbeans/modules/mdrxml/resources/rootNode";
37
38     private static class DocumentNameProperty extends PropertySupport.ReadOnly {
39         
40         private RootNode node;
41         
42         public DocumentNameProperty (RootNode node) {
43             super (NbBundle.getMessage(RootNodeLook.class,"TXT_DocumentName"),String JavaDoc.class,NbBundle.getMessage(RootNodeLook.class,"TXT_DocumentName"),NbBundle.getMessage(RootNodeLook.class,"TIP_DocumentName"));
44             this.node = node;
45         }
46         
47         public Object JavaDoc getValue () {
48             if (this.node != null)
49                 return this.node.getDocumentName ();
50             else
51                 return null;
52         }
53     }
54     
55     /** Creates a new instance of RootNodeLook */
56     public RootNodeLook() {
57         super (NbBundle.getMessage (RootNodeLook.class, "TXT_RootNodeLook"));
58     }
59     
60     public String JavaDoc iconBase (Look.NodeSubstitute substitute) {
61         return ICON;
62     }
63     
64     public Node.PropertySet[] getPropertySets (Look.NodeSubstitute substitute) {
65         Node.PropertySet[] sets = super.getPropertySets (substitute);
66         ((Sheet.Set)sets[0]).put (new DocumentNameProperty ((RootNode)substitute.getRepresentedObject()));
67         return sets;
68     }
69     
70 }
71
Popular Tags