KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > src > nodes > SourceElementFilter


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.openide.src.nodes;
21
22 import java.lang.reflect.Modifier JavaDoc;
23
24 /** Interface for filtering and ordering the items in the visual
25 * presentation of a source element.
26 * Used to control the children of a source element node.
27 * <p>Note that this does <em>not</em> fire events for changes
28 * in its properties; it is expected that a new filter will instead
29 * be created and applied to the source children.
30 *
31 * @see org.openide.src.SourceElement
32 * @see SourceChildren
33 * @author Dafe Simonek, Jan Jancura
34 */

35 public class SourceElementFilter {
36
37     /** Specifies a child representing a package or class import. */
38     public static final int IMPORT = 1;
39     /** Specifies a child representing a (top-level) class. */
40     public static final int CLASS = 2;
41     /** Specifies a child representing a (top-level) interface. */
42     public static final int INTERFACE = 4;
43     /** Does not specify any top-level element. */
44     public static final int ALL = IMPORT + CLASS + INTERFACE;
45
46     /** Specifies package-private member access. */
47     public static final int PACKAGE = 65536;
48     /** Specifies public member access. */
49     public static final int PUBLIC = Modifier.PUBLIC;
50     /** Specifies private member access. */
51     public static final int PRIVATE = Modifier.PRIVATE;
52     /** Specifies protected member access. */
53     public static final int PROTECTED = Modifier.PROTECTED;
54     /** Does not specify any member access. */
55     public static final int ALL_MODIFIERS = PROTECTED | PUBLIC | PRIVATE | PACKAGE;
56
57     /** Default order of the top-level element types in the hierarchy.
58     * A list, each of whose elements is a bitwise disjunction of element types.
59     * By default, only classes and interfaces are listed, and these together.
60     */

61     public static final int[] DEFAULT_ORDER = {CLASS + INTERFACE};
62
63     /** stores property value */
64     private boolean allClasses = false;
65     /** stores property value */
66     private int[] order = null;
67     /** stores property value */
68     private int modifiers = ALL_MODIFIERS;
69
70
71     /** Test whether all classes in the source should be recursively shown.
72     * @return <code>true</code> to include inner classes/interfaces, <code>false</code> to only
73     * include top-level classes/interfaces
74     */

75     public boolean isAllClasses () {
76         return allClasses;
77     }
78
79     /** Set whether all classes should be shown.
80     * @param allClasses <code>true</code> if so
81     * @see #isAllClasses
82     */

83     public void setAllClasses (boolean allClasses) {
84         this.allClasses = allClasses;
85     }
86
87     /** Get the current order for elements.
88     * @return the current order, as a list of bitwise disjunctions among element
89     * types (e.g. {@link #CLASS}). If <code>null</code>, the {@link #DEFAULT_ORDER},
90     * or no particular order at all, may be used.
91     */

92     public int[] getOrder () {
93         return order;
94     }
95
96     /** Set a new order for elements.
97     * Should update the children list of the source element node.
98     * @param order the new order, or <code>null</code> for the default
99     * @see #getOrder
100     */

101     public void setOrder (int[] order) {
102         this.order = order;
103     }
104
105     /**
106     * Get permitted access modes.
107     * Members with excluded access modes will not be displayed.
108     * @return a modifier mask, as a bitwise disjunction of modes, e.g. {@link #PROTECTED}
109     */

110     public int getModifiers () {
111         return modifiers;
112     }
113
114     /**
115     * Set permitted access modes.
116     * @param modifiers the new modifier mask
117     * @see #getModifiers
118     */

119     public void setModifiers (int modifiers) {
120         this.modifiers = modifiers;
121     }
122 }
123
Popular Tags