diff --git a/o.n.swing.tabcontrol/apichanges.xml b/o.n.swing.tabcontrol/apichanges.xml
--- a/o.n.swing.tabcontrol/apichanges.xml
+++ b/o.n.swing.tabcontrol/apichanges.xml
@@ -108,6 +108,32 @@
Added new methods to support operations with window groups, e.g. close
+ window group or minimize window group.
+ Also the implementation of look and feels for all supported
+ platform switches to non-stretching tab layout.
+ The system property winsys.stretching_view_tabs
+ can be used to switch to stretching tab layout as implemented
+ in NetBeans version 7.0 and older.
+
displayer.postActionEvent()
.
+ * This method will create a TabActionEvent with the passed string as an
+ * action command, and cause the displayer to fire this event. It will
+ * return true if no listener on the displayer consumed the TabActionEvent;
+ * consuming the event is the way a listener can veto a change, or provide
+ * special handling for it.
+ *
+ * @param e The original tab action event.
+ * @return true if the event posted was not consumed by any listener
+ * @since 1.27
+ */
+ protected final boolean shouldPerformAction(TabActionEvent e) {
+ TabActionEvent evt = new TabActionEvent(displayer, e.getActionCommand(), e.getTabIndex(), e.getMouseEvent());
+ evt.setGroupName( e.getGroupName() );
+ displayer.postActionEvent(evt);
+ return !evt.isConsumed();
+ }
/**
* Instruct the UI to ensure that the tab at the given index is visible.
diff --git a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabbedContainer.java b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabbedContainer.java
--- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabbedContainer.java
+++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/TabbedContainer.java
@@ -218,6 +218,20 @@
public static final String COMMAND_DISABLE_AUTO_HIDE = "disableAutoHide"; //NOI18N
public static final String COMMAND_TOGGLE_TRANSPARENCY = "toggleTransparency"; //NOI18N
+ /**
+ * @since 1.27
+ */
+ public static final String COMMAND_MINIMIZE_GROUP = "minimizeGroup"; //NOI18N
+
+ /**
+ * @since 1.27
+ */
+ public static final String COMMAND_RESTORE_GROUP = "restoreGroup"; //NOI18N
+
+ /**
+ * @since 1.27
+ */
+ public static final String COMMAND_CLOSE_GROUP = "closeGroup"; //NOI18N
//XXX support supressing close buttons
diff --git a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java
--- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java
+++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/WinsysInfoForTabbedContainer.java
@@ -114,6 +114,22 @@
return true;
}
+ /**
+ * @return True if it is possible to minimize the whole group of TopCOmponents.
+ * @since 1.27
+ */
+ public boolean isModeSlidingEnabled() {
+ return true;
+ }
+
+ /**
+ * @return True if this container is currently slided out (and contains a single window)
+ * @since 1.27
+ */
+ public boolean isSlidedOutContainer() {
+ return false;
+ }
+
public static WinsysInfoForTabbedContainer getDefault( WinsysInfoForTabbed winsysInfo ) {
return new DefaultWinsysInfoForTabbedContainer( winsysInfo );
}
diff --git a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/event/TabActionEvent.java b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/event/TabActionEvent.java
--- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/event/TabActionEvent.java
+++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/event/TabActionEvent.java
@@ -108,12 +111,31 @@
public int getTabIndex() {
return tabIndex;
}
+
+ /**
+ * @return Name of window group this command applies to or null.
+ * @since 1.27
+ */
+ public String getGroupName() {
+ return groupName;
+ }
+
+ /**
+ * Set the name of window group this command applies to.
+ * @param groupName
+ * @since 1.27
+ */
+ public void setGroupName( String groupName ) {
+ this.groupName = groupName;
+ }
diff --git a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AbstractViewTabDisplayerUI.java b/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
+++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AbstractViewTabDisplayerUI.java
@@ -394,6 +410,28 @@
protected abstract void paintTabBackground(Graphics g, int index, int x,
int y, int width, int height);
+
+ /**
+ * Paint the background when using non-stretching tabs.
+ * @param g
+ * @param c
+ * @since 1.27
+ */
+ protected void paintDisplayerBackground( Graphics g, JComponent c ) {
+ int x;
+ int width;
+ if( !isUseStretchingTabs() ) {
+ x = 0;
+ width = c.getWidth();
+ if( dataModel.size() > 0 ) {
+ x += layoutModel.getX( dataModel.size()-1 );
+ x += layoutModel.getW( dataModel.size()-1 )-1;
+ width -= x;
+ }
+ paintTabBackground( g, -1, x, 0, width, c.getHeight());
+ paintTabBorder( g, -1, x, 0, width, c.getHeight());
+ }
+ }
diff --git a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButton.java b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButton.java
--- a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButton.java
+++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButton.java
@@ -73,6 +73,14 @@
public static final int ID_DROP_DOWN_BUTTON = 8;
public static final int ID_SCROLL_LEFT_BUTTON = 9;
public static final int ID_SCROLL_RIGHT_BUTTON = 10;
+ /**
+ * @since 1.27
+ */
+ public static final int ID_RESTORE_GROUP_BUTTON = 11;
+ /**
+ * @since 1.27
+ */
+ public static final int ID_SLIDE_GROUP_BUTTON = 12;
public static final int STATE_DEFAULT = 0;
public static final int STATE_PRESSED = 1;
diff --git a/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButtonFactory.java b/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
+++ b/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabControlButtonFactory.java
@@ -64,8 +64,8 @@
import org.netbeans.swing.tabcontrol.TabData;
import org.netbeans.swing.tabcontrol.TabDisplayer;
import org.netbeans.swing.tabcontrol.TabListPopupAction;
-import org.netbeans.swing.tabcontrol.WinsysInfoForTabbed;
import org.netbeans.swing.tabcontrol.WinsysInfoForTabbedContainer;
+import org.netbeans.swing.tabcontrol.event.TabActionEvent;
/**
* A factory to create tab control buttons.
@@ -94,6 +94,14 @@
}
/**
+ * Create button to close the whole window group.
+ * @since 1.27
+ */
+ public static TabControlButton createCloseGroupButton( TabDisplayer displayer ) {
+ return new CloseGroupButton( displayer );
+ }
+
+ /**
* Create default auto-hide/pin button. The button changes icons depending
* on the state of tab component.
*/
@@ -102,6 +110,27 @@
}
/**
+ * Create default minimize window group button.
+ * @since 1.27
+ */
+ public static TabControlButton createSlideGroupButton( TabDisplayer displayer ) {
+ return new SlideGroupButton( displayer );
+ }
+
+ /**
+ * Create button to restore a group of windows from minimized state.
+ * @param displayer
+ * @param groupName Name of the group of windows to un-minimize. When the default
+ * window system implementation is being used then the group name is the name
+ * of TopComponent Mode.
+ * @see org.openide.windows.Mode#getName()
+ * @since 1.27
+ */
+ public static TabControlButton createRestoreGroupButton( TabDisplayer displayer, String groupName ) {
+ return new RestoreGroupButton( displayer, groupName );
+ }
+
+ /**
* Create default maximize/restore button. The button changes icons depending
* on the state of tab component.
*/