Line 0
Link Here
|
|
|
1 |
/* |
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 |
* |
4 |
* Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. |
5 |
* |
6 |
* Oracle and Java are registered trademarks of Oracle and/or its affiliates. |
7 |
* Other names may be trademarks of their respective owners. |
8 |
* |
9 |
* The contents of this file are subject to the terms of either the GNU |
10 |
* General Public License Version 2 only ("GPL") or the Common |
11 |
* Development and Distribution License("CDDL") (collectively, the |
12 |
* "License"). You may not use this file except in compliance with the |
13 |
* License. You can obtain a copy of the License at |
14 |
* http://www.netbeans.org/cddl-gplv2.html |
15 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the |
16 |
* specific language governing permissions and limitations under the |
17 |
* License. When distributing the software, include this License Header |
18 |
* Notice in each file and include the License file at |
19 |
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this |
20 |
* particular file as subject to the "Classpath" exception as provided |
21 |
* by Oracle in the GPL Version 2 section of the License file that |
22 |
* accompanied this code. If applicable, add the following below the |
23 |
* License Header, with the fields enclosed by brackets [] replaced by |
24 |
* your own identifying information: |
25 |
* "Portions Copyrighted [year] [name of copyright owner]" |
26 |
* |
27 |
* Contributor(s): |
28 |
* |
29 |
* The Original Software is NetBeans. The Initial Developer of the Original |
30 |
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
31 |
* Microsystems, Inc. All Rights Reserved. |
32 |
* |
33 |
* If you wish your version of this file to be governed by only the CDDL |
34 |
* or only the GPL Version 2, indicate your decision by adding |
35 |
* "[Contributor] elects to include this software in this distribution |
36 |
* under the [CDDL or GPL Version 2] license." If you do not indicate a |
37 |
* single choice of license, a recipient has the option to distribute |
38 |
* your version of this file under either the CDDL, the GPL Version 2 or |
39 |
* to extend the choice of license to its licensees as provided above. |
40 |
* However, if you add GPL Version 2 code and therefore, elected the GPL |
41 |
* Version 2 license, then the option applies only if the new code is |
42 |
* made subject to such option by the copyright holder. |
43 |
*/ |
44 |
|
45 |
|
46 |
package org.netbeans.swing.tabcontrol.customtabs; |
47 |
|
48 |
|
49 |
import java.awt.*; |
50 |
import java.awt.event.ActionListener; |
51 |
import javax.swing.Action; |
52 |
import javax.swing.Icon; |
53 |
import javax.swing.event.ChangeListener; |
54 |
import org.openide.windows.TopComponent; |
55 |
|
56 |
|
57 |
/** |
58 |
* Abstraction of a container similar to JTabbedPane. The container holds several |
59 |
* TopComponents and user is switching the active (showing) TopComponent by clicking |
60 |
* on a tab with TopComponent title (and icon). The look and feel of the container |
61 |
* may differ depending whether it is showing document or non-document TopComponents. |
62 |
* |
63 |
* @see TabbedComponentFactory |
64 |
* |
65 |
* @since 1.33 |
66 |
* |
67 |
* @author Peter Zavadsky |
68 |
* @author S. Aubrecht |
69 |
*/ |
70 |
public abstract class Tabbed { |
71 |
|
72 |
public abstract void requestAttention(TopComponent tc); |
73 |
|
74 |
public abstract void cancelRequestAttention(TopComponent tc); |
75 |
|
76 |
public abstract void addTopComponent(String name, Icon icon, TopComponent tc, String toolTip); |
77 |
|
78 |
public abstract void insertComponent(String name, Icon icon, Component comp, String toolTip, int position); |
79 |
|
80 |
public abstract void setTopComponents(TopComponent[] tcs, TopComponent selected); |
81 |
|
82 |
public abstract int getTabCount(); |
83 |
|
84 |
public abstract TopComponent[] getTopComponents(); |
85 |
|
86 |
public abstract TopComponent getTopComponentAt(int index); |
87 |
|
88 |
public abstract int indexOf(Component tc); |
89 |
|
90 |
public abstract void removeComponent(Component comp); |
91 |
|
92 |
public abstract void setTitleAt(int index, String title); |
93 |
|
94 |
public abstract void setIconAt(int index, Icon icon); |
95 |
|
96 |
public abstract void setToolTipTextAt(int index, String toolTip); |
97 |
|
98 |
public abstract void setSelectedComponent(Component comp); |
99 |
|
100 |
public abstract TopComponent getSelectedTopComponent(); |
101 |
|
102 |
public abstract void addChangeListener(ChangeListener listener); |
103 |
|
104 |
public abstract void removeChangeListener(ChangeListener listener); |
105 |
|
106 |
public abstract void addActionListener (ActionListener al); |
107 |
|
108 |
public abstract void removeActionListener (ActionListener al); |
109 |
|
110 |
public abstract void setActive(boolean active); |
111 |
|
112 |
public abstract int tabForCoordinate(Point p); |
113 |
|
114 |
public abstract Shape getIndicationForLocation(Point location, TopComponent startingTransfer, |
115 |
Point startingPoint, boolean attachingPossible); |
116 |
|
117 |
public abstract Object getConstraintForLocation(Point location, boolean attachingPossible); |
118 |
|
119 |
public abstract Image createImageOfTab (int tabIndex); |
120 |
|
121 |
/** Accessor for visual component holding components */ |
122 |
public abstract Component getComponent(); |
123 |
|
124 |
/** Allows tabbed implementors to speficy content of popup menu on tab |
125 |
* with given index. Incoming actions are default set by winsys |
126 |
*/ |
127 |
public abstract Action[] getPopupActions(Action[] defaultActions, int tabIndex); |
128 |
|
129 |
/** Returns bounds of tab with given index */ |
130 |
public abstract Rectangle getTabBounds(int tabIndex); |
131 |
|
132 |
/** |
133 |
* @return Bounds of the area which displays the tab headers. |
134 |
* @since 2.32 |
135 |
*/ |
136 |
public abstract Rectangle getTabsArea(); |
137 |
|
138 |
public abstract boolean isTransparent(); |
139 |
|
140 |
public abstract void setTransparent( boolean transparent ); |
141 |
|
142 |
/** Interface for simple accessing of Tabbed instance */ |
143 |
public interface Accessor { |
144 |
|
145 |
public Tabbed getTabbed (); |
146 |
|
147 |
} // end of Accessor |
148 |
} |
149 |
|