KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > dbschema > nodes > SchemaElementFilter


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

33 public class SchemaElementFilter {
34
35   /** Specifies a child representing a package or class import. */
36   public static final int TABLE = 1;
37   /** Specifies a child representing a (top-level) class. */
38   public static final int VIEW = 2;
39   /** Does not specify any top-level element. */
40   public static final int ALL = TABLE + VIEW;
41
42   /** Default order of the top-level element types in the hierarchy.
43   * A list, each of whose elements is a bitwise disjunction of element types.
44   * By default, only classes and interfaces are listed, and these together.
45   */

46   public static final int[] DEFAULT_ORDER = {TABLE + VIEW};
47
48   /** stores property value */
49   private boolean allTables = false;
50   /** stores property value */
51   private int[] order = null;
52   
53
54   /** Test whether all classes in the source should be recursively shown.
55   * @return <code>true</code> to include inner classes/interfaces, <code>false</code> to only
56   * include top-level classes/interfaces
57   */

58   public boolean isAllTables () {
59     return allTables;
60   }
61
62   /** Set whether all classes should be shown.
63   * @param type <code>true</code> if so
64   * @see #isAllClasses
65   */

66   public void setAllTables (boolean allTables) {
67     this.allTables = allTables;
68   }
69
70   /** Get the current order for elements.
71   * @return the current order, as a list of bitwise disjunctions among element
72   * types (e.g. {@link #CLASS}). If <code>null</code>, the {@link #DEFAULT_ORDER},
73   * or no particular order at all, may be used.
74   */

75   public int[] getOrder () {
76     return order;
77   }
78
79   /** Set a new order for elements.
80   * Should update the children list of the source element node.
81   * @param order the new order, or <code>null</code> for the default
82   * @see #getOrder
83   */

84   public void setOrder (int[] order) {
85     this.order = order;
86   }
87 }
88
Popular Tags