# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: D:\hg\core-copy # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: o.n.swing.tabcontrol/apichanges.xml --- o.n.swing.tabcontrol/apichanges.xml Base (BASE) +++ o.n.swing.tabcontrol/apichanges.xml Locally Modified (Based On LOCAL) @@ -108,6 +108,50 @@ + + + Allow custom implementation of tab control. + + + + + +

There is a new TabbedComponentFactory class that allows + custom implementations of tab control to be used in the window system.

+ +

If you want to create tab control based for example on JTabbedPane then + provide an implementation of Tabbed.Accessor interface like this:

+
+            class MyTabbedPane extends JTabbedPane implements Tabbed.Accessor {
+
+                private final Tabbed tabbedImpl = new Tabbed() {
+                    //implement abstract methods while delegating most of them to JTabbedPane
+                };
+
+                @Override
+                public Tabbed getTabbed() {
+                    return tabbedImpl;
+                }
+            }
+        
+ +

Then inject your new implementation to the window system by registering + your own TabbedComponentFactory:

+
+            @ServiceProvider(service=TabbedComponentFactory.class,supersedes="org.netbeans.core.windows.view.ui.DefaultTabbedComponentFactory" )
+            public class MyTabbedPaneFactory implements TabbedComponentFactory {
+                @Override
+                public Accessor createTabbedComponent( TabbedType type, WinsysInfoForTabbedContainer info ) {
+                    return new MyTabbedPane();
+                }
+            }
+        
+
+ + + +
+ Allow custom UI for 'restore window group' button. Index: o.n.swing.tabcontrol/manifest.mf --- o.n.swing.tabcontrol/manifest.mf Base (BASE) +++ o.n.swing.tabcontrol/manifest.mf Locally Modified (Based On LOCAL) @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module-Localizing-Bundle: org/netbeans/swing/tabcontrol/Bundle.properties OpenIDE-Module: org.netbeans.swing.tabcontrol -OpenIDE-Module-Specification-Version: 1.32 +OpenIDE-Module-Specification-Version: 1.33 AutoUpdate-Essential-Module: true Index: o.n.swing.tabcontrol/nbproject/project.xml --- o.n.swing.tabcontrol/nbproject/project.xml Base (BASE) +++ o.n.swing.tabcontrol/nbproject/project.xml Locally Modified (Based On LOCAL) @@ -99,6 +99,7 @@ org.netbeans.swing.popupswitcher org.netbeans.swing.tabcontrol + org.netbeans.swing.tabcontrol.customtabs org.netbeans.swing.tabcontrol.event org.netbeans.swing.tabcontrol.plaf Index: o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/Tabbed.java --- o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/Tabbed.java Base (BASE) +++ o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/Tabbed.java Locally New @@ -0,0 +1,149 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ + + +package org.netbeans.swing.tabcontrol.customtabs; + + +import java.awt.*; +import java.awt.event.ActionListener; +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.event.ChangeListener; +import org.openide.windows.TopComponent; + + +/** + * Abstraction of a container similar to JTabbedPane. The container holds several + * TopComponents and user is switching the active (showing) TopComponent by clicking + * on a tab with TopComponent title (and icon). The look and feel of the container + * may differ depending whether it is showing document or non-document TopComponents. + * + * @see TabbedComponentFactory + * + * @since 1.33 + * + * @author Peter Zavadsky + * @author S. Aubrecht + */ +public abstract class Tabbed { + + public abstract void requestAttention(TopComponent tc); + + public abstract void cancelRequestAttention(TopComponent tc); + + public abstract void addTopComponent(String name, Icon icon, TopComponent tc, String toolTip); + + public abstract void insertComponent(String name, Icon icon, Component comp, String toolTip, int position); + + public abstract void setTopComponents(TopComponent[] tcs, TopComponent selected); + + public abstract int getTabCount(); + + public abstract TopComponent[] getTopComponents(); + + public abstract TopComponent getTopComponentAt(int index); + + public abstract int indexOf(Component tc); + + public abstract void removeComponent(Component comp); + + public abstract void setTitleAt(int index, String title); + + public abstract void setIconAt(int index, Icon icon); + + public abstract void setToolTipTextAt(int index, String toolTip); + + public abstract void setSelectedComponent(Component comp); + + public abstract TopComponent getSelectedTopComponent(); + + public abstract void addChangeListener(ChangeListener listener); + + public abstract void removeChangeListener(ChangeListener listener); + + public abstract void addActionListener (ActionListener al); + + public abstract void removeActionListener (ActionListener al); + + public abstract void setActive(boolean active); + + public abstract int tabForCoordinate(Point p); + + public abstract Shape getIndicationForLocation(Point location, TopComponent startingTransfer, + Point startingPoint, boolean attachingPossible); + + public abstract Object getConstraintForLocation(Point location, boolean attachingPossible); + + public abstract Image createImageOfTab (int tabIndex); + + /** Accessor for visual component holding components */ + public abstract Component getComponent(); + + /** Allows tabbed implementors to speficy content of popup menu on tab + * with given index. Incoming actions are default set by winsys + */ + public abstract Action[] getPopupActions(Action[] defaultActions, int tabIndex); + + /** Returns bounds of tab with given index */ + public abstract Rectangle getTabBounds(int tabIndex); + + /** + * @return Bounds of the area which displays the tab headers. + * @since 2.32 + */ + public abstract Rectangle getTabsArea(); + + public abstract boolean isTransparent(); + + public abstract void setTransparent( boolean transparent ); + + /** Interface for simple accessing of Tabbed instance */ + public interface Accessor { + + public Tabbed getTabbed (); + + } // end of Accessor +} + Index: o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedComponentFactory.java --- o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedComponentFactory.java Base (BASE) +++ o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedComponentFactory.java Locally New @@ -0,0 +1,70 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ + +package org.netbeans.swing.tabcontrol.customtabs; + +import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer; + +/** + * Service Interface used by the Window System for creating NetBeans specific + * Tabbed Containers. Use this if you want to provide an alternative implementation + * (e.g. based on JTabbedPane). + * Implement to return your own implementation of Tabbed. Make it available by + * registering as a ServiceProvider using this annotation: + * @ServiceProvider(service=TabbedComponentFactory.class,supersedes="org.netbeans.core.windows.view.ui.DefaultTabbedComponentFactory" ) + * + * @since 1.33 + * @author S. Aubrecht + */ +public interface TabbedComponentFactory { +/** + * Create Tabbed implementation for given type. + * + * @param type Type of the container to be created. + * @param info Information from the window system that may affect the look and feel of the tab control. + * @return Tabbed accessor. + */ + public Tabbed.Accessor createTabbedComponent(TabbedType type, WinsysInfoForTabbedContainer info); + +} Index: o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedType.java --- o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedType.java Base (BASE) +++ o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/customtabs/TabbedType.java Locally New @@ -0,0 +1,93 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ +package org.netbeans.swing.tabcontrol.customtabs; + +import org.netbeans.swing.tabcontrol.TabbedContainer; + +/** + * Lists all possible types of tabbed container. + * + * @see TabbedContainer + * + * @since 1.33 + * @author S. Aubrecht + */ +public enum TabbedType { + /** + * Tabbed container showing non-document windows. + */ + View { + @Override + public int toInt() { + return TabbedContainer.TYPE_VIEW; + } + }, + /** + * Tabbed container showing document windows. + */ + Editor { + @Override + public int toInt() { + return TabbedContainer.TYPE_EDITOR; + } + }, + /** + * Tabbed container showing minimized windows. + */ + Sliding { + @Override + public int toInt() { + return TabbedContainer.TYPE_SLIDING; + } + }, + /** + * Tabbed container which uses toolbar-like component to switch active window. + */ + Toolbar { + @Override + public int toInt() { + return TabbedContainer.TYPE_TOOLBAR; + } + }; + + public abstract int toInt(); +} Index: o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java --- o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java Base (BASE) +++ o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java Locally Modified (Based On LOCAL) @@ -45,6 +45,7 @@ package org.netbeans.swing.tabcontrol; import java.awt.Component; +import org.netbeans.swing.tabcontrol.customtabs.TabbedComponentFactory; import org.openide.windows.TopComponent; @@ -56,6 +57,7 @@ * the position of the container or on maximization state. * * @see TabbedContainer#TabbedContainer + * @see TabbedComponentFactory * * @author S. Aubrecht */