# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: D:\src\nb.55\core # 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: output2/src/org/netbeans/core/output2/resources/vista_close_enabled.png *** D:\src\nb.55\core\output2\src\org\netbeans\core\output2\resources\vista_close_enabled.png No Base Revision --- D:\src\nb.55\core\output2\src\org\netbeans\core\output2\resources\vista_close_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/plaf/src/org/netbeans/swing/plaf/resources/vista_mini_close_over.png *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_mini_close_over.png No Base Revision --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_mini_close_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_maximize_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_maximize_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_maximize_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slideright_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideright_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideright_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_pin_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_pin_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_pin_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slideleft_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideleft_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideleft_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_popup_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_popup_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_popup_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicTabDisplayerUI.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\BasicTabDisplayerUI.java Base (1.10.26.1.2.1) --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\BasicTabDisplayerUI.java Locally Modified (Based On 1.10.26.1.2.1) *************** *** 16,39 **** * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.swing.tabcontrol.plaf; ! import javax.swing.event.ListDataEvent; ! import org.netbeans.swing.tabcontrol.TabData; ! import org.netbeans.swing.tabcontrol.TabDisplayer; ! import org.netbeans.swing.tabcontrol.TabbedContainer; ! ! import javax.swing.*; ! import javax.swing.event.ChangeEvent; ! import javax.swing.event.ChangeListener; ! import java.awt.*; ! import java.awt.event.*; import java.awt.geom.Area; import java.awt.image.BufferedImage; import java.beans.PropertyChangeListener; import org.netbeans.swing.tabcontrol.event.ComplexListDataEvent; --- 16,50 ---- * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun * Microsystems, Inc. All Rights Reserved. */ + package org.netbeans.swing.tabcontrol.plaf; ! import java.awt.Graphics; ! import java.awt.Graphics2D; ! import java.awt.GraphicsConfiguration; ! import java.awt.GraphicsEnvironment; ! import java.awt.Image; ! import java.awt.Insets; ! import java.awt.Point; ! import java.awt.Polygon; ! import java.awt.Rectangle; ! import java.awt.Shape; ! import java.awt.event.MouseEvent; ! import java.awt.event.MouseListener; ! import java.awt.event.MouseMotionListener; ! import java.awt.event.MouseWheelEvent; ! import java.awt.event.MouseWheelListener; import java.awt.geom.Area; import java.awt.image.BufferedImage; import java.beans.PropertyChangeListener; + import javax.swing.JComponent; + import javax.swing.JLabel; + import javax.swing.SwingUtilities; + import javax.swing.event.ChangeEvent; + import javax.swing.event.ChangeListener; + import javax.swing.event.ListDataEvent; + import org.netbeans.swing.tabcontrol.TabData; + import org.netbeans.swing.tabcontrol.TabDisplayer; import org.netbeans.swing.tabcontrol.event.ComplexListDataEvent; /** *************** *** 39,51 **** * and data from various objects relating to the tab displayer, which it creates and * installs. Basically, the things that are involved are: * ! * The usage pattern of this class is similar to other {@link javax.swing.plaf.ComponentUI} subclasses - ! * {@link javax.swing.plaf.ComponentUI#installUI} ! * is called via {@link JComponent#updateUI}. installUI initializes protected fields which * subclasses will need, in a well defined way; abstract methods are provided for subclasses to * create these objects (such as the things listed above), and convenience implementations of some ! * are provided. Under no circumstances should subclasses modify these protected fields - * due to the circuitousness of the way Swing installs UIs, they cannot be declared final, but should * be treated as read-only. *

* The goal of this class is to make it quite easy to implement new appearances ! * for tabs: To create a new appearance, implement a {@link TabCellRenderer} that can * paint individual tabs as desired. This is made even easier via the ! * {@link TabPainter} interface - simply create the painting logic needed there. Then ! * subclass BasicTabDisplayerUI and include any painting logic for the background, ! * scroll buttons, etc. needed. A good example is {@link AquaEditorTabDisplayerUI}. * */ public abstract class BasicTabDisplayerUI extends AbstractTabDisplayerUI { *************** *** 510,515 **** --- 524,535 ---- | TabState.REPAINT_ON_MOUSE_PRESSED; } + /** + * @return Rectangle of the tab to be repainted + */ + protected Rectangle getTabRectForRepaint( int tab, Rectangle rect ) { + return getTabRect( tab, rect ); + } protected class BasicTabState extends TabState { *************** *** 544,550 **** if (tab == -1 || tab > displayer.getModel().size()) { return; } ! getTabRect(tab, scratch); scratch.y = 0; scratch.height = displayer.getHeight(); displayer.repaint(scratch.x, scratch.y, scratch.width, --- 564,570 ---- if (tab == -1 || tab > displayer.getModel().size()) { return; } ! getTabRectForRepaint(tab, scratch); scratch.y = 0; scratch.height = displayer.getHeight(); displayer.repaint(scratch.x, scratch.y, scratch.width, *************** *** 756,762 **** * TabState object, so it can update which tab indices are flashing in * "attention" mode, if any. */ ! protected class BasicModelListener extends ModelListener { public void contentsChanged(ListDataEvent e) { super.contentsChanged(e); tabState.contentsChanged(e); --- 776,782 ---- * TabState object, so it can update which tab indices are flashing in * "attention" mode, if any. */ ! protected class BasicModelListener extends AbstractTabDisplayerUI.ModelListener { public void contentsChanged(ListDataEvent e) { super.contentsChanged(e); tabState.contentsChanged(e); Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_close_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_close_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_close_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: output2/src/org/netbeans/core/output2/resources/vista_close_pressed.png *** D:\src\nb.55\core\output2\src\org\netbeans\core\output2\resources\vista_close_pressed.png No Base Revision --- D:\src\nb.55\core\output2\src\org\netbeans\core\output2\resources\vista_close_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_right_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_maximize_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_maximize_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_maximize_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slideright_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideright_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideright_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_left_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slideright_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideright_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideright_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_popup_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_popup_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_popup_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/plaf/src/org/netbeans/swing/plaf/winvista/EditorToolbarBorder.java *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\winvista\EditorToolbarBorder.java No Base Revision --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\winvista\EditorToolbarBorder.java Locally New *************** *** 1,0 **** --- 1,43 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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. + */ + package org.netbeans.swing.plaf.winvista; + + import org.netbeans.swing.plaf.LFCustoms; + + import javax.swing.*; + import javax.swing.border.AbstractBorder; + import java.awt.*; + + /** + * (copy & paste of XP EditorToolbarBorder) + * @author S. Aubrecht + */ + class EditorToolbarBorder extends AbstractBorder { + private static final Insets insets = new Insets(1, 0, 1, 0); + + public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { + Color borderC = UIManager.getColor (LFCustoms.SCROLLPANE_BORDER_COLOR); + g.setColor(borderC); + g.drawLine(x, y + h - 1, x + w - 1, y + h - 1); + } + + public Insets getBorderInsets(Component c) { + return insets; + } + } Index: swing/plaf/src/org/netbeans/swing/plaf/resources/vista_mini_close_pressed.png *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_mini_close_pressed.png No Base Revision --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_mini_close_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_close_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_close_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_close_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/plaf/src/org/netbeans/swing/plaf/winvista/StatusLineBorder.java *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\winvista\StatusLineBorder.java No Base Revision --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\winvista\StatusLineBorder.java Locally New *************** *** 1,0 **** --- 1,83 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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. + /* + * StatusLineBorder.java + * + * Created on March 14, 2004, 4:36 AM + */ + + package org.netbeans.swing.plaf.winvista; + + import org.netbeans.swing.plaf.LFCustoms; + + import javax.swing.*; + import javax.swing.border.AbstractBorder; + import java.awt.*; + + /** + * (copy & paste of XP StatusLineBorder) + * @author S. Aubrecht + */ + class StatusLineBorder extends AbstractBorder { + + /** Constants for sides of status line border */ + public static final int LEFT = 1; + public static final int TOP = 2; + public static final int RIGHT = 4; + + private Insets insets; + + private int type; + + /** Constructs new status line border of specified type. Type is bit + * mask specifying which sides of border should be visible */ + public StatusLineBorder(int type) { + this.type = type; + } + + public void paintBorder(Component c, Graphics g, int x, int y, + int w, int h) { + g.translate(x, y); + Color borderC = UIManager.getColor (LFCustoms.SCROLLPANE_BORDER_COLOR); + g.setColor(borderC); + // top + if ((type & TOP) != 0) { + g.drawLine(0, 0, w - 1, 0); + } + // left side + if ((type & LEFT) != 0) { + g.drawLine(0, 0, 0, h - 1); + } + // right side + if ((type & RIGHT) != 0) { + g.drawLine(w - 1, 0, w - 1, h - 1); + } + + g.translate(-x, -y); + } + + public Insets getBorderInsets(Component c) { + if (insets == null) { + insets = new Insets((type & TOP) != 0 ? 1 : 0, + (type & LEFT) != 0 ? 1 : 0, 0, + (type & RIGHT) != 0 ? 1 : 0); + } + return insets; + } + + } Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_restore_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_restore_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_restore_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slidedown_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slidedown_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slidedown_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinVistaViewTabDisplayerUI.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaViewTabDisplayerUI.java No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaViewTabDisplayerUI.java Locally New *************** *** 1,0 **** --- 1,545 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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. + */ + + package org.netbeans.swing.tabcontrol.plaf; + + import org.netbeans.swing.tabcontrol.TabDisplayer; + + import javax.swing.*; + import javax.swing.plaf.ComponentUI; + import java.awt.*; + import java.awt.event.MouseEvent; + import java.util.Collections; + + import java.util.HashMap; + import java.util.Map; + + + import org.openide.awt.HtmlRenderer; + + /** + * Win Vista-like user interface of view type tabs. + * + * @author S. Aubrecht + */ + public final class WinVistaViewTabDisplayerUI extends AbstractViewTabDisplayerUI { + + /*********** constants *************/ + + /** + * Space between text and left side of the tab + */ + private static final int TXT_X_PAD = 9; + private static final int TXT_Y_PAD = 3; + + private static final int ICON_X_PAD = 1; + private static final int ICON_Y_PAD = 7; + + private static final int BUMP_X_PAD = 3; + private static final int BUMP_Y_PAD_UPPER = 6; + private static final int BUMP_Y_PAD_BOTTOM = 3; + + /*********** static fields **********/ + + /** + * True when colors were already initialized, false otherwise + */ + private static boolean colorsReady = false; + + private static Color + unselFillBrightUpperC, + unselFillDarkUpperC, + unselFillBrightLowerC, + unselFillDarkLowerC, + selFillC, + focusFillUpperC, + focusFillBrightLowerC, + focusFillDarkLowerC, + mouseOverFillBrightUpperC, + mouseOverFillDarkUpperC, + mouseOverFillBrightLowerC, + mouseOverFillDarkLowerC, + txtC, + borderC, + selBorderC, + borderInnerC; + + private static AbstractViewTabDisplayerUI.IconLoader closeIcon; + + /** + * ******** instance fields ******** + */ + + private Dimension prefSize; + + /** + * rectangle instance used to speedup recurring computations in painting + * methods + */ + private Rectangle tempRect = new Rectangle(); + + /** + * Should be constructed only from createUI method. + */ + private WinVistaViewTabDisplayerUI(TabDisplayer displayer) { + super(displayer); + prefSize = new Dimension(100, 17); + } + + public static ComponentUI createUI(JComponent c) { + return new WinVistaViewTabDisplayerUI((TabDisplayer)c); + } + + public void installUI (JComponent c) { + super.installUI(c); + initColors(); + c.setOpaque(true); + } + + protected AbstractViewTabDisplayerUI.Controller createController() { + return new OwnController(); + } + + public Dimension getPreferredSize(JComponent c) { + FontMetrics fm = getTxtFontMetrics(); + int height = fm == null ? + 17 : fm.getAscent() + 2 * fm.getDescent() + 3; + Insets insets = c.getInsets(); + prefSize.height = height + insets.bottom + insets.top; + return prefSize; + } + + protected void paintTabContent(Graphics g, int index, String text, int x, + int y, int width, int height) { + FontMetrics fm = getTxtFontMetrics(); + // setting font already here to compute string width correctly + g.setFont(getTxtFont()); + if( 0 == index ) + x++; + int txtWidth = width; + if (isSelected(index)) { + // paint text, dragger and close icon + // close icon has the biggest space priority, text the smallest one + PinButton pin = configurePinButton(index); + boolean showPin = pin != null && pin.getOrientation() != TabDisplayer.ORIENTATION_INVISIBLE; + int space4pin = showPin ? pinButton.getWidth() + 1 : 0; + if (displayer.isShowCloseButton()) { + if (closeIcon == null) { + closeIcon = new IconLoader(); + } + String iconPath = findIconPath(index); + Icon icon = closeIcon.obtainIcon(iconPath); + int iconWidth = icon.getIconWidth(); + int space4Icon = iconWidth + 2 * ICON_X_PAD + space4pin; + txtWidth = width - TXT_X_PAD - space4Icon; + getCloseIconRect(tempRect, index); + icon.paintIcon(getDisplayer(), g, tempRect.x, tempRect.y); + } else { + txtWidth = width - 2 * TXT_X_PAD - space4pin; + tempRect.x = x + (width - 2); + tempRect.y = !showPin ? 0 : ((displayer.getHeight() / 2) - + (pinButton.getPreferredSize().height / 2)); + + } + + if (showPin) { + // don't activate and draw pin button if tab is too narrow + if (tempRect.x - space4pin < x + TXT_X_PAD - 1) { + pinButton.setVisible(false); + } else { + pinButton.setVisible(true); + pinButton.setLocation(tempRect.x - space4pin, tempRect.y); + } + } else { + pinButton.setVisible(false); + } + } else { + txtWidth = width - 2 * TXT_X_PAD; + } + + // draw bump (dragger) + ColorUtil.paintVistaTabDragTexture(getDisplayer(), g, x + BUMP_X_PAD, y + + BUMP_Y_PAD_UPPER, height - (BUMP_Y_PAD_UPPER + + BUMP_Y_PAD_BOTTOM)); + HtmlRenderer.renderString(text, g, x + TXT_X_PAD, y + fm.getAscent() + + TXT_Y_PAD, txtWidth, height, getTxtFont(), + txtC, + HtmlRenderer.STYLE_TRUNCATE, true); + } + + protected void paintTabBorder(Graphics g, int index, int x, int y, + int width, int height) { + boolean isFirst = index == 0; + boolean isHighlighted = isTabHighlighted(index); + + g.translate(x, y); + + Color borderColor = isHighlighted ? selBorderC : borderC; + g.setColor(borderColor); + int left = 0; + //left + if (isFirst ) + g.drawLine(0, 0, 0, height - 2); + //top + g.drawLine(0, 0, width - 1, 0); + //right + if( index < getDataModel().size()-1 && isTabHighlighted(index+1) ) + g.setColor( selBorderC ); + g.drawLine(width - 1, 0, width - 1, height - 2); + //bottom + g.setColor(borderC); + g.drawLine(0, height - 1, width - 1, height - 1); + + //inner white border + g.setColor(borderInnerC); + //left + if (isFirst) + g.drawLine(1, 1, 1, height - 2); + else + g.drawLine(0, 1, 0, height - 2); + //right + g.drawLine(width-2, 1, width-2, height - 2); + //top + g.drawLine(1, 1, width-2, 1); + + g.translate(-x, -y); + } + + protected void paintTabBackground(Graphics g, int index, int x, int y, + int width, int height) { + // shrink rectangle - don't affect border and tab header + y += 2; + height -= 2; + // background body, colored according to state + boolean selected = isSelected(index); + boolean focused = selected && isActive(); + boolean attention = isAttention(index); + boolean mouseOver = isMouseOver(index); + if (focused && !attention) { + ColorUtil.vistaFillRectGradient((Graphics2D) g, x, y, width, height, + focusFillUpperC, + focusFillBrightLowerC, focusFillDarkLowerC ); + } else if (selected && !attention) { + g.setColor(selFillC); + g.fillRect(x, y, width, height); + } else if (mouseOver && !attention) { + ColorUtil.vistaFillRectGradient((Graphics2D) g, x, y, width, height, + mouseOverFillBrightUpperC, mouseOverFillDarkUpperC, + mouseOverFillBrightLowerC, mouseOverFillDarkLowerC ); + } else if (attention) { + Color a = new Color (255, 255, 128); + Color b = new Color (230, 200, 64); + ColorUtil.xpFillRectGradient((Graphics2D) g, x, y, width, height, a, b); + } else { + ColorUtil.vistaFillRectGradient((Graphics2D) g, x, y, width, height, + unselFillBrightUpperC, unselFillDarkUpperC, + unselFillBrightLowerC, unselFillDarkLowerC ); + } + } + + /** + * Override to bold font + */ + protected Font getTxtFont() { + Font font = super.getTxtFont(); + if (!font.isBold()) { + font = font.deriveFont(Font.BOLD); + } + return font; + } + + /** + * Returns path of icon which is correct for currect state of tab at given + * index + */ + private String findIconPath(int index) { + if (((OwnController) getController()).isClosePressed() + == index) { + return "org/netbeans/swing/tabcontrol/resources/vista_close_pressed.png"; // NOI18N + } + if (((OwnController) getController()).isMouseInCloseButton() + == index) { + return "org/netbeans/swing/tabcontrol/resources/vista_close_over.png"; // NOI18N + } + return "org/netbeans/swing/tabcontrol/resources/vista_close_enabled.png"; // NOI18N + } + + /** + * @return true if tab with given index should have highlighted border, false otherwise. + */ + private boolean isTabHighlighted(int index) { + if (((OwnController) getController()).getMouseIndex() == index) { + return true; + } + return isSelected(index) && isActive(); + } + + /** + * @return true if tab with given index has mouse cursor above and is not + * the selected one, false otherwise. + */ + private boolean isMouseOver(int index) { + return ((OwnController) getController()).getMouseIndex() == index + && !isSelected(index); + } + + /** + * Initialization of colors + */ + private static void initColors() { + if (!colorsReady) { + txtC = UIManager.getColor("TabbedPane.foreground"); // NOI18N + + selFillC = UIManager.getColor("tab_sel_fill"); // NOI18N + + focusFillUpperC = UIManager.getColor("tab_focus_fill_upper"); // NOI18N + focusFillBrightLowerC = UIManager.getColor("tab_focus_fill_bright_lower"); // NOI18N + focusFillDarkLowerC = UIManager.getColor("tab_focus_fill_dark_lower"); // NOI18N + + unselFillBrightUpperC = UIManager.getColor("tab_unsel_fill_bright_upper"); // NOI18N + unselFillDarkUpperC = UIManager.getColor("tab_unsel_fill_dark_upper"); // NOI18N + unselFillBrightLowerC = UIManager.getColor("tab_unsel_fill_bright_lower"); // NOI18N + unselFillDarkLowerC = UIManager.getColor("tab_unsel_fill_dark_lower"); // NOI18N + + mouseOverFillBrightUpperC = UIManager.getColor("tab_mouse_over_fill_bright_upper"); // NOI18N + mouseOverFillDarkUpperC = UIManager.getColor("tab_mouse_over_fill_dark_upper"); // NOI18N + mouseOverFillBrightLowerC = UIManager.getColor("tab_mouse_over_fill_bright_lower"); // NOI18N + mouseOverFillDarkLowerC = UIManager.getColor("tab_mouse_over_fill_dark_lower"); // NOI18N + + borderC = UIManager.getColor("tab_border"); // NOI18N + selBorderC = UIManager.getColor("tab_sel_border"); // NOI18N + borderInnerC = UIManager.getColor("tab_border_inner"); // NOI18N + + colorsReady = true; + } + } + + /** + * Computes rectangle occupied by close icon and fill values in given + * rectangle. + */ + private Rectangle getCloseIconRect(Rectangle rect, int index) { + TabLayoutModel tlm = getLayoutModel(); + int x = tlm.getX(index); + int y = tlm.getY(index); + int w = tlm.getW(index); + int h = tlm.getH(index); + String iconPath = findIconPath(index); + if (closeIcon == null) { + //Tab control can be asked to process mouse motion events that + //occured during startup - this causes an NPE here + closeIcon = new IconLoader(); + } + Icon icon = closeIcon.obtainIcon(iconPath); + int iconWidth = icon.getIconWidth(); + int iconHeight = icon.getIconHeight(); + rect.x = x + w - iconWidth - 2 * ICON_X_PAD; + rect.y = getCenteredIconY(icon, index); + rect.width = iconWidth; + rect.height = iconHeight; + return rect; + } + + protected PinButton createPinButton() { + Map normalIcons = new HashMap(6); + normalIcons.put(TabDisplayer.ORIENTATION_EAST, "org/netbeans/swing/tabcontrol/resources/vista_slideright_enabled.png"); + normalIcons.put(TabDisplayer.ORIENTATION_WEST, "org/netbeans/swing/tabcontrol/resources/vista_slideleft_enabled.png"); + normalIcons.put(TabDisplayer.ORIENTATION_SOUTH, "org/netbeans/swing/tabcontrol/resources/vista_slidedown_enabled.png"); + normalIcons.put(TabDisplayer.ORIENTATION_CENTER, "org/netbeans/swing/tabcontrol/resources/vista_pin_enabled.png"); + Map pressedIcons = new HashMap(6); + pressedIcons.put(TabDisplayer.ORIENTATION_EAST, "org/netbeans/swing/tabcontrol/resources/vista_slideright_pressed.png"); + pressedIcons.put(TabDisplayer.ORIENTATION_WEST, "org/netbeans/swing/tabcontrol/resources/vista_slideleft_pressed.png"); + pressedIcons.put(TabDisplayer.ORIENTATION_SOUTH, "org/netbeans/swing/tabcontrol/resources/vista_slidedown_pressed.png"); + pressedIcons.put(TabDisplayer.ORIENTATION_CENTER, "org/netbeans/swing/tabcontrol/resources/vista_pin_pressed.png"); + Map rolloverIcons = new HashMap(6); + rolloverIcons.put(TabDisplayer.ORIENTATION_EAST, "org/netbeans/swing/tabcontrol/resources/vista_slideright_over.png"); + rolloverIcons.put(TabDisplayer.ORIENTATION_WEST, "org/netbeans/swing/tabcontrol/resources/vista_slideleft_over.png"); + rolloverIcons.put(TabDisplayer.ORIENTATION_SOUTH, "org/netbeans/swing/tabcontrol/resources/vista_slidedown_over.png"); + rolloverIcons.put(TabDisplayer.ORIENTATION_CENTER, "org/netbeans/swing/tabcontrol/resources/vista_pin_over.png"); + Map focusNormalIcons = new HashMap(6); + focusNormalIcons.put(TabDisplayer.ORIENTATION_EAST, "org/netbeans/swing/tabcontrol/resources/vista_slideright_enabled.png"); + focusNormalIcons.put(TabDisplayer.ORIENTATION_WEST, "org/netbeans/swing/tabcontrol/resources/vista_slideleft_enabled.png"); + focusNormalIcons.put(TabDisplayer.ORIENTATION_SOUTH, "org/netbeans/swing/tabcontrol/resources/vista_slidedown_enabled.png"); + focusNormalIcons.put(TabDisplayer.ORIENTATION_CENTER, "org/netbeans/swing/tabcontrol/resources/vista_pin_enabled.png"); + Map focusPressedIcons = new HashMap(6); + focusPressedIcons.put(TabDisplayer.ORIENTATION_EAST, "org/netbeans/swing/tabcontrol/resources/vista_slideright_pressed.png"); + focusPressedIcons.put(TabDisplayer.ORIENTATION_WEST, "org/netbeans/swing/tabcontrol/resources/vista_slideleft_pressed.png"); + focusPressedIcons.put(TabDisplayer.ORIENTATION_SOUTH, "org/netbeans/swing/tabcontrol/resources/vista_slidedown_pressed.png"); + focusPressedIcons.put(TabDisplayer.ORIENTATION_CENTER, "org/netbeans/swing/tabcontrol/resources/vista_pin_pressed.png"); + Map focusRolloverIcons = new HashMap(6); + focusRolloverIcons.put(TabDisplayer.ORIENTATION_EAST, "org/netbeans/swing/tabcontrol/resources/vista_slideright_over.png"); + focusRolloverIcons.put(TabDisplayer.ORIENTATION_WEST, "org/netbeans/swing/tabcontrol/resources/vista_slideleft_over.png"); + focusRolloverIcons.put(TabDisplayer.ORIENTATION_SOUTH, "org/netbeans/swing/tabcontrol/resources/vista_slidedown_over.png"); + focusRolloverIcons.put(TabDisplayer.ORIENTATION_CENTER, "org/netbeans/swing/tabcontrol/resources/vista_pin_over.png"); + + return new VistaPinButton(displayer, focusNormalIcons, focusPressedIcons, focusRolloverIcons, normalIcons, pressedIcons, rolloverIcons); + } + + /** + * Own close icon button controller + */ + private class OwnController extends Controller { + //TODO - add a method to AbstractViewTabDisplayerUI to get the close button rect and implement everything + //on the parent class + + /** + * holds index of tab in which mouse pointer was lastly located. -1 + * means mouse pointer is out of component's area + */ + // TBD - should be part of model, not controller + private int lastIndex = -1; + + /** + * @return Index of tab in which mouse pointer is currently located. + */ + public int getMouseIndex() { + return lastIndex; + } + + protected int inCloseIconRect(Point point) { + if (!displayer.isShowCloseButton()) { + return -1; + } + int index = getLayoutModel().indexOfPoint(point.x, point.y); + if (index < 0 || !isSelected(index)) { + return -1; + } + return getCloseIconRect(tempRect, index).contains(point) ? + index : -1; + } + + protected boolean inPinButtonRect(Point p) { + if (!pinButton.isVisible()) { + return false; + } + Point p2 = SwingUtilities.convertPoint(displayer, p, pinButton); + return pinButton.contains(p2); + } + + /** + * Triggers visual tab header change when mouse enters/leaves tab in + * advance to superclass functionality. + */ + public void mouseMoved(MouseEvent e) { + super.mouseMoved(e); + Point pos = e.getPoint(); + updateHighlight(getLayoutModel().indexOfPoint(pos.x, pos.y)); + } + + /** + * Resets tab header in advance to superclass functionality + */ + public void mouseExited(MouseEvent e) { + super.mouseExited(e); + // #72459: don't reset highlight if mouse exited into pin button + if (!inPinButtonRect(e.getPoint())) { + updateHighlight(-1); + } + } + + /** + * Invokes repaint of dirty region if needed + */ + private void updateHighlight(int curIndex) { + if (curIndex == lastIndex) { + return; + } + // compute region which needs repaint + TabLayoutModel tlm = getLayoutModel(); + int x, y, w, h; + Rectangle repaintRect = null; + if (curIndex != -1) { + x = tlm.getX(curIndex)-1; + y = tlm.getY(curIndex); + w = tlm.getW(curIndex)+2; + h = tlm.getH(curIndex); + repaintRect = new Rectangle(x, y, w, h); + } + // due to model changes, lastIndex may become invalid, so check + if ((lastIndex != -1) && (lastIndex < getDataModel().size())) { + x = tlm.getX(lastIndex)-1; + y = tlm.getY(lastIndex); + w = tlm.getW(lastIndex)+2; + h = tlm.getH(lastIndex); + if (repaintRect != null) { + repaintRect = + repaintRect.union(new Rectangle(x, y, w, h)); + } else { + repaintRect = new Rectangle(x, y, w, h); + } + } + // trigger repaint if needed, update index + if (repaintRect != null) { + getDisplayer().repaint(repaintRect); + } + lastIndex = curIndex; + } + + + } // end of OwnController + + protected static class VistaPinButton extends PinButton { + private Map focusedNormal; + private Map focusedRollover; + private Map focusedPressed; + + private TabDisplayer displayer; + + + protected VistaPinButton(TabDisplayer displayer, + Map focusedNormal, Map focusedPressed, Map focusedRollover, + Map selectNormal, Map selectPressed, Map selectRollover) { + super(selectNormal, selectPressed, selectRollover); + this.focusedPressed = focusedPressed; + this.focusedRollover = focusedRollover; + this.focusedNormal = focusedNormal; + this.displayer = displayer; + } + + + public Icon getIcon() { + if (displayer == null) { + //superclass constructor - UI is asking for icon + return null; + } + if (displayer.isActive()) { + return iconCache.obtainIcon((String)focusedNormal.get(getOrientation())); + } else { + return super.getIcon(); + } + } + + public Icon getRolloverIcon() { + if (displayer.isActive()) { + return iconCache.obtainIcon((String)focusedRollover.get(getOrientation())); + } else { + return super.getRolloverIcon(); + } + + } + + public Icon getPressedIcon() { + if (displayer.isActive()) { + return iconCache.obtainIcon((String)focusedPressed.get(getOrientation())); + } else { + return super.getPressedIcon(); + } + } + } + } Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_left_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/plaf/src/org/netbeans/swing/plaf/resources/vista_folder.png *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_folder.png No Base Revision --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_folder.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_left_disabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_disabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_disabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_right_disabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_disabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_disabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinVistaSlidingButtonUI.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaSlidingButtonUI.java No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaSlidingButtonUI.java Locally New *************** *** 1,0 **** --- 1,36 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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. + */ + + package org.netbeans.swing.tabcontrol.plaf; + + import javax.swing.AbstractButton; + import org.netbeans.swing.tabcontrol.SlidingButtonUI; + + /** + * @see SlidingButtonUI + * + * @author S. Aubrecht + */ + public class WinVistaSlidingButtonUI extends WinXPSlidingButtonUI { + + + /** Install a border on the button */ + protected void installBorder (AbstractButton b) { + } + } Index: swing/plaf/src/org/netbeans/swing/plaf/resources/vista_mini_close_enabled.png *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_mini_close_enabled.png No Base Revision --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\resources\vista_mini_close_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/TabState.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\TabState.java Base (1.5.46.1) --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\TabState.java Locally Modified (Based On 1.5.46.1) *************** *** 177,182 **** --- 177,188 ---- public static final int ATTENTION = 16384; /** + * Bitmask indicating that the tab's index is that of the armed index + * less one + */ + public static final int BEFORE_ARMED = 32768; + + /** * Indicates the last constant defined - renderers that wish to add their * own bitmasks should use multiples of this number */ *************** *** 257,262 **** --- 263,271 ---- if (tab == selectedIndex - 1) { result |= BEFORE_SELECTED; } + if (tab == containsMouseIndex - 1) { + result |= BEFORE_ARMED; + } if (isAlarmTab(tab)) { result |= ATTENTION; } Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slidedown_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slidedown_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slidedown_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_pin_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_pin_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_pin_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_maximize_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_maximize_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_maximize_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/plaf/src/org/netbeans/swing/plaf/LFCustoms.java *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\LFCustoms.java Base (1.5.16.1.2.1) --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\LFCustoms.java Locally Modified (Based On 1.5.16.1.2.1) *************** *** 301,304 **** --- 301,306 ---- // keys used by the progressbar api module. public static final String PROGRESS_CANCEL_BUTTON_ICON = "nb.progress.cancel.icon"; + public static final String PROGRESS_CANCEL_BUTTON_ROLLOVER_ICON = "nb.progress.cancel.icon.mouseover"; + public static final String PROGRESS_CANCEL_BUTTON_PRESSED_ICON = "nb.progress.cancel.icon.pressed"; } Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_right_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: progress/src/org/netbeans/progress/module/ui/ListComponent.java *** D:\src\nb.55\core\progress\src\org\netbeans\progress\module\ui\ListComponent.java Base (1.14.8.3.2.1) --- D:\src\nb.55\core\progress\src\org\netbeans\progress\module\ui\ListComponent.java Locally Modified (Based On 1.14.8.3.2.1) *************** *** 128,134 **** --- 128,150 ---- closeButton.setBorderPainted(false); closeButton.setBorder(BorderFactory.createEmptyBorder()); closeButton.setOpaque(false); + closeButton.setContentAreaFilled(false); + closeButton.setFocusable(false); + Image img = (Image)UIManager.get("nb.progress.cancel.icon"); + if( null != img ) { + closeButton.setIcon( new ImageIcon( img ) ); + } + img = (Image)UIManager.get("nb.progress.cancel.icon.mouseover"); + if( null != img ) { + closeButton.setRolloverEnabled(true); + closeButton.setRolloverIcon( new ImageIcon( img ) ); + } + img = (Image)UIManager.get("nb.progress.cancel.icon.pressed"); + if( null != img ) { + closeButton.setPressedIcon( new ImageIcon( img ) ); + } + closeButton.setToolTipText(NbBundle.getMessage(ListComponent.class, "ListComponent.btnClose.tooltip")); add(closeButton); if (handle.getState() != InternalHandle.STATE_RUNNING) { Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/ColorUtil.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\ColorUtil.java Base (1.6.40.1.2.1) --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\ColorUtil.java Locally Modified (Based On 1.6.40.1.2.1) *************** *** 74,79 **** --- 74,83 ---- * holds icon of XP style tab drag texture */ private static Icon XP_DRAG_IMAGE; + /** + * holds icon of Vista style tab drag texture + */ + private static Icon VISTA_DRAG_IMAGE; /** * Utility class, no instances should be created. *************** *** 516,521 **** --- 520,592 ---- } /** + * Fills given the upper and lower halves of the given rectangle + * in gradient style from bright to dark colors. + */ + public static void vistaFillRectGradient(Graphics2D g, Rectangle rect, + Color brightUpperC, Color darkUpperC, + Color brightLowerC, Color darkLowerC) { + vistaFillRectGradient(g, rect.x, rect.y, rect.width, rect.height, + brightUpperC, darkUpperC, brightLowerC, darkLowerC); + } + + /** + * Fills given the upper and lower halves of the given rectangle + * in gradient style from bright to dark colors. + */ + public static void vistaFillRectGradient(Graphics2D g, int x, int y, + int width, int height, + Color brightUpperC, Color darkUpperC, + Color brightLowerC, Color darkLowerC) { + paintVistaGradientFill( g, x, y, width, height/2, + brightUpperC, darkUpperC ); + paintVistaGradientFill( g, x, y+height/2, width, height-height/2, + brightLowerC, darkLowerC ); + } + + /** + * Fills given rectangle in gradient style from bright to dark colors, + * the upper half of the rectangle has a single color fill. + */ + public static void vistaFillRectGradient(Graphics2D g, Rectangle rect, + Color upperC, + Color brightLowerC, Color darkLowerC) { + vistaFillRectGradient( g, rect.x, rect.y, rect.width, rect.height, + upperC, brightLowerC, darkLowerC ); + } + /** + * Fills given rectangle in gradient style from bright to dark colors, + * the upper half of the rectangle has a single color fill. + */ + public static void vistaFillRectGradient(Graphics2D g, int x, int y, + int width, int height, + Color upperC, + Color brightLowerC, Color darkLowerC) { + g.setColor( upperC ); + g.fillRect( x, y, width, height/2 ); + paintVistaGradientFill( g, x, y+height/2, width, height-height/2, + brightLowerC, darkLowerC ); + } + + /** + * Draws drag texture of the tab in specified bounds. + */ + public static void paintVistaTabDragTexture(Component control, Graphics g, + int x, int y, int height) { + if (VISTA_DRAG_IMAGE == null) { + VISTA_DRAG_IMAGE = initVistaDragTextureImage(); + } + int count = height / 4; + int ypos = y; + g.setColor( Color.WHITE ); + for (int i = 0; i < count; i++) { + VISTA_DRAG_IMAGE.paintIcon(control, g, x, ypos); + g.drawLine( x+1, ypos+2, x+2, ypos+2 ); + g.drawLine( x+2, ypos+1, x+2, ypos+1 ); + ypos += 4; + } + } + /** * Adjusts color by given values, positive values means brightening, * negative values darkening of original color. * *************** *** 610,615 **** --- 681,711 ---- return new ImageIcon(i); } + /** + * Fills given rectangle using top-down gradient fill of specified colors + */ + private static void paintVistaGradientFill(Graphics2D g, int x, int y, + int width, int height, + Color brightC, Color darkC) { + GradientPaint gradient = getGradientPaint(x, y, brightC, x, y + height, + darkC); + g.setPaint(gradient); + g.fillRect(x, y, width, height); + } + + /** + * Dynamically creates and returns drag texture icon + */ + private static final Icon initVistaDragTextureImage() { + BufferedImage i = new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB); + int grey = new Color(124,124,124).getRGB(); + i.setRGB(1, 0, grey); + i.setRGB(0, 1, grey); + i.setRGB(0, 0, new Color(162,163,164).getRGB()); + i.setRGB(1, 1, new Color(107,107,107).getRGB()); + return new ImageIcon(i); + } + public boolean isBlueprintTheme() { return ("blueprint".equals(//NOI18N Toolkit.getDefaultToolkit().getDesktopProperty( Index: output2/src/org/netbeans/core/output2/ui/CloseButtonTabbedPane.java *** D:\src\nb.55\core\output2\src\org\netbeans\core\output2\ui\CloseButtonTabbedPane.java Base (1.8.68.2) --- D:\src\nb.55\core\output2\src\org\netbeans\core\output2\ui\CloseButtonTabbedPane.java Locally Modified (Based On 1.8.68.2) *************** *** 43,52 **** */ final class CloseButtonTabbedPane extends JTabbedPane implements ChangeListener /*, Runnable */ { ! private final Image closeTabImage = ! org.openide.util.Utilities.loadImage("org/netbeans/core/output2/resources/tabclose.gif"); // NOI18N ! private final Image closeTabInactiveImage = ! org.openide.util.Utilities.loadImage("org/netbeans/core/output2/resources/tabcloseinactive.gif"); // NOI18N public static final String PROP_CLOSE = "close"; --- 43,60 ---- */ final class CloseButtonTabbedPane extends JTabbedPane implements ChangeListener /*, Runnable */ { ! private final Image closeTabImage = isWindowsVista() ? ! org.openide.util.Utilities.loadImage("org/netbeans/core/output2/resources/vista_close_enabled.png") // NOI18N ! : org.openide.util.Utilities.loadImage("org/netbeans/core/output2/resources/tabclose.gif"); // NOI18N ! private final Image closeTabPressedImage = isWindowsVista() ? ! org.openide.util.Utilities.loadImage("org/netbeans/core/output2/resources/vista_close_pressed.png") // NOI18N ! : null; ! private final Image closeTabMouseOverImage = isWindowsVista() ? ! org.openide.util.Utilities.loadImage("org/netbeans/core/output2/resources/vista_close_over.png") // NOI18N ! : null; ! private final Image closeTabInactiveImage = isWindowsVista() ? ! null ! : org.openide.util.Utilities.loadImage("org/netbeans/core/output2/resources/tabcloseinactive.gif"); // NOI18N public static final String PROP_CLOSE = "close"; *************** *** 148,153 **** --- 156,165 ---- || b.y + b.height >= tabsz.height) return null; + if( isWindowsVista() && i == getSelectedIndex() ) { + b.x -= 1; + b.y -= 2; + } return new Rectangle(b.x + b.width - 13, b.y + b.height / 2 - 5, 8, *************** *** 177,182 **** --- 189,199 ---- } } + private boolean isWindowsVista() { + String osName = System.getProperty ("os.name"); + return osName.indexOf("Vista") >= 0; + } + public void paint(Graphics g) { super.paint(g); *************** *** 187,198 **** --- 204,232 ---- // http://ui.netbeans.org/docs/ui/closeButton/closeButtonUISpec.html // to see how the buttons are specified to be drawn. + if( isWindowsVista() ) { int selectedIndex = getSelectedIndex(); for (int i = 0, n = getTabCount(); i < n; i++) { Rectangle r = getCloseButtonBoundsAt(i); if (r == null) continue; + if (i == mouseOverCloseButtonIndex + || (i == pressedCloseButtonIndex && draggedOut)) { + g.drawImage(closeTabMouseOverImage, r.x, r.y , this); + } else if (i == pressedCloseButtonIndex) { + g.drawImage(closeTabPressedImage, r.x, r.y , this); + } else { + g.drawImage(closeTabImage, r.x, r.y , this); + } + } + } else { + int selectedIndex = getSelectedIndex(); + for (int i = 0, n = getTabCount(); i < n; i++) { + Rectangle r = getCloseButtonBoundsAt(i); + if (r == null) + continue; + if(i == pressedCloseButtonIndex && !draggedOut) { g.setColor(UIManager.getColor("Button.shadow")); //NOI18N g.fillRect(r.x , r.y, r.width, r.height); *************** *** 238,243 **** --- 272,278 ---- } } } + } private void setPressedCloseButtonIndex(int index) { if (pressedCloseButtonIndex == index) Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_close_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_close_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_close_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_restore_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_restore_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_restore_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinXPSlidingButtonUI.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinXPSlidingButtonUI.java Base (1.3.54.1.2.1) --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinXPSlidingButtonUI.java Locally Modified (Based On 1.3.54.1.2.1) *************** *** 64,71 **** protected JToggleButton hiddenToggle; ! /** Private, no need for outer classes to instantiate */ ! private WinXPSlidingButtonUI() { } public static ComponentUI createUI(JComponent c) { --- 64,70 ---- protected JToggleButton hiddenToggle; ! WinXPSlidingButtonUI() { } public static ComponentUI createUI(JComponent c) { Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slideleft_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideleft_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideleft_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slidedown_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slidedown_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slidedown_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_pin_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_pin_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_pin_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_restore_enabled.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_restore_enabled.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_restore_enabled.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/plaf/src/org/netbeans/swing/plaf/Startup.java *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\Startup.java Base (1.14.12.1.2.1) --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\Startup.java Locally Modified (Based On 1.14.12.1.2.1) *************** *** 37,42 **** --- 37,43 ---- import java.util.HashSet; import java.util.Set; import org.netbeans.swing.plaf.winclassic.WindowsLFCustoms; + import org.netbeans.swing.plaf.winvista.VistaLFCustoms; import org.netbeans.swing.plaf.winxp.XPLFCustoms; /** Singleton, manages customizers for various LFs. Installs, uninstalls them on LF change. *************** *** 288,294 **** if (FORCED_CUSTOMS != null) { System.err.println("Using explicitly set UI customizations: " + //NOI18N FORCED_CUSTOMS); ! if ("XP".equals(FORCED_CUSTOMS)) { //NOI18N return new XPLFCustoms(); } else if ("Aqua".equals(FORCED_CUSTOMS)) { //NOI18N return new AquaLFCustoms(); --- 289,297 ---- if (FORCED_CUSTOMS != null) { System.err.println("Using explicitly set UI customizations: " + //NOI18N FORCED_CUSTOMS); ! if ("Vista".equals(FORCED_CUSTOMS)) { //NOI18N ! return new VistaLFCustoms(); ! } else if ("XP".equals(FORCED_CUSTOMS)) { //NOI18N return new XPLFCustoms(); } else if ("Aqua".equals(FORCED_CUSTOMS)) { //NOI18N return new AquaLFCustoms(); *************** *** 312,318 **** --- 315,325 ---- buf.append("Nb."); //NOI18N buf.append(UIManager.getLookAndFeel().getID()); if (UIUtils.isXPLF()) { + if (isWindowsVista()) { + buf.append("VistaLFCustoms"); //NOI18N + } else { buf.append("XPLFCustoms"); //NOI18N + } } else { buf.append("LFCustoms"); //NOI18N } *************** *** 331,337 **** --- 338,348 ---- switch (Arrays.asList(knownLFs).indexOf(UIManager.getLookAndFeel().getID())) { case 1 : if (UIUtils.isXPLF()) { + if (isWindowsVista()) { + result = new VistaLFCustoms(); + } else { result = new XPLFCustoms(); + } } else { result = new WindowsLFCustoms(); } *************** *** 346,354 **** --- 357,374 ---- result = new GtkLFCustoms(); break; default : + // #79401 check if it's XP style LnF, for example jGoodies + if (UIUtils.isXPLF()) { + if (isWindowsVista()) { + result = new VistaLFCustoms(); + } else { + result = new XPLFCustoms(); + } + } else { result = new WindowsLFCustoms(); } } + } return result; } *************** *** 383,388 **** --- 403,413 ---- return osName.startsWith("Windows"); } + private boolean isWindowsVista() { + String osName = System.getProperty ("os.name"); + return osName.indexOf("Vista") >= 0; + } + private boolean isMac() { String osName = System.getProperty ("os.name"); boolean result = osName.startsWith ("Darwin") || "Mac OS X".equals(osName); Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_slideleft_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideleft_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_slideleft_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_left_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_left_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinVistaEditorTabCellRenderer.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaEditorTabCellRenderer.java No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaEditorTabCellRenderer.java Locally New *************** *** 1,0 **** --- 1,574 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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. + */ + /* + * WinVistaEditorTabCellRenderer.java + * + */ + + package org.netbeans.swing.tabcontrol.plaf; + + import javax.swing.*; + import java.awt.*; + import java.awt.geom.Area; + import java.awt.geom.Point2D; + import org.netbeans.swing.tabcontrol.TabDisplayer; + import org.netbeans.swing.tabcontrol.plaf.AbstractViewTabDisplayerUI.Controller; + + /** + * Windows Vista implementation of tab renderer + * + * @author S. Aubrecht + */ + final class WinVistaEditorTabCellRenderer extends AbstractTabCellRenderer { + //Default insets values for Vista look and feel + private static final int TOP_INSET = 0; + private static final int LEFT_INSET = 3; + private static final int RIGHT_INSET = 0; + static final int BOTTOM_INSET = 0; + + //Painters which will be used for the various states, to pass to superclass + //constructor + private static final TabPainter leftClip = new WinVistaLeftClipPainter(); + private static final TabPainter rightClip = new WinVistaRightClipPainter(); + private static final TabPainter normal = new WinVistaPainter(); + + private static AbstractViewTabDisplayerUI.IconLoader closeIcon; + + /** + * Creates a new instance of WinVistaEditorTabCellRenderer + */ + public WinVistaEditorTabCellRenderer() { + super(leftClip, normal, rightClip, new Dimension(32, 42)); + } + + /** + * Vista look and feel makes selected tab wider by 2 pixels on each side + */ + public int getPixelsToAddToSelection() { + return 0; + } + + public Dimension getPadding() { + Dimension d = super.getPadding(); + d.width = isShowCloseButton() && !Boolean.getBoolean("nb.tabs.suppressCloseButton") ? 32 : 16; + return d; + } + + private static final Color getUnselFillBrightUpperColor() { + Color result = UIManager.getColor("tab_unsel_fill_bright_upper"); //NOI18N + if (result == null) { + result = new Color(235,235,235); + } + return result; + } + + private static final Color getUnselFillDarkUpperColor() { + Color result = UIManager.getColor("tab_unsel_fill_dark_upper"); //NOI18N + if (result == null) { + result = new Color(229, 229, 229); + } + return result; + } + + private static final Color getUnselFillBrightLowerColor() { + Color result = UIManager.getColor("tab_unsel_fill_bright_lower"); //NOI18N + if (result == null) { + result = new Color(214,214,214); + } + return result; + } + + private static final Color getUnselFillDarkLowerColor() { + Color result = UIManager.getColor("tab_unsel_fill_dark_lower"); //NOI18N + if (result == null) { + result = new Color(203, 203, 203); + } + return result; + } + + private static final Color getSelFillColor() { + Color result = UIManager.getColor("tab_sel_fill"); //NOI18N + if (result == null) { + result = new Color(244,244,244); + } + return result; + } + + private static final Color getFocusFillUpperColor() { + Color result = UIManager.getColor("tab_focus_fill_upper"); //NOI18N + if (result == null) { + result = new Color(242, 249, 252); + } + return result; + } + + private static final Color getFocusFillBrightLowerColor() { + Color result = UIManager.getColor("tab_focus_fill_bright_lower"); //NOI18N + if (result == null) { + result = new Color(225, 241, 249); + } + return result; + } + + private static final Color getFocusFillDarkLowerColor() { + Color result = UIManager.getColor("tab_focus_fill_dark_lower"); //NOI18N + if (result == null) { + result = new Color(216, 236, 246); + } + return result; + } + + private static final Color getMouseOverFillBrightUpperColor() { + Color result = UIManager.getColor("tab_mouse_over_fill_bright_upper"); //NOI18N + if (result == null) { + result = new Color(223,242,252); + } + return result; + } + + private static final Color getMouseOverFillDarkUpperColor() { + Color result = UIManager.getColor("tab_mouse_over_fill_dark_upper"); //NOI18N + if (result == null) { + result = new Color(214,239,252); + } + return result; + } + + private static final Color getMouseOverFillBrightLowerColor() { + Color result = UIManager.getColor("tab_mouse_over_fill_bright_lower"); //NOI18N + if (result == null) { + result = new Color(189,228,250); + } + return result; + } + + private static final Color getMouseOverFillDarkLowerColor() { + Color result = UIManager.getColor("tab_mouse_over_fill_dark_lower"); //NOI18N + if (result == null) { + result = new Color(171,221,248); + } + return result; + } + + private static final Color getTxtColor() { + Color result = UIManager.getColor("TabbedPane.foreground"); //NOI18N + if (result == null) { + result = new Color(0, 0, 0); + } + return result; + } + + static final Color getBorderColor() { + Color result = UIManager.getColor("tab_border"); //NOI18N + if (result == null) { + result = new Color(137,140,149); + } + return result; + } + + private static final Color getSelBorderColor() { + Color result = UIManager.getColor("tab_sel_border"); //NOI18N + if (result == null) { + result = new Color(60,127,177); + } + return result; + } + + private static final Color getBorderInnerColor() { + Color result = UIManager.getColor("tab_border_inner"); //NOI18N + if (result == null) { + result = new Color(255,255,255); + } + return result; + } + + + + + + + + public Color getSelectedActivatedForeground() { + return getTxtColor(); + } + + public Color getSelectedForeground() { + return getTxtColor(); + } + + + + private static void paintTabGradient( Graphics g, WinVistaEditorTabCellRenderer ren, Polygon poly ) { + Rectangle rect = poly.getBounds(); + boolean selected = ren.isSelected(); + boolean focused = selected && ren.isActive(); + boolean attention = ren.isAttention(); + boolean mouseOver = ren.isArmed(); + if (focused && !attention) { + rect.height++; + ColorUtil.vistaFillRectGradient((Graphics2D) g, rect, + getFocusFillUpperColor(), + getFocusFillBrightLowerColor(), getFocusFillDarkLowerColor() ); + } else if (selected && !attention) { + rect.height++; + g.setColor(getSelFillColor()); + g.fillPolygon( poly ); + } else if (mouseOver && !attention) { + ColorUtil.vistaFillRectGradient((Graphics2D) g, rect, + getMouseOverFillBrightUpperColor(), getMouseOverFillDarkUpperColor(), + getMouseOverFillBrightLowerColor(), getMouseOverFillDarkLowerColor() ); + } else if (attention) { + Color a = new Color (255, 255, 128); + Color b = new Color (230, 200, 64); + ColorUtil.xpFillRectGradient((Graphics2D) g, rect, + a, b); + } else { + ColorUtil.vistaFillRectGradient((Graphics2D) g, rect, + getUnselFillBrightUpperColor(), getUnselFillDarkUpperColor(), + getUnselFillBrightLowerColor(), getUnselFillDarkLowerColor() ); + } + + } + + protected int getCaptionYAdjustment() { + return 0; + } + + protected int getIconYAdjustment() { + return -2; + } + + private static class WinVistaPainter implements TabPainter { + + public Insets getBorderInsets(Component c) { + return new Insets(TOP_INSET, LEFT_INSET, BOTTOM_INSET, RIGHT_INSET); + } + + public void getCloseButtonRectangle(JComponent jc, + final Rectangle rect, + Rectangle bounds) { + + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) jc; + + if (!ren.isShowCloseButton()) { + rect.x = -100; + rect.y = -100; + rect.width = 0; + rect.height = 0; + return; + } + String iconPath = findIconPath(ren); + if (closeIcon == null) { + //Tab control can be asked to process mouse motion events that + //occured during startup - this causes an NPE here + closeIcon = new AbstractViewTabDisplayerUI.IconLoader(); + } + Icon icon = closeIcon.obtainIcon(iconPath); + int iconWidth = icon.getIconWidth(); + int iconHeight = icon.getIconHeight(); + rect.x = bounds.x + bounds.width - iconWidth - 2; + rect.y = bounds.y + (Math.max(0, bounds.height / 2 - iconHeight / 2)); + rect.width = iconWidth; + rect.height = iconHeight; + } + + + /** + * Returns path of icon which is correct for currect state of tab at given + * index + */ + private String findIconPath( WinVistaEditorTabCellRenderer renderer ) { + if( renderer.inCloseButton() && renderer.isPressed() ) { + return "org/netbeans/swing/tabcontrol/resources/vista_close_pressed.png"; // NOI18N + } + if( renderer.inCloseButton() ) { + return "org/netbeans/swing/tabcontrol/resources/vista_close_over.png"; // NOI18N + } + return "org/netbeans/swing/tabcontrol/resources/vista_close_enabled.png"; // NOI18N + } + + public Polygon getInteriorPolygon(Component c) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + + Insets ins = getBorderInsets(c); + Polygon p = new Polygon(); + int x = 0; + int y = 0; + + int width = ren.isRightmost() ? c.getWidth() - 1 : c.getWidth(); + int height = c.getHeight() - ins.bottom; + + //just a plain rectangle + p.addPoint(x, y + ins.top); + p.addPoint(x + width, y + ins.top); + p.addPoint(x + width, y + height - 1); + p.addPoint(x, y + height - 1); + return p; + } + + public boolean isBorderOpaque() { + return true; + } + + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + + g.translate(x, y); + + Color borderColor = ((ren.isActive() && ren.isSelected()) + || ren.isArmed()) ? getSelBorderColor() : getBorderColor(); + g.setColor(borderColor); + int left = 0; + //left + if (ren.isLeftmost() ) + g.drawLine(0, 0, 0, height - 1); + //top + g.drawLine(0, 0, width - 1, 0); + //right + if( (ren.isActive() && ren.isNextTabSelected()) || ren.isNextTabArmed() ) + g.setColor( getSelBorderColor() ); + g.drawLine(width - 1, 0, width - 1, height - 2); + //bottom + g.setColor(getBorderColor()); + if( !ren.isSelected() ) { + g.drawLine(0, height - 1, width - 1, height - 1); + } else { + g.drawLine(width - 1, height-1, width - 1, height - 1); + } + + //inner white border + g.setColor(getBorderInnerColor()); + //top + g.drawLine(1, 1, width-2, 1); + if( ren.isSelected() ) + height++; + //left + if (ren.isLeftmost()) + g.drawLine(1, 1, 1, height - 2); + else + g.drawLine(0, 1, 0, height - 2); + //right + g.drawLine(width-2, 1, width-2, height - 2); + + g.translate(-x, -y); + } + + + public void paintInterior(Graphics g, Component c) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + Polygon poly = getInteriorPolygon(ren); + paintTabGradient( g, ren, poly ); + + //Get the close button bounds, more or less + Rectangle r = new Rectangle(); + getCloseButtonRectangle(ren, r, new Rectangle(0, 0, + ren.getWidth(), + ren.getHeight())); + + if (!g.hitClip(r.x, r.y, r.width, r.height)) { + return; + } + + //paint close button + String iconPath = findIconPath( ren ); + Icon icon = closeIcon.obtainIcon( iconPath ); + icon.paintIcon(ren, g, r.x, r.y); + } + + public boolean supportsCloseButton(JComponent renderer) { + return renderer instanceof TabDisplayer ? + ((TabDisplayer) renderer).isShowCloseButton() : true; + } + + } + + private static class WinVistaLeftClipPainter implements TabPainter { + + public Insets getBorderInsets(Component c) { + return new Insets(TOP_INSET, LEFT_INSET, BOTTOM_INSET, RIGHT_INSET); + } + + public Polygon getInteriorPolygon(Component c) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + + Insets ins = getBorderInsets(c); + Polygon p = new Polygon(); + int x = 0; + int y = 0; + + int width = ren.isRightmost() ? c.getWidth() - 1 : c.getWidth(); + int height = c.getHeight() - ins.bottom; + + //just a plain rectangle + p.addPoint(x, y + ins.top); + p.addPoint(x + width, y + ins.top); + p.addPoint(x + width, y + height - 1); + p.addPoint(x, y + height - 1); + return p; + } + + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) { + + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + g.translate(x, y); + + Color borderColor = ((ren.isActive() && ren.isSelected()) + || ren.isArmed()) ? getSelBorderColor() : getBorderColor(); + g.setColor(borderColor); + int left = 0; + //left + //no line + //top + g.drawLine(0, 0, width - 1, 0); + //right + if( (ren.isActive() && ren.isNextTabSelected()) || ren.isNextTabArmed() ) + g.setColor( getSelBorderColor() ); + g.drawLine(width - 1, 0, width - 1, height - 2); + //bottom + g.setColor(getBorderColor()); + if( !ren.isSelected() ) { + g.drawLine(0, height - 1, width - 1, height - 1); + } else { + g.drawLine(width - 1, height-1, width - 1, height - 1); + } + + //inner white border + g.setColor(getBorderInnerColor()); + //top + g.drawLine(0, 1, width-2, 1); + if( ren.isSelected() ) + height++; + //left + //no line + //right + g.drawLine(width-2, 1, width-2, height - 2); + + g.translate(-x, -y); + } + + public void paintInterior(Graphics g, Component c) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + + Polygon poly = getInteriorPolygon(ren); + paintTabGradient( g, ren, poly ); + } + + public boolean isBorderOpaque() { + return true; + } + + public boolean supportsCloseButton(JComponent renderer) { + return false; + } + + public void getCloseButtonRectangle(JComponent jc, + final Rectangle rect, + Rectangle bounds) { + rect.setBounds(-20, -20, 0, 0); + } + + } + + private static class WinVistaRightClipPainter implements TabPainter { + + public Insets getBorderInsets(Component c) { + return new Insets(TOP_INSET, LEFT_INSET, BOTTOM_INSET, RIGHT_INSET); + } + + public boolean isBorderOpaque() { + return true; + } + + public Polygon getInteriorPolygon(Component c) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + + Insets ins = getBorderInsets(c); + Polygon p = new Polygon(); + int x = 0; + int y = 0; + + int width = c.getWidth() + 1; + int height = c.getHeight() - ins.bottom; + + //just a plain rectangle + p.addPoint(x, y + ins.top); + p.addPoint(x + width, y + ins.top); + p.addPoint(x + width, y + height - 1); + p.addPoint(x, y + height - 1); + return p; + } + + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + + g.translate(x, y); + + Color borderColor = ((ren.isActive() && ren.isSelected()) + || ren.isArmed()) ? getSelBorderColor() : getBorderColor(); + g.setColor(borderColor); + int left = 0; + //left + //no line + //top + g.drawLine(0, 0, width, 0); + //right + //no line + //bottom + g.setColor(getBorderColor()); + if( !ren.isSelected() ) { + g.drawLine(0, height - 1, width - 1, height - 1); + } else { + g.drawLine(width - 1, height-1, width - 1, height - 1); + } + + //inner white border + g.setColor(getBorderInnerColor()); + //top + g.drawLine(1, 1, width, 1); + if( ren.isSelected() ) + height++; + //left + g.drawLine(0, 1, 0, height - 2); + //right + //no line + + g.translate(-x, -y); + } + + public void paintInterior(Graphics g, Component c) { + WinVistaEditorTabCellRenderer ren = (WinVistaEditorTabCellRenderer) c; + + Polygon poly = getInteriorPolygon(ren); + paintTabGradient( g, ren, poly ); + } + + public boolean supportsCloseButton(JComponent renderer) { + return false; + } + + public void getCloseButtonRectangle(JComponent jc, + final Rectangle rect, + Rectangle bounds) { + rect.setBounds(-20, -20, 0, 0); + } + } + } Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/AbstractTabCellRenderer.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\AbstractTabCellRenderer.java Base (1.6.84.1) --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\AbstractTabCellRenderer.java Locally Modified (Based On 1.6.84.1) *************** *** 221,226 **** --- 221,235 ---- /** * Convenience getter to determine if the current state indicates + * that the renderer is currently configured appears to the left of + * the armed tab. + */ + protected final boolean isNextTabArmed() { + return (state & TabState.BEFORE_ARMED) != 0; + } + + /** + * Convenience getter to determine if the current state indicates * that the renderer is currently configured appears to the right of * the selected tab. */ Index: output2/src/org/netbeans/core/output2/resources/vista_close_over.png *** D:\src\nb.55\core\output2\src\org\netbeans\core\output2\resources\vista_close_over.png No Base Revision --- D:\src\nb.55\core\output2\src\org\netbeans\core\output2\resources\vista_close_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinXPEditorTabDisplayerUI.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinXPEditorTabDisplayerUI.java Base (1.6.26.1.2.1) --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinXPEditorTabDisplayerUI.java Locally Modified (Based On 1.6.26.1.2.1) *************** *** 35,42 **** * @author Tim Boudreau */ public final class WinXPEditorTabDisplayerUI extends BasicScrollingTabDisplayerUI { - protected static final int[] xpoints = new int[20]; - protected static final int[] ypoints = new int[20]; private static final Rectangle scratch5 = new Rectangle(); public WinXPEditorTabDisplayerUI(TabDisplayer displayer) { --- 35,40 ---- *************** *** 47,61 **** return new WinXPEditorTabDisplayerUI ((TabDisplayer) c); } - public void install() { - super.install(); - // Color col = UIManager.getColor("nb_workplace_fill"); //NOI18N - // if (col == null) { - // col = new Color(226, 223, 214); - // } - // displayer.setBackground(col); - } - private static final String[] iconNames = new String[]{ "org/netbeans/swing/tabcontrol/resources/xp-right-enabled.gif", "org/netbeans/swing/tabcontrol/resources/xp-right-disabled.gif", --- 45,50 ---- Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/BasicScrollingTabDisplayerUI.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\BasicScrollingTabDisplayerUI.java Base (1.6.46.1.2.1) --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\BasicScrollingTabDisplayerUI.java Locally Modified (Based On 1.6.46.1.2.1) *************** *** 263,271 **** --- 263,277 ---- Timer timer = null; Image disabledImage = null; Image enabledImage = null; + boolean useCachedPainting = true; public TimerButton(Action a) { + this( a, true ); + } + + public TimerButton(Action a, boolean useCachedPainting) { super(a); + this.useCachedPainting = useCachedPainting; } private Timer getTimer() { *************** *** 324,333 **** startTimer(); } else if (me.getID() == me.MOUSE_RELEASED) { stopTimer(); ! } else { super.processMouseEvent(me); } - } protected void processFocusEvent(FocusEvent fe) { super.processFocusEvent(fe); --- 330,341 ---- startTimer(); } else if (me.getID() == me.MOUSE_RELEASED) { stopTimer(); ! } super.processMouseEvent(me); } protected void processFocusEvent(FocusEvent fe) { *************** *** 337,342 **** --- 342,348 ---- } protected void paintComponent(Graphics g) { + if( useCachedPainting ) { boolean enabled = isEnabled(); if (enabled && enabledImage == null || !enabled && disabledImage == null) { *************** *** 360,367 **** --- 366,376 ---- } g.drawImage(enabled? enabledImage: disabledImage, 0, 0, null); + } else { + super.paintComponent( g ); } } + } /** A convenience button class which fires its action event on mouse pressed, not * mouse released. Used to enable press-and-drag behavior on the tab list popup. *************** *** 374,385 **** --- 383,410 ---- protected void processMouseEvent(MouseEvent me) { super.processMouseEvent(me); if (isEnabled() && me.getID() == me.MOUSE_PRESSED) { + Icon defaultIcon = getIcon(); + Icon pressedIcon = getPressedIcon(); + //swap regular and pressed icon to force 'pressed' visual feedback + if( null != defaultIcon && null != pressedIcon ) { + setIcon( pressedIcon ); + setPressedIcon( defaultIcon ); + } getAction().actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "pressed")); } + else if (isEnabled() && me.getID() == me.MOUSE_RELEASED) { + Icon defaultIcon = getPressedIcon(); + Icon pressedIcon = getIcon(); + //mouse button released - restore icons back + if( null != defaultIcon && null != pressedIcon ) { + setIcon( defaultIcon ); + setPressedIcon( pressedIcon ); } } + } + } static SoftReference ctx = null; Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/plaf/WinVistaEditorTabDisplayerUI.java *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaEditorTabDisplayerUI.java No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\plaf\WinVistaEditorTabDisplayerUI.java Locally New *************** *** 1,0 **** --- 1,214 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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. + */ + + package org.netbeans.swing.tabcontrol.plaf; + + import org.netbeans.swing.tabcontrol.TabDisplayer; + + import javax.swing.*; + import javax.swing.plaf.ComponentUI; + import java.awt.*; + import java.awt.image.BufferedImage; + import java.net.URL; + import org.netbeans.swing.tabcontrol.TabListPopupAction; + import org.openide.util.Utilities; + + /** + * Windows Vista impl of tabs ui + * + * @author S. Aubrecht + */ + public final class WinVistaEditorTabDisplayerUI extends BasicScrollingTabDisplayerUI { + private static final Rectangle scratch5 = new Rectangle(); + + public WinVistaEditorTabDisplayerUI(TabDisplayer displayer) { + super (displayer); + } + + public static ComponentUI createUI(JComponent c) { + return new WinVistaEditorTabDisplayerUI ((TabDisplayer) c); + } + + private static final String[] iconNames = new String[]{ + "org/netbeans/swing/tabcontrol/resources/vista_left_enabled.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_left_disabled.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_left_over.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_left_pressed.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_right_enabled.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_right_disabled.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_right_over.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_right_pressed.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_popup_enabled.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_popup_enabled.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_popup_over.png", //NOI18N + "org/netbeans/swing/tabcontrol/resources/vista_popup_pressed.png"}; //NOI18N + + protected AbstractButton[] createControlButtons() { + //XXX probably this can be moved into superclass? + JButton[] result = new JButton[3]; + result[0] = new TimerButton(scroll().getBackwardAction(), false); + result[1] = new TimerButton(scroll().getForwardAction(), false); + result[2] = new OnPressButton(new TabListPopupAction(displayer)); + configureButton(result[0], 0); + configureButton(result[1], 1); + configureButton(result[2], 2); + result[0].setPreferredSize(new Dimension(15, 15)); + result[2].setPreferredSize(new Dimension(16, 15)); + result[1].setPreferredSize(new Dimension(15, 15)); + + scroll().getBackwardAction().putValue("control", displayer); //NOI18N + scroll().getForwardAction().putValue("control", displayer); //NOI18N + + return result; + } + + public Dimension getPreferredSize(JComponent c) { + int prefHeight = 22; + Graphics g = BasicScrollingTabDisplayerUI.getOffscreenGraphics(); + if (g != null) { + FontMetrics fm = g.getFontMetrics(displayer.getFont()); + Insets ins = getTabAreaInsets(); + prefHeight = fm.getHeight() + ins.top + ins.bottom + 6; + } + return new Dimension(displayer.getWidth(), prefHeight); + } + + private static final Icon createIcon(int i) { + return new ImageIcon(Utilities.loadImage(iconNames[i])); + } + + private static void configureButton(JButton button, int idx) { + button.setFocusPainted(false); + button.setBorderPainted(false); + button.setContentAreaFilled(false); + button.setBorder(BorderFactory.createEmptyBorder()); + + Icon normal = createIcon((idx * 4)); + Icon disabled = createIcon((idx * 4) + 1); + Icon rollover = createIcon((idx * 4) + 2); + Icon pressed = createIcon((idx * 4) + 3); + + button.setIcon(normal); + button.setRolloverEnabled(true); + button.setRolloverIcon(rollover); + button.setDisabledIcon(disabled); + button.setPressedIcon(pressed); + + button.setMargin(null); + button.setText(null); + //undocumented (?) call to hide action text - see JButton line 234 + button.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N + button.setFocusable(false); + } + + public void paintBackground (Graphics g) { + g.setColor (displayer.getBackground()); + g.fillRect (0, 0, displayer.getWidth(), displayer.getHeight()); + } + + protected void paintAfterTabs(Graphics g) { + Rectangle r = new Rectangle(); + getTabsVisibleArea(r); + r.width = displayer.getWidth(); + + Insets ins = getTabAreaInsets(); + + int y = displayer.getHeight() - WinVistaEditorTabCellRenderer.BOTTOM_INSET; + int tabsWidth = getTabsAreaWidth(); + + g.setColor(WinVistaEditorTabCellRenderer.getBorderColor()); + + //Draw a line tracking the bottom of the tabs under the control + //buttons, out to the right edge of the control + + //Find the last visible tab + int last = scroll().getLastVisibleTab(tabsWidth); + int l = 0; + if (last >= 0) { + //If it's onscreen (usually will be unless there are no tabs, + //find the edge of the last tab - it may be scrolled) + getTabRect(last, scratch5); + last = scratch5.x + scratch5.width; + } + //Draw the dark line under the controls button area that closes the + //tabs bottom margin on top + g.drawLine(last, y - 1, displayer.getWidth(), y - 1); + } + + protected TabCellRenderer createDefaultRenderer() { + return new WinVistaEditorTabCellRenderer(); + } + + protected LayoutManager createLayout() { + return new WCLayout(); + } + + public java.awt.Insets getTabAreaInsets() { + return new Insets(0, 0, 0, 57); + } + + protected Rectangle getTabRectForRepaint( int tab, Rectangle rect ) { + Rectangle res = super.getTabRectForRepaint( tab, rect ); + //we need to repaint extra vertical lines on both sides when mouse-over + //or selection changes + res.x--; + res.width += 2; + return res; + } + + private class WCLayout implements LayoutManager { + + public void addLayoutComponent(String name, Component comp) { + } + + public void layoutContainer(java.awt.Container parent) { + Insets in = getTabAreaInsets(); + Component[] c = parent.getComponents(); + int x = parent.getWidth() - 49; + int y = 0; + Dimension psize; + for (int i = 0; i < c.length; i++) { + y = in.top; + if (c[i] instanceof JButton) { + int w = Math.min( + ((JButton) c[i]).getIcon().getIconWidth(), + parent.getWidth() - x); + c[i].setBounds(x, y, w, Math.min( + ((JButton) c[i]).getIcon().getIconHeight(), + parent.getHeight())); + x += ((JButton) c[i]).getIcon().getIconWidth(); + if (i == 1) { + x += 3; + } + } + } + } + + public Dimension minimumLayoutSize(Container parent) { + return getPreferredSize((JComponent) parent); + } + + public Dimension preferredLayoutSize(Container parent) { + return getPreferredSize((JComponent) parent); + } + + public void removeLayoutComponent(java.awt.Component comp) { + } + } + } Index: swing/plaf/src/org/netbeans/swing/plaf/winvista/VistaLFCustoms.java *** D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\winvista\VistaLFCustoms.java No Base Revision --- D:\src\nb.55\core\swing\plaf\src\org\netbeans\swing\plaf\winvista\VistaLFCustoms.java Locally New *************** *** 1,0 **** --- 1,235 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (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.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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. + */ + + package org.netbeans.swing.plaf.winvista; + + import java.awt.GraphicsEnvironment; + import java.util.Locale; + import javax.swing.UIManager; + import javax.swing.plaf.ColorUIResource; + import javax.swing.plaf.FontUIResource; + import org.netbeans.swing.plaf.LFCustoms; + import org.netbeans.swing.plaf.util.GuaranteedValue; + import org.netbeans.swing.plaf.util.UIBootstrapValue; + import org.netbeans.swing.plaf.util.UIUtils; + + import javax.swing.*; + import javax.swing.border.EmptyBorder; + import javax.swing.border.MatteBorder; + import java.awt.*; + + + /** Default system-provided customizer for Windows Vista LF + * Public only to be accessible by ProxyLazyValue, please don't abuse. + */ + public final class VistaLFCustoms extends LFCustoms { + private static final String TAB_FOCUS_FILL_UPPER = "tab_focus_fill_upper"; //NOI18N + private static final String TAB_FOCUS_FILL_DARK_LOWER = "tab_focus_fill_dark_lower"; //NOI18N + private static final String TAB_FOCUS_FILL_BRIGHT_LOWER = "tab_focus_fill_bright_lower"; //NOI18N + + private static final String TAB_UNSEL_FILL_DARK_UPPER = "tab_unsel_fill_dark_upper"; //NOI18N + private static final String TAB_UNSEL_FILL_BRIGHT_UPPER = "tab_unsel_fill_bright_upper"; //NOI18N + private static final String TAB_UNSEL_FILL_DARK_LOWER = "tab_unsel_fill_dark_lower"; //NOI18N + private static final String TAB_UNSEL_FILL_BRIGHT_LOWER = "tab_unsel_fill_bright_lower"; //NOI18N + + private static final String TAB_SEL_FILL = "tab_sel_fill"; //NOI18N + + private static final String TAB_MOUSE_OVER_FILL_BRIGHT_UPPER = "tab_mouse_over_fill_bright_upper"; //NOI18N + private static final String TAB_MOUSE_OVER_FILL_DARK_UPPER = "tab_mouse_over_fill_dark_upper"; //NOI18N + private static final String TAB_MOUSE_OVER_FILL_BRIGHT_LOWER = "tab_mouse_over_fill_bright_lower"; //NOI18N + private static final String TAB_MOUSE_OVER_FILL_DARK_LOWER = "tab_mouse_over_fill_dark_lower"; //NOI18N + + private static final String TAB_BORDER = "tab_border"; //NOI18N + private static final String TAB_SEL_BORDER = "tab_sel_border"; //NOI18N + private static final String TAB_BORDER_INNER = "tab_border_inner"; //NOI18N + + private static final String TAHOMA_FONT_NAME = "Tahoma"; + + static final String SCROLLPANE_BORDER_COLOR = "scrollpane_border"; //NOI18N + + public Object[] createLookAndFeelCustomizationKeysAndValues() { + int fontsize = 11; + Integer in = (Integer) UIManager.get(CUSTOM_FONT_SIZE); //NOI18N + if (in != null) { + fontsize = in.intValue(); + } + + Object[] result = new Object[] { + //Work around a bug in windows which sets the text area font to + //"MonoSpaced", causing all accessible dialogs to have monospaced text + "TextArea.font", new GuaranteedValue ("Label.font", new Font("Dialog", Font.PLAIN, fontsize)), + + EDITOR_ERRORSTRIPE_SCROLLBAR_INSETS, new Insets(17, 0, 17, 0), + }; + + return result; + } + + public Object[] createApplicationSpecificKeysAndValues () { + UIBootstrapValue editorTabsUI = new VistaEditorColorings ( + "org.netbeans.swing.tabcontrol.plaf.WinVistaEditorTabDisplayerUI"); + + Object viewTabsUI = editorTabsUI.createShared("org.netbeans.swing.tabcontrol.plaf.WinVistaViewTabDisplayerUI"); + + //TODO change icon (copy & paste) + Image explorerIcon = UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_folder.png"); + + Object propertySheetValues = new VistaPropertySheetColorings(); + + Object[] uiDefaults = { + EDITOR_TAB_DISPLAYER_UI, editorTabsUI, + VIEW_TAB_DISPLAYER_UI, viewTabsUI, + + DESKTOP_BACKGROUND, new Color(226, 223, 214), //NOI18N + SCROLLPANE_BORDER_COLOR, new Color(127, 157, 185), + DESKTOP_BORDER, new EmptyBorder(6, 5, 4, 6), + SCROLLPANE_BORDER, UIManager.get("ScrollPane.border"), + EXPLORER_STATUS_BORDER, new StatusLineBorder(StatusLineBorder.TOP), + EXPLORER_FOLDER_ICON , explorerIcon, + EXPLORER_FOLDER_OPENED_ICON, explorerIcon, + EDITOR_STATUS_LEFT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.RIGHT), + EDITOR_STATUS_RIGHT_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT), + EDITOR_STATUS_INNER_BORDER, new StatusLineBorder(StatusLineBorder.TOP | StatusLineBorder.LEFT | StatusLineBorder.RIGHT), + EDITOR_STATUS_ONLYONEBORDER, new StatusLineBorder(StatusLineBorder.TOP), + EDITOR_TOOLBAR_BORDER, new EditorToolbarBorder(), + OUTPUT_SELECTION_BACKGROUND, new Color (164, 180, 255), + + PROPERTYSHEET_BOOTSTRAP, propertySheetValues, + + WORKPLACE_FILL, new Color(226, 223, 214), + + DESKTOP_SPLITPANE_BORDER, BorderFactory.createEmptyBorder(4, 0, 0, 0), + SLIDING_BUTTON_UI, "org.netbeans.swing.tabcontrol.plaf.WinVistaSlidingButtonUI", + + // progress component related + "nbProgressBar.Foreground", new Color(49, 106, 197), + "nbProgressBar.Background", Color.WHITE, + "nbProgressBar.popupDynaText.foreground", new Color(115, 115, 115), + "nbProgressBar.popupText.background", new Color(249, 249, 249), + "nbProgressBar.popupText.foreground", UIManager.getColor("TextField.foreground"), + "nbProgressBar.popupText.selectBackground", UIManager.getColor("List.selectionBackground"), + "nbProgressBar.popupText.selectForeground", UIManager.getColor("List.selectionForeground"), + PROGRESS_CANCEL_BUTTON_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_mini_close_enabled.png"), + PROGRESS_CANCEL_BUTTON_ROLLOVER_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_mini_close_over.png"), + PROGRESS_CANCEL_BUTTON_PRESSED_ICON, UIUtils.loadImage("org/netbeans/swing/plaf/resources/vista_mini_close_pressed.png") + + }; //NOI18N + + //Workaround for JDK 1.5.0 bug 5080144 - Disabled JTextFields stay white + //XPTheme uses Color instead of ColorUIResource + convert ("TextField.background"); //NOI18N + convert ("TextField.inactiveBackground"); //NOI18N + convert ("TextField.disabledBackground"); //NOI18N + + return uiDefaults; + } + + /** + * Takes a UIManager color key and ensures that it is stored as a + * ColorUIResource, not a Color. + */ + private static final void convert (String key) { + Color c = UIManager.getColor(key); + if (c != null && !(c instanceof ColorUIResource)) { + UIManager.put (key, new ColorUIResource(c)); + } + } + + protected Object[] additionalKeys() { + Object[] kv = new VistaEditorColorings("").createKeysAndValues(); + Object[] kv2 = new VistaPropertySheetColorings().createKeysAndValues(); + Object[] result = new Object[(kv.length / 2) + (kv2.length / 2)]; + int ct = 0; + for (int i=0; i < kv.length; i+=2) { + result[ct] = kv[i]; + ct++; + } + for (int i=0; i < kv2.length; i+=2) { + result[ct] = kv2[i]; + ct++; + } + return result; + } + + private class VistaEditorColorings extends UIBootstrapValue.Lazy { + public VistaEditorColorings (String name) { + super (name); + } + + public Object[] createKeysAndValues() { + return new Object[] { + //Tab control - XXX REPLACE WITH RelativeColor - need to figure out base + //colors for each color + //selected & focused + TAB_FOCUS_FILL_UPPER, new Color(242, 249, 252), + TAB_FOCUS_FILL_BRIGHT_LOWER, new Color(225, 241, 249), + TAB_FOCUS_FILL_DARK_LOWER, new Color(216, 236, 246), + + //no selection, no focus + TAB_UNSEL_FILL_BRIGHT_UPPER, new Color(235,235,235), + TAB_UNSEL_FILL_DARK_UPPER, new Color(229, 229, 229), + TAB_UNSEL_FILL_BRIGHT_LOWER, new Color(214,214,214), + TAB_UNSEL_FILL_DARK_LOWER, new Color(203, 203, 203), + + //selected, no focus + TAB_SEL_FILL, new Color(244,244,244), + + //no selection, mouse over + TAB_MOUSE_OVER_FILL_BRIGHT_UPPER, new Color(223,242,252), + TAB_MOUSE_OVER_FILL_DARK_UPPER, new Color(214,239,252), + TAB_MOUSE_OVER_FILL_BRIGHT_LOWER, new Color(189,228,250), + TAB_MOUSE_OVER_FILL_DARK_LOWER, new Color(171,221,248), + + TAB_BORDER, new Color(137,140,149), + TAB_SEL_BORDER, new Color(60,127,177), + TAB_BORDER_INNER, new Color(255,255,255), + + //Borders for the tab control + EDITOR_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(), + EDITOR_TAB_CONTENT_BORDER, + new MatteBorder(0, 1, 1, 1, new Color(137, 140, 149)), + EDITOR_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(), + + VIEW_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(), + VIEW_TAB_CONTENT_BORDER, + new MatteBorder(0, 1, 1, 1, new Color(137, 140, 149)), + VIEW_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(), + }; + } + } + + private class VistaPropertySheetColorings extends UIBootstrapValue.Lazy { + public VistaPropertySheetColorings () { + super ("propertySheet"); //NOI18N + } + + public Object[] createKeysAndValues() { + return new Object[] { + PROPSHEET_SELECTION_BACKGROUND, new Color(49,106,197), + PROPSHEET_SELECTION_FOREGROUND, Color.WHITE, + PROPSHEET_SET_BACKGROUND, new Color(213,213,213), + PROPSHEET_SET_FOREGROUND, Color.BLACK, + PROPSHEET_SELECTED_SET_BACKGROUND, new Color(49,106,197), + PROPSHEET_SELECTED_SET_FOREGROUND, Color.WHITE, + PROPSHEET_DISABLED_FOREGROUND, new Color(161,161,146), + PROPSHEET_BUTTON_FOREGROUND, Color.BLACK, + }; + } + } + } Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_right_pressed.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_pressed.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_right_pressed.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: swing/tabcontrol/src/org/netbeans/swing/tabcontrol/resources/vista_popup_over.png *** D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_popup_over.png No Base Revision --- D:\src\nb.55\core\swing\tabcontrol\src\org\netbeans\swing\tabcontrol\resources\vista_popup_over.png Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New]