# HG changeset patch
# User aivanov
# Date 1402469607 -14400
# Node ID aade36e70da0fd69be24951bdd7793c702370517
# Parent 5b781839611defc12d5147b361ed7e2bb3586f66
8046391: Hang displaying JFileChooser with Windows L&F
Reviewed-by: anthony, serb
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -130,14 +130,11 @@
//one second seems plausible value
duration = 1000;
} else {
- XPStyle xp = XPStyle.getXP();
- duration = (xp != null)
- ? xp.getThemeTransitionDuration(
- c, part,
- normalizeState(oldState),
- normalizeState(newState),
- Prop.TRANSITIONDURATIONS)
- : 1000;
+ duration = XPStyle.getXP().getThemeTransitionDuration(
+ c, part,
+ normalizeState(oldState),
+ normalizeState(newState),
+ Prop.TRANSITIONDURATIONS);
}
controller.startAnimation(c, part, oldState, newState, duration);
}
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
import static com.sun.java.swing.plaf.windows.TMSchema.Part;
import static com.sun.java.swing.plaf.windows.TMSchema.State;
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
-
import sun.swing.DefaultLookup;
import sun.swing.StringUIClientPropertyKey;
@@ -232,9 +231,6 @@
private void paintXPComboBoxBackground(Graphics g, JComponent c) {
XPStyle xp = XPStyle.getXP();
- if (xp == null) {
- return;
- }
State state = getXPComboBoxState(c);
Skin skin = null;
if (! comboBox.isEditable()
@@ -404,9 +400,8 @@
* @return a button which represents the popup control
*/
protected JButton createArrowButton() {
- XPStyle xp = XPStyle.getXP();
- if (xp != null) {
- return new XPComboBoxButton(xp);
+ if (XPStyle.getXP() != null) {
+ return new XPComboBoxButton();
} else {
return super.createArrowButton();
}
@@ -414,9 +409,9 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
private class XPComboBoxButton extends XPStyle.GlyphButton {
- public XPComboBoxButton(XPStyle xp) {
+ public XPComboBoxButton() {
super(null,
- (! xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
+ (! XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
? Part.CP_DROPDOWNBUTTON
: (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
? Part.CP_DROPDOWNBUTTONLEFT
@@ -429,11 +424,10 @@
protected State getState() {
State rv;
rv = super.getState();
- XPStyle xp = XPStyle.getXP();
if (rv != State.DISABLED
&& comboBox != null && ! comboBox.isEditable()
- && xp != null && xp.isSkinDefined(comboBox,
- Part.CP_DROPDOWNBUTTONRIGHT)) {
+ && XPStyle.getXP().isSkinDefined(comboBox,
+ Part.CP_DROPDOWNBUTTONRIGHT)) {
/*
* for non editable ComboBoxes Vista seems to have the
* same glyph for all non DISABLED states
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -125,9 +125,6 @@
static void paintXPText(AbstractButton b, Part part, State state,
Graphics g, int x, int y, String text, int mnemIndex) {
XPStyle xp = XPStyle.getXP();
- if (xp == null) {
- return;
- }
Color textColor = b.getForeground();
if (textColor instanceof UIResource) {
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java Wed Jun 11 10:53:27 2014 +0400
@@ -623,8 +623,8 @@
@SuppressWarnings("serial") // Same-version serialization only
private static class MenuArrowIcon implements Icon, UIResource, Serializable {
public void paintIcon(Component c, Graphics g, int x, int y) {
- XPStyle xp = XPStyle.getXP();
- if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+ if (WindowsMenuItemUI.isVistaPainting()) {
+ XPStyle xp = XPStyle.getXP();
State state = State.NORMAL;
if (c instanceof JMenuItem) {
state = ((JMenuItem) c).getModel().isEnabled()
@@ -657,18 +657,16 @@
}
}
public int getIconWidth() {
- XPStyle xp = XPStyle.getXP();
- if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
- Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
+ if (WindowsMenuItemUI.isVistaPainting()) {
+ Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
return skin.getWidth();
} else {
return 4;
}
}
public int getIconHeight() {
- XPStyle xp = XPStyle.getXP();
- if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
- Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
+ if (WindowsMenuItemUI.isVistaPainting()) {
+ Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
return skin.getHeight();
} else {
return 8;
@@ -694,8 +692,7 @@
}
static int getIconWidth() {
- XPStyle xp = XPStyle.getXP();
- return ((xp != null) ? xp.getSkin(null, Part.MP_POPUPCHECK).getWidth() : 16)
+ return XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK).getWidth()
+ 2 * OFFSET;
}
@@ -759,17 +756,12 @@
Icon icon = getIcon();
int height = 0;
if (icon != null) {
- height = icon.getIconHeight();
+ height = icon.getIconHeight() + 2 * OFFSET;
} else {
- XPStyle xp = XPStyle.getXP();
- if (xp != null) {
- Skin skin = xp.getSkin(null, Part.MP_POPUPCHECK);
- height = skin.getHeight();
- } else {
- height = 16;
- }
+ Skin skin =
+ XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
+ height = skin.getHeight() + 2 * OFFSET;
}
- height += 2 * OFFSET;
return height;
}
@@ -817,16 +809,14 @@
? State.BULLETDISABLED
: State.CHECKMARKDISABLED;
}
+ Skin skin;
XPStyle xp = XPStyle.getXP();
- if (xp != null) {
- Skin skin;
- skin = xp.getSkin(c, backgroundPart);
- skin.paintSkin(g, x, y,
- getIconWidth(), getIconHeight(), backgroundState);
- if (icon == null) {
- skin = xp.getSkin(c, part);
- skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
- }
+ skin = xp.getSkin(c, backgroundPart);
+ skin.paintSkin(g, x, y,
+ getIconWidth(), getIconHeight(), backgroundState);
+ if (icon == null) {
+ skin = xp.getSkin(c, part);
+ skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
}
}
}
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -86,15 +86,14 @@
}
} else {
buttonWidth += 2;
+ selectedTitleGradientColor =
+ UIManager.getColor("InternalFrame.activeTitleGradient");
+ notSelectedTitleGradientColor =
+ UIManager.getColor("InternalFrame.inactiveTitleGradient");
Color activeBorderColor =
UIManager.getColor("InternalFrame.activeBorderColor");
setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
}
- // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
- selectedTitleGradientColor =
- UIManager.getColor("InternalFrame.activeTitleGradient");
- notSelectedTitleGradientColor =
- UIManager.getColor("InternalFrame.inactiveTitleGradient");
}
protected void uninstallListeners() {
@@ -389,7 +388,7 @@
public class WindowsTitlePaneLayout extends BasicInternalFrameTitlePane.TitlePaneLayout {
private Insets captionMargin = null;
private Insets contentMargin = null;
- private final XPStyle xp = XPStyle.getXP();
+ private XPStyle xp = XPStyle.getXP();
WindowsTitlePaneLayout() {
if (xp != null) {
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Wed Jun 11 10:53:27 2014 +0400
@@ -2327,9 +2327,8 @@
}
public Object getXPValue(UIDefaults table) {
- XPStyle xp = XPStyle.getXP();
- Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null;
- if (xpBorder != null && extraMargin != null) {
+ Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
+ if (extraMargin != null) {
return new BorderUIResource.
CompoundBorderUIResource(xpBorder, extraMargin);
} else {
@@ -2345,8 +2344,7 @@
public Object getXPValue(UIDefaults table) {
XPColorValueKey key = (XPColorValueKey)xpValue;
- XPStyle xp = XPStyle.getXP();
- return xp != null ? xp.getColor(key.skin, key.prop, null) : null;
+ return XPStyle.getXP().getColor(key.skin, key.prop, null);
}
private static class XPColorValueKey {
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -156,8 +156,8 @@
@Override
public void paint(Graphics g, JComponent c) {
- XPStyle xp = XPStyle.getXP();
- if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+ if (WindowsMenuItemUI.isVistaPainting()) {
+ XPStyle xp = XPStyle.getXP();
Skin skin;
skin = xp.getSkin(c, Part.MP_BARBACKGROUND);
int width = c.getWidth();
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -109,8 +109,7 @@
static void paintBackground(WindowsMenuItemUIAccessor menuItemUI,
Graphics g, JMenuItem menuItem, Color bgColor) {
assert isVistaPainting();
- XPStyle xp = XPStyle.getXP();
- if (xp != null && isVistaPainting()) {
+ if (isVistaPainting()) {
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
if (menuItem.isOpaque()) {
@@ -119,6 +118,7 @@
g.fillRect(0,0, menuWidth, menuHeight);
g.setColor(oldColor);
}
+ XPStyle xp = XPStyle.getXP();
Part part = menuItemUI.getPart(menuItem);
Skin skin = xp.getSkin(menuItem, part);
skin.paintSkin(g, 0 , 0,
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,8 +50,7 @@
public void paint(Graphics g, JComponent c) {
Dimension s = c.getSize();
- XPStyle xp = XPStyle.getXP();
- if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+ if (WindowsMenuItemUI.isVistaPainting()) {
int x = 1;
Component parent = c.getParent();
if (parent instanceof JComponent) {
@@ -68,7 +67,7 @@
x += WindowsPopupMenuUI.getGutterWidth();
}
}
- Skin skin = xp.getSkin(c, Part.MP_POPUPSEPARATOR);
+ Skin skin = XPStyle.getXP().getSkin(c, Part.MP_POPUPSEPARATOR);
int skinHeight = skin.getHeight();
int y = (s.height - skinHeight) / 2;
skin.paintSkin(g, x, y, s.width - x - 1, skinHeight, State.NORMAL);
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -194,8 +194,8 @@
@Override
public void paint(Graphics g, JComponent c) {
- XPStyle xp = XPStyle.getXP();
- if (xp != null && WindowsMenuItemUI.isVistaPainting()) {
+ if (WindowsMenuItemUI.isVistaPainting()) {
+ XPStyle xp = XPStyle.getXP();
Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
int textOffset = getTextOffset(c);
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -322,9 +322,8 @@
private Rectangle getFullChunkBounds(Rectangle box) {
boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL);
XPStyle xp = XPStyle.getXP();
- int gap = (xp != null) ? xp.getInt(progressBar, Part.PP_PROGRESS,
- null, Prop.PROGRESSSPACESIZE, 0)
- : 0;
+ int gap = xp.getInt(progressBar, Part.PP_PROGRESS, null,
+ Prop.PROGRESSSPACESIZE, 0);
if (!vertical) {
int chunksize = box.width+gap;
@@ -339,9 +338,6 @@
boolean vertical,
int bgwidth, int bgheight) {
XPStyle xp = XPStyle.getXP();
- if (xp == null) {
- return;
- }
// create a new graphics to keep drawing surface state
Graphics2D gfx = (Graphics2D)g.create();
@@ -400,9 +396,6 @@
private void paintXPBackground(Graphics g, boolean vertical,
int barRectWidth, int barRectHeight) {
XPStyle xp = XPStyle.getXP();
- if (xp == null) {
- return;
- }
Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;
Skin skin = xp.getSkin(progressBar, part);
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -215,6 +215,7 @@
}
private Part getXPThumbPart() {
+ XPStyle xp = XPStyle.getXP();
Part part;
boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
boolean leftToRight = slider.getComponentOrientation().isLeftToRight();
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,9 +63,6 @@
private void paintXPBackground(Graphics g, JComponent c) {
XPStyle xp = XPStyle.getXP();
- if (xp == null) {
- return;
- }
Skin skin = xp.getSkin(c, Part.EP_EDIT);
State state = getXPState(c);
skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java Wed Jun 11 10:53:27 2014 +0400
@@ -91,10 +91,9 @@
this.column = column;
this.hasRollover = (column == getRolloverColumn());
if (skin == null) {
- XPStyle xp = XPStyle.getXP();
- skin = (xp != null) ? xp.getSkin(header, Part.HP_HEADERITEM) : null;
+ skin = XPStyle.getXP().getSkin(header, Part.HP_HEADERITEM);
}
- Insets margins = (skin != null) ? skin.getContentMargin() : null;
+ Insets margins = skin.getContentMargin();
Border border = null;
int contentTop = 0;
int contentLeft = 0;
diff -r 5b781839611d -r aade36e70da0 jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java Wed Jun 11 10:53:27 2014 +0400
@@ -115,7 +115,7 @@
}
}
}
- return ThemeReader.isXPStyleEnabled() ? xp : null;
+ return xp;
}
static boolean isVista() {
@@ -180,10 +180,9 @@
* should probably be cached there instead of here.
*/
Dimension getDimension(Component c, Part part, State state, Prop prop) {
- Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
- State.getValue(part, state),
- prop.getValue());
- return (d != null) ? d : new Dimension();
+ return ThemeReader.getPosition(part.getControlName(c), part.getValue(),
+ State.getValue(part, state),
+ prop.getValue());
}
/** Get a named Point
(e.g. a location or an offset) value
@@ -200,7 +199,11 @@
Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
State.getValue(part, state),
prop.getValue());
- return (d != null) ? new Point(d.width, d.height) : new Point();
+ if (d != null) {
+ return new Point(d.width, d.height);
+ } else {
+ return null;
+ }
}
/** Get a named Insets
value from the current style
@@ -214,10 +217,9 @@
* The return value is already cached in those places.
*/
Insets getMargin(Component c, Part part, State state, Prop prop) {
- Insets insets = ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
- State.getValue(part, state),
- prop.getValue());
- return (insets != null) ? insets : new Insets(0, 0, 0, 0);
+ return ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
+ State.getValue(part, state),
+ prop.getValue());
}
@@ -507,17 +509,16 @@
int boundingWidth = 100;
int boundingHeight = 100;
- Insets insets = ThemeReader.getThemeBackgroundContentMargins(
+ return ThemeReader.getThemeBackgroundContentMargins(
part.getControlName(null), part.getValue(),
0, boundingWidth, boundingHeight);
- return (insets != null) ? insets : new Insets(0, 0, 0, 0);
}
private int getWidth(State state) {
if (size == null) {
size = getPartSize(part, state);
}
- return (size != null) ? size.width : 0;
+ return size.width;
}
int getWidth() {
@@ -528,7 +529,7 @@
if (size == null) {
size = getPartSize(part, state);
}
- return (size != null) ? size.height : 0;
+ return size.height;
}
int getHeight() {
@@ -585,9 +586,6 @@
* @param state which state to paint
*/
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
- if (XPStyle.getXP() == null) {
- return;
- }
if (ThemeReader.isGetThemeTransitionDurationDefined()
&& component instanceof JComponent
&& SwingUtilities.getAncestorOfClass(CellRendererPane.class,
@@ -613,9 +611,6 @@
* @param state which state to paint
*/
void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, State state) {
- if (XPStyle.getXP() == null) {
- return;
- }
skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
}
@@ -635,7 +630,7 @@
void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state,
boolean borderFill) {
if(borderFill && "borderfill".equals(getTypeEnumName(component, part,
- state, Prop.BGTYPE)) && XPStyle.getXP() == null) {
+ state, Prop.BGTYPE))) {
return;
}
skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
@@ -689,7 +684,7 @@
public GlyphButton(Component parent, Part part) {
XPStyle xp = getXP();
- skin = xp != null ? xp.getSkin(parent, part) : null;
+ skin = xp.getSkin(parent, part);
setBorder(null);
setContentAreaFilled(false);
setMinimumSize(new Dimension(5, 5));
@@ -714,16 +709,13 @@
}
public void paintComponent(Graphics g) {
- if (XPStyle.getXP() == null || skin == null) {
- return;
- }
Dimension d = getSize();
skin.paintSkin(g, 0, 0, d.width, d.height, getState());
}
public void setPart(Component parent, Part part) {
XPStyle xp = getXP();
- skin = xp != null ? xp.getSkin(parent, part) : null;
+ skin = xp.getSkin(parent, part);
revalidate();
repaint();
}
diff -r 5b781839611d -r aade36e70da0 jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java
--- a/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/solaris/classes/sun/awt/windows/ThemeReader.java Wed Jun 11 10:53:27 2014 +0400
@@ -45,10 +45,6 @@
return false;
}
- public static boolean isXPStyleEnabled() {
- return false;
- }
-
public static void paintBackground(int[] buffer, String widget,
int part, int state, int x, int y, int w, int h, int stride) {
}
diff -r 5b781839611d -r aade36e70da0 jdk/src/windows/classes/sun/awt/windows/ThemeReader.java
--- a/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/ThemeReader.java Wed Jun 11 10:53:27 2014 +0400
@@ -61,8 +61,6 @@
private static final Lock readLock = readWriteLock.readLock();
private static final Lock writeLock = readWriteLock.writeLock();
- static volatile boolean xpStyleEnabled;
-
static void flush() {
writeLock.lock();
try {
@@ -78,10 +76,6 @@
public static native boolean isThemed();
- public static boolean isXPStyleEnabled() {
- return xpStyleEnabled;
- }
-
// this should be called only with writeLock held
private static Long getThemeImpl(String widget) {
Long theme = widgetToTheme.get(widget);
diff -r 5b781839611d -r aade36e70da0 jdk/src/windows/classes/sun/awt/windows/WToolkit.java
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Mon Jun 09 16:24:47 2014 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java Wed Jun 11 10:53:27 2014 +0400
@@ -72,9 +72,6 @@
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
- // Desktop property which specifies whether XP visual styles are in effect
- public static final String XPSTYLE_THEME_ACTIVE = "win.xpstyle.themeActive";
-
static GraphicsConfiguration config;
// System clipboard.
@@ -897,7 +894,7 @@
private synchronized void lazilyInitWProps() {
if (wprops == null) {
wprops = new WDesktopProperties(this);
- updateProperties(wprops.getProperties());
+ updateProperties();
}
}
@@ -932,27 +929,21 @@
* Windows doesn't always send WM_SETTINGCHANGE when it should.
*/
private void windowsSettingChange() {
- // JDK-8039383: Have to update the value of XPSTYLE_THEME_ACTIVE property
- // as soon as possible to prevent NPE and other errors because theme data
- // has become unavailable.
- final Map props = getWProps();
- updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
-
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
- updateProperties(props);
+ updateProperties();
}
});
}
- private synchronized void updateProperties(final Map props) {
- if (null == props) {
+ private synchronized void updateProperties() {
+ if (null == wprops) {
+ // wprops has not been initialized, so we have nothing to update
return;
}
- updateXPStyleEnabled(props.get(XPSTYLE_THEME_ACTIVE));
-
+ Map props = wprops.getProperties();
for (String propName : props.keySet()) {
Object val = props.get(propName);
if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -962,14 +953,6 @@
}
}
- private synchronized Map getWProps() {
- return (wprops != null) ? wprops.getProperties() : null;
- }
-
- private void updateXPStyleEnabled(final Object dskProp) {
- ThemeReader.xpStyleEnabled = Boolean.TRUE.equals(dskProp);
- }
-
@Override
public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
if (name == null) {