KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > ui > nodes > elements > ClassElementFilter


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.java.ui.nodes.elements;
21
22 import java.lang.reflect.Modifier JavaDoc;
23
24 /* ? --jglick
25 * For convenience, implementations of this interface could use
26 * {@link Modifier} masks.
27 */

28 /** Orders and filters members in a class element node.
29 * Can be used for methods, fields, inner classes, etc.
30 * <p>The semantics are very similar to those of <code>SourceElementFilter</code>.
31 * @see org.netbeans.modules.java.ui.nodes.elements.ClassChildren
32 *
33 * @author Dafe Simonek, Jan Jancura
34 */

35 public class ClassElementFilter extends SourceElementFilter {
36     // [PENDING] should initializers be included? --jglick
37

38     /** Specifies a child representing a constructor. */
39     public static final int CONSTRUCTOR = ENUM << 1;
40     /** Specifies a child representing a field (instance variable). */
41     public static final int FIELD = CONSTRUCTOR << 1;
42     /** Specifies a child representing a method. */
43     public static final int METHOD = FIELD << 1;
44     /** Specifies a child representing the superclass of the node's class. */
45     public static final int EXTENDS = METHOD << 1;
46     /** Specifies a child representing an implemented interface of the node's class.
47     * For a node representing an interface, this would specify an extended interface.
48     */

49     public static final int IMPLEMENTS = EXTENDS << 1;
50     /** Does not specify a child type. */
51     public static final int ALL = SourceElementFilter.ALL | CONSTRUCTOR | FIELD | METHOD |
52                                       EXTENDS | IMPLEMENTS;
53
54     /** Default order and filtering.
55     * Places all fields, constructors, methods, and inner classes (interfaces) together
56     * in one block.
57     */

58     public static final int[] DEFAULT_ORDER = {FIELD | CONSTRUCTOR | METHOD | CLASS | INTERFACE | ANNOTATION_TYPE | ENUM};
59
60     // [PENDING] where is this used? --jglick
61
/** Specifies a child which is static. */
62     public static final int STATIC = Modifier.STATIC;
63
64     /** stores property value */
65     private boolean sorted = true;
66
67     /** Test whether the elements in one element type group are sorted.
68     * @return <code>true</code> if groups in getOrder () field are sorted, <code>false</code>
69     * to default order of elements
70     */

71     public boolean isSorted () {
72         return sorted;
73     }
74
75     /** Set whether groups of elements returned by getOrder () should be sorted.
76     * @param sorted <code>true</code> if so
77     */

78     public void setSorted (boolean sorted) {
79         this.sorted = sorted;
80     }
81 }
82
Popular Tags