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

(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/DragAndDropFeedbackVisualizer.java (-1 / +1 lines)
Lines 54-60 Link Here
54
import javax.swing.SwingUtilities;
54
import javax.swing.SwingUtilities;
55
import org.netbeans.core.windows.nativeaccess.NativeWindowSystem;
55
import org.netbeans.core.windows.nativeaccess.NativeWindowSystem;
56
import org.netbeans.core.windows.options.WinSysPrefs;
56
import org.netbeans.core.windows.options.WinSysPrefs;
57
import org.netbeans.core.windows.view.ui.Tabbed;
57
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
58
58
59
/**
59
/**
60
 *
60
 *
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/DragWindow.java (-1 / +1 lines)
Lines 59-65 Link Here
59
import javax.swing.SwingUtilities;
59
import javax.swing.SwingUtilities;
60
import javax.swing.Timer;
60
import javax.swing.Timer;
61
import org.netbeans.core.windows.options.WinSysPrefs;
61
import org.netbeans.core.windows.options.WinSysPrefs;
62
import org.netbeans.core.windows.view.ui.Tabbed;
62
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
63
63
64
/**
64
/**
65
 *
65
 *
(-)a/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java (+1 lines)
Lines 44-49 Link Here
44
44
45
45
46
46
47
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
47
import java.awt.AWTEvent;
48
import java.awt.AWTEvent;
48
import java.awt.Color;
49
import java.awt.Color;
49
import java.awt.Component;
50
import java.awt.Component;
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/AbstractModeContainer.java (+1 lines)
Lines 43-48 Link Here
43
package org.netbeans.core.windows.view.ui;
43
package org.netbeans.core.windows.view.ui;
44
44
45
45
46
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
46
import java.lang.reflect.Field;
47
import java.lang.reflect.Field;
47
import org.netbeans.core.windows.Constants;
48
import org.netbeans.core.windows.Constants;
48
import org.netbeans.core.windows.ModeImpl;
49
import org.netbeans.core.windows.ModeImpl;
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSeparateContainer.java (-8 / +6 lines)
Lines 43-48 Link Here
43
package org.netbeans.core.windows.view.ui;
43
package org.netbeans.core.windows.view.ui;
44
44
45
45
46
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
46
import java.text.MessageFormat;
47
import java.text.MessageFormat;
47
import javax.swing.plaf.basic.BasicHTML;
48
import javax.swing.plaf.basic.BasicHTML;
48
import org.netbeans.core.windows.Constants;
49
import org.netbeans.core.windows.Constants;
Lines 53-59 Link Here
53
import org.netbeans.core.windows.view.dnd.TopComponentDroppable;
54
import org.netbeans.core.windows.view.dnd.TopComponentDroppable;
54
import org.netbeans.core.windows.view.dnd.WindowDnDManager;
55
import org.netbeans.core.windows.view.dnd.WindowDnDManager;
55
import org.netbeans.core.windows.view.dnd.ZOrderManager;
56
import org.netbeans.core.windows.view.dnd.ZOrderManager;
56
import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
57
import org.openide.util.NbBundle;
57
import org.openide.util.NbBundle;
58
import org.openide.windows.TopComponent;
58
import org.openide.windows.TopComponent;
59
59
Lines 64-69 Link Here
64
import java.util.logging.Level;
64
import java.util.logging.Level;
65
import java.util.logging.Logger;
65
import java.util.logging.Logger;
66
import org.netbeans.core.windows.options.WinSysPrefs;
66
import org.netbeans.core.windows.options.WinSysPrefs;
67
import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
68
import org.netbeans.swing.tabcontrol.customtabs.TabbedComponentFactory;
69
import org.openide.util.Lookup;
67
import org.openide.windows.WindowManager;
70
import org.openide.windows.WindowManager;
68
71
69
72
Lines 110-123 Link Here
110
    }
113
    }
111
    
114
    
112
    protected Tabbed createTabbed() {
115
    protected Tabbed createTabbed() {
113
        Tabbed tabbed;
116
        return Lookup.getDefault().lookup(TabbedComponentFactory.class).
114
        if(getKind() == Constants.MODE_KIND_EDITOR) {
117
                getTabbedComponent(getKind(), new TabbedAdapter.WinsysInfo(getKind()));
115
            tabbed = new TabbedAdapter(Constants.MODE_KIND_EDITOR);
116
        } else {
117
            tabbed = new TabbedAdapter(Constants.MODE_KIND_VIEW);
118
        }
118
        }
119
        return tabbed;    
120
    }    
121
    
119
    
122
    protected void updateTitle (String title) {
120
    protected void updateTitle (String title) {
123
        getModeUIBase().updateTitle(title);
121
        getModeUIBase().updateTitle(title);
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java (-8 / +6 lines)
Lines 43-59 Link Here
43
package org.netbeans.core.windows.view.ui;
43
package org.netbeans.core.windows.view.ui;
44
44
45
45
46
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
46
import org.netbeans.core.windows.Constants;
47
import org.netbeans.core.windows.Constants;
47
import org.netbeans.core.windows.WindowManagerImpl;
48
import org.netbeans.core.windows.WindowManagerImpl;
48
import org.netbeans.core.windows.view.ModeView;
49
import org.netbeans.core.windows.view.ModeView;
49
import org.netbeans.core.windows.view.ViewElement;
50
import org.netbeans.core.windows.view.ViewElement;
50
import org.netbeans.core.windows.view.dnd.TopComponentDroppable;
51
import org.netbeans.core.windows.view.dnd.TopComponentDroppable;
51
import org.netbeans.core.windows.view.dnd.WindowDnDManager;
52
import org.netbeans.core.windows.view.dnd.WindowDnDManager;
52
import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
53
import org.openide.windows.TopComponent;
53
import org.openide.windows.TopComponent;
54
54
55
import javax.swing.*;
55
import javax.swing.*;
56
import java.awt.*;
56
import java.awt.*;
57
import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
58
import org.netbeans.swing.tabcontrol.customtabs.TabbedComponentFactory;
59
import org.openide.util.Lookup;
57
60
58
61
59
/**
62
/**
Lines 91-104 Link Here
91
    }
94
    }
92
    
95
    
93
    protected Tabbed createTabbed() {
96
    protected Tabbed createTabbed() {
94
        Tabbed tabbed;
97
        return Lookup.getDefault().lookup(TabbedComponentFactory.class).
95
        if(getKind() == Constants.MODE_KIND_EDITOR) {
98
                getTabbedComponent(getKind(), new TabbedAdapter.WinsysInfo(getKind()));
96
            tabbed = new TabbedAdapter(Constants.MODE_KIND_EDITOR);
97
        } else {
98
            tabbed = new TabbedAdapter(Constants.MODE_KIND_VIEW);
99
        }
99
        }
100
        return tabbed;    
101
    }    
102
    
100
    
103
    protected void updateTitle(String title) {
101
    protected void updateTitle(String title) {
104
        // no op
102
        // no op
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/Tabbed.java (-134 lines)
Lines 1-134 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2009 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-2006 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
43
package org.netbeans.core.windows.view.ui;
44
45
46
import org.openide.windows.TopComponent;
47
48
import javax.swing.*;
49
import javax.swing.event.ChangeListener;
50
import java.awt.*;
51
import java.awt.event.ActionListener;
52
53
54
/**
55
 * Interface describing component which is used inside <code>SimpleContainer</code>.
56
 * There will be at two implementations one for view and second one for editor type.
57
 *
58
 * @author  Peter Zavadsky
59
 */
60
public interface Tabbed {
61
62
    public void requestAttention(TopComponent tc);
63
64
    public void cancelRequestAttention(TopComponent tc);
65
    
66
    public void addTopComponent(String name, Icon icon, TopComponent tc, String toolTip);
67
68
    public void insertComponent(String name, Icon icon, Component comp, String toolTip, int position);
69
    
70
    public void setTopComponents(TopComponent[] tcs, TopComponent selected);
71
    
72
    public int getTabCount();
73
    
74
    public TopComponent[] getTopComponents();
75
    
76
    public TopComponent getTopComponentAt(int index);
77
    
78
    public int indexOf(Component tc);
79
    
80
    public void removeComponent(Component comp);
81
    
82
    public void setTitleAt(int index, String title);
83
    
84
    public void setIconAt(int index, Icon icon);
85
    
86
    public void setToolTipTextAt(int index, String toolTip);
87
    
88
    public void setSelectedComponent(Component comp);
89
    
90
    public TopComponent getSelectedTopComponent();
91
92
    public void addChangeListener(ChangeListener listener);
93
    
94
    public void removeChangeListener(ChangeListener listener);
95
96
    public void addActionListener (ActionListener al);
97
98
    public void removeActionListener (ActionListener al);
99
100
    public void setActive(boolean active);
101
    
102
    public int tabForCoordinate(Point p);
103
   
104
    public Shape getIndicationForLocation(Point location, TopComponent startingTransfer,
105
            Point startingPoint, boolean attachingPossible);
106
    
107
    public Object getConstraintForLocation(Point location, boolean attachingPossible);
108
    
109
    public Image createImageOfTab (int tabIndex);
110
    
111
    /** Accessor for visual component holding components */
112
    public Component getComponent();
113
    
114
    /** Allows tabbed implementors to speficy content of popup menu on tab
115
     * with given index. Incoming actions are default set by winsys
116
     */
117
    public Action[] getPopupActions(Action[] defaultActions, int tabIndex);
118
    
119
    /** Returns bounds of tab with given index */
120
    public Rectangle getTabBounds(int tabIndex);
121
    
122
    public boolean isTransparent();
123
    
124
    public void setTransparent( boolean transparent );
125
    
126
    /** Interface for simple accessing of Tabbed instance */
127
    public interface Accessor {
128
129
        public Tabbed getTabbed ();
130
131
    } // end of Accessor
132
133
}
134
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/TabbedHandler.java (+1 lines)
Lines 43-48 Link Here
43
package org.netbeans.core.windows.view.ui;
43
package org.netbeans.core.windows.view.ui;
44
44
45
45
46
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
46
import org.netbeans.core.windows.Constants;
47
import org.netbeans.core.windows.Constants;
47
import org.netbeans.core.windows.actions.ActionUtils;
48
import org.netbeans.core.windows.actions.ActionUtils;
48
import org.netbeans.core.windows.actions.MaximizeWindowAction;
49
import org.netbeans.core.windows.actions.MaximizeWindowAction;
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/slides/SlideBar.java (-1 / +1 lines)
Lines 72-78 Link Here
72
import org.netbeans.core.windows.Constants;
72
import org.netbeans.core.windows.Constants;
73
import org.netbeans.core.windows.Switches;
73
import org.netbeans.core.windows.Switches;
74
import org.netbeans.core.windows.WindowManagerImpl;
74
import org.netbeans.core.windows.WindowManagerImpl;
75
import org.netbeans.core.windows.view.ui.Tabbed;
75
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
76
import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
76
import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
77
import org.netbeans.swing.tabcontrol.SlideBarDataModel;
77
import org.netbeans.swing.tabcontrol.SlideBarDataModel;
78
import org.netbeans.swing.tabcontrol.SlidingButton;
78
import org.netbeans.swing.tabcontrol.SlidingButton;
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/slides/SlideBarContainer.java (-1 / +1 lines)
Lines 65-71 Link Here
65
import org.netbeans.core.windows.view.ui.AbstractModeContainer;
65
import org.netbeans.core.windows.view.ui.AbstractModeContainer;
66
import org.netbeans.core.windows.view.ui.ModeComponent;
66
import org.netbeans.core.windows.view.ui.ModeComponent;
67
import org.netbeans.core.windows.view.dnd.TopComponentDroppable;
67
import org.netbeans.core.windows.view.dnd.TopComponentDroppable;
68
import org.netbeans.core.windows.view.ui.Tabbed;
68
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
69
import org.openide.windows.TopComponent;
69
import org.openide.windows.TopComponent;
70
70
71
71
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/slides/TabbedSlideAdapter.java (-1 / +1 lines)
Lines 62-68 Link Here
62
import org.netbeans.core.windows.Switches;
62
import org.netbeans.core.windows.Switches;
63
import org.netbeans.core.windows.WindowManagerImpl;
63
import org.netbeans.core.windows.WindowManagerImpl;
64
import org.netbeans.core.windows.actions.ActionUtils;
64
import org.netbeans.core.windows.actions.ActionUtils;
65
import org.netbeans.core.windows.view.ui.Tabbed;
65
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
66
import org.netbeans.swing.tabcontrol.DefaultTabDataModel;
66
import org.netbeans.swing.tabcontrol.DefaultTabDataModel;
67
import org.netbeans.core.windows.view.dnd.DragAndDropFeedbackVisualizer;
67
import org.netbeans.core.windows.view.dnd.DragAndDropFeedbackVisualizer;
68
import org.netbeans.swing.tabcontrol.SlideBarDataModel;
68
import org.netbeans.swing.tabcontrol.SlideBarDataModel;
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedAdapter.java (-4 / +4 lines)
Lines 49-55 Link Here
49
import org.netbeans.core.windows.Constants;
49
import org.netbeans.core.windows.Constants;
50
import org.netbeans.core.windows.Debug;
50
import org.netbeans.core.windows.Debug;
51
import org.netbeans.core.windows.WindowManagerImpl;
51
import org.netbeans.core.windows.WindowManagerImpl;
52
import org.netbeans.core.windows.view.ui.Tabbed;
52
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
53
import org.netbeans.swing.tabcontrol.ComponentConverter;
53
import org.netbeans.swing.tabcontrol.ComponentConverter;
54
import org.netbeans.swing.tabcontrol.TabData;
54
import org.netbeans.swing.tabcontrol.TabData;
55
import org.netbeans.swing.tabcontrol.TabbedContainer;
55
import org.netbeans.swing.tabcontrol.TabbedContainer;
Lines 89-96 Link Here
89
    private PropertyChangeListener tooltipListener, weakTooltipListener;
89
    private PropertyChangeListener tooltipListener, weakTooltipListener;
90
90
91
    /** Creates a new instance of TabbedAdapter */
91
    /** Creates a new instance of TabbedAdapter */
92
    public TabbedAdapter (int type) {
92
    public TabbedAdapter (int type, WinsysInfoForTabbedContainer info) {
93
        super (null, type, new WinsysInfo(type));
93
        super (null, type, info);
94
        getSelectionModel().addChangeListener(new ChangeListener() {
94
        getSelectionModel().addChangeListener(new ChangeListener() {
95
            public void stateChanged (ChangeEvent ce) {
95
            public void stateChanged (ChangeEvent ce) {
96
                int idx = getSelectionModel().getSelectedIndex();
96
                int idx = getSelectionModel().getSelectedIndex();
Lines 515-521 Link Here
515
515
516
    /********* implementation of WinsysInfoForTabbed ********/
516
    /********* implementation of WinsysInfoForTabbed ********/
517
    
517
    
518
    static class WinsysInfo extends WinsysInfoForTabbedContainer {
518
    public static class WinsysInfo extends WinsysInfoForTabbedContainer {
519
        private int containerType;
519
        private int containerType;
520
        public WinsysInfo( int containerType ) {
520
        public WinsysInfo( int containerType ) {
521
            this.containerType = containerType;
521
            this.containerType = containerType;
(-)a/o.n.swing.tabcontrol/nbproject/project.xml (+1 lines)
Lines 88-93 Link Here
88
            <public-packages>
88
            <public-packages>
89
                <package>org.netbeans.swing.popupswitcher</package>
89
                <package>org.netbeans.swing.popupswitcher</package>
90
                <package>org.netbeans.swing.tabcontrol</package>
90
                <package>org.netbeans.swing.tabcontrol</package>
91
                <package>org.netbeans.swing.tabcontrol.customtabs</package>
91
                <package>org.netbeans.swing.tabcontrol.event</package>
92
                <package>org.netbeans.swing.tabcontrol.event</package>
92
                <package>org.netbeans.swing.tabcontrol.plaf</package>
93
                <package>org.netbeans.swing.tabcontrol.plaf</package>
93
            </public-packages>
94
            </public-packages>
(-)a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultTabbedComponentFactory.java (+61 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 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
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
/**
41
 *
42
 * @author eppleton
43
 */
44
45
package org.netbeans.core.windows.view.ui;
46
47
import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter;
48
import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer;
49
import org.netbeans.swing.tabcontrol.customtabs.Tabbed;
50
import org.netbeans.swing.tabcontrol.customtabs.TabbedComponentFactory;
51
import org.openide.util.lookup.ServiceProvider;
52
53
54
@ServiceProvider(service=TabbedComponentFactory.class)
55
public class DefaultTabbedComponentFactory implements TabbedComponentFactory{
56
57
    public Tabbed getTabbedComponent(int type, WinsysInfoForTabbedContainer info) {
58
        return new TabbedAdapter(type, info);
59
    }
60
61
}
(-)a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/Tabbed.java (+138 lines)
Line 0 Link Here
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): maxnitribitt
25
 *
26
 * The Original Software is NetBeans. The Initial Developer of the Original
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 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
43
package org.netbeans.swing.tabcontrol.customtabs;
44
45
46
import org.openide.windows.TopComponent;
47
48
import javax.swing.*;
49
import javax.swing.event.ChangeListener;
50
import java.awt.*;
51
import java.awt.event.ActionListener;
52
53
54
/**
55
 * Interface for a pseudo JTabbedPane API for the actual tab control.
56
 * Default implementation is based on nb specific <code>TabbedContainer</code>.
57
 *
58
 * @author  Peter Zavadsky
59
 */
60
public interface Tabbed {
61
62
    /**
63
     * Give a visual hint (e.g. blink) to draw attention to this TopComponent
64
     * @param tc
65
     */
66
    public void requestAttention(TopComponent tc);
67
68
    public void cancelRequestAttention(TopComponent tc);
69
    
70
    public void addTopComponent(String name, Icon icon, TopComponent tc, String toolTip);
71
72
    public void insertComponent(String name, Icon icon, Component comp, String toolTip, int position);
73
    
74
    public void setTopComponents(TopComponent[] tcs, TopComponent selected);
75
    
76
    public int getTabCount();
77
    
78
    public TopComponent[] getTopComponents();
79
    
80
    public TopComponent getTopComponentAt(int index);
81
    
82
    public int indexOf(Component tc);
83
    
84
    public void removeComponent(Component comp);
85
    
86
    public void setTitleAt(int index, String title);
87
    
88
    public void setIconAt(int index, Icon icon);
89
    
90
    public void setToolTipTextAt(int index, String toolTip);
91
    
92
    public void setSelectedComponent(Component comp);
93
    
94
    public TopComponent getSelectedTopComponent();
95
96
    public void addChangeListener(ChangeListener listener);
97
    
98
    public void removeChangeListener(ChangeListener listener);
99
100
    public void addActionListener (ActionListener al);
101
102
    public void removeActionListener (ActionListener al);
103
104
    public void setActive(boolean active);
105
    
106
    public int tabForCoordinate(Point p);
107
   
108
    public Shape getIndicationForLocation(Point location, TopComponent startingTransfer,
109
            Point startingPoint, boolean attachingPossible);
110
    
111
    public Object getConstraintForLocation(Point location, boolean attachingPossible);
112
    
113
    public Image createImageOfTab (int tabIndex);
114
    
115
    /** Accessor for visual component holding components */
116
    public Component getComponent();
117
    
118
    /** Allows tabbed implementors to speficy content of popup menu on tab
119
     * with given index. Incoming actions are default set by winsys
120
     */
121
    public Action[] getPopupActions(Action[] defaultActions, int tabIndex);
122
    
123
    /** Returns bounds of tab with given index */
124
    public Rectangle getTabBounds(int tabIndex);
125
    
126
    public boolean isTransparent();
127
    
128
    public void setTransparent( boolean transparent );
129
    
130
    /** Interface for simple accessing of Tabbed instance */
131
    public interface Accessor {
132
133
        public Tabbed getTabbed ();
134
135
    } // end of Accessor
136
137
}
138
(-)a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedComponentFactory.java (+63 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 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
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.swing.tabcontrol.customtabs;
41
42
import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer;
43
44
/**
45
 * Service Interface used by the Window System for creating NetBeans specific
46
 * Tabbed Containers. Use this if you want to provide an alternative implementation
47
 * (e.g. based on JTabbedPane).
48
 * Implement to return your own implementation of Tabbed. Make it available by
49
 * registering as a ServiceProvider using this annotation:
50
 * <code>@ServiceProvider(service=TabbedComponentFactory.class,supersedes="org.netbeans.core.windows.view.ui.DefaultTabbedComponentFactory" )</code>
51
 *
52
 * @since 1.17
53
 * @author maxnitribitt
54
 */
55
public interface TabbedComponentFactory {
56
/**
57
 * Get the Tabbed implementation for this type (Editor / View)
58
 * @param type
59
 * @return
60
 */
61
    public Tabbed getTabbedComponent(int type, WinsysInfoForTabbedContainer info);
62
63
}

Return to bug 169099