comparing with https://saubrecht:***@hg.netbeans.org/core-main searching for changes changeset: 81942:f324ca62ccb1 tag: tip user: S. Aubrecht date: Fri Jun 06 13:32:16 2008 +0200 summary: 136636 - window system customizations diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/nbproject/project.properties --- a/core.windows/nbproject/project.properties Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/nbproject/project.properties Fri Jun 06 13:32:16 2008 +0200 @@ -39,4 +39,4 @@ javac.compilerargs=-Xlint:unchecked javac.source=1.5 -spec.version.base=2.11.0 +spec.version.base=2.12.0 diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/nbproject/project.xml --- a/core.windows/nbproject/project.xml Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/nbproject/project.xml Fri Jun 06 13:32:16 2008 +0200 @@ -80,7 +80,7 @@ - 1.8 + 1.13 diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/Bundle.properties --- a/core.windows/src/org/netbeans/core/windows/Bundle.properties Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/Bundle.properties Fri Jun 06 13:32:16 2008 +0200 @@ -43,3 +43,11 @@ # Name of the only (fake) workspace LBL_FakeWorkspace= +TopComponent.DragAndDrop.Enabled=true +TopComponent.Resizing.Enabled=true +TopComponent.Undocking.Enabled=true +TopComponent.Maximization.Enabled=true +TopComponent.Sliding.Enabled=true +Editor.TopComponent.Closing.Enabled=true +View.TopComponent.Closing.Enabled=true +Splitter.Respect.MinimumSize.Enabled=false diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/Switches.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.windows/src/org/netbeans/core/windows/Switches.java Fri Jun 06 13:32:16 2008 +0200 @@ -0,0 +1,98 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * 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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun 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.core.windows; + +import java.util.MissingResourceException; +import org.openide.util.NbBundle; + +/** + * Window system switches + * + * @author S. Aubrecht + */ +public final class Switches { + + public static boolean isTopComponentDragAndDropEnabled() { + return getSwitchValue( "TopComponent.DragAndDrop.Enabled", true ); //NOI18N + } + + public static boolean isTopComponentUndockingEnabled() { + return getSwitchValue( "TopComponent.Undocking.Enabled", true ); //NOI18N + } + + public static boolean isTopComponentSlidingEnabled() { + return getSwitchValue( "TopComponent.Sliding.Enabled", true ); //NOI18N + } + + public static boolean isTopComponentResizingEnabled() { + return getSwitchValue( "TopComponent.Resizing.Enabled", true ); //NOI18N + } + + public static boolean isViewTopComponentClosingEnabled() { + return getSwitchValue( "View.TopComponent.Closing.Enabled", true ); //NOI18N + } + + public static boolean isEditorTopComponentClosingEnabled() { + return getSwitchValue( "Editor.TopComponent.Closing.Enabled", true ); //NOI18N + } + + public static boolean isTopComponentMaximizationEnabled() { + return getSwitchValue( "TopComponent.Maximization.Enabled", true ); //NOI18N + } + + public static boolean isSplitterRespectMinimumSizeEnabled() { + return getSwitchValue( "Splitter.Respect.MinimumSize.Enabled", false ); //NOI18N + } + + private static boolean getSwitchValue( String switchName, boolean defaultValue ) { + boolean result = defaultValue; + try { + String resValue = NbBundle.getMessage(Switches.class, switchName ); + result = "true".equals( resValue.toLowerCase() ); //NOI18N + } catch( MissingResourceException mrE ) { + //ignore + } + return result; + } + + private Switches() {} +} diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/actions/ActionUtils.java --- a/core.windows/src/org/netbeans/core/windows/actions/ActionUtils.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/ActionUtils.java Fri Jun 06 13:32:16 2008 +0200 @@ -76,32 +76,50 @@ List actions = new ArrayList(); if(kind == Constants.MODE_KIND_EDITOR) { - actions.add(new CloseAllDocumentsAction(true)); - CloseAllButThisAction allBut = new CloseAllButThisAction(tc, true); - if (mode != null && mode.getOpenedTopComponents().size() == 1) { - allBut.setEnabled(false); + if( Switches.isEditorTopComponentClosingEnabled() ) { + actions.add(new CloseAllDocumentsAction(true)); + CloseAllButThisAction allBut = new CloseAllButThisAction(tc, true); + if (mode != null && mode.getOpenedTopComponents().size() == 1) { + allBut.setEnabled(false); + } + actions.add(allBut); + actions.add(null); // Separator } - actions.add(allBut); - actions.add(null); // Separator actions.add(new SaveDocumentAction(tc)); actions.add(new CloneDocumentAction(tc)); actions.add(null); // Separator - actions.add(new CloseWindowAction(tc)); - actions.add(new MaximizeWindowAction(tc)); - actions.add(new UndockWindowAction(tc)); - } else if (kind == Constants.MODE_KIND_VIEW) { - actions.add(new CloseWindowAction(tc)); - // #82053: don't include maximize action for floating (separate) views - if (mode.getState() == Constants.MODE_STATE_JOINED) { + if( Switches.isEditorTopComponentClosingEnabled() ) { + actions.add(new CloseWindowAction(tc)); + } + if( Switches.isTopComponentMaximizationEnabled() ) { actions.add(new MaximizeWindowAction(tc)); } - actions.add(new UndockWindowAction(tc)); - } else if (kind == Constants.MODE_KIND_SLIDING) { - actions.add(new CloseWindowAction(tc)); - if (mode.getState() == Constants.MODE_STATE_JOINED) { + if( Switches.isTopComponentUndockingEnabled() ) { + actions.add(new UndockWindowAction(tc)); + } + } else if (kind == Constants.MODE_KIND_VIEW) { + if( Switches.isViewTopComponentClosingEnabled() ) { + actions.add(new CloseWindowAction(tc)); + } + // #82053: don't include maximize action for floating (separate) views + if (mode.getState() == Constants.MODE_STATE_JOINED + && Switches.isTopComponentMaximizationEnabled() ) { actions.add(new MaximizeWindowAction(tc)); } - actions.add(new UndockWindowAction(tc)); + if( Switches.isTopComponentUndockingEnabled() ) { + actions.add(new UndockWindowAction(tc)); + } + } else if (kind == Constants.MODE_KIND_SLIDING) { + if( Switches.isViewTopComponentClosingEnabled() ) { + actions.add(new CloseWindowAction(tc)); + } + if (mode.getState() == Constants.MODE_STATE_JOINED + && Switches.isTopComponentMaximizationEnabled() ) { + actions.add(new MaximizeWindowAction(tc)); + } + if( Switches.isTopComponentUndockingEnabled() ) { + actions.add(new UndockWindowAction(tc)); + } } return actions.toArray(new Action[actions.size()]); diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/actions/CloseAllButThisAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/CloseAllButThisAction.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/CloseAllButThisAction.java Fri Jun 06 13:32:16 2008 +0200 @@ -55,6 +55,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.awt.event.KeyEvent; +import org.netbeans.core.windows.Switches; /** @@ -124,7 +125,7 @@ } setEnabled(mode != null && mode.getKind() == Constants.MODE_KIND_EDITOR - && areOtherDocs); + && areOtherDocs && Switches.isEditorTopComponentClosingEnabled()); } private TopComponent obtainTC () { diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/actions/CloseAllDocumentsAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/CloseAllDocumentsAction.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/CloseAllDocumentsAction.java Fri Jun 06 13:32:16 2008 +0200 @@ -48,6 +48,7 @@ import javax.swing.*; import org.netbeans.core.windows.Constants; import org.netbeans.core.windows.ModeImpl; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.WindowManagerImpl; import org.openide.windows.TopComponent; @@ -112,6 +113,8 @@ @Override public boolean isEnabled() { + if( !Switches.isEditorTopComponentClosingEnabled() ) + return false; WindowManagerImpl wmi = WindowManagerImpl.getInstance(); if (isContext) { TopComponent activeTC = TopComponent.getRegistry().getActivated(); diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/actions/CloseWindowAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/CloseWindowAction.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/CloseWindowAction.java Fri Jun 06 13:32:16 2008 +0200 @@ -50,6 +50,8 @@ import javax.swing.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import org.netbeans.core.windows.Switches; +import org.netbeans.core.windows.WindowManagerImpl; /** @@ -73,7 +75,11 @@ //a component that is not selected putValue(Action.NAME, NbBundle.getMessage(ActionUtils.class, "LBL_CloseWindowAction")); //NOI18N - setEnabled(true); + if( WindowManagerImpl.getInstance().isEditorTopComponent(tc) ) { + setEnabled(Switches.isEditorTopComponentClosingEnabled()); + } else { + setEnabled(Switches.isViewTopComponentClosingEnabled()); + } } @@ -96,7 +102,14 @@ } private void updateEnabled() { - setEnabled(TopComponent.getRegistry().getActivated() != null); + TopComponent activeTc = TopComponent.getRegistry().getActivated(); + if( null == activeTc ) + setEnabled(false); + if( WindowManagerImpl.getInstance().isEditorTopComponent(activeTc) ) { + setEnabled( Switches.isEditorTopComponentClosingEnabled() ); + } else { + setEnabled( Switches.isViewTopComponentClosingEnabled() ); + } } /** Overriden to share accelerator with diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/actions/MaximizeWindowAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/MaximizeWindowAction.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/MaximizeWindowAction.java Fri Jun 06 13:32:16 2008 +0200 @@ -54,6 +54,7 @@ import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import org.netbeans.core.windows.Switches; import org.openide.util.Mutex; @@ -163,7 +164,7 @@ TopComponent active = getTCToWorkWith(); boolean maximize; ModeImpl activeMode = (ModeImpl)wm.findMode(active); - if (activeMode == null) { + if (activeMode == null || !Switches.isTopComponentMaximizationEnabled() ) { String label = NbBundle.getMessage(MaximizeWindowAction.class, "CTL_MaximizeWindowAction"); //NOI18N putValue(Action.NAME, (isPopup ? Actions.cutAmpersand(label) : label)); setEnabled(false); diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/actions/UndockWindowAction.java --- a/core.windows/src/org/netbeans/core/windows/actions/UndockWindowAction.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/actions/UndockWindowAction.java Fri Jun 06 13:32:16 2008 +0200 @@ -45,6 +45,7 @@ import javax.swing.AbstractAction; import javax.swing.Action; import org.netbeans.core.windows.ModeImpl; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.WindowManagerImpl; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; @@ -114,7 +115,7 @@ public boolean isEnabled() { updateName(); - return getTC2WorkWith() != null; + return getTC2WorkWith() != null && Switches.isTopComponentUndockingEnabled(); } private void updateName() { diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java --- a/core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java Fri Jun 06 13:32:16 2008 +0200 @@ -139,7 +139,7 @@ /** Indicates whether the window drag and drop is enabled. */ public static boolean isDnDEnabled() { - return !Constants.SWITCH_DND_DISABLE; + return !Constants.SWITCH_DND_DISABLE && Switches.isTopComponentDragAndDropEnabled(); } /** Gets the only current instance of DragSource used in diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/DefaultSplitContainer.java Fri Jun 06 13:32:16 2008 +0200 @@ -75,9 +75,6 @@ panel = new ModePanel(this); panel.add(this.tabbedHandler.getComponent(), BorderLayout.CENTER); - - // To be able to move split dividers. - panel.setMinimumSize(new Dimension(1, 1)); } public void requestAttention (TopComponent tc) { diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/MultiSplitCell.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/MultiSplitCell.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/MultiSplitCell.java Fri Jun 06 13:32:16 2008 +0200 @@ -42,6 +42,7 @@ package org.netbeans.core.windows.view.ui; import java.awt.Component; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.view.ViewElement; /** @@ -57,6 +58,8 @@ private int requiredSize = -1; private boolean dirty = false; private boolean isHorizontalSplit; + + private static final int MINIMUM_POSSIBLE_SIZE = 10; MultiSplitCell( ViewElement view, double initialSplitWeight, boolean isHorizontalSplit ) { this.view = view; @@ -104,9 +107,16 @@ * result is a sum of minimum sizes of all children cells. */ int getMinimumSize() { - if( isHorizontalSplit ) - return getComponent().getMinimumSize().width; - return getComponent().getMinimumSize().height; + int result = MINIMUM_POSSIBLE_SIZE; + if( Switches.isSplitterRespectMinimumSizeEnabled() ) { + if( isHorizontalSplit ) + result = getComponent().getMinimumSize().width; + else + result = getComponent().getMinimumSize().height; + } + if( result < MINIMUM_POSSIBLE_SIZE ) + result = MINIMUM_POSSIBLE_SIZE; + return result; } int getRequiredSize() { diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/MultiSplitPane.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/MultiSplitPane.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/MultiSplitPane.java Fri Jun 06 13:32:16 2008 +0200 @@ -62,6 +62,7 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.UIManager; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.view.ViewElement; @@ -217,6 +218,7 @@ this.dividerSize = newDividerSize; } + @Override public Dimension getMinimumSize() { //the minimum size is a sum of minimum sizes of all children components Dimension d = new Dimension(); @@ -268,6 +270,8 @@ } public void mousePressed(MouseEvent e) { + if( !Switches.isTopComponentResizingEnabled() ) + return; MultiSplitDivider divider = dividerAtPoint( e.getPoint() ); if( null == divider ) return; @@ -292,6 +296,8 @@ private void switchCursor( MouseEvent e ) { + if( !Switches.isTopComponentResizingEnabled() ) + return; MultiSplitDivider divider = dividerAtPoint( e.getPoint() ); if( null == divider ) { setCursor( Cursor.getDefaultCursor() ); @@ -312,6 +318,7 @@ return null; } + @Override public void paint( Graphics g ) { super.paint(g); //paint split bars @@ -528,6 +535,7 @@ // ************************************************************************* // Accessibility + @Override public AccessibleContext getAccessibleContext() { if( accessibleContext == null ) { accessibleContext = new AccessibleMultiSplitPane(); @@ -542,6 +550,7 @@ } protected class AccessibleMultiSplitPane extends AccessibleJComponent { + @Override public AccessibleStateSet getAccessibleStateSet() { AccessibleStateSet states = super.getAccessibleStateSet(); if( isHorizontalSplit() ) { @@ -552,10 +561,12 @@ return states; } + @Override public AccessibleRole getAccessibleRole() { return AccessibleRole.SPLIT_PANE; } + @Override public Accessible getAccessibleAt( Point p ) { MultiSplitDivider divider = dividerAtPoint( p ); if( null != divider ) { @@ -564,6 +575,7 @@ return super.getAccessibleAt( p ); } + @Override public Accessible getAccessibleChild(int i) { int childrenCount = super.getAccessibleChildrenCount(); @@ -578,6 +590,7 @@ return divider; } + @Override public int getAccessibleChildrenCount() { return super.getAccessibleChildrenCount() + dividers.size(); } diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/TabbedHandler.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/TabbedHandler.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/TabbedHandler.java Fri Jun 06 13:32:16 2008 +0200 @@ -68,6 +68,7 @@ import java.awt.event.MouseEvent; import java.awt.event.AWTEventListener; import java.util.logging.Logger; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.view.ui.slides.SlideBar; import org.netbeans.core.windows.view.ui.slides.SlideBarActionEvent; import org.netbeans.core.windows.view.ui.slides.SlideOperationFactory; @@ -332,19 +333,21 @@ ActionUtils.closeAllExcept(tc, true); //Pin button handling here } else if (TabbedContainer.COMMAND_ENABLE_AUTO_HIDE.equals(cmd)) { - TopComponent tc = (TopComponent) tabbed.getTopComponentAt(tae.getTabIndex()); - // prepare slide operation - Component tabbedComp = tabbed.getComponent(); - - String side = WindowManagerImpl.getInstance().guessSlideSide(tc); - SlideOperation operation = SlideOperationFactory.createSlideIntoEdge( - tabbedComp, side, true); - operation.setStartBounds( - new Rectangle(tabbedComp.getLocationOnScreen(), tabbedComp.getSize())); - operation.prepareEffect(); - - modeView.getController().userEnabledAutoHide(modeView, tc); - modeView.getController().userTriggeredSlideIntoEdge(modeView, operation); + if( Switches.isTopComponentSlidingEnabled() ) { + TopComponent tc = (TopComponent) tabbed.getTopComponentAt(tae.getTabIndex()); + // prepare slide operation + Component tabbedComp = tabbed.getComponent(); + + String side = WindowManagerImpl.getInstance().guessSlideSide(tc); + SlideOperation operation = SlideOperationFactory.createSlideIntoEdge( + tabbedComp, side, true); + operation.setStartBounds( + new Rectangle(tabbedComp.getLocationOnScreen(), tabbedComp.getSize())); + operation.prepareEffect(); + + modeView.getController().userEnabledAutoHide(modeView, tc); + modeView.getController().userTriggeredSlideIntoEdge(modeView, operation); + } } } else if (e instanceof SlideBarActionEvent) { // slide bar commands @@ -424,7 +427,8 @@ TopComponent tc = tab.getTopComponentAt(tae.getTabIndex()); // perform action MaximizeWindowAction mwa = new MaximizeWindowAction(tc); - mwa.actionPerformed(tae); + if( mwa.isEnabled() ) + mwa.actionPerformed(tae); } /** Well, we can't totally get rid of AWT event listeners - this is what diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/slides/CommandManager.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/slides/CommandManager.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/slides/CommandManager.java Fri Jun 06 13:32:16 2008 +0200 @@ -281,7 +281,7 @@ private TabbedContainer getSlidedTabContainer () { if (slidedTabContainer == null) { TabDataModel slidedCompModel = new DefaultTabDataModel(); - slidedTabContainer = new TabbedContainer(slidedCompModel, TabbedContainer.TYPE_VIEW, slideBar); + slidedTabContainer = new TabbedContainer(slidedCompModel, TabbedContainer.TYPE_VIEW, slideBar.createWinsysInfo()); slidedTabContainer.addActionListener(this); Border b = (Border) UIManager.get ("floatingBorder"); //NOI18N if (b != null) { diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/slides/SlideBar.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/slides/SlideBar.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/slides/SlideBar.java Fri Jun 06 13:32:16 2008 +0200 @@ -60,6 +60,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.ListDataEvent; import org.netbeans.core.windows.Constants; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.WindowManagerImpl; import org.netbeans.core.windows.view.ui.Tabbed; import org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter; @@ -69,6 +70,7 @@ import org.netbeans.swing.tabcontrol.TabDisplayer; import org.netbeans.swing.tabcontrol.TabbedContainer; import org.netbeans.swing.tabcontrol.WinsysInfoForTabbed; +import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer; import org.netbeans.swing.tabcontrol.event.ComplexListDataEvent; import org.netbeans.swing.tabcontrol.event.ComplexListDataListener; import org.openide.windows.TopComponent; @@ -84,7 +86,7 @@ * @author Dafe Simonek */ public final class SlideBar extends Box implements ComplexListDataListener, - SlideBarController, Tabbed.Accessor, WinsysInfoForTabbed, ChangeListener { + SlideBarController, Tabbed.Accessor, ChangeListener { /** Command indicating request for slide in (appear) of sliding component */ public static final String COMMAND_SLIDE_IN = "slideIn"; //NOI18N @@ -369,19 +371,34 @@ return tabbed; } - /********* implementation of WinsysInfoForTabbed **************/ + /********* implementation of WinsysInfoForTabbedContainer **************/ - public Object getOrientation(Component comp) { - if (WindowManagerImpl.getInstance().getEditorAreaState() != Constants.EDITOR_AREA_JOINED) { - return TabDisplayer.ORIENTATION_INVISIBLE; - } - return TabDisplayer.ORIENTATION_CENTER; + public WinsysInfoForTabbedContainer createWinsysInfo() { + return new SlidedWinsysInfoForTabbedContainer(); } - public boolean inMaximizedMode(Component comp) { - return TabbedAdapter.isInMaximizedMode(comp); + private class SlidedWinsysInfoForTabbedContainer extends WinsysInfoForTabbedContainer { + public Object getOrientation(Component comp) { + if (WindowManagerImpl.getInstance().getEditorAreaState() != Constants.EDITOR_AREA_JOINED) { + return TabDisplayer.ORIENTATION_INVISIBLE; + } + return TabDisplayer.ORIENTATION_CENTER; + } + + public boolean inMaximizedMode(Component comp) { + return TabbedAdapter.isInMaximizedMode(comp); + } + + @Override + public boolean isTopComponentSlidingEnabled() { + return Switches.isTopComponentSlidingEnabled(); + } + + @Override + public boolean isTopComponentClosingEnabled() { + return Switches.isViewTopComponentClosingEnabled(); + } } - /*************** non public stuff **************************/ diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/slides/TabbedSlideAdapter.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/slides/TabbedSlideAdapter.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/slides/TabbedSlideAdapter.java Fri Jun 06 13:32:16 2008 +0200 @@ -59,6 +59,7 @@ import javax.swing.SingleSelectionModel; import javax.swing.event.ChangeListener; import org.netbeans.core.windows.Constants; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.WindowManagerImpl; import org.netbeans.core.windows.actions.ActionUtils; import org.netbeans.core.windows.view.ui.Tabbed; @@ -372,9 +373,9 @@ /** Add action for disabling slide */ public Action[] getPopupActions(Action[] defaultActions, int tabIndex) { boolean isMDI = WindowManagerImpl.getInstance().getEditorAreaState() == Constants.EDITOR_AREA_JOINED; - Action[] result = new Action[defaultActions.length + (isMDI ? 2 : 0)]; + Action[] result = new Action[defaultActions.length + (isMDI && Switches.isTopComponentSlidingEnabled() ? 2 : 0)]; System.arraycopy(defaultActions, 0, result, 0, defaultActions.length); - if (isMDI) { + if (isMDI && Switches.isTopComponentSlidingEnabled() ) { result[defaultActions.length] = new ActionUtils.AutoHideWindowAction(slideBar, tabIndex, true); result[defaultActions.length+1] = diff -r 95cf9ddea4af -r f324ca62ccb1 core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedAdapter.java --- a/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedAdapter.java Mon Jun 02 13:14:39 2008 +0200 +++ b/core.windows/src/org/netbeans/core/windows/view/ui/tabcontrol/TabbedAdapter.java Fri Jun 06 13:32:16 2008 +0200 @@ -56,7 +56,6 @@ import org.netbeans.swing.tabcontrol.plaf.EqualPolygon; import org.openide.util.WeakListeners; import org.openide.windows.TopComponent; -import java.awt.Image; import org.netbeans.core.windows.view.ui.slides.SlideController; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -65,9 +64,10 @@ import java.util.ArrayList; import java.util.Arrays; import org.netbeans.core.windows.ModeImpl; +import org.netbeans.core.windows.Switches; import org.netbeans.core.windows.actions.ActionUtils; import org.netbeans.swing.tabcontrol.TabDisplayer; -import org.netbeans.swing.tabcontrol.WinsysInfoForTabbed; +import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer; import org.netbeans.swing.tabcontrol.event.TabActionEvent; import org.openide.util.ChangeSupport; @@ -90,7 +90,7 @@ /** Creates a new instance of TabbedAdapter */ public TabbedAdapter (int type) { - super (null, type, new WinsysInfo()); + super (null, type, new WinsysInfo(type)); getSelectionModel().addChangeListener(new ChangeListener() { public void stateChanged (ChangeEvent ce) { int idx = getSelectionModel().getSelectedIndex(); @@ -128,7 +128,7 @@ "RequestAttention on component unknown to container: " + tc); //NOI18N } } - + public void cancelRequestAttention (TopComponent tc) { int idx = indexOf(tc); if (idx >= 0) { @@ -460,7 +460,7 @@ public Action[] getPopupActions(Action[] defaultActions, int tabIndex) { boolean isDocked = WindowManagerImpl.getInstance().isDocked(getTopComponentAt(tabIndex)); // no auto hide for editors and floating views - if (TabbedContainer.TYPE_EDITOR == getType() || !isDocked) { + if (TabbedContainer.TYPE_EDITOR == getType() || !isDocked || !Switches.isTopComponentSlidingEnabled()) { return defaultActions; } int actionCount = defaultActions.length; @@ -509,8 +509,12 @@ /********* implementation of WinsysInfoForTabbed ********/ - static class WinsysInfo implements WinsysInfoForTabbed { - + static class WinsysInfo extends WinsysInfoForTabbedContainer { + private int containerType; + public WinsysInfo( int containerType ) { + this.containerType = containerType; + } + public Object getOrientation (Component comp) { WindowManagerImpl wmi = WindowManagerImpl.getInstance(); // don't show pin button in separate views @@ -535,6 +539,19 @@ public boolean inMaximizedMode (Component comp) { return isInMaximizedMode(comp); } + + @Override + public boolean isTopComponentSlidingEnabled() { + return Switches.isTopComponentSlidingEnabled(); + } + + @Override + public boolean isTopComponentClosingEnabled() { + if( containerType == Constants.MODE_KIND_EDITOR ) + return Switches.isEditorTopComponentClosingEnabled(); + else + return Switches.isViewTopComponentClosingEnabled(); + } } // end of LocInfo diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/apichanges.xml --- a/o.n.swing.tabcontrol/apichanges.xml Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/apichanges.xml Fri Jun 06 13:32:16 2008 +0200 @@ -104,6 +104,26 @@ + + + + Added new abstract class WinsysInfoForTabbedContainer which can + adjust some tabbed container properties and behavior. + + + + + +

The new abstract class WinsysInfoForTabbedContainer is a replacement + for interface WinsysInfoForTabbed. The new class implements the old interface + and also contains method informing the tabbed containers about the state + of some of window system switches that may disable some of its functionality. + (For example disable window sliding). +

+
+ + +
diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/manifest.mf --- a/o.n.swing.tabcontrol/manifest.mf Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/manifest.mf Fri Jun 06 13:32:16 2008 +0200 @@ -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.12 +OpenIDE-Module-Specification-Version: 1.13 AutoUpdate-Essential-Module: true diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabDisplayer.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabDisplayer.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabDisplayer.java Fri Jun 06 13:32:16 2008 +0200 @@ -221,6 +221,7 @@ private transient List actionListenerList; private WinsysInfoForTabbed winsysInfo = null; + private WinsysInfoForTabbedContainer containerWinsysInfo = null; @Deprecated private LocationInformer locationInformer = null; @@ -249,9 +250,16 @@ } /** + * Depreacated, please use constructor with WinsysInfoForTabbedContainer param. + */ + @Deprecated + public TabDisplayer(TabDataModel model, int type, WinsysInfoForTabbed winsysInfo) { + this( model, type, WinsysInfoForTabbedContainer.getDefault(winsysInfo) ); + } + /** * Creates a new instance of TabDisplayer */ - public TabDisplayer(TabDataModel model, int type, WinsysInfoForTabbed winsysInfo) { + public TabDisplayer(TabDataModel model, int type, WinsysInfoForTabbedContainer containerWinsysInfo) { switch (type) { case TYPE_VIEW: case TYPE_EDITOR: @@ -263,7 +271,9 @@ } this.model = model; this.type = type; - this.winsysInfo = winsysInfo; + this.winsysInfo = containerWinsysInfo; + this.containerWinsysInfo = containerWinsysInfo; + showClose &= containerWinsysInfo.isTopComponentClosingEnabled(); putClientProperty (PROP_ORIENTATION, ORIENTATION_NORTH); initialized = true; updateUI(); @@ -552,8 +562,13 @@ return getUI().tabForCoordinate(p); } + @Deprecated public WinsysInfoForTabbed getWinsysInfo() { return winsysInfo; + } + + public WinsysInfoForTabbedContainer getContainerWinsysInfo() { + return containerWinsysInfo; } @Deprecated diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabbedContainer.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabbedContainer.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabbedContainer.java Fri Jun 06 13:32:16 2008 +0200 @@ -292,6 +292,9 @@ /** Winsys info needed for tab control or null if not available */ private WinsysInfoForTabbed winsysInfo = null; + + /** Winsys info needed for tab control or null if not available */ + private WinsysInfoForTabbedContainer containerWinsysInfo = null; @Deprecated private LocationInformer locationInformer = null; @@ -333,10 +336,18 @@ } /** + * Deprecated, please use constructor with WinsysInfoForTabbed instead. + */ + @Deprecated + public TabbedContainer(TabDataModel model, int type, WinsysInfoForTabbed winsysInfo) { + this( model, type, WinsysInfoForTabbedContainer.getDefault( winsysInfo ) ); + } + + /** * Create a new pane with the specified model, displayer type and extra * information from winsys */ - public TabbedContainer(TabDataModel model, int type, WinsysInfoForTabbed winsysInfo) { + public TabbedContainer(TabDataModel model, int type, WinsysInfoForTabbedContainer winsysInfo) { switch (type) { case TYPE_VIEW: case TYPE_EDITOR: @@ -352,6 +363,7 @@ this.model = model; this.type = Boolean.getBoolean("nb.tabcontrol.alltoolbar") ? TYPE_TOOLBAR : type; this.winsysInfo = winsysInfo; + this.containerWinsysInfo = winsysInfo; initialized = true; updateUI(); //A few borders and such will check this @@ -791,10 +803,15 @@ return locationInformer; } + @Deprecated public WinsysInfoForTabbed getWinsysInfo() { return winsysInfo; } + public WinsysInfoForTabbedContainer getContainerWinsysInfo() { + return containerWinsysInfo; + } + static { //Support for experimenting with different content policies in NetBeans String s = System.getProperty("nb.tabcontrol.contentpolicy"); //NOI18N diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbed.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbed.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbed.java Fri Jun 06 13:32:16 2008 +0200 @@ -69,5 +69,4 @@ * false otherwise */ public boolean inMaximizedMode (Component comp); - } diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java Fri Jun 06 13:32:16 2008 +0200 @@ -0,0 +1,88 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * 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. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun 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; + +import java.awt.Component; + + +/** + * Interface that provides external information (provided by window system) + * that TabbedContainers need to know in order to work fully.

+ * + * Tab control uses info to provide for example tab buttons reacting on + * the position of the container or on maximization state. + * + * @see TabbedContainer#TabbedContainer + * + * @author S. Aubrecht + */ +public abstract class WinsysInfoForTabbedContainer implements WinsysInfoForTabbed { + + public boolean isTopComponentSlidingEnabled() { + return true; + } + + public boolean isTopComponentClosingEnabled() { + return true; + } + + public static WinsysInfoForTabbedContainer getDefault( WinsysInfoForTabbed winsysInfo ) { + return new DefaultWinsysInfoForTabbedContainer( winsysInfo ); + } + + private static class DefaultWinsysInfoForTabbedContainer extends WinsysInfoForTabbedContainer { + + private WinsysInfoForTabbed delegate; + + public DefaultWinsysInfoForTabbedContainer( WinsysInfoForTabbed winsysInfo ) { + this.delegate = winsysInfo; + } + + public Object getOrientation(Component comp) { + return null == delegate ? TabDisplayer.ORIENTATION_CENTER : delegate.getOrientation(comp); + } + + public boolean inMaximizedMode(Component comp) { + return null == delegate ? false : delegate.inMaximizedMode(comp); + } + } +} diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AbstractViewTabDisplayerUI.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AbstractViewTabDisplayerUI.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AbstractViewTabDisplayerUI.java Fri Jun 06 13:32:16 2008 +0200 @@ -167,7 +167,8 @@ tabComponent = tab.getComponent(); } btnAutoHidePin.setVisible( tabComponent != null - && !TabDisplayer.ORIENTATION_INVISIBLE.equals( displayer.getWinsysInfo().getOrientation( tabComponent ) ) ); + && !TabDisplayer.ORIENTATION_INVISIBLE.equals( displayer.getContainerWinsysInfo().getOrientation( tabComponent ) ) + && displayer.getContainerWinsysInfo().isTopComponentSlidingEnabled() ); } protected void installControlButtons() { @@ -199,7 +200,7 @@ // } //create autohide/pin button - if( null != displayer.getWinsysInfo() ) { + if( null != displayer.getContainerWinsysInfo() ) { btnAutoHidePin = TabControlButtonFactory.createSlidePinButton( displayer ); buttonsPanel.add( btnAutoHidePin ); @@ -210,16 +211,19 @@ width += icon.getIconWidth(); } - //create close button - btnClose = TabControlButtonFactory.createCloseButton( displayer ); - buttonsPanel.add( btnClose ); + if( null == displayer.getContainerWinsysInfo() + || displayer.getContainerWinsysInfo().isTopComponentClosingEnabled() ) { + //create close button + btnClose = TabControlButtonFactory.createCloseButton( displayer ); + buttonsPanel.add( btnClose ); - Icon icon = btnClose.getIcon(); - if( 0 != width ) - width += ICON_X_PAD; - btnClose.setBounds( width, 0, icon.getIconWidth(), icon.getIconHeight() ); - width += icon.getIconWidth(); - height = icon.getIconHeight(); + Icon icon = btnClose.getIcon(); + if( 0 != width ) + width += ICON_X_PAD; + btnClose.setBounds( width, 0, icon.getIconWidth(), icon.getIconHeight() ); + width += icon.getIconWidth(); + height = icon.getIconHeight(); + } Dimension size = new Dimension( width, height ); buttonsPanel.setMinimumSize( size ); @@ -520,6 +524,22 @@ } return -1; + } + + @Override + public Dimension getMinimumSize(JComponent c) { + int index = displayer.getSelectionModel().getSelectedIndex(); + TabDataModel model = displayer.getModel(); + if( index < 0 || index >= model.size() ) + index = 0; + Dimension minSize = null; + if( index >= model.size() ) + minSize = new Dimension( 100, 10 ); + else + minSize = model.getTab(index).getComponent().getMinimumSize(); + minSize.width = Math.max(minSize.width, 100); + minSize.height = Math.max(minSize.height, 10); + return minSize; } protected int createRepaintPolicy () { diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicScrollingTabDisplayerUI.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicScrollingTabDisplayerUI.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicScrollingTabDisplayerUI.java Fri Jun 06 13:32:16 2008 +0200 @@ -53,6 +53,7 @@ import java.awt.event.*; import java.awt.image.BufferedImage; import java.lang.ref.SoftReference; +import org.netbeans.swing.tabcontrol.TabDataModel; /** * Base class for tab displayers that have scrollable tabs. @@ -188,7 +189,7 @@ height = Math.max ( height, prefDim.height ); //maximize / restore button - if( null != displayer.getWinsysInfo() ) { + if( null != displayer.getContainerWinsysInfo() ) { width += 3; btnMaximizeRestore = TabControlButtonFactory.createMaximizeRestoreButton( displayer, isGTK ); buttonsPanel.add( btnMaximizeRestore ); @@ -242,10 +243,6 @@ protected void installControlButtons() { displayer.setLayout(createLayout()); displayer.add(getControlButtons()); - } - - public Dimension getMinimumSize(JComponent c) { - return getPreferredSize(c); } /** @@ -375,6 +372,22 @@ return new Rectangle( parent.getWidth()-c.getWidth(), 0, c.getWidth(), c.getHeight() ); } + @Override + public Dimension getMinimumSize(JComponent c) { + int index = displayer.getSelectionModel().getSelectedIndex(); + TabDataModel model = displayer.getModel(); + if( index < 0 || index >= model.size() ) + index = 0; + Dimension minSize = null; + if( index >= model.size() ) + minSize = new Dimension( 100, 10 ); + else + minSize = model.getTab(index).getComponent().getMinimumSize(); + minSize.width = Math.max(minSize.width, 100); + minSize.height = Math.max(minSize.height, 10); + return minSize; + } + /** * Layout manager for the tab displayer to make sure that control buttons * are always displayed at the end of the tab list. @@ -392,7 +405,7 @@ } public Dimension minimumLayoutSize(Container parent) { - return getPreferredSize((JComponent) parent); + return getMinimumSize((JComponent) parent); } public Dimension preferredLayoutSize(Container parent) { diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicTabDisplayerUI.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicTabDisplayerUI.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicTabDisplayerUI.java Fri Jun 06 13:32:16 2008 +0200 @@ -141,6 +141,9 @@ super.install(); tabState = createTabState(); defaultRenderer = createDefaultRenderer(); + if( null != displayer.getContainerWinsysInfo() ) { + defaultRenderer.setShowCloseButton( displayer.getContainerWinsysInfo().isTopComponentClosingEnabled() ); + } layoutModel.setPadding (defaultRenderer.getPadding()); pixelsToAdd = defaultRenderer.getPixelsToAddToSelection(); repaintPolicy = createRepaintPolicy(); diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/DefaultTabbedContainerUI.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/DefaultTabbedContainerUI.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/DefaultTabbedContainerUI.java Fri Jun 06 13:32:16 2008 +0200 @@ -88,7 +88,7 @@ import org.netbeans.swing.tabcontrol.TabDisplayer; import org.netbeans.swing.tabcontrol.TabbedContainer; import org.netbeans.swing.tabcontrol.TabbedContainerUI; -import org.netbeans.swing.tabcontrol.WinsysInfoForTabbed; +import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer; import org.netbeans.swing.tabcontrol.event.ArrayDiff; import org.netbeans.swing.tabcontrol.event.ComplexListDataEvent; import org.netbeans.swing.tabcontrol.event.ComplexListDataListener; @@ -427,7 +427,7 @@ */ protected TabDisplayer createTabDisplayer() { TabDisplayer result = null; - WinsysInfoForTabbed winsysInfo = container.getWinsysInfo(); + WinsysInfoForTabbedContainer winsysInfo = container.getContainerWinsysInfo(); if (winsysInfo != null) { result = new TabDisplayer( container.getModel(), container.getType(), winsysInfo); diff -r 95cf9ddea4af -r f324ca62ccb1 o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButtonFactory.java --- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButtonFactory.java Mon Jun 02 13:14:39 2008 +0200 +++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButtonFactory.java Fri Jun 06 13:32:16 2008 +0200 @@ -62,6 +62,7 @@ import org.netbeans.swing.tabcontrol.TabDisplayer; import org.netbeans.swing.tabcontrol.TabListPopupAction; import org.netbeans.swing.tabcontrol.WinsysInfoForTabbed; +import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer; /** * A factory to create tab control buttons. @@ -151,11 +152,12 @@ return TabDisplayer.COMMAND_ENABLE_AUTO_HIDE; } + @Override protected int getButtonId() { int retValue = TabControlButton.ID_PIN_BUTTON; Component currentTab = getActiveTab( getTabDisplayer() ); if( null != currentTab ) { - WinsysInfoForTabbed winsysInfo = getTabDisplayer().getWinsysInfo(); + WinsysInfoForTabbedContainer winsysInfo = getTabDisplayer().getContainerWinsysInfo(); if( null != winsysInfo ) { Object orientation = winsysInfo.getOrientation( currentTab ); if( TabDisplayer.ORIENTATION_EAST.equals( orientation ) ) @@ -189,11 +191,12 @@ return TabDisplayer.COMMAND_MAXIMIZE; } + @Override protected int getButtonId() { int retValue = TabControlButton.ID_MAXIMIZE_BUTTON; Component currentTab = getActiveTab( getTabDisplayer() ); if( null != currentTab ) { - WinsysInfoForTabbed winsysInfo = getTabDisplayer().getWinsysInfo(); + WinsysInfoForTabbedContainer winsysInfo = getTabDisplayer().getContainerWinsysInfo(); if( null != winsysInfo ) { if( winsysInfo.inMaximizedMode( currentTab ) ) { retValue = TabControlButton.ID_RESTORE_BUTTON; diff -r 95cf9ddea4af -r f324ca62ccb1 openide.windows/apichanges.xml --- a/openide.windows/apichanges.xml Mon Jun 02 13:14:39 2008 +0200 +++ b/openide.windows/apichanges.xml Fri Jun 06 13:32:16 2008 +0200 @@ -47,6 +47,32 @@ Window System API + + + +

Added a group of resource bundle properties for customization + of window system behavior. + + + + + +

There is a set of new properties defined in resource bundle which platform + developers can use to customize the behavior of NetBeans' window system:

+
    +
  • Disable window drag and drop
  • +
  • Disable window undocking (floating windows)
  • +
  • Disable window sliding
  • +
  • Disable window resizing
  • +
  • Disable window maximization
  • +
  • Disable closing of non-editor windows (views)
  • +
  • Disable closing of editor windows
  • +
  • Force window system into respecting window minimum sizes when resizing windows using splitter bars
  • +
+

The features above can be turned on/off simply by branding of core.windows module.

+
+ +
diff -r 95cf9ddea4af -r f324ca62ccb1 openide.windows/arch.xml --- a/openide.windows/arch.xml Mon Jun 02 13:14:39 2008 +0200 +++ b/openide.windows/arch.xml Fri Jun 06 13:32:16 2008 +0200 @@ -578,6 +578,73 @@ will receive the keystroke.

+ + + Name of resource bundle property which disables the drag and drop of window + TopComponents when its value is set to false, the default value is true. + The property value can be adjusted by branding of org.netbeans.core.windows module. + + + + Name of resource bundle property which disables undocking of window + TopComponents when its value is set to false, the default value is true. + When this feature is disabled then there is no 'Undock' item in TopComponent popup menu + and 'Undock Window' action the main menu is disabled. + The property value can be adjusted by branding of org.netbeans.core.windows module. + + + + Name of resource bundle property which disables sliding of window + TopComponents when its value is set to false, the default value is true. + When this feature is disabled then there is no 'Minimize Window' item in TopComponent popup menu + and also the Minimize button in TopComponent's header is hidden. + The property value can be adjusted by branding of org.netbeans.core.windows module. + + + + Name of resource bundle property which disables resizing of window + TopComponents when its value is set to false, the default value is true. + When this feature is disabled then it is not possible to drag splitter bars + to change the size of TopComponents. + The property value can be adjusted by branding of org.netbeans.core.windows module. + + + + Name of resource bundle property which disables closing of view TopComponents (non-editor windows) + when its value is set to false, the default value is true. + When this feature is disabled then there is no 'Close Window' item in view's popup menu, + there is no close button in TopComponent's header and also 'Close Window' action in + the main menu is disabled when a view TopComponent is activated. + The property value can be adjusted by branding of org.netbeans.core.windows module. + + + + Name of resource bundle property which disables closing of editor TopComponents (document windows) + when its value is set to false, the default value is true. + When this feature is disabled then there are no 'Close Window', 'Close All Documents' and + 'Close Other Documents' items in editor's popup menu, + there is no close button in editor's header and also Close actions in + the main menu are disabled when an editor TopComponent is activated. + The property value can be adjusted by branding of org.netbeans.core.windows module. + + + + Name of resource bundle property which disables maximization of TopComponents + when its value is set to false, the default value is true. + When this feature is disabled then there is no 'Maximize Window' item + in TopComponent's popup menu and also 'Maximize Window' action in + the main menu is disabled. + The property value can be adjusted by branding of org.netbeans.core.windows module. + + + + Name of resource bundle property which forces splitter to respect TopComponent + minimum size when resizing when its value is set to true, + the default value is false. + When this feature is enabled then the splitter bars will not move beyond + the minimum size of its TopComponents. + The property value can be adjusted by branding of org.netbeans.core.windows module. + diff -r 95cf9ddea4af -r f324ca62ccb1 openide.windows/manifest.mf --- a/openide.windows/manifest.mf Mon Jun 02 13:14:39 2008 +0200 +++ b/openide.windows/manifest.mf Fri Jun 06 13:32:16 2008 +0200 @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.windows -OpenIDE-Module-Specification-Version: 6.22 +OpenIDE-Module-Specification-Version: 6.23 OpenIDE-Module-Localizing-Bundle: org/openide/windows/Bundle.properties AutoUpdate-Essential-Module: true