KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > looks > NamespaceLookProvider


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.looks;
21
22 import java.util.Enumeration JavaDoc;
23 import java.util.TooManyListenersException JavaDoc;
24 import javax.swing.event.ChangeListener JavaDoc;
25
26 /** Given name of context searches in the namespace for Looks/LookSelectors.
27  * Subclasses may change the algorithm for finding the looks by overriding
28  * the {@link #namesFor(java.lang.Object) namesFor( object )} method.
29  * <P>
30  * Default implementation is based on the inheritance hierarchy (including
31  * interfaces) of the represented object's class.
32  *
33  * @author Petr Hrebejk, Jaroslav Tulach
34  */

35 public interface NamespaceLookProvider {
36             
37     /** Defines the list of names that should be searched for a given
38      * represented object.
39      * <P>
40      * Subclasses are allowed to provide different implementation which can
41      * base the naming based on for example public ID
42      * for <code>org.w3c.dom.Document</code>.
43      * <P>
44      * Default implementation of NamespaceLook uses the inheritance hierarchy
45      * of the represented object to locate the Looks/LookSelectors. I.e. this
46      * method returns Enumeration of names composed of the represented object's
47      * class and it's superclasses and all interfaces (and superinterfaces)
48      * implemented by the represented object's class.
49      * <P>
50      * The {@link org.netbeans.spi.looks.Selectors#defaultTypes() Looks.defaultTypes()} and
51      * {@link org.netbeans.spi.looks.Selectors#namespaceTypes(java.lang.String) Looks.namespaceTypes(String)}
52      * use the this class.
53      *
54      * @param obj the represented object
55      * @return enumeration of Strings
56      * @see org.netbeans.spi.looks.Selectors#defaultTypes()
57      * @see org.netbeans.spi.looks.Selectors#namespaceTypes(java.lang.String)
58      * @since Made non abstract in version 0.2
59      */

60     public Enumeration JavaDoc getNamesForKey( Object JavaDoc obj );
61     
62     
63     /** Returns key for given object. Make sure you return the same key for
64      * given object during whole lifecycle of the LookSelector.
65      * @param representedObject The represented object we want to find key for.
66      * @return Key for given represented object. Returning <CODE>null</CODE>
67      * instead of a key will result in returning empty Enumeration
68      * from the LookSelector.
69      */

70     public Object JavaDoc getKeyForObject( Object JavaDoc representedObject );
71     
72     
73     public void addChangeListener( ChangeListener JavaDoc listener ) throws TooManyListenersException JavaDoc;
74     
75 }
76
Popular Tags