~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to xml/xamui/src/org/netbeans/modules/xml/xam/ui/category/CategoryPane.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 *
 
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
5
 *
 
6
 * The contents of this file are subject to the terms of either the GNU
 
7
 * General Public License Version 2 only ("GPL") or the Common
 
8
 * Development and Distribution License("CDDL") (collectively, the
 
9
 * "License"). You may not use this file except in compliance with the
 
10
 * License. You can obtain a copy of the License at
 
11
 * http://www.netbeans.org/cddl-gplv2.html
 
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
13
 * specific language governing permissions and limitations under the
 
14
 * License.  When distributing the software, include this License Header
 
15
 * Notice in each file and include the License file at
 
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
17
 * particular file as subject to the "Classpath" exception as provided
 
18
 * by Sun in the GPL Version 2 section of the License file that
 
19
 * accompanied this code. If applicable, add the following below the
 
20
 * License Header, with the fields enclosed by brackets [] replaced by
 
21
 * your own identifying information:
 
22
 * "Portions Copyrighted [year] [name of copyright owner]"
 
23
 *
 
24
 * Contributor(s):
 
25
 *
 
26
 * The Original Software is NetBeans. The Initial Developer of the Original
 
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
 
28
 * Microsystems, Inc. All Rights Reserved.
 
29
 *
 
30
 * If you wish your version of this file to be governed by only the CDDL
 
31
 * or only the GPL Version 2, indicate your decision by adding
 
32
 * "[Contributor] elects to include this software in this distribution
 
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 
34
 * single choice of license, a recipient has the option to distribute
 
35
 * your version of this file under either the CDDL, the GPL Version 2 or
 
36
 * to extend the choice of license to its licensees as provided above.
 
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 
38
 * Version 2 license, then the option applies only if the new code is
 
39
 * made subject to such option by the copyright holder.
 
40
 */
 
41
 
 
42
package org.netbeans.modules.xml.xam.ui.category;
 
43
 
 
44
import java.awt.Component;
 
45
import java.beans.PropertyChangeListener;
 
46
import javax.swing.JToolBar;
 
47
import org.openide.util.Lookup;
 
48
 
 
49
/**
 
50
 * A CategoryPane manages a set of Category instances, displaying one
 
51
 * category at any given time, and providing a means of selecting the
 
52
 * category to be shown.
 
53
 *
 
54
 * @author Nathan Fiedler
 
55
 */
 
56
public interface CategoryPane {
 
57
    /** Property name for the selected Category. */
 
58
    public static final String PROP_CATEGORY = "category";
 
59
 
 
60
    /**
 
61
     * Adds the Category to this pane. All of the available categories
 
62
     * must be added before the populateToolbar() method is invoked.
 
63
     *
 
64
     * @param  category  Category to be added.
 
65
     */
 
66
    void addCategory(Category category);
 
67
 
 
68
    /**
 
69
     * Add a PropertyChangeListener to the listener list.
 
70
     *
 
71
     * @param  listener  property change listener to add.
 
72
     */
 
73
    void addPropertyChangeListener(PropertyChangeListener listener);
 
74
 
 
75
    /**
 
76
     * Add a PropertyChangeListener for a specific property.
 
77
     *
 
78
     * @param  name      name of property to listen to.
 
79
     * @param  listener  property change listener to add.
 
80
     */
 
81
    void addPropertyChangeListener(String name, PropertyChangeListener listener);
 
82
    
 
83
    /**
 
84
     * Returns the currently selected Category.
 
85
     *
 
86
     * @return  currently seleced Category, or null if none.
 
87
     */
 
88
    Category getCategory();
 
89
 
 
90
    /**
 
91
     * Returns the user interface component for this category pane.
 
92
     *
 
93
     * @return  the user interface component.
 
94
     */
 
95
    Component getComponent();
 
96
 
 
97
    /**
 
98
     * Returns the search component for this category pane. This component
 
99
     * should be made visible when the Find action is invoked, by calling
 
100
     * <code>setVisible(true)</code>.
 
101
     *
 
102
     * @return  search component.
 
103
     */
 
104
    SearchComponent getSearchComponent();
 
105
 
 
106
    /**
 
107
     * Add components to the given toolbar to permit selecting the current
 
108
     * category. Note that all categories should have already been added
 
109
     * to this pane via the add(Category) method.
 
110
     *
 
111
     * @param  toolbar  toolbar component to be populated.
 
112
     */
 
113
    void populateToolbar(JToolBar toolbar);
 
114
 
 
115
    /**
 
116
     * Remove a PropertyChangeListener from the listener list.
 
117
     *
 
118
     * @param  listener  property change listener to remove.
 
119
     */
 
120
    void removePropertyChangeListener(PropertyChangeListener listener);
 
121
 
 
122
    /**
 
123
     * Remove a PropertyChangeListener for a specific property.
 
124
     *
 
125
     * @param  name      name of property to listen to.
 
126
     * @param  listener  property change listener to remove.
 
127
     */
 
128
    void removePropertyChangeListener(String name, PropertyChangeListener listener);
 
129
 
 
130
    /**
 
131
     * Change the selected Category to the one given. Notifies property change
 
132
     * listeners of the change in selection (property name "category").
 
133
     *
 
134
     * @param  category  Category to be selected (may not be null).
 
135
     */
 
136
    void setCategory(Category category);
 
137
}