KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > explorer > propertysheet > PropertySetModel


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  * PropertySetModel.java
21  *
22  * Created on January 5, 2003, 5:22 PM
23  */

24 package org.openide.explorer.propertysheet;
25
26 import org.openide.nodes.Node.*;
27
28 import java.beans.*;
29
30 import java.util.Comparator JavaDoc;
31
32
33 /** Interface for the property set model for property sheets.
34  * PropertySetModel is a model-within-a-model that manages
35  * the available properties and property sets and
36  * the available property sets' expanded state. Since
37  * both Node.Property and Node.PropertySet extend FeatureDescriptor,
38  * the getters for indexed elements return FeatureDescriptor
39  * objects - clients must test and cast to determine which
40  * they are dealing with.
41  * @author Tim Boudreau
42  */

43 interface PropertySetModel {
44     /** Determines if a given property set is expanded */
45     boolean isExpanded(FeatureDescriptor fd);
46
47     /** Set the expanded state for a feature descriptor of the
48      * given index. */

49     void toggleExpanded(int index);
50
51     /** Returns either a Node.Property or a Node.PropertySet
52      * instance for a given index. */

53     FeatureDescriptor getFeatureDescriptor(int index);
54
55     /** Registers a PropertySetModelListener to receive events.
56      * @param listener The listener to register. */

57     void addPropertySetModelListener(PropertySetModelListener listener);
58
59     /** Removes a PropertySetModelListener from the list of listeners.
60      * @param listener The listener to remove. */

61     void removePropertySetModelListener(PropertySetModelListener listener);
62
63     /** Assign the property sets this model will manage */
64     void setPropertySets(PropertySet[] sets);
65
66     /** Utility method to determine if a given index holds a property
67      * or property set.*/

68     boolean isProperty(int index);
69
70     /** Get the number of feature descriptors (properties and
71      * property sets) currently represented by the model, not
72      * including properties belonging to unexpanded property
73      * sets - in other words, the current number of objects
74      * a component rendering this model is being asked to display. */

75     int getCount();
76
77     /** Get the index, in the model, of a given feature descriptor.
78      * If it is not currently available (either not part of the model
79      * at all, or part of an unexpanded property set), returns -1. */

80     int indexOf(FeatureDescriptor fd);
81
82     /** Set the comparator the model will use for sorting properties */
83     void setComparator(Comparator JavaDoc<Property> c);
84
85     int getSetCount();
86
87     Comparator JavaDoc getComparator();
88 }
89
Popular Tags