This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 169099
Collapse All | Expand All

(-)o.n.swing.tabcontrol/apichanges.xml (+44 lines)
Lines 108-113 Link Here
108
108
109
<changes>
109
<changes>
110
110
111
    <change id="tabcontrol_factory">
112
      <api name="tabcontrol"/>
113
      <summary>Allow custom implementation of tab control.</summary>
114
      <version major="1" minor="33"/>
115
      <date day="18" month="1" year="2012"/>
116
      <author login="saubrecht"/>
117
      <compatibility addition="yes" binary="compatible" deprecation="no"/>
118
      <description>
119
        <p>There is a new <code>TabbedComponentFactory</code> class that allows
120
        custom implementations of tab control to be used in the window system.</p>
121
122
        <p>If you want to create tab control based for example on JTabbedPane then
123
        provide an implementation of Tabbed.Accessor interface like this:</p>
124
        <pre>
125
            class MyTabbedPane extends JTabbedPane implements Tabbed.Accessor {
126
127
                private final Tabbed tabbedImpl = new Tabbed() {
128
                    //implement abstract methods while delegating most of them to JTabbedPane
129
                };
130
131
                @Override
132
                public Tabbed getTabbed() {
133
                    return tabbedImpl;
134
                }
135
            }
136
        </pre>
137
138
        <p>Then inject your new implementation to the window system by registering
139
        your own TabbedComponentFactory:</p>
140
        <pre>
141
            @ServiceProvider(service=TabbedComponentFactory.class,supersedes="org.netbeans.core.windows.view.ui.DefaultTabbedComponentFactory" )
142
            public class MyTabbedPaneFactory implements TabbedComponentFactory {
143
                @Override
144
                public Accessor createTabbedComponent( TabbedType type, WinsysInfoForTabbedContainer info ) {
145
                    return new MyTabbedPane();
146
                }
147
            }
148
        </pre>
149
      </description>
150
      <class package="org.netbeans.swing.tabcontrol.customtabs" name="TabbedComponentFactory"/>
151
      <class package="org.netbeans.swing.tabcontrol.customtabs" name="Tabbed"/>
152
      <class package="org.netbeans.swing.tabcontrol.customtabs" name="TabbedType"/>
153
    </change>
154
111
    <change id="restore_group_button_ui">
155
    <change id="restore_group_button_ui">
112
      <api name="tabcontrol"/>
156
      <api name="tabcontrol"/>
113
      <summary>Allow custom UI for 'restore window group' button.</summary>
157
      <summary>Allow custom UI for 'restore window group' button.</summary>
(-)o.n.swing.tabcontrol/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/swing/tabcontrol/Bundle.properties
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/swing/tabcontrol/Bundle.properties
3
OpenIDE-Module: org.netbeans.swing.tabcontrol
3
OpenIDE-Module: org.netbeans.swing.tabcontrol
4
OpenIDE-Module-Specification-Version: 1.32
4
OpenIDE-Module-Specification-Version: 1.33
5
AutoUpdate-Essential-Module: true
5
AutoUpdate-Essential-Module: true
6
6
(-)o.n.swing.tabcontrol/nbproject/project.xml (+1 lines)
Lines 99-104 Link Here
99
            <public-packages>
99
            <public-packages>
100
                <package>org.netbeans.swing.popupswitcher</package>
100
                <package>org.netbeans.swing.popupswitcher</package>
101
                <package>org.netbeans.swing.tabcontrol</package>
101
                <package>org.netbeans.swing.tabcontrol</package>
102
                <package>org.netbeans.swing.tabcontrol.customtabs</package>
102
                <package>org.netbeans.swing.tabcontrol.event</package>
103
                <package>org.netbeans.swing.tabcontrol.event</package>
103
                <package>org.netbeans.swing.tabcontrol.plaf</package>
104
                <package>org.netbeans.swing.tabcontrol.plaf</package>
104
            </public-packages>
105
            </public-packages>
(-)o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/Tabbed.java (+149 lines)
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
(-)o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedComponentFactory.java (+70 lines)
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
package org.netbeans.swing.tabcontrol.customtabs;
46
47
import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer;
48
49
/**
50
 * Service Interface used by the Window System for creating NetBeans specific
51
 * Tabbed Containers. Use this if you want to provide an alternative implementation
52
 * (e.g. based on JTabbedPane).
53
 * Implement to return your own implementation of Tabbed. Make it available by
54
 * registering as a ServiceProvider using this annotation:
55
 * <code>@ServiceProvider(service=TabbedComponentFactory.class,supersedes="org.netbeans.core.windows.view.ui.DefaultTabbedComponentFactory" )</code>
56
 *
57
 * @since 1.33
58
 * @author S. Aubrecht
59
 */
60
public interface TabbedComponentFactory {
61
/**
62
 * Create Tabbed implementation for given type.
63
 * 
64
 * @param type Type of the container to be created.
65
 * @param info Information from the window system that may affect the look and feel of the tab control.
66
 * @return Tabbed accessor.
67
 */
68
    public Tabbed.Accessor createTabbedComponent(TabbedType type, WinsysInfoForTabbedContainer info);
69
70
}
(-)o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedType.java (+93 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 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
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.swing.tabcontrol.customtabs;
43
44
import org.netbeans.swing.tabcontrol.TabbedContainer;
45
46
/**
47
 * Lists all possible types of tabbed container.
48
 * 
49
 * @see TabbedContainer
50
 * 
51
 * @since 1.33
52
 * @author S. Aubrecht
53
 */
54
public enum TabbedType {
55
    /**
56
     * Tabbed container showing non-document windows.
57
     */
58
    View {
59
        @Override
60
        public int toInt() {
61
            return TabbedContainer.TYPE_VIEW;
62
        }
63
    },
64
    /**
65
     * Tabbed container showing document windows.
66
     */
67
    Editor {
68
        @Override
69
        public int toInt() {
70
            return TabbedContainer.TYPE_EDITOR;
71
        }
72
    },
73
    /**
74
     * Tabbed container showing minimized windows.
75
     */
76
    Sliding {
77
        @Override
78
        public int toInt() {
79
            return TabbedContainer.TYPE_SLIDING;
80
        }
81
    },
82
    /**
83
     * Tabbed container which uses toolbar-like component to switch active window.
84
     */
85
    Toolbar {
86
        @Override
87
        public int toInt() {
88
            return TabbedContainer.TYPE_TOOLBAR;
89
        }
90
    };
91
    
92
    public abstract int toInt();
93
}
(-)o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java (+2 lines)
Lines 45-50 Link Here
45
package org.netbeans.swing.tabcontrol;
45
package org.netbeans.swing.tabcontrol;
46
46
47
import java.awt.Component;
47
import java.awt.Component;
48
import org.netbeans.swing.tabcontrol.customtabs.TabbedComponentFactory;
48
import org.openide.windows.TopComponent;
49
import org.openide.windows.TopComponent;
49
50
50
51
Lines 56-61 Link Here
56
 * the position of the container or on maximization state.
57
 * the position of the container or on maximization state.
57
 *
58
 *
58
 * @see TabbedContainer#TabbedContainer
59
 * @see TabbedContainer#TabbedContainer
60
 * @see TabbedComponentFactory
59
 *
61
 *
60
 * @author S. Aubrecht
62
 * @author S. Aubrecht
61
 */
63
 */

Return to bug 169099