Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 215265
Collapse All | Expand All

(-)a/core.windows/manifest.mf (-1 / +1 lines)
 Lines 6-10    Link Here 
6
OpenIDE-Module-Recommends: org.netbeans.core.windows.nativeaccess.NativeWindowSystem
6
OpenIDE-Module-Recommends: org.netbeans.core.windows.nativeaccess.NativeWindowSystem
7
AutoUpdate-Show-In-Client: false
7
AutoUpdate-Show-In-Client: false
8
AutoUpdate-Essential-Module: true
8
AutoUpdate-Essential-Module: true
9
OpenIDE-Module-Specification-Version: 2.51
9
OpenIDE-Module-Specification-Version: 2.52
10
10
(-)a/core.windows/nbproject/project.xml (-1 / +1 lines)
 Lines 101-107    Link Here 
101
                    <build-prerequisite/>
101
                    <build-prerequisite/>
102
                    <compile-dependency/>
102
                    <compile-dependency/>
103
                    <run-dependency>
103
                    <run-dependency>
104
                        <specification-version>6.2</specification-version>
104
                        <specification-version>7.48</specification-version>
105
                    </run-dependency>
105
                    </run-dependency>
106
                </dependency>
106
                </dependency>
107
                <dependency>
107
                <dependency>
(-)a/openide.awt/src/org/openide/awt/CloseButtonTabbedPane.java (-5 / +29 lines)
 Lines 42-48    Link Here 
42
 * made subject to such option by the copyright holder.
42
 * made subject to such option by the copyright holder.
43
 */
43
 */
44
44
45
package org.openide.awt;
45
package org.netbeans.core.windows.view.ui;
46
46
47
import java.awt.*;
47
import java.awt.*;
48
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionEvent;
 Lines 56-76    Link Here 
56
import java.util.regex.Pattern;
56
import java.util.regex.Pattern;
57
import javax.swing.*;
57
import javax.swing.*;
58
import javax.swing.plaf.UIResource;
58
import javax.swing.plaf.UIResource;
59
import org.netbeans.core.windows.actions.MaximizeWindowAction;
60
import org.openide.awt.CloseButtonFactory;
61
import org.openide.awt.TabbedPaneFactory;
59
import org.openide.util.Exceptions;
62
import org.openide.util.Exceptions;
60
import org.openide.util.Utilities;
63
import org.openide.util.Utilities;
64
import org.openide.windows.TopComponent;
61
65
62
/**
66
/**
63
 * Copy of original CloseButtonTabbedPane from the NetBeans 3.4 winsys.  Old code never dies.
67
 * Copy of original CloseButtonTabbedPane from the NetBeans 3.4 winsys.  Old code never dies.
68
 * (moved from openide.awt module)
64
 *
69
 *
65
 * @author Tran Duc Trung
70
 * @author Tran Duc Trung
66
 * @author S. Aubrecht
71
 * @author S. Aubrecht
67
 * @since 6.10.0
72
 * @since 2.52
68
 *
73
 *
69
 */
74
 */
70
final class CloseButtonTabbedPane extends JTabbedPane implements PropertyChangeListener {
75
final class CloseButtonTabbedPane extends JTabbedPane implements PropertyChangeListener {
71
76
72
    static final String PROP_CLOSE = "close";
73
74
    CloseButtonTabbedPane() {
77
    CloseButtonTabbedPane() {
75
            // close tab via middle button
78
            // close tab via middle button
76
            addMouseListener(new MouseAdapter() {
79
            addMouseListener(new MouseAdapter() {
 Lines 96-101    Link Here 
96
                        lastIdx = -1;
99
                        lastIdx = -1;
97
                    }
100
                    }
98
                }
101
                }
102
103
            @Override
104
            public void mouseClicked( MouseEvent e ) {
105
                if( e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton( e ) ) {
106
                    //toggle maximize
107
                    TopComponent tc = ( TopComponent ) SwingUtilities.getAncestorOfClass( TopComponent.class, CloseButtonTabbedPane.this );
108
                    if( null != tc ) {
109
                        MaximizeWindowAction mwa = new MaximizeWindowAction(tc);
110
                        if( mwa.isEnabled() )
111
                            mwa.actionPerformed(null);
112
                    }
113
                }
114
            }
115
116
99
            });
117
            });
100
        //Bugfix #28263: Disable focus.
118
        //Bugfix #28263: Disable focus.
101
        setFocusable(false);
119
        setFocusable(false);
 Lines 110-131    Link Here 
110
    }
128
    }
111
129
112
    private class CBTPPolicy extends FocusTraversalPolicy {
130
    private class CBTPPolicy extends FocusTraversalPolicy {
131
        @Override
113
        public Component getComponentAfter(Container aContainer, Component aComponent) {
132
        public Component getComponentAfter(Container aContainer, Component aComponent) {
114
            return sel();
133
            return sel();
115
        }
134
        }
116
135
136
        @Override
117
        public Component getComponentBefore(Container aContainer, Component aComponent) {
137
        public Component getComponentBefore(Container aContainer, Component aComponent) {
118
            return sel();
138
            return sel();
119
        }
139
        }
120
140
141
        @Override
121
        public Component getFirstComponent(Container aContainer) {
142
        public Component getFirstComponent(Container aContainer) {
122
            return sel();
143
            return sel();
123
        }
144
        }
124
145
146
        @Override
125
        public Component getLastComponent(Container aContainer) {
147
        public Component getLastComponent(Container aContainer) {
126
            return sel();
148
            return sel();
127
        }
149
        }
128
150
151
        @Override
129
        public Component getDefaultComponent(Container aContainer) {
152
        public Component getDefaultComponent(Container aContainer) {
130
            return sel();
153
            return sel();
131
        }
154
        }
 Lines 359-365    Link Here 
359
    }
382
    }
360
    
383
    
361
    private void fireCloseRequest(Component c) {
384
    private void fireCloseRequest(Component c) {
362
        firePropertyChange(PROP_CLOSE, null, c);
385
        firePropertyChange(TabbedPaneFactory.PROP_CLOSE, null, c);
363
        if (getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
386
        if (getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
364
            int idx = getSelectedIndex();
387
            int idx = getSelectedIndex();
365
            if (idx > 0) {
388
            if (idx > 0) {
 Lines 438-443    Link Here 
438
        return super.getBackgroundAt(index);
461
        return super.getBackgroundAt(index);
439
    }
462
    }
440
463
464
    @Override
441
    public void propertyChange(PropertyChangeEvent evt) {
465
    public void propertyChange(PropertyChangeEvent evt) {
442
        if (evt.getSource() instanceof Component) {
466
        if (evt.getSource() instanceof Component) {
443
            assert evt.getPropertyName().equals(TabbedPaneFactory.NO_CLOSE_BUTTON);
467
            assert evt.getPropertyName().equals(TabbedPaneFactory.NO_CLOSE_BUTTON);
(-)a/openide.awt/apichanges.xml (+13 lines)
 Lines 50-55    Link Here 
50
<apidef name="awt">AWT API</apidef>
50
<apidef name="awt">AWT API</apidef>
51
</apidefs>
51
</apidefs>
52
<changes>
52
<changes>
53
    <change id="TabbedPaneFactorySubClass">
54
      <api name="awt"/>
55
      <summary>TabbedPaneFactory can be subclassed.</summary>
56
      <date day="17" month="7" year="2012"/>
57
      <author login="saubrecht"/>
58
      <compatibility addition="yes" binary="compatible" source="compatible" deprecation="no" semantic="compatible" modification="no" deletion="no"/>
59
      <description>
60
          It is possible to subclass TabbedPaneFactory to provide custom
61
          implementations of close button tabbed pane.
62
      </description>
63
      <class package="org.openide.awt" name="TabbedPaneFactory"/>
64
      <issue number="215265"/>
65
    </change>
53
    <change id="CheckForUpdatesProvider">
66
    <change id="CheckForUpdatesProvider">
54
        <api name="awt"/>
67
        <api name="awt"/>
55
        <summary>Support for Check for Updates feature</summary>
68
        <summary>Support for Check for Updates feature</summary>
(-)a/openide.awt/manifest.mf (-1 / +1 lines)
 Lines 2-6    Link Here 
2
OpenIDE-Module: org.openide.awt
2
OpenIDE-Module: org.openide.awt
3
OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties
4
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 7.47
5
OpenIDE-Module-Specification-Version: 7.48
6
6
(-)a/openide.awt/src/org/openide/awt/TabbedPaneFactory.java (-7 / +26 lines)
 Lines 45-50    Link Here 
45
package org.openide.awt;
45
package org.openide.awt;
46
46
47
import javax.swing.JTabbedPane;
47
import javax.swing.JTabbedPane;
48
import org.openide.util.Lookup;
48
49
49
/**
50
/**
50
 * Factory class for TabbedPanes with closeable tabs.
51
 * Factory class for TabbedPanes with closeable tabs.
 Lines 58-64    Link Here 
58
     * Name of the property that is fired from the closeable tabbed pane
59
     * Name of the property that is fired from the closeable tabbed pane
59
     * when the user clicks close button on a tab.
60
     * when the user clicks close button on a tab.
60
     */
61
     */
61
    public static final String PROP_CLOSE = CloseButtonTabbedPane.PROP_CLOSE;
62
    public static final String PROP_CLOSE = "close"; //NOI18N
62
63
63
    /**
64
    /**
64
     * To hide close button feature on specific tab, put value Boolean.TRUE
65
     * To hide close button feature on specific tab, put value Boolean.TRUE
 Lines 68-79    Link Here 
68
     * </pre>
69
     * </pre>
69
     * @since 7.8
70
     * @since 7.8
70
     */
71
     */
71
    public static final String NO_CLOSE_BUTTON = "noCloseButton";
72
    public static final String NO_CLOSE_BUTTON = "noCloseButton"; //NOI18N
72
    
73
73
    /** Creates a new instance of TabbedPaneFactory */
74
    /**
74
    private TabbedPaneFactory() {
75
     * @return TabbedPaneFactory instance from the global Lookup.
76
     */
77
    public static TabbedPaneFactory getDefault() {
78
        TabbedPaneFactory res = Lookup.getDefault().lookup( TabbedPaneFactory.class );
79
        if( null == res )
80
            return new TabbedPaneFactory();
81
        
82
        return res;
75
    }
83
    }
76
    
84
85
    /**
86
     * The default implementation provides just the vanilla Swing JTabbedPane.
87
     * The actual implementation in core.windows provides a special subclass
88
     * with a small 'close' button in each tab.
89
     * @return A new TabbedPane instance.
90
     * @since 7.48
91
     */
92
    public JTabbedPane createTabbedPane() {
93
        return new JTabbedPane();
94
    }
95
77
    /**
96
    /**
78
     * Creates a special {@link JTabbedPane} that displays a small 'close' button in each tab.
97
     * Creates a special {@link JTabbedPane} that displays a small 'close' button in each tab.
79
     * When user clicks the close button a {@link java.beans.PropertyChangeEvent} is fired from the
98
     * When user clicks the close button a {@link java.beans.PropertyChangeEvent} is fired from the
 Lines 84-89    Link Here 
84
     * @see TabbedPaneFactory#NO_CLOSE_BUTTON
103
     * @see TabbedPaneFactory#NO_CLOSE_BUTTON
85
     */
104
     */
86
    public static JTabbedPane createCloseButtonTabbedPane() {
105
    public static JTabbedPane createCloseButtonTabbedPane() {
87
        return new CloseButtonTabbedPane();
106
        return getDefault().createTabbedPane();
88
    }
107
    }
89
}
108
}

Return to bug 215265
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo