001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: /*
042: * PropertySetModel.java
043: *
044: * Created on January 5, 2003, 5:22 PM
045: */
046: package org.openide.explorer.propertysheet;
047:
048: import org.openide.nodes.Node.*;
049:
050: import java.beans.*;
051:
052: import java.util.Comparator;
053:
054: /** Interface for the property set model for property sheets.
055: * PropertySetModel is a model-within-a-model that manages
056: * the available properties and property sets and
057: * the available property sets' expanded state. Since
058: * both Node.Property and Node.PropertySet extend FeatureDescriptor,
059: * the getters for indexed elements return FeatureDescriptor
060: * objects - clients must test and cast to determine which
061: * they are dealing with.
062: * @author Tim Boudreau
063: */
064: interface PropertySetModel {
065: /** Determines if a given property set is expanded */
066: boolean isExpanded(FeatureDescriptor fd);
067:
068: /** Set the expanded state for a feature descriptor of the
069: * given index. */
070: void toggleExpanded(int index);
071:
072: /** Returns either a Node.Property or a Node.PropertySet
073: * instance for a given index. */
074: FeatureDescriptor getFeatureDescriptor(int index);
075:
076: /** Registers a PropertySetModelListener to receive events.
077: * @param listener The listener to register. */
078: void addPropertySetModelListener(PropertySetModelListener listener);
079:
080: /** Removes a PropertySetModelListener from the list of listeners.
081: * @param listener The listener to remove. */
082: void removePropertySetModelListener(
083: PropertySetModelListener listener);
084:
085: /** Assign the property sets this model will manage */
086: void setPropertySets(PropertySet[] sets);
087:
088: /** Utility method to determine if a given index holds a property
089: * or property set.*/
090: boolean isProperty(int index);
091:
092: /** Get the number of feature descriptors (properties and
093: * property sets) currently represented by the model, not
094: * including properties belonging to unexpanded property
095: * sets - in other words, the current number of objects
096: * a component rendering this model is being asked to display. */
097: int getCount();
098:
099: /** Get the index, in the model, of a given feature descriptor.
100: * If it is not currently available (either not part of the model
101: * at all, or part of an unexpanded property set), returns -1. */
102: int indexOf(FeatureDescriptor fd);
103:
104: /** Set the comparator the model will use for sorting properties */
105: void setComparator(Comparator<Property> c);
106:
107: int getSetCount();
108:
109: Comparator getComparator();
110: }
|