--- a/jdk/make/copy/Copy-jdk.accessibility.gmk Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/make/copy/Copy-jdk.accessibility.gmk Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2104, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2104, 2016, 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
@@ -30,8 +30,7 @@
ifeq ($(OPENJDK_TARGET_OS), windows)
TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \
- $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h \
- $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c
+ $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h
$(INCLUDE_DST_OS_DIR)/bridge/%: \
$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/%
--- a/jdk/make/launcher/Launcher-jdk.accessibility.gmk Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/make/launcher/Launcher-jdk.accessibility.gmk Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, 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
@@ -71,7 +71,7 @@
$$(eval $$(call SetupNativeCompilation, BUILD_JACCESSINSPECTOR$1, \
SRC := $(TOPDIR)/jaccessinspector $(TOPDIR)/common \
- $(TOPDIR)/toolscommon $(TOPDIR)/include/bridge, \
+ $(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
LIBS := advapi32.lib user32.lib, \
@@ -98,7 +98,7 @@
$$(eval $$(call SetupNativeCompilation,BUILD_JACCESSWALKER$1, \
SRC := $(TOPDIR)/jaccesswalker $(TOPDIR)/common \
- $(TOPDIR)/toolscommon $(TOPDIR)/include/bridge, \
+ $(TOPDIR)/toolscommon $(TOPDIR)/bridge, \
CFLAGS := $$(CFLAGS_JDKEXE) $(TOOLS_CFLAGS) -DACCESSBRIDGE_ARCH_$2 -EHsc, \
LDFLAGS := $$(LDFLAGS_JDKEXE) -stack:655360, \
LIBS := advapi32.lib comctl32.lib gdi32.lib user32.lib, \
--- a/jdk/make/lib/Awt2dLibraries.gmk Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/make/lib/Awt2dLibraries.gmk Mon Nov 14 09:03:07 2016 -0800
@@ -356,7 +356,7 @@
$(X_CFLAGS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
- deprecated-declarations unused-result maybe-uninitialized format \
+ unused-result maybe-uninitialized format \
format-security int-to-pointer-cast parentheses, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
--- a/jdk/make/lib/Lib-jdk.accessibility.gmk Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/make/lib/Lib-jdk.accessibility.gmk Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, 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
@@ -48,7 +48,7 @@
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS) \
$(addprefix -I,$(JAVA_AB_SRCDIR)) \
- -I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
+ -I$(ROOT_SRCDIR)/include/bridge \
-DACCESSBRIDGE_ARCH_$2, \
LDFLAGS := $(LDFLAGS_JDKLIB) -subsystem:windows, \
LIBS := kernel32.lib user32.lib gdi32.lib \
@@ -78,7 +78,7 @@
OPTIMIZATION := LOW, \
CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT $(ACCESSBRIDGE_CFLAGS) \
$(addprefix -I,$(WIN_AB_SRCDIR)) \
- -I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
+ -I$(ROOT_SRCDIR)/include/bridge \
-DACCESSBRIDGE_ARCH_$2, \
LDFLAGS := $(LDFLAGS_JDKLIB) -subsystem:windows \
-def:$(ROOT_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Mon Nov 14 09:03:07 2016 -0800
@@ -431,6 +431,7 @@
}
@Override
+ @SuppressWarnings("deprecation")
public void mouseReleased(final MouseEvent e) {
if (didForwardEvent(e)) return;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java Mon Nov 14 09:03:07 2016 -0800
@@ -179,8 +179,8 @@
T getInstance() {
try {
ReflectUtil.checkPackageAccess(clazz);
- return clazz.newInstance();
- } catch (InstantiationException | IllegalAccessException ignored) {
+ return clazz.getDeclaredConstructor().newInstance();
+ } catch (ReflectiveOperationException ignored) {
}
return null;
}
--- a/jdk/src/java.desktop/macosx/classes/sun/java2d/OSXSurfaceData.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/classes/sun/java2d/OSXSurfaceData.java Mon Nov 14 09:03:07 2016 -0800
@@ -672,7 +672,7 @@
TexturePaint color = (TexturePaint) sg2d.paint;
this.fGraphicsStatesInt.put(kColorStateIndex, kColorTexture);
texturePaintImage = color.getImage();
- SurfaceData textureSurfaceData = BufImgSurfaceData.createData(texturePaintImage);
+ SurfaceData textureSurfaceData = OSXOffScreenSurfaceData.createNewSurface(texturePaintImage);
this.fGraphicsStatesInt.put(kColorWidthIndex, texturePaintImage.getWidth());
this.fGraphicsStatesInt.put(kColorHeightIndex, texturePaintImage.getHeight());
Rectangle2D anchor = color.getAnchorRect();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Mon Nov 14 09:03:07 2016 -0800
@@ -38,6 +38,7 @@
import java.util.*;
import java.util.regex.*;
import java.awt.datatransfer.*;
+import java.nio.charset.StandardCharsets;
import sun.awt.datatransfer.*;
public class CDataTransferer extends DataTransferer {
@@ -132,7 +133,7 @@
String charset = Charset.defaultCharset().name();
if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
try {
- charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
+ charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), StandardCharsets.UTF_8);
} catch (UnsupportedFlavorException cannotHappen) {
}
}
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformLWWindow.java Mon Nov 14 09:03:07 2016 -0800
@@ -196,7 +196,8 @@
getLocalGraphicsEnvironment();
LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
- int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();
+ int scale =(int) Math.round(((LightweightFrame)peer.getTarget())
+ .getScaleFactorX());
Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
for (GraphicsDevice d : ge.getScreenDevices()) {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Nov 14 09:03:07 2016 -0800
@@ -25,10 +25,12 @@
package sun.lwawt.macosx;
+import com.apple.eawt.FullScreenAdapter;
+import com.apple.eawt.FullScreenUtilities;
+import com.apple.eawt.event.FullScreenEvent;
import java.awt.*;
import java.awt.Dialog.ModalityType;
import java.awt.event.*;
-import java.awt.peer.WindowPeer;
import java.beans.*;
import java.lang.reflect.InvocationTargetException;
@@ -44,6 +46,7 @@
import com.apple.laf.*;
import com.apple.laf.ClientPropertyApplicator.Property;
import com.sun.awt.AWTUtilities;
+import sun.lwawt.LWWindowPeer.PeerType;
public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
@@ -175,10 +178,24 @@
c.setStyleBits(CLOSEABLE, Boolean.parseBoolean(value.toString()));
}},
new Property<CPlatformWindow>(WINDOW_ZOOMABLE) { public void applyProperty(final CPlatformWindow c, final Object value) {
- c.setStyleBits(ZOOMABLE, Boolean.parseBoolean(value.toString()));
+ boolean zoomable = Boolean.parseBoolean(value.toString());
+ if (c.target instanceof RootPaneContainer
+ && c.getPeer().getPeerType() == PeerType.FRAME) {
+ if (c.isInFullScreen && !zoomable) {
+ c.toggleFullScreen();
+ }
+ }
+ c.setStyleBits(ZOOMABLE, zoomable);
}},
new Property<CPlatformWindow>(WINDOW_FULLSCREENABLE) { public void applyProperty(final CPlatformWindow c, final Object value) {
- c.setStyleBits(FULLSCREENABLE, Boolean.parseBoolean(value.toString()));
+ boolean fullscrenable = Boolean.parseBoolean(value.toString());
+ if (c.target instanceof RootPaneContainer
+ && c.getPeer().getPeerType() == PeerType.FRAME) {
+ if (c.isInFullScreen && !fullscrenable) {
+ c.toggleFullScreen();
+ }
+ }
+ c.setStyleBits(FULLSCREENABLE, fullscrenable);
}},
new Property<CPlatformWindow>(WINDOW_SHADOW_REVALIDATE_NOW) { public void applyProperty(final CPlatformWindow c, final Object value) {
nativeRevalidateNSWindowShadow(c.getNSWindowPtr());
@@ -210,6 +227,8 @@
private volatile boolean isFullScreenMode;
private boolean isFullScreenAnimationOn;
+ private volatile boolean isInFullScreen;
+
private Window target;
private LWWindowPeer peer;
protected CPlatformView contentView;
@@ -308,6 +327,8 @@
styleBits = SET(styleBits, RESIZABLE, resizable);
if (!resizable) {
styleBits = SET(styleBits, ZOOMABLE, false);
+ } else {
+ setCanFullscreen(true);
}
}
@@ -680,9 +701,25 @@
updateFocusabilityForAutoRequestFocus(true);
}
+ private void setCanFullscreen(final boolean canFullScreen) {
+ if (target instanceof RootPaneContainer
+ && getPeer().getPeerType() == PeerType.FRAME) {
+
+ if (isInFullScreen && !canFullScreen) {
+ toggleFullScreen();
+ }
+
+ final RootPaneContainer rpc = (RootPaneContainer) target;
+ rpc.getRootPane().putClientProperty(
+ CPlatformWindow.WINDOW_FULLSCREENABLE, canFullScreen);
+ }
+ }
+
@Override
public void setResizable(final boolean resizable) {
+ setCanFullscreen(resizable);
setStyleBits(RESIZABLE, resizable);
+ setStyleBits(ZOOMABLE, resizable);
}
@Override
@@ -1074,6 +1111,7 @@
}
private void windowDidEnterFullScreen() {
+ isInFullScreen = true;
isFullScreenAnimationOn = false;
}
@@ -1082,6 +1120,7 @@
}
private void windowDidExitFullScreen() {
+ isInFullScreen = false;
isFullScreenAnimationOn = false;
}
}
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.h Mon Nov 14 09:03:07 2016 -0800
@@ -26,6 +26,7 @@
#include <jni.h>
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
+#import <AppKit/NSTrackingArea.h>
#import "CPopupMenu.h"
@@ -64,12 +65,14 @@
@public
AWTTrayIcon *trayIcon;
NSImage* image;
+ NSTrackingArea *trackingArea;
BOOL isHighlighted;
}
-(id)initWithTrayIcon:(AWTTrayIcon *)theTrayIcon;
-(void)setHighlighted:(BOOL)aFlag;
-(void)setImage:(NSImage*)anImage;
-(void)setTrayIcon:(AWTTrayIcon*)theTrayIcon;
+-(void)addTrackingArea;
@end //AWTTrayIconView
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m Mon Nov 14 09:03:07 2016 -0800
@@ -171,12 +171,27 @@
[self setTrayIcon: theTrayIcon];
isHighlighted = NO;
image = nil;
+ trackingArea = nil;
+
+ [self addTrackingArea];
+
+ return self;
+}
- return self;
+- (void)addTrackingArea {
+ NSTrackingAreaOptions options = NSTrackingMouseMoved |
+ NSTrackingInVisibleRect |
+ NSTrackingActiveAlways;
+ trackingArea = [[NSTrackingArea alloc] initWithRect: CGRectZero
+ options: options
+ owner: self
+ userInfo: nil];
+ [self addTrackingArea:trackingArea];
}
-(void) dealloc {
[image release];
+ [trackingArea release];
[super dealloc];
}
@@ -269,6 +284,10 @@
[trayIcon deliverJavaMouseEvent: event];
}
+- (void) mouseMoved: (NSEvent *)event {
+ [trayIcon deliverJavaMouseEvent: event];
+}
+
- (void) rightMouseDown:(NSEvent *)event {
[trayIcon deliverJavaMouseEvent: event];
}
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java Mon Nov 14 09:03:07 2016 -0800
@@ -280,7 +280,8 @@
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
ElementHandler parent = this.handler;
try {
- this.handler = getElementHandler(qName).newInstance();
+ this.handler =
+ getElementHandler(qName).getDeclaredConstructor().newInstance();
this.handler.setOwner(this);
this.handler.setParent(parent);
}
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/finder/InstanceFinder.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/finder/InstanceFinder.java Mon Nov 14 09:03:07 2016 -0800
@@ -94,7 +94,7 @@
}
if (this.type.isAssignableFrom(type)) {
@SuppressWarnings("unchecked")
- T tmp = (T) type.newInstance();
+ T tmp = (T) type.getDeclaredConstructor().newInstance();
return tmp;
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFaxDecompressor.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFaxDecompressor.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -101,7 +101,8 @@
0xff // 8
};
- // Table to be used when fillOrder = 2, for flipping bytes.
+ // Table to be used for flipping bytes when fillOrder is
+ // BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT (2).
static byte flipTable[] = {
0, -128, 64, -64, 32, -96, 96, -32,
16, -112, 80, -48, 48, -80, 112, -16,
@@ -597,7 +598,8 @@
TIFFField f;
f = tmetadata.getTIFFField(BaselineTIFFTagSet.TAG_FILL_ORDER);
- this.fillOrder = f == null ? 1 : f.getAsInt(0);
+ this.fillOrder = f == null ?
+ BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT : f.getAsInt(0);
f = tmetadata.getTIFFField(BaselineTIFFTagSet.TAG_COMPRESSION);
this.compression = f == null ?
@@ -612,7 +614,7 @@
f = tmetadata.getTIFFField(BaselineTIFFTagSet.TAG_T6_OPTIONS);
this.t6Options = f == null ? 0 : f.getAsInt(0);
} else {
- this.fillOrder = 1; // MSB-to-LSB
+ this.fillOrder = BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT;
this.compression = BaselineTIFFTagSet.COMPRESSION_CCITT_RLE; // RLE
@@ -1458,7 +1460,7 @@
int l = data.length - 1;
int bp = this.bytePointer;
- if (fillOrder == 1) {
+ if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT) {
b = data[bp];
if (bp == l) {
@@ -1471,7 +1473,7 @@
next = data[bp + 1];
next2next = data[bp + 2];
}
- } else if (fillOrder == 2) {
+ } else if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT) {
b = flipTable[data[bp] & 0xff];
if (bp == l) {
@@ -1527,14 +1529,14 @@
int l = data.length - 1;
int bp = this.bytePointer;
- if (fillOrder == 1) {
+ if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT) {
b = data[bp];
if (bp == l) {
next = 0x00;
} else {
next = data[bp + 1];
}
- } else if (fillOrder == 2) {
+ } else if (fillOrder == BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT) {
b = flipTable[data[bp] & 0xff];
if (bp == l) {
next = 0x00;
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java Mon Nov 14 09:03:07 2016 -0800
@@ -49,6 +49,52 @@
private long stripOrTileOffsetsPosition = -1;
private long lastPosition = -1;
+ //
+ // A set of tag numbers corresponding to tags essential to decoding
+ // the image and metadata required to interpret its samples.
+ //
+ private static volatile Set<Integer> essentialTags = null;
+
+ private static void initializeEssentialTags() {
+ Set<Integer> tags = essentialTags;
+ if (tags == null) {
+ essentialTags = tags = Set.of(
+ BaselineTIFFTagSet.TAG_BITS_PER_SAMPLE,
+ BaselineTIFFTagSet.TAG_COLOR_MAP,
+ BaselineTIFFTagSet.TAG_COMPRESSION,
+ BaselineTIFFTagSet.TAG_EXTRA_SAMPLES,
+ BaselineTIFFTagSet.TAG_FILL_ORDER,
+ BaselineTIFFTagSet.TAG_ICC_PROFILE,
+ BaselineTIFFTagSet.TAG_IMAGE_LENGTH,
+ BaselineTIFFTagSet.TAG_IMAGE_WIDTH,
+ BaselineTIFFTagSet.TAG_JPEG_AC_TABLES,
+ BaselineTIFFTagSet.TAG_JPEG_DC_TABLES,
+ BaselineTIFFTagSet.TAG_JPEG_INTERCHANGE_FORMAT,
+ BaselineTIFFTagSet.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH,
+ BaselineTIFFTagSet.TAG_JPEG_PROC,
+ BaselineTIFFTagSet.TAG_JPEG_Q_TABLES,
+ BaselineTIFFTagSet.TAG_JPEG_RESTART_INTERVAL,
+ BaselineTIFFTagSet.TAG_JPEG_TABLES,
+ BaselineTIFFTagSet.TAG_PHOTOMETRIC_INTERPRETATION,
+ BaselineTIFFTagSet.TAG_PLANAR_CONFIGURATION,
+ BaselineTIFFTagSet.TAG_PREDICTOR,
+ BaselineTIFFTagSet.TAG_REFERENCE_BLACK_WHITE,
+ BaselineTIFFTagSet.TAG_ROWS_PER_STRIP,
+ BaselineTIFFTagSet.TAG_SAMPLES_PER_PIXEL,
+ BaselineTIFFTagSet.TAG_SAMPLE_FORMAT,
+ BaselineTIFFTagSet.TAG_STRIP_BYTE_COUNTS,
+ BaselineTIFFTagSet.TAG_STRIP_OFFSETS,
+ BaselineTIFFTagSet.TAG_T4_OPTIONS,
+ BaselineTIFFTagSet.TAG_T6_OPTIONS,
+ BaselineTIFFTagSet.TAG_TILE_BYTE_COUNTS,
+ BaselineTIFFTagSet.TAG_TILE_LENGTH,
+ BaselineTIFFTagSet.TAG_TILE_OFFSETS,
+ BaselineTIFFTagSet.TAG_TILE_WIDTH,
+ BaselineTIFFTagSet.TAG_Y_CB_CR_COEFFICIENTS,
+ BaselineTIFFTagSet.TAG_Y_CB_CR_SUBSAMPLING
+ );
+ }
+ }
/**
* Converts a {@code TIFFDirectory} to a {@code TIFFIFD}.
@@ -507,6 +553,15 @@
List<TIFFTagSet> tagSetList = getTagSetList();
+ boolean ensureEssentialTags = false;
+ TIFFTagSet baselineTagSet = null;
+ if (isPrimaryIFD && ignoreUnknownFields
+ && !tagSetList.contains(BaselineTIFFTagSet.getInstance())) {
+ ensureEssentialTags = true;
+ initializeEssentialTags();
+ baselineTagSet = BaselineTIFFTagSet.getInstance();
+ }
+
List<Object> entries = new ArrayList<>();
Object[] entryData = new Object[1]; // allocate once for later reuse.
@@ -530,6 +585,11 @@
// Get the associated TIFFTag.
TIFFTag tag = getTag(tagNumber, tagSetList);
+ if (tag == null && ensureEssentialTags
+ && essentialTags.contains(tagNumber)) {
+ tag = baselineTagSet.getTag(tagNumber);
+ }
+
// Ignore unknown fields, fields with unknown type, and fields
// with count out of int range.
if((tag == null && ignoreUnknownFields)
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java Mon Nov 14 09:03:07 2016 -0800
@@ -1174,7 +1174,14 @@
int predictor = ((predictorField == null)
? BaselineTIFFTagSet.PREDICTOR_NONE
: predictorField.getAsInt(0));
- this.decompressor = new TIFFLZWDecompressor(predictor);
+
+ TIFFField fillOrderField
+ = imageMetadata.getTIFFField(BaselineTIFFTagSet.TAG_FILL_ORDER);
+ int fillOrder = ((fillOrderField == null)
+ ? BaselineTIFFTagSet.FILL_ORDER_LEFT_TO_RIGHT
+ : fillOrderField.getAsInt(0));
+
+ this.decompressor = new TIFFLZWDecompressor(predictor, fillOrder);
} else if (compression
== BaselineTIFFTagSet.COMPRESSION_JPEG) {
this.decompressor = new TIFFJPEGDecompressor();
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java Mon Nov 14 09:03:07 2016 -0800
@@ -30,6 +30,10 @@
class TIFFLZWDecompressor extends TIFFDecompressor {
+ private static final int CLEAR_CODE = 256;
+ private static final int EOI_CODE = 257;
+ private static final int FIRST_CODE = 258;
+
private static final int andTable[] = {
511,
1023,
@@ -39,6 +43,10 @@
private int predictor;
+ // whether to reverse the bits in each byte of the input data, i.e.,
+ // convert right-to-left fill order (lsb) to left-to-right (msb).
+ private boolean flipBits;
+
private byte[] srcData;
private byte[] dstData;
@@ -51,7 +59,8 @@
private int nextData = 0;
private int nextBits = 0;
- public TIFFLZWDecompressor(int predictor) throws IIOException {
+ public TIFFLZWDecompressor(int predictor, int fillOrder)
+ throws IIOException {
super();
if (predictor != BaselineTIFFTagSet.PREDICTOR_NONE &&
@@ -62,6 +71,8 @@
}
this.predictor = predictor;
+
+ flipBits = fillOrder == BaselineTIFFTagSet.FILL_ORDER_RIGHT_TO_LEFT;
}
public void decodeRaw(byte[] b,
@@ -88,6 +99,12 @@
byte[] sdata = new byte[byteCount];
stream.readFully(sdata);
+ if (flipBits) {
+ for (int i = 0; i < byteCount; i++) {
+ sdata[i] = TIFFFaxDecompressor.flipTable[sdata[i] & 0xff];
+ }
+ }
+
int bytesPerRow = (srcWidth*bitsPerPixel + 7)/8;
byte[] buf;
int bufOffset;
@@ -133,11 +150,11 @@
int code, oldCode = 0;
byte[] string;
- while ((code = getNextCode()) != 257) {
- if (code == 256) {
+ while ((code = getNextCode()) != EOI_CODE) {
+ if (code == CLEAR_CODE) {
initializeStringTable();
code = getNextCode();
- if (code == 257) {
+ if (code == EOI_CODE) {
break;
}
@@ -186,12 +203,12 @@
public void initializeStringTable() {
stringTable = new byte[4096][];
- for (int i = 0; i < 256; i++) {
+ for (int i = 0; i < CLEAR_CODE; i++) {
stringTable[i] = new byte[1];
stringTable[i][0] = (byte)i;
}
- tableIndex = 258;
+ tableIndex = FIRST_CODE;
bitsToGet = 9;
}
@@ -281,7 +298,7 @@
return code;
} catch (ArrayIndexOutOfBoundsException e) {
// Strip not terminated as expected: return EndOfInformation code.
- return 257;
+ return EOI_CODE;
}
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/SwingUtilities3.java Mon Nov 14 09:03:07 2016 -0800
@@ -88,6 +88,7 @@
* or {@code Applet}
* @param isRequested the value to set vsyncRequested state to
*/
+ @SuppressWarnings("deprecation")
public static void setVsyncRequested(Container rootContainer,
boolean isRequested) {
assert (rootContainer instanceof Applet) || (rootContainer instanceof Window);
@@ -104,6 +105,7 @@
* @param rootContainer topmost container. Should be either Window or Applet
* @return {@code true} if vsync painting is requested for {@code rootContainer}
*/
+ @SuppressWarnings("deprecation")
public static boolean isVsyncRequested(Container rootContainer) {
assert (rootContainer instanceof Applet) || (rootContainer instanceof Window);
return Boolean.TRUE == vsyncedMap.get(rootContainer);
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Mon Nov 14 09:03:07 2016 -0800
@@ -1131,16 +1131,12 @@
getContextClassLoader());
if (methodName == null) {
- return c.newInstance();
+ return c.getDeclaredConstructor().newInstance();
}
Method m = c.getMethod(methodName, (Class<?>[])null);
return m.invoke(c, (Object[])null);
- } catch (ClassNotFoundException cnfe) {
- } catch (IllegalAccessException iae) {
- } catch (InvocationTargetException ite) {
- } catch (NoSuchMethodException nsme) {
- } catch (InstantiationException ie) {
+ } catch (ReflectiveOperationException e) {
}
return null;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, 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
@@ -29,6 +29,7 @@
import com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType;
import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import javax.swing.plaf.synth.*;
import java.awt.*;
@@ -40,7 +41,6 @@
import java.util.*;
import javax.swing.*;
-import javax.swing.border.*;
import javax.xml.parsers.*;
import org.xml.sax.SAXException;
@@ -226,12 +226,8 @@
JComponent titlePane = (JComponent)button.getParent();
Container titlePaneParent = titlePane.getParent();
- JInternalFrame jif;
- if (titlePaneParent instanceof JInternalFrame) {
- jif = (JInternalFrame)titlePaneParent;
- } else if (titlePaneParent instanceof JInternalFrame.JDesktopIcon) {
- jif = ((JInternalFrame.JDesktopIcon)titlePaneParent).getInternalFrame();
- } else {
+ JInternalFrame jif = findInternalFrame(titlePaneParent);
+ if (jif == null) {
return;
}
@@ -332,6 +328,19 @@
}
}
+ JInternalFrame findInternalFrame(Component comp) {
+ if (comp.getParent() instanceof BasicInternalFrameTitlePane) {
+ comp = comp.getParent();
+ }
+ if (comp instanceof JInternalFrame) {
+ return (JInternalFrame)comp;
+ } else if (comp instanceof JInternalFrame.JDesktopIcon) {
+ return ((JInternalFrame.JDesktopIcon)comp).getInternalFrame();
+ }
+ assert false : "cannot find the internal frame";
+ return null;
+ }
+
void paintFrameBorder(SynthContext context, Graphics g, int x0, int y0, int width, int height) {
updateFrameGeometry(context);
@@ -343,13 +352,8 @@
return;
}
- JInternalFrame jif = null;
- if (comp instanceof JInternalFrame) {
- jif = (JInternalFrame)comp;
- } else if (comp instanceof JInternalFrame.JDesktopIcon) {
- jif = ((JInternalFrame.JDesktopIcon)comp).getInternalFrame();
- } else {
- assert false : "component is not JInternalFrame or JInternalFrame.JDesktopIcon";
+ JInternalFrame jif = findInternalFrame(comp);
+ if (jif == null) {
return;
}
@@ -1467,13 +1471,8 @@
JComponent comp = context.getComponent();
JComponent titlePane = findChild(comp, "InternalFrame.northPane");
- JInternalFrame jif = null;
- if (comp instanceof JInternalFrame) {
- jif = (JInternalFrame)comp;
- } else if (comp instanceof JInternalFrame.JDesktopIcon) {
- jif = ((JInternalFrame.JDesktopIcon)comp).getInternalFrame();
- } else {
- assert false : "component is not JInternalFrame or JInternalFrame.JDesktopIcon";
+ JInternalFrame jif = findInternalFrame(comp);
+ if (jif == null) {
return;
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JARSoundbankReader.java Mon Nov 14 09:03:07 2016 -0800
@@ -90,12 +90,10 @@
Class<?> c = Class.forName(line.trim(), false, ucl);
if (Soundbank.class.isAssignableFrom(c)) {
ReflectUtil.checkPackageAccess(c);
- Object o = c.newInstance();
+ Object o = c.getDeclaredConstructor().newInstance();
soundbanks.add((Soundbank) o);
}
- } catch (ClassNotFoundException ignored) {
- } catch (InstantiationException ignored) {
- } catch (IllegalAccessException ignored) {
+ } catch (ReflectiveOperationException ignored) {
}
}
line = r.readLine();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Mon Nov 14 09:03:07 2016 -0800
@@ -55,6 +55,7 @@
* @author Arthur van Hoff, Kara Kytle, Jan Borgersen
* @author Florian Bomers
*/
+@SuppressWarnings("deprecation")
public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, LineListener {
private static final boolean DEBUG = false;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelAbstractOscillator.java Mon Nov 14 09:03:07 2016 -0800
@@ -137,10 +137,8 @@
public ModelOscillatorStream open(float samplerate) {
ModelAbstractOscillator oscs;
try {
- oscs = this.getClass().newInstance();
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
+ oscs = this.getClass().getDeclaredConstructor().newInstance();
+ } catch (ReflectiveOperationException e) {
throw new IllegalArgumentException(e);
}
oscs.setSampleRate(samplerate);
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java Mon Nov 14 09:03:07 2016 -0800
@@ -4016,6 +4016,7 @@
* {@code true}.
* @see #createBuffers(int, BufferCapabilities)
*/
+ @SuppressWarnings("deprecation")
protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
throws AWTException
{
@@ -8133,6 +8134,7 @@
return res;
}
+ @SuppressWarnings("deprecation")
final Component getNextFocusCandidate() {
Container rootAncestor = getTraversalRoot();
Component comp = this;
--- a/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -75,6 +75,7 @@
private LinkedList<KeyEvent> enqueuedKeyEvents = new LinkedList<KeyEvent>();
private LinkedList<TypeAheadMarker> typeAheadMarkers = new LinkedList<TypeAheadMarker>();
private boolean consumeNextKeyTyped;
+ private Component restoreFocusTo;
static {
AWTAccessor.setDefaultKeyboardFocusManagerAccessor(
@@ -145,19 +146,24 @@
}
private boolean restoreFocus(Window aWindow, Component vetoedComponent,
boolean clearOnFailure) {
+ restoreFocusTo = null;
Component toFocus =
KeyboardFocusManager.getMostRecentFocusOwner(aWindow);
if (toFocus != null && toFocus != vetoedComponent) {
- Component heavyweight = getHeavyweight(aWindow);
- if (heavyweight != null) {
- setNativeFocusOwner(heavyweight);
- Toolkit.getEventQueue().createSecondaryLoop(
- () -> getGlobalFocusedWindow() != aWindow, null, 50)
- .enter();
- }
- if (getGlobalFocusedWindow() == aWindow &&
- doRestoreFocus(toFocus, vetoedComponent, false)) {
+ if (getHeavyweight(aWindow) != getNativeFocusOwner()) {
+ // cannot restore focus synchronously
+ if (!toFocus.isShowing() || !toFocus.canBeFocusOwner()) {
+ toFocus = toFocus.getNextFocusCandidate();
+ }
+ if (toFocus != null && toFocus != vetoedComponent) {
+ if (!toFocus.requestFocus(false,
+ FocusEvent.Cause.ROLLBACK)) {
+ restoreFocusTo = toFocus;
+ }
+ return true;
+ }
+ } else if (doRestoreFocus(toFocus, vetoedComponent, false)) {
return true;
}
}
@@ -423,6 +429,8 @@
// may cause deadlock, thus we don't synchronize this block.
Component toFocus = KeyboardFocusManager.
getMostRecentFocusOwner(newFocusedWindow);
+ boolean isFocusRestore = restoreFocusTo != null &&
+ toFocus == restoreFocusTo;
if ((toFocus == null) &&
newFocusedWindow.isFocusableWindow())
{
@@ -441,7 +449,10 @@
tempLost, toFocus);
}
if (tempLost != null) {
- tempLost.requestFocusInWindow(FocusEvent.Cause.ACTIVATION);
+ tempLost.requestFocusInWindow(
+ isFocusRestore && tempLost == toFocus ?
+ FocusEvent.Cause.ROLLBACK :
+ FocusEvent.Cause.ACTIVATION);
}
if (toFocus != null && toFocus != tempLost) {
@@ -450,6 +461,7 @@
toFocus.requestFocusInWindow(FocusEvent.Cause.ACTIVATION);
}
}
+ restoreFocusTo = null;
Window realOppositeWindow = this.realOppositeWindowWR.get();
if (realOppositeWindow != we.getOppositeWindow()) {
@@ -499,6 +511,7 @@
}
case FocusEvent.FOCUS_GAINED: {
+ restoreFocusTo = null;
FocusEvent fe = (FocusEvent)e;
Component oldFocusOwner = getGlobalFocusOwner();
Component newFocusOwner = fe.getComponent();
--- a/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java Mon Nov 14 09:03:07 2016 -0800
@@ -108,7 +108,7 @@
ClassLoader cl = ClassLoader.getSystemClassLoader();
geCls = Class.forName(nm, true, cl);
}
- ge = (GraphicsEnvironment)geCls.newInstance();
+ ge = (GraphicsEnvironment)geCls.getConstructor().newInstance();
// long t1 = System.currentTimeMillis();
// System.out.println("GE creation took " + (t1-t0)+ "ms.");
if (isHeadless()) {
@@ -116,12 +116,9 @@
}
} catch (ClassNotFoundException e) {
throw new Error("Could not find class: "+nm);
- } catch (InstantiationException e) {
+ } catch (ReflectiveOperationException | IllegalArgumentException e) {
throw new Error("Could not instantiate Graphics Environment: "
+ nm);
- } catch (IllegalAccessException e) {
- throw new Error ("Could not access Graphics Environment: "
- + nm);
}
return ge;
}
--- a/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/Taskbar.java Mon Nov 14 09:03:07 2016 -0800
@@ -407,10 +407,21 @@
}
/**
- * Displays progress for specified window.
+ * Displays a determinate progress bar in the task area for the specified
+ * window.
+ * <br>
+ * The visual behavior is platform and {@link State} dependent.
+ * <br>
+ * This call cancels the {@link State#INDETERMINATE INDETERMINATE} state
+ * of the window.
+ * <br>
+ * Note that when multiple windows is grouped in the task area
+ * the behavior is platform specific.
*
* @param w window to update
- * @param value from 0 to 100, other to disable progress indication
+ * @param value from 0 to 100, other to switch to {@link State#OFF} state
+ * and disable progress indication
+ * @see #setWindowProgressState(java.awt.Window, State)
* @throws SecurityException if a security manager exists and it denies the
* {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
@@ -426,14 +437,21 @@
/**
* Sets a progress state for a specified window.
+ * <br>
+ * Each state displays a progress in a platform-dependent way.
+ * <br>
+ * Note than switching from {@link State#INDETERMINATE INDETERMINATE} state
+ * to any of determinate states may reset value set by
+ * {@link #setWindowProgressValue(java.awt.Window, int) setWindowProgressValue}
*
* @param w window
* @param state to change to
* @see State#OFF
* @see State#NORMAL
* @see State#PAUSED
+ * @see State#ERROR
* @see State#INDETERMINATE
- * @see State#ERROR
+ * @see #setWindowProgressValue(java.awt.Window, int)
* @throws SecurityException if a security manager exists and it denies the
* {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java Mon Nov 14 09:03:07 2016 -0800
@@ -468,7 +468,7 @@
private static void fallbackToLoadClassForAT(String atName) {
try {
Class<?> c = Class.forName(atName, false, ClassLoader.getSystemClassLoader());
- c.newInstance();
+ c.getConstructor().newInstance();
} catch (ClassNotFoundException e) {
newAWTError(e, "Assistive Technology not found: " + atName);
} catch (InstantiationException e) {
@@ -583,15 +583,13 @@
}
try {
if (cls != null) {
- toolkit = (Toolkit)cls.newInstance();
+ toolkit = (Toolkit)cls.getConstructor().newInstance();
if (GraphicsEnvironment.isHeadless()) {
toolkit = new HeadlessToolkit(toolkit);
}
}
- } catch (final InstantiationException ignored) {
- throw new AWTError("Could not instantiate Toolkit: " + nm);
- } catch (final IllegalAccessException ignored) {
- throw new AWTError("Could not access Toolkit: " + nm);
+ } catch (final ReflectiveOperationException ignored) {
+ throw new AWTError("Could not create Toolkit: " + nm);
}
return null;
}
--- a/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/print/PrinterJob.java Mon Nov 14 09:03:07 2016 -0800
@@ -79,13 +79,12 @@
public PrinterJob run() {
String nm = System.getProperty("java.awt.printerjob", null);
try {
- return (PrinterJob)Class.forName(nm).newInstance();
+ return (PrinterJob)Class.forName(nm).
+ getConstructor().newInstance();
} catch (ClassNotFoundException e) {
throw new AWTError("PrinterJob not found: " + nm);
- } catch (InstantiationException e) {
+ } catch (ReflectiveOperationException e) {
throw new AWTError("Could not instantiate PrinterJob: " + nm);
- } catch (IllegalAccessException e) {
- throw new AWTError("Could not access PrinterJob: " + nm);
}
}
});
--- a/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java Mon Nov 14 09:03:07 2016 -0800
@@ -44,6 +44,7 @@
*/
+@SuppressWarnings("deprecation")
public interface AppletInitializer {
/**
--- a/jdk/src/java.desktop/share/classes/java/beans/Beans.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/beans/Beans.java Mon Nov 14 09:03:07 2016 -0800
@@ -154,7 +154,7 @@
* @exception IOException if an I/O error occurs.
* @since 1.2
*/
-
+ @SuppressWarnings("deprecation")
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
throws IOException, ClassNotFoundException {
@@ -501,7 +501,7 @@
* Package private support class. This provides a default AppletContext
* for beans which are applets.
*/
-
+@SuppressWarnings("deprecation")
class BeansAppletContext implements AppletContext {
Applet target;
Hashtable<URL,Object> imageCache = new Hashtable<>();
@@ -586,6 +586,7 @@
* Package private support class. This provides an AppletStub
* for beans which are applets.
*/
+@SuppressWarnings("deprecation")
class BeansAppletStub implements AppletStub {
transient boolean active;
transient Applet target;
--- a/jdk/src/java.desktop/share/classes/java/beans/Introspector.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/beans/Introspector.java Mon Nov 14 09:03:07 2016 -0800
@@ -36,6 +36,7 @@
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
@@ -1280,11 +1281,12 @@
*/
static Object instantiate(Class<?> sibling, String className)
throws InstantiationException, IllegalAccessException,
+ NoSuchMethodException, InvocationTargetException,
ClassNotFoundException {
// First check with sibling's classloader (if any).
ClassLoader cl = sibling.getClassLoader();
Class<?> cls = ClassFinder.findClass(className, cl);
- return cls.newInstance();
+ return cls.getDeclaredConstructor().newInstance();
}
} // end class Introspector
--- a/jdk/src/java.desktop/share/classes/java/beans/MetaData.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/beans/MetaData.java Mon Nov 14 09:03:07 2016 -0800
@@ -1261,9 +1261,9 @@
internalPersistenceDelegates.put(typeName, defaultPersistenceDelegate);
try {
String name = type.getName();
- Class c = Class.forName("java.beans.MetaData$" + name.replace('.', '_')
+ Class<?> c = Class.forName("java.beans.MetaData$" + name.replace('.', '_')
+ "_PersistenceDelegate");
- pd = (PersistenceDelegate)c.newInstance();
+ pd = (PersistenceDelegate)c.getDeclaredConstructor().newInstance();
internalPersistenceDelegates.put(typeName, pd);
}
catch (ClassNotFoundException e) {
--- a/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java Mon Nov 14 09:03:07 2016 -0800
@@ -470,14 +470,14 @@
Constructor<?> ctor = null;
if (bean != null) {
try {
- ctor = cls.getConstructor(new Class<?>[] { Object.class });
+ ctor = cls.getDeclaredConstructor(new Class<?>[] { Object.class });
} catch (Exception ex) {
// Fall through
}
}
try {
if (ctor == null) {
- editor = cls.newInstance();
+ editor = cls.getDeclaredConstructor().newInstance();
} else {
editor = ctor.newInstance(new Object[] { bean });
}
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -28,6 +28,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
/**
* An instance of the {@code AudioFileFormat} class describes an audio file,
@@ -344,7 +345,7 @@
* @param extension the string that commonly marks the file type
* without leading dot
*/
- public Type(String name, String extension) {
+ public Type(final String name, final String extension) {
this.name = name;
this.extension = extension;
}
@@ -353,14 +354,14 @@
* Finalizes the equals method.
*/
@Override
- public final boolean equals(Object obj) {
- if (toString() == null) {
- return (obj != null) && (obj.toString() == null);
+ public final boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
}
- if (obj instanceof Type) {
- return toString().equals(obj.toString());
+ if (!(obj instanceof Type)) {
+ return false;
}
- return false;
+ return Objects.equals(name, ((Type) obj).name);
}
/**
@@ -368,10 +369,7 @@
*/
@Override
public final int hashCode() {
- if (toString() == null) {
- return 0;
- }
- return toString().hashCode();
+ return name != null ? name.hashCode() : 0;
}
/**
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -28,6 +28,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
/**
* {@code AudioFormat} is the class that specifies a particular arrangement of
@@ -599,7 +600,7 @@
*
* @param name the name of the new type of encoding
*/
- public Encoding(String name) {
+ public Encoding(final String name) {
this.name = name;
}
@@ -607,14 +608,14 @@
* Finalizes the equals method.
*/
@Override
- public final boolean equals(Object obj) {
- if (toString() == null) {
- return (obj != null) && (obj.toString() == null);
+ public final boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
}
- if (obj instanceof Encoding) {
- return toString().equals(obj.toString());
+ if (!(obj instanceof Encoding)) {
+ return false;
}
- return false;
+ return Objects.equals(name, ((Encoding) obj).name);
}
/**
@@ -622,10 +623,7 @@
*/
@Override
public final int hashCode() {
- if (toString() == null) {
- return 0;
- }
- return toString().hashCode();
+ return name != null ? name.hashCode() : 0;
}
/**
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -129,7 +129,7 @@
* system
* @throws NullPointerException if {@code stream} or {@code fileType} or
* {@code out} are {@code null}
- * @see #isFileTypeSupported(AudioFileFormat.Type, AudioInputStream)
+ * @see #isFileTypeSupported(Type, AudioInputStream)
* @see #getAudioFileTypes
*/
public abstract int write(AudioInputStream stream, Type fileType,
@@ -149,7 +149,7 @@
* the system
* @throws NullPointerException if {@code stream} or {@code fileType} or
* {@code out} are {@code null}
- * @see #isFileTypeSupported
+ * @see #isFileTypeSupported(Type, AudioInputStream)
* @see #getAudioFileTypes
*/
public abstract int write(AudioInputStream stream, Type fileType, File out)
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Mon Nov 14 09:03:07 2016 -0800
@@ -555,6 +555,7 @@
* @see #setComponentPopupMenu
* @since 1.5
*/
+ @SuppressWarnings("deprecation")
public JPopupMenu getComponentPopupMenu() {
if(!getInheritsPopupMenu()) {
@@ -2913,6 +2914,7 @@
* @param pressed true if the key is pressed
* @return true if there is a key binding for <code>e</code>
*/
+ @SuppressWarnings("deprecation")
boolean processKeyBindings(KeyEvent e, boolean pressed) {
if (!SwingUtilities.isValidKeyEventForKeyBindings(e)) {
return false;
@@ -4457,6 +4459,7 @@
* return value for this method
* @see #getVisibleRect
*/
+ @SuppressWarnings("deprecation")
static final void computeVisibleRect(Component c, Rectangle visibleRect) {
Container p = c.getParent();
Rectangle bounds = c.getBounds();
@@ -4625,6 +4628,7 @@
* or <code>null</code> if not in any container
*/
@BeanProperty(bound = false)
+ @SuppressWarnings("deprecation")
public Container getTopLevelAncestor() {
for(Container p = this; p != null; p = p.getParent()) {
if(p instanceof Window || p instanceof Applet) {
@@ -5032,6 +5036,7 @@
this.paintingChild = paintingChild;
}
+ @SuppressWarnings("deprecation")
void _paintImmediately(int x, int y, int w, int h) {
Graphics g;
Container c;
--- a/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java Mon Nov 14 09:03:07 2016 -0800
@@ -1196,7 +1196,7 @@
// registerEditorKitForContentType(type, class, null).
c = SwingUtilities.loadSystemClass(classname);
}
- k = (EditorKit) c.newInstance();
+ k = (EditorKit) c.getDeclaredConstructor().newInstance();
kitRegistry.put(type, k);
} catch (Throwable e) {
k = null;
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java Mon Nov 14 09:03:07 2016 -0800
@@ -6043,6 +6043,7 @@
this.focusManager = fm;
}
+ @SuppressWarnings("deprecation")
public void propertyChange(PropertyChangeEvent ev) {
if (!isEditing() || getClientProperty("terminateEditOnFocusLost") != Boolean.TRUE) {
return;
--- a/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java Mon Nov 14 09:03:07 2016 -0800
@@ -27,6 +27,12 @@
import java.awt.*;
import java.awt.event.*;
+import java.awt.geom.AffineTransform;
+import static java.awt.geom.AffineTransform.TYPE_FLIP;
+import static java.awt.geom.AffineTransform.TYPE_MASK_SCALE;
+import static java.awt.geom.AffineTransform.TYPE_TRANSLATION;
+import java.awt.image.AbstractMultiResolutionImage;
+import java.awt.image.ImageObserver;
import java.awt.peer.ComponentPeer;
import java.beans.BeanProperty;
import java.beans.Transient;
@@ -37,6 +43,8 @@
import javax.accessibility.*;
import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collections;
import sun.awt.AWTAccessor;
@@ -739,7 +747,43 @@
g.clipRect(0, 0, viewBounds.width, viewBounds.height);
}
- if (backingStoreImage == null) {
+ boolean recreateBackingStoreImage = (backingStoreImage == null);
+ int scaledWidth = width;
+ int scaledHeight = height;
+
+ if (g instanceof Graphics2D) {
+ double sw = width;
+ double sh = height;
+ Graphics2D g2d = (Graphics2D) g;
+ AffineTransform tx = g2d.getTransform();
+ int type = tx.getType();
+ if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP)) == 0) {
+ // skip
+ } else if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP | TYPE_MASK_SCALE)) == 0) {
+ sw = Math.abs(width * tx.getScaleX());
+ sh = Math.abs(height * tx.getScaleY());
+ } else {
+ sw = Math.abs(width * Math.hypot(tx.getScaleX(), tx.getShearY()));
+ sh = Math.abs(height * Math.hypot(tx.getShearX(), tx.getScaleY()));
+ }
+
+ scaledWidth = (int) Math.ceil(sw);
+ scaledHeight = (int) Math.ceil(sh);
+
+ if (!recreateBackingStoreImage) {
+ if (backingStoreImage instanceof BackingStoreMultiResolutionImage) {
+ BackingStoreMultiResolutionImage mrImage
+ = (BackingStoreMultiResolutionImage) backingStoreImage;
+ recreateBackingStoreImage = (mrImage.scaledWidth != scaledWidth
+ || mrImage.scaledHeight != scaledHeight);
+ } else {
+ recreateBackingStoreImage = (width != scaledWidth
+ || height != scaledHeight);
+ }
+ }
+ }
+
+ if (recreateBackingStoreImage) {
// Backing store is enabled but this is the first call to paint.
// Create the backing store, paint it and then copy to g.
// The backing store image will be created with the size of
@@ -747,7 +791,8 @@
// same size, otherwise when scrolling the backing image
// the region outside of the clipped region will not be painted,
// and result in empty areas.
- backingStoreImage = createImage(width, height);
+ backingStoreImage = createScaledImage(width, height,
+ scaledWidth, scaledHeight);
Rectangle clip = g.getClipBounds();
if (clip.width != width || clip.height != height) {
if (!isOpaque()) {
@@ -815,6 +860,74 @@
scrollUnderway = false;
}
+ private Image createScaledImage(final int width, final int height,
+ int scaledWidth, int scaledHeight)
+ {
+ if (scaledWidth == width && scaledHeight == height) {
+ return createImage(width, height);
+ }
+
+ Image rvImage = createImage(scaledWidth, scaledHeight);
+
+ return new BackingStoreMultiResolutionImage(width, height,
+ scaledWidth, scaledHeight, rvImage);
+ }
+
+ static class BackingStoreMultiResolutionImage
+ extends AbstractMultiResolutionImage {
+
+ private final int width;
+ private final int height;
+ private final int scaledWidth;
+ private final int scaledHeight;
+ private final Image rvImage;
+
+ public BackingStoreMultiResolutionImage(int width, int height,
+ int scaledWidth, int scaledHeight, Image rvImage) {
+ this.width = width;
+ this.height = height;
+ this.scaledWidth = scaledWidth;
+ this.scaledHeight = scaledHeight;
+ this.rvImage = rvImage;
+ }
+
+ @Override
+ public int getWidth(ImageObserver observer) {
+ return width;
+ }
+
+ @Override
+ public int getHeight(ImageObserver observer) {
+ return height;
+ }
+
+ @Override
+ protected Image getBaseImage() {
+ return rvImage;
+ }
+
+ @Override
+ public Graphics getGraphics() {
+ Graphics graphics = rvImage.getGraphics();
+ if (graphics instanceof Graphics2D) {
+ double sx = (double) scaledWidth / width;
+ double sy = (double) scaledHeight / height;
+ ((Graphics2D) graphics).scale(sx, sy);
+ }
+ return graphics;
+ }
+
+ @Override
+ public Image getResolutionVariant(double w, double h) {
+ return rvImage;
+ }
+
+ @Override
+ public java.util.List<Image> getResolutionVariants() {
+ return Collections.unmodifiableList(Arrays.asList(rvImage));
+ }
+ }
+
/**
* Sets the bounds of this viewport. If the viewport's width
--- a/jdk/src/java.desktop/share/classes/javax/swing/KeyboardManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/KeyboardManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -137,6 +137,7 @@
/**
* Find the top focusable Window, Applet, or InternalFrame
*/
+ @SuppressWarnings("deprecation")
private static Container getTopAncestor(JComponent c) {
for(Container p = c.getParent(); p != null; p = p.getParent()) {
if (p instanceof Window && ((Window)p).isFocusableWindow() ||
--- a/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java Mon Nov 14 09:03:07 2016 -0800
@@ -614,6 +614,7 @@
* Returns true if popup can fit the screen and the owner's top parent.
* It determines can popup be lightweight or mediumweight.
*/
+ @SuppressWarnings("deprecation")
boolean fitsOnScreen() {
boolean result = false;
Component component = getComponent();
@@ -783,6 +784,8 @@
component.removeAll();
recycleLightWeightPopup(this);
}
+
+ @SuppressWarnings("deprecation")
public void show() {
Container parent = null;
@@ -938,6 +941,8 @@
rootPane.getContentPane().removeAll();
recycleMediumWeightPopup(this);
}
+
+ @SuppressWarnings("deprecation")
public void show() {
Component component = getComponent();
Container parent = null;
--- a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -408,6 +408,7 @@
*
* @see JComponent#repaint
*/
+ @SuppressWarnings("deprecation")
private void addDirtyRegion0(Container c, int x, int y, int w, int h) {
/* Special cases we don't have to bother with.
*/
@@ -521,10 +522,12 @@
* @see JApplet#repaint
* @since 1.6
*/
+ @SuppressWarnings("deprecation")
public void addDirtyRegion(Applet applet, int x, int y, int w, int h) {
addDirtyRegion0(applet, x, y, w, h);
}
+ @SuppressWarnings("deprecation")
void scheduleHeavyWeightPaints() {
Map<Container,Rectangle> hws;
--- a/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SwingUtilities.java Mon Nov 14 09:03:07 2016 -0800
@@ -416,6 +416,7 @@
* @param p a Point object (converted to the new coordinate system)
* @param c a Component object
*/
+ @SuppressWarnings("deprecation")
public static void convertPointToScreen(Point p,Component c) {
Rectangle b;
int x,y;
@@ -455,6 +456,7 @@
* @param p a Point object (converted to the new coordinate system)
* @param c a Component object
*/
+ @SuppressWarnings("deprecation")
public static void convertPointFromScreen(Point p,Component c) {
Rectangle b;
int x,y;
@@ -1655,6 +1657,7 @@
* @param c the component
* @return the first ancestor of c that's a Window or the last Applet ancestor
*/
+ @SuppressWarnings("deprecation")
public static Component getRoot(Component c) {
Component applet = null;
for(Component p = c; p != null; p = p.getParent()) {
@@ -1695,6 +1698,7 @@
* @return true if a binding has found and processed
* @since 1.4
*/
+ @SuppressWarnings("deprecation")
public static boolean processKeyBindings(KeyEvent event) {
if (event != null) {
if (event.isConsumed()) {
@@ -2209,6 +2213,7 @@
* @see java.awt.Component#isVisible()
* @since 1.7
*/
+ @SuppressWarnings("deprecation")
static Container getValidateRoot(Container c, boolean visibleOnly) {
Container root = null;
--- a/jdk/src/java.desktop/share/classes/javax/swing/ToolTipManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ToolTipManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -753,6 +753,7 @@
// Returns: 0 no adjust
// -1 can't fit
// >0 adjust value by amount returned
+ @SuppressWarnings("deprecation")
private int getPopupFitWidth(Rectangle popupRectInScreen, Component invoker){
if (invoker != null){
Container parent;
@@ -778,6 +779,7 @@
// Returns: 0 no adjust
// >0 adjust by value return
+ @SuppressWarnings("deprecation")
private int getPopupFitHeight(Rectangle popupRectInScreen, Component invoker){
if (invoker != null){
Container parent;
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -526,14 +526,16 @@
if (info.getName().equals(name)) {
Class<?> cls = Class.forName(UIManager.class.getModule(),
info.getClassName());
- LookAndFeel laf = (LookAndFeel) cls.newInstance();
+ LookAndFeel laf =
+ (LookAndFeel) cls.getDeclaredConstructor().newInstance();
if (!laf.isSupportedLookAndFeel()) {
break;
}
return laf;
}
}
- } catch (InstantiationException | IllegalAccessException ignore) {
+ } catch (ReflectiveOperationException |
+ IllegalArgumentException ignore) {
}
throw new UnsupportedLookAndFeelException(name);
@@ -625,7 +627,16 @@
}
else {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
- setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));
+ try {
+ LookAndFeel laf =
+ (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
+ setLookAndFeel(laf);
+ } catch (ReflectiveOperationException | IllegalArgumentException e) {
+ InstantiationException ex =
+ new InstantiationException("Wrapped Exception");
+ ex.initCause(e);
+ throw ex;
+ }
}
}
@@ -1093,7 +1104,8 @@
String className = getLAFState().swingProps.getProperty(multiplexingLAFKey, defaultName);
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
- multiLookAndFeel = (LookAndFeel)lnfClass.newInstance();
+ multiLookAndFeel =
+ (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
} catch (Exception exc) {
System.err.println("UIManager: failed loading " + className);
}
@@ -1427,7 +1439,8 @@
String className = p.nextToken();
try {
Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
- LookAndFeel newLAF = (LookAndFeel)lnfClass.newInstance();
+ LookAndFeel newLAF =
+ (LookAndFeel)lnfClass.getDeclaredConstructor().newInstance();
newLAF.initialize();
auxLookAndFeels.addElement(newLAF);
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java Mon Nov 14 09:03:07 2016 -0800
@@ -403,7 +403,7 @@
*/
public static void drawString(JComponent c, Graphics2D g, String string,
float x, float y) {
- SwingUtilities2.drawString(c, g, string, (int) x, (int) y);
+ SwingUtilities2.drawString(c, g, string, x, y, true);
}
/**
@@ -439,7 +439,7 @@
public static void drawStringUnderlineCharAt(JComponent c, Graphics2D g,
String string, int underlinedIndex, float x, float y) {
SwingUtilities2.drawStringUnderlineCharAt(c, g, string, underlinedIndex,
- (int) x, (int) y);
+ x, y, true);
}
/**
@@ -482,6 +482,6 @@
* @since 9
*/
public static float getStringWidth(JComponent c, FontMetrics fm, String string) {
- return SwingUtilities2.stringWidth(c, fm, string);
+ return SwingUtilities2.stringWidth(c, fm, string, true);
}
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java Mon Nov 14 09:03:07 2016 -0800
@@ -926,6 +926,7 @@
}
}
+ @SuppressWarnings("deprecation")
boolean isInPopup(Component src) {
for (Component c=src; c!=null; c=c.getParent()) {
if (c instanceof Applet || c instanceof Window) {
@@ -1143,6 +1144,7 @@
}
}
+ @SuppressWarnings("deprecation")
public void stateChanged(ChangeEvent ev) {
if (!(UIManager.getLookAndFeel() instanceof BasicLookAndFeel)) {
uninstall();
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/Utilities.java Mon Nov 14 09:03:07 2016 -0800
@@ -107,7 +107,7 @@
TabExpander e,
int startOffset)
{
- return drawTabbedText(s, (int) x, (int) y, (Graphics) g, e, startOffset);
+ return drawTabbedText(null, s, x, y, g, e, startOffset, null, true);
}
/**
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/ObjectView.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/ObjectView.java Mon Nov 14 09:03:07 2016 -0800
@@ -46,7 +46,7 @@
* <p>
* If the class can successfully be loaded, an attempt will
* be made to create an instance of it by calling
- * <code>Class.newInstance</code>. An attempt will be made
+ * <code>Class.getDeclaredConstructor().newInstance</code>. An attempt will be made
* to narrow the instance to type <code>java.awt.Component</code>
* to display the object.
* <p>
@@ -92,7 +92,7 @@
ReflectUtil.checkPackageAccess(classname);
Class<?> c = Class.forName(classname, true,Thread.currentThread().
getContextClassLoader());
- Object o = c.newInstance();
+ Object o = c.getDeclaredConstructor().newInstance();
if (o instanceof Component) {
Component comp = (Component) o;
setParameters(comp, attr);
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletAudioClip.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletAudioClip.java Mon Nov 14 09:03:07 2016 -0800
@@ -41,6 +41,7 @@
* @author Arthur van Hoff, Kara Kytle
*/
+@SuppressWarnings("deprecation")
public class AppletAudioClip implements AudioClip {
// url that this AudioClip is based on
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java Mon Nov 14 09:03:07 2016 -0800
@@ -54,7 +54,7 @@
*
* @author Arthur van Hoff
*/
-@SuppressWarnings("serial") // JDK implementation class
+@SuppressWarnings({"serial", "deprecation"}) // JDK implementation class
public
abstract class AppletPanel extends Panel implements AppletStub, Runnable {
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java Mon Nov 14 09:03:07 2016 -0800
@@ -117,7 +117,7 @@
* (The document named appletviewertags.html in the JDK's docs/tooldocs directory,
* once the JDK docs have been installed.)
*/
-@SuppressWarnings("serial") // JDK implementation class
+@SuppressWarnings({"serial", "deprecation"}) // JDK-implementation class
public class AppletViewer extends Frame implements AppletContext, Printable {
/**
@@ -157,7 +157,6 @@
/**
* Create the applet viewer.
*/
- @SuppressWarnings("deprecation")
public AppletViewer(int x, int y, URL doc, Hashtable<String, String> atts,
PrintStream statusMsgStream, AppletViewerFactory factory) {
this.factory = factory;
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java Mon Nov 14 09:03:07 2016 -0800
@@ -197,6 +197,7 @@
* Get the applet context. For now this is
* also implemented by the AppletPanel class.
*/
+ @SuppressWarnings("deprecation")
public AppletContext getAppletContext() {
return (AppletContext)getParent();
}
--- a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java Mon Nov 14 09:03:07 2016 -0800
@@ -499,6 +499,7 @@
* @return the parent applet or {@ null}
* @since 1.6
*/
+ @SuppressWarnings("deprecation")
public static Applet getAppletIfAncestorOf(Component comp) {
Container parent = comp.getParent();
Applet applet = null;
--- a/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/awt/FontConfiguration.java Mon Nov 14 09:03:07 2016 -0800
@@ -971,7 +971,7 @@
if (fcc != null) {
try {
- fc = (Charset) fcc.newInstance();
+ fc = (Charset) fcc.getDeclaredConstructor().newInstance();
} catch (Exception e) {
}
}
--- a/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/awt/LightweightFrame.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -141,17 +141,52 @@
*
* @return the scale factor
* @see #notifyDisplayChanged(int)
+ * @Depricated replaced by {@link #getScaleFactorX()} and
+ * {@link #getScaleFactorY}
*/
+ @Deprecated(since = "9")
public abstract int getScaleFactor();
/**
+ * Returns the scale factor of this frame along x coordinate. The default
+ * value is 1.
+ *
+ * @return the x coordinate scale factor
+ * @see #notifyDisplayChanged(double, double)
+ * @since 9
+ */
+ public abstract double getScaleFactorX();
+
+ /**
+ * Returns the scale factor of this frame along y coordinate. The default
+ * value is 1.
+ *
+ * @return the y coordinate scale factor
+ * @see #notifyDisplayChanged(double, double)
+ * @since 9
+ */
+ public abstract double getScaleFactorY();
+
+ /**
* Called when display of the hosted frame is changed.
*
* @param scaleFactor the scale factor
+ * @Depricated replaced by {@link #notifyDisplayChanged(double, double)}
*/
+ @Deprecated(since = "9")
public abstract void notifyDisplayChanged(int scaleFactor);
/**
+ * Called when display of the hosted frame is changed.
+ *
+ * @param scaleFactorX the scale factor
+ * @param scaleFactorY the scale factor
+ * @since 9
+ */
+ public abstract void notifyDisplayChanged(double scaleFactorX,
+ double scaleFactorY);
+
+ /**
* Host window absolute bounds.
*/
private int hostX, hostY, hostW, hostH;
@@ -202,4 +237,5 @@
* Removes a drop target from the lightweight frame.
*/
public abstract void removeDropTarget(DropTarget dt);
+
}
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/VolatileSurfaceManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/VolatileSurfaceManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, 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
@@ -55,6 +55,15 @@
protected SunVolatileImage vImg;
/**
+ * A reference to the AffineTransform corresponding to the graphics
+ * configuration of the volatile image. Affine Transformation is usually
+ * derived from the screen device. During the displayChanged() callback,
+ * the existing transform is compared with the updated screen transform to
+ * determine whether the software backed surface needs to be re-created
+ */
+ protected AffineTransform atCurrent;
+
+ /**
* The accelerated SurfaceData object.
*/
protected SurfaceData sdAccel;
@@ -93,6 +102,7 @@
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
this.vImg = vImg;
this.context = context;
+ this.atCurrent = vImg.getGraphicsConfig().getDefaultTransform();
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
@@ -210,6 +220,10 @@
sdCurrent = getBackupSurface();
sdAccel = null;
returnCode = VolatileImage.IMAGE_RESTORED;
+ } else if (lostSurfaceTmp) {
+ // A software surface has been restored. This could be due to
+ // display mode change on a non-accelerated volatile image.
+ returnCode = VolatileImage.IMAGE_RESTORED;
}
if ((returnCode != VolatileImage.IMAGE_INCOMPATIBLE) &&
@@ -326,9 +340,6 @@
* method in the rendering process to recreate the surface.
*/
public void displayChanged() {
- if (!isAccelerationEnabled()) {
- return;
- }
lostSurface = true;
if (sdAccel != null) {
// First, nullify the software surface. This guards against
@@ -345,6 +356,28 @@
// Update graphicsConfig for the vImg in case it changed due to
// this display change event
vImg.updateGraphicsConfig();
+
+ // Compare the Graphics configuration transforms to determine
+ // whether the software backed surface needs to be invalidated.
+ AffineTransform atUpdated = vImg.getGraphicsConfig()
+ .getDefaultTransform();
+ if (!isAccelerationEnabled()) {
+ if (!atUpdated.equals(atCurrent)) {
+ // Ideally there is no need to re-create a software surface.
+ // But some OSs allow changes to display state at runtime. Such
+ // a provision would cause mismatch in graphics configuration of
+ // the display and the surface. Hence we re-create the software
+ // surface as well.
+ sdBackup = null;
+ sdCurrent = getBackupSurface();
+ } else {
+ // Software backed surface was not invalidated.
+ lostSurface = false;
+ }
+ }
+
+ // Update the AffineTransformation backing the volatile image
+ atCurrent = atUpdated;
}
/**
--- a/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java Mon Nov 14 09:03:07 2016 -0800
@@ -226,13 +226,10 @@
}
try {
shellFolderManager =
- (ShellFolderManager)managerClass.newInstance();
- } catch (InstantiationException e) {
+ (ShellFolderManager)managerClass.getDeclaredConstructor().newInstance();
+ } catch (ReflectiveOperationException e) {
throw new Error("Could not instantiate Shell Folder Manager: "
+ managerClass.getName());
- } catch (IllegalAccessException e) {
- throw new Error ("Could not access Shell Folder Manager: "
- + managerClass.getName());
}
invoker = shellFolderManager.createInvoker();
--- a/jdk/src/java.desktop/share/classes/sun/font/FontManagerFactory.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/font/FontManagerFactory.java Mon Nov 14 09:03:07 2016 -0800
@@ -80,10 +80,9 @@
DEFAULT_CLASS);
ClassLoader cl = ClassLoader.getSystemClassLoader();
Class<?> fmClass = Class.forName(fmClassName, true, cl);
- instance = (FontManager) fmClass.newInstance();
- } catch (ClassNotFoundException |
- InstantiationException |
- IllegalAccessException ex) {
+ instance =
+ (FontManager) fmClass.getDeclaredConstructor().newInstance();
+ } catch (ReflectiveOperationException ex) {
throw new InternalError(ex);
}
--- a/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -362,6 +362,14 @@
});
}
+ /**
+ * If the module image layout changes the location of JDK fonts,
+ * this will be updated to reflect that.
+ */
+ public static final String getJDKFontDir() {
+ return jreFontDirName;
+ }
+
public TrueTypeFont getEUDCFont() {
// Overridden in Windows.
return null;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/font/lookup/JDKFontLookup.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.font.lookup;
+
+import sun.font.SunFontManager;
+
+/**
+ * Implementation-class accessed by other JDK modules to
+ * locate the JDK-provided fonts.
+ */
+public final class JDKFontLookup {
+
+ public final static String getJDKFontDir() {
+ return SunFontManager.getJDKFontDir();
+ }
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/cmm/CMSManager.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/cmm/CMSManager.java Mon Nov 14 09:03:07 2016 -0800
@@ -57,7 +57,7 @@
if (cmmProviderClass != null) {
try {
Class<?> cls = Class.forName(cmmProviderClass);
- provider = (CMMServiceProvider)cls.newInstance();
+ provider = (CMMServiceProvider)cls.getConstructor().newInstance();
} catch (ReflectiveOperationException e) {
}
}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java Mon Nov 14 09:03:07 2016 -0800
@@ -81,18 +81,15 @@
+ relativeClassName;
try {
Class<?> clazz = Class.forName(name);
- GraphicsPrimitive p = (GraphicsPrimitive) clazz.newInstance();
+ GraphicsPrimitive p =
+ (GraphicsPrimitive) clazz.getDeclaredConstructor().newInstance();
if (!satisfiesSameAs(p)) {
throw new RuntimeException("Primitive " + p
+ " incompatible with proxy for "
+ name);
}
return p;
- } catch (ClassNotFoundException ex) {
- throw new RuntimeException(ex.toString());
- } catch (InstantiationException ex) {
- throw new RuntimeException(ex.toString());
- } catch (IllegalAccessException ex) {
+ } catch (ReflectiveOperationException ex) {
throw new RuntimeException(ex.toString());
}
// A RuntimeException should never happen in a deployed JDK, because
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java Mon Nov 14 09:03:07 2016 -0800
@@ -127,7 +127,7 @@
if (reClass != null) {
try {
Class<?> cls = Class.forName(reClass);
- reImpl = (RenderingEngine) cls.newInstance();
+ reImpl = (RenderingEngine) cls.getConstructor().newInstance();
} catch (ReflectiveOperationException ignored0) {
}
}
@@ -135,7 +135,7 @@
final String marlinREClass = "sun.java2d.marlin.MarlinRenderingEngine";
try {
Class<?> cls = Class.forName(marlinREClass);
- reImpl = (RenderingEngine) cls.newInstance();
+ reImpl = (RenderingEngine) cls.getConstructor().newInstance();
} catch (ReflectiveOperationException ignored1) {
}
}
--- a/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, 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
@@ -25,18 +25,7 @@
package sun.swing;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.EventQueue;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.MouseInfo;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.Window;
+import java.awt.*;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragGestureRecognizer;
@@ -46,6 +35,7 @@
import java.awt.dnd.peer.DragSourceContextPeer;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
+import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.beans.PropertyChangeEvent;
@@ -89,7 +79,8 @@
private BufferedImage bbImage;
- private volatile int scaleFactor = 1;
+ private volatile double scaleFactorX;
+ private volatile double scaleFactorY;
/**
* {@code copyBufferEnabled}, true by default, defines the following strategy.
@@ -124,6 +115,10 @@
*/
public JLightweightFrame() {
super();
+ AffineTransform defaultTransform =
+ getGraphicsConfiguration().getDefaultTransform();
+ scaleFactorX = defaultTransform.getScaleX();
+ scaleFactorY = defaultTransform.getScaleY();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
@@ -157,8 +152,9 @@
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
- new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
- bbImage.getHeight() / scaleFactor));
+ new Rectangle(0, 0,
+ (int)Math.round(bbImage.getWidth() / scaleFactorX),
+ (int)Math.round(bbImage.getHeight() / scaleFactorY)));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
@@ -212,7 +208,7 @@
g.setBackground(getBackground());
g.setColor(getForeground());
g.setFont(getFont());
- g.scale(scaleFactor, scaleFactor);
+ g.scale(scaleFactorX, scaleFactorY);
return g;
}
@@ -237,28 +233,52 @@
}
@Override
+ @SuppressWarnings("deprecation")
public int getScaleFactor() {
- return scaleFactor;
+ return (int)scaleFactorX;
+ }
+
+ @Override
+ public double getScaleFactorX() {
+ return scaleFactorX;
+ }
+
+ @Override
+ public double getScaleFactorY() {
+ return scaleFactorY;
}
@Override
public void notifyDisplayChanged(final int scaleFactor) {
- if (scaleFactor != this.scaleFactor) {
+ notifyDisplayChanged(scaleFactor, scaleFactor);
+ }
+
+ @Override
+ public void notifyDisplayChanged(final double scaleFactorX,
+ final double scaleFactorY) {
+ if (Double.compare(scaleFactorX, this.scaleFactorX) != 0 ||
+ Double.compare(scaleFactorY, this.scaleFactorY) != 0) {
if (!copyBufferEnabled) content.paintLock();
try {
if (bbImage != null) {
- resizeBuffer(getWidth(), getHeight(), scaleFactor);
+ resizeBuffer(getWidth(), getHeight(), scaleFactorX,
+ scaleFactorY);
}
} finally {
if (!copyBufferEnabled) content.paintUnlock();
}
- this.scaleFactor = scaleFactor;
+ this.scaleFactorX = scaleFactorX;
+ this.scaleFactorY = scaleFactorY;
+
+ if(isVisible()) {
+ final Object peer =
+ AWTAccessor.getComponentAccessor().getPeer(this);
+ if (peer instanceof DisplayChangedListener) {
+ ((DisplayChangedListener) peer).displayChanged();
+ }
+ repaint();
+ }
}
- final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
- if (peer instanceof DisplayChangedListener) {
- ((DisplayChangedListener) peer).displayChanged();
- }
- repaint();
}
@Override
@@ -270,7 +290,8 @@
}
}
- private void syncCopyBuffer(boolean reset, int x, int y, int w, int h, int scale) {
+ private void syncCopyBuffer(boolean reset, int x, int y, int w, int h,
+ double scaleX, double scaleY) {
content.paintLock();
try {
int[] srcBuffer = ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
@@ -279,14 +300,14 @@
}
int linestride = bbImage.getWidth();
- x *= scale;
- y *= scale;
- w *= scale;
- h *= scale;
+ int startX = (int)Math.floor(x * scaleX);
+ int startY = (int)Math.floor(y * scaleY);
+ int width = (int)Math.ceil((x + w) * scaleX) - startX;
+ int height = (int)Math.ceil((y + h) * scaleY) - startY;
- for (int i=0; i<h; i++) {
- int from = (y + i) * linestride + x;
- System.arraycopy(srcBuffer, from, copyBuffer, from, w);
+ for (int i = 0; i < height; i++) {
+ int from = (startY + i) * linestride + startX;
+ System.arraycopy(srcBuffer, from, copyBuffer, from, width);
}
} finally {
content.paintUnlock();
@@ -295,7 +316,8 @@
private void notifyImageUpdated(int x, int y, int width, int height) {
if (copyBufferEnabled) {
- syncCopyBuffer(false, x, y, width, height, scaleFactor);
+ syncCopyBuffer(false, x, y, width, height, scaleFactorX,
+ scaleFactorY);
}
content.imageUpdated(x, y, width, height);
}
@@ -382,8 +404,10 @@
int newW = width;
int newH = height;
if (bbImage != null) {
- int imgWidth = bbImage.getWidth() / scaleFactor;
- int imgHeight = bbImage.getHeight() / scaleFactor;
+ int imgWidth = (int)Math.round(bbImage.getWidth() /
+ scaleFactorX);
+ int imgHeight = (int)Math.round(bbImage.getHeight() /
+ scaleFactorY);
if (width != imgWidth || height != imgHeight) {
createBB = true;
if (bbImage != null) {
@@ -407,7 +431,7 @@
}
}
if (createBB) {
- resizeBuffer(newW, newH, scaleFactor);
+ resizeBuffer(newW, newH, scaleFactorX, scaleFactorY);
return;
}
content.imageReshaped(0, 0, width, height);
@@ -419,16 +443,19 @@
}
}
- private void resizeBuffer(int width, int height, int newScaleFactor) {
- bbImage = new BufferedImage(width*newScaleFactor,height*newScaleFactor,
+ private void resizeBuffer(int width, int height, double newScaleFactorX,
+ double newScaleFactorY) {
+ bbImage = new BufferedImage((int)Math.round(width * newScaleFactorX),
+ (int)Math.round(height * newScaleFactorY),
BufferedImage.TYPE_INT_ARGB_PRE);
int[] pixels= ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
if (copyBufferEnabled) {
- syncCopyBuffer(true, 0, 0, width, height, newScaleFactor);
+ syncCopyBuffer(true, 0, 0, width, height, newScaleFactorX,
+ newScaleFactorY);
pixels = copyBuffer;
}
content.imageBufferReset(pixels, 0, 0, width, height,
- width * newScaleFactor, newScaleFactor);
+ bbImage.getWidth(), newScaleFactorX, newScaleFactorY);
}
@Override
--- a/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/swing/LightweightContent.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016 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
@@ -117,7 +117,10 @@
* @param height the logical height of the image
* @param linestride the line stride of the pixel buffer
* @param scale the scale factor of the pixel buffer
+ * @Depricated replaced by
+ * {@link #imageBufferReset(int[],int,int,int,int,int,double,double)}
*/
+ @Deprecated(since = "9")
default public void imageBufferReset(int[] data,
int x, int y,
int width, int height,
@@ -128,11 +131,54 @@
}
/**
+ * {@code JLightweightFrame} calls this method to notify the client
+ * application that a new data buffer has been set as a content pixel
+ * buffer. Typically this occurs when a buffer of a larger size is
+ * created in response to a content resize event.
+ * <p>
+ * The method reports a reference to the pixel data buffer, the content
+ * image bounds within the buffer and the line stride of the buffer.
+ * These values have the following correlation.
+ * The {@code width} and {@code height} matches the layout size of the
+ * content (the component returned from the {@link #getComponent} method).
+ * The {@code x} and {@code y} is the origin of the content, {@code (0, 0)}
+ * in the layout coordinate space of the content, appearing at
+ * {@code data[y * scaleY * linestride + x * scaleX]} in the buffer.
+ * A pixel with indices {@code (i, j)}, where {@code (0 <= i < width)} and
+ * {@code (0 <= j < height)}, in the layout coordinate space of the content
+ * is represented by a {@code scaleX * scaleY} square of pixels in the
+ * physical coordinate space of the buffer. The top-left corner of the
+ * square has the following physical coordinate in the buffer:
+ * {@code data[(y + j) * scaleY * linestride + (x + i) * scaleX]}.
+ *
+ * @param data the content pixel data buffer of INT_ARGB_PRE type
+ * @param x the logical x coordinate of the image
+ * @param y the logical y coordinate of the image
+ * @param width the logical width of the image
+ * @param height the logical height of the image
+ * @param linestride the line stride of the pixel buffer
+ * @param scaleX the x coordinate scale factor of the pixel buffer
+ * @param scaleY the y coordinate scale factor of the pixel buffer
+ * @since 9
+ */
+ @SuppressWarnings("deprecation")
+ default public void imageBufferReset(int[] data,
+ int x, int y,
+ int width, int height,
+ int linestride,
+ double scaleX, double scaleY)
+ {
+ imageBufferReset(data, x, y, width, height, linestride,
+ (int)Math.round(scaleX));
+ }
+
+ /**
* The default implementation for #imageBufferReset uses a hard-coded value
* of 1 for the scale factor. Both the old and the new methods provide
* default implementations in order to allow a client application to run
* with any JDK version without breaking backward compatibility.
*/
+ @SuppressWarnings("deprecation")
default public void imageBufferReset(int[] data,
int x, int y,
int width, int height,
--- a/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java Mon Nov 14 09:03:07 2016 -0800
@@ -318,7 +318,21 @@
* @param fm FontMetrics used to measure the String width
* @param string String to get the width of
*/
- public static int stringWidth(JComponent c, FontMetrics fm, String string){
+ public static int stringWidth(JComponent c, FontMetrics fm, String string) {
+ return (int) stringWidth(c, fm, string, false);
+ }
+
+ /**
+ * Returns the width of the passed in String.
+ * If the passed String is {@code null}, returns zero.
+ *
+ * @param c JComponent that will display the string, may be null
+ * @param fm FontMetrics used to measure the String width
+ * @param string String to get the width of
+ * @param useFPAPI use floating point API
+ */
+ public static float stringWidth(JComponent c, FontMetrics fm, String string,
+ boolean useFPAPI){
if (string == null || string.equals("")) {
return 0;
}
@@ -333,9 +347,9 @@
if (needsTextLayout) {
TextLayout layout = createTextLayout(c, string,
fm.getFont(), fm.getFontRenderContext());
- return (int) layout.getAdvance();
+ return layout.getAdvance();
} else {
- return fm.stringWidth(string);
+ return getFontStringWidth(string, fm, useFPAPI);
}
}
@@ -426,6 +440,21 @@
*/
public static void drawString(JComponent c, Graphics g, String text,
int x, int y) {
+ drawString(c, g, text, x, y, false);
+ }
+
+ /**
+ * Draws the string at the specified location.
+ *
+ * @param c JComponent that will display the string, may be null
+ * @param g Graphics to draw the text to
+ * @param text String to display
+ * @param x X coordinate to draw the text at
+ * @param y Y coordinate to draw the text at
+ * @param useFPAPI use floating point API
+ */
+ public static void drawString(JComponent c, Graphics g, String text,
+ float x, float y, boolean useFPAPI) {
// c may be null
// All non-editable widgets that draw strings call into this
@@ -509,7 +538,7 @@
g2.getFontRenderContext());
layout.draw(g2, x, y);
} else {
- g.drawString(text, x, y);
+ g2.drawString(text, x, y);
}
if (oldAAValue != null) {
@@ -530,7 +559,7 @@
}
}
- g.drawString(text, x, y);
+ g.drawString(text, (int) x, (int) y);
}
/**
@@ -544,17 +573,36 @@
* @param x X coordinate to draw the text at
* @param y Y coordinate to draw the text at
*/
+
public static void drawStringUnderlineCharAt(JComponent c,Graphics g,
- String text, int underlinedIndex, int x,int y) {
+ String text, int underlinedIndex, int x, int y) {
+ drawStringUnderlineCharAt(c, g, text, underlinedIndex, x, y, false);
+ }
+ /**
+ * Draws the string at the specified location underlining the specified
+ * character.
+ *
+ * @param c JComponent that will display the string, may be null
+ * @param g Graphics to draw the text to
+ * @param text String to display
+ * @param underlinedIndex Index of a character in the string to underline
+ * @param x X coordinate to draw the text at
+ * @param y Y coordinate to draw the text at
+ * @param useFPAPI use floating point API
+ */
+ public static void drawStringUnderlineCharAt(JComponent c, Graphics g,
+ String text, int underlinedIndex,
+ float x, float y,
+ boolean useFPAPI) {
if (text == null || text.length() <= 0) {
return;
}
- SwingUtilities2.drawString(c, g, text, x, y);
+ SwingUtilities2.drawString(c, g, text, x, y, useFPAPI);
int textLength = text.length();
if (underlinedIndex >= 0 && underlinedIndex < textLength ) {
- int underlineRectY = y;
+ float underlineRectY = y;
int underlineRectHeight = 1;
- int underlineRectX = 0;
+ float underlineRectX = 0;
int underlineRectWidth = 0;
boolean isPrinting = isPrinting(g);
boolean needsTextLayout = isPrinting;
@@ -594,7 +642,7 @@
underlineRectWidth = rect.width;
}
}
- g.fillRect(underlineRectX, underlineRectY + 1,
+ g.fillRect((int) underlineRectX, (int) underlineRectY + 1,
underlineRectWidth, underlineRectHeight);
}
}
--- a/jdk/src/java.desktop/unix/classes/sun/font/XMap.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/font/XMap.java Mon Nov 14 09:03:07 2016 -0800
@@ -172,7 +172,8 @@
if (className != null) {
try {
if (className.startsWith("sun.awt")) {
- enc = ((Charset)Class.forName(className).newInstance()).newEncoder();
+ enc = ((Charset)Class.forName(className).getDeclaredConstructor().
+ newInstance()).newEncoder();
} else {
enc = Charset.forName(className).newEncoder();
}
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp Mon Nov 14 09:03:07 2016 -0800
@@ -128,7 +128,7 @@
return;
}
hDC = comp->GetDCFromComponent();
- if (hDC != NULL) {
+ if (hDC != NULL && wsdo->device != NULL) {
::SelectObject(hDC, nullbrush);
::SelectObject(hDC, nullpen);
::SelectClipRgn(hDC, (HRGN) NULL);
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp Mon Nov 14 09:03:07 2016 -0800
@@ -3523,7 +3523,7 @@
WORD wChar[2];
int converted = 1;
- UINT ch = ::MapVirtualKey(wkey, 2);
+ UINT ch = ::MapVirtualKeyEx(wkey, 2, GetKeyboardLayout());
if (ch & 0x80000000) {
// Dead key which is handled as a normal key
isDeadKey = deadKeyActive = TRUE;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Taskbar.cpp Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Taskbar.cpp Mon Nov 14 09:03:07 2016 -0800
@@ -58,7 +58,11 @@
JNIEXPORT void JNICALL Java_sun_awt_windows_WTaskbarPeer_setProgressValue
(JNIEnv *, jobject, jlong window, jint value)
{
- m_Taskbar->SetProgressValue((HWND)window, value, 100);
+ if (value < 0 || value > 100) {
+ m_Taskbar->SetProgressState((HWND)window, TBPF_NOPROGRESS);
+ } else {
+ m_Taskbar->SetProgressValue((HWND)window, value, 100);
+ }
}
@@ -88,6 +92,9 @@
flag = TBPF_NOPROGRESS;
} else if (strcmp(valueNative, "NORMAL") == 0) {
flag = TBPF_NORMAL;
+
+ // Switching from TBPF_INDETERMINATE to TBPF_NORMAL has no effect
+ m_Taskbar->SetProgressState((HWND)window, TBPF_PAUSED);
} else if (strcmp(valueNative, "PAUSED") == 0) {
flag = TBPF_PAUSED;
} else if (strcmp(valueNative, "INDETERMINATE") == 0) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.accessibility/windows/native/bridge/AccessBridgeCalls.c Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,1130 @@
+/*
+ *
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Wrapper functions around calls to the AccessBridge DLL
+ */
+
+
+#include <windows.h>
+#include <jni.h>
+
+
+//#define ACCESSBRIDGE_32
+//#define ACCESSBRIDGE_64
+
+#include "AccessBridgeCalls.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ HINSTANCE theAccessBridgeInstance;
+ AccessBridgeFPs theAccessBridge;
+
+ BOOL theAccessBridgeInitializedFlag = FALSE;
+
+#define LOAD_FP(result, type, name) \
+ if ((theAccessBridge.result = \
+ (type) GetProcAddress(theAccessBridgeInstance, name)) == (type) 0) { \
+ return FALSE; \
+ }
+
+ BOOL initializeAccessBridge() {
+
+#ifdef ACCESSBRIDGE_ARCH_32 // For 32 bit AT interfacing with Java on 64 bit OS
+ theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE-32");
+#else
+#ifdef ACCESSBRIDGE_ARCH_64 // For 64 bit AT interfacing with Java on 64 bit OS
+ theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE-64");
+#else // For 32 bit AT interfacing with Java on 32 bit OS
+ theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE");
+#endif
+#endif
+ if (theAccessBridgeInstance != 0) {
+ LOAD_FP(Windows_run, Windows_runFP, "Windows_run");
+
+ LOAD_FP(SetJavaShutdown, SetJavaShutdownFP, "setJavaShutdownFP");
+ LOAD_FP(SetFocusGained, SetFocusGainedFP, "setFocusGainedFP");
+ LOAD_FP(SetFocusLost, SetFocusLostFP, "setFocusLostFP");
+
+ LOAD_FP(SetCaretUpdate, SetCaretUpdateFP, "setCaretUpdateFP");
+
+ LOAD_FP(SetMouseClicked, SetMouseClickedFP, "setMouseClickedFP");
+ LOAD_FP(SetMouseEntered, SetMouseEnteredFP, "setMouseEnteredFP");
+ LOAD_FP(SetMouseExited, SetMouseExitedFP, "setMouseExitedFP");
+ LOAD_FP(SetMousePressed, SetMousePressedFP, "setMousePressedFP");
+ LOAD_FP(SetMouseReleased, SetMouseReleasedFP, "setMouseReleasedFP");
+
+ LOAD_FP(SetMenuCanceled, SetMenuCanceledFP, "setMenuCanceledFP");
+ LOAD_FP(SetMenuDeselected, SetMenuDeselectedFP, "setMenuDeselectedFP");
+ LOAD_FP(SetMenuSelected, SetMenuSelectedFP, "setMenuSelectedFP");
+ LOAD_FP(SetPopupMenuCanceled, SetPopupMenuCanceledFP, "setPopupMenuCanceledFP");
+ LOAD_FP(SetPopupMenuWillBecomeInvisible, SetPopupMenuWillBecomeInvisibleFP, "setPopupMenuWillBecomeInvisibleFP");
+ LOAD_FP(SetPopupMenuWillBecomeVisible, SetPopupMenuWillBecomeVisibleFP, "setPopupMenuWillBecomeVisibleFP");
+
+ LOAD_FP(SetPropertyNameChange, SetPropertyNameChangeFP, "setPropertyNameChangeFP");
+ LOAD_FP(SetPropertyDescriptionChange, SetPropertyDescriptionChangeFP, "setPropertyDescriptionChangeFP");
+ LOAD_FP(SetPropertyStateChange, SetPropertyStateChangeFP, "setPropertyStateChangeFP");
+ LOAD_FP(SetPropertyValueChange, SetPropertyValueChangeFP, "setPropertyValueChangeFP");
+ LOAD_FP(SetPropertySelectionChange, SetPropertySelectionChangeFP, "setPropertySelectionChangeFP");
+ LOAD_FP(SetPropertyTextChange, SetPropertyTextChangeFP, "setPropertyTextChangeFP");
+ LOAD_FP(SetPropertyCaretChange, SetPropertyCaretChangeFP, "setPropertyCaretChangeFP");
+ LOAD_FP(SetPropertyVisibleDataChange, SetPropertyVisibleDataChangeFP, "setPropertyVisibleDataChangeFP");
+ LOAD_FP(SetPropertyChildChange, SetPropertyChildChangeFP, "setPropertyChildChangeFP");
+ LOAD_FP(SetPropertyActiveDescendentChange, SetPropertyActiveDescendentChangeFP, "setPropertyActiveDescendentChangeFP");
+
+ LOAD_FP(SetPropertyTableModelChange, SetPropertyTableModelChangeFP, "setPropertyTableModelChangeFP");
+
+ LOAD_FP(ReleaseJavaObject, ReleaseJavaObjectFP, "releaseJavaObject");
+ LOAD_FP(GetVersionInfo, GetVersionInfoFP, "getVersionInfo");
+
+ LOAD_FP(IsJavaWindow, IsJavaWindowFP, "isJavaWindow");
+ LOAD_FP(IsSameObject, IsSameObjectFP, "isSameObject");
+ LOAD_FP(GetAccessibleContextFromHWND, GetAccessibleContextFromHWNDFP, "getAccessibleContextFromHWND");
+ LOAD_FP(getHWNDFromAccessibleContext, getHWNDFromAccessibleContextFP, "getHWNDFromAccessibleContext");
+
+ LOAD_FP(GetAccessibleContextAt, GetAccessibleContextAtFP, "getAccessibleContextAt");
+ LOAD_FP(GetAccessibleContextWithFocus, GetAccessibleContextWithFocusFP, "getAccessibleContextWithFocus");
+ LOAD_FP(GetAccessibleContextInfo, GetAccessibleContextInfoFP, "getAccessibleContextInfo");
+ LOAD_FP(GetAccessibleChildFromContext, GetAccessibleChildFromContextFP, "getAccessibleChildFromContext");
+ LOAD_FP(GetAccessibleParentFromContext, GetAccessibleParentFromContextFP, "getAccessibleParentFromContext");
+
+ /* begin AccessibleTable */
+ LOAD_FP(getAccessibleTableInfo, getAccessibleTableInfoFP, "getAccessibleTableInfo");
+ LOAD_FP(getAccessibleTableCellInfo, getAccessibleTableCellInfoFP, "getAccessibleTableCellInfo");
+
+ LOAD_FP(getAccessibleTableRowHeader, getAccessibleTableRowHeaderFP, "getAccessibleTableRowHeader");
+ LOAD_FP(getAccessibleTableColumnHeader, getAccessibleTableColumnHeaderFP, "getAccessibleTableColumnHeader");
+
+ LOAD_FP(getAccessibleTableRowDescription, getAccessibleTableRowDescriptionFP, "getAccessibleTableRowDescription");
+ LOAD_FP(getAccessibleTableColumnDescription, getAccessibleTableColumnDescriptionFP, "getAccessibleTableColumnDescription");
+
+ LOAD_FP(getAccessibleTableRowSelectionCount, getAccessibleTableRowSelectionCountFP,
+ "getAccessibleTableRowSelectionCount");
+ LOAD_FP(isAccessibleTableRowSelected, isAccessibleTableRowSelectedFP,
+ "isAccessibleTableRowSelected");
+ LOAD_FP(getAccessibleTableRowSelections, getAccessibleTableRowSelectionsFP,
+ "getAccessibleTableRowSelections");
+
+ LOAD_FP(getAccessibleTableColumnSelectionCount, getAccessibleTableColumnSelectionCountFP,
+ "getAccessibleTableColumnSelectionCount");
+ LOAD_FP(isAccessibleTableColumnSelected, isAccessibleTableColumnSelectedFP,
+ "isAccessibleTableColumnSelected");
+ LOAD_FP(getAccessibleTableColumnSelections, getAccessibleTableColumnSelectionsFP,
+ "getAccessibleTableColumnSelections");
+
+ LOAD_FP(getAccessibleTableRow, getAccessibleTableRowFP,
+ "getAccessibleTableRow");
+ LOAD_FP(getAccessibleTableColumn, getAccessibleTableColumnFP,
+ "getAccessibleTableColumn");
+ LOAD_FP(getAccessibleTableIndex, getAccessibleTableIndexFP,
+ "getAccessibleTableIndex");
+
+ /* end AccessibleTable */
+
+ /* AccessibleRelationSet */
+ LOAD_FP(getAccessibleRelationSet, getAccessibleRelationSetFP, "getAccessibleRelationSet");
+
+ /* AccessibleHypertext */
+ LOAD_FP(getAccessibleHypertext, getAccessibleHypertextFP, "getAccessibleHypertext");
+ LOAD_FP(activateAccessibleHyperlink, activateAccessibleHyperlinkFP, "activateAccessibleHyperlink");
+ LOAD_FP(getAccessibleHyperlinkCount, getAccessibleHyperlinkCountFP, "getAccessibleHyperlinkCount");
+ LOAD_FP(getAccessibleHypertextExt, getAccessibleHypertextExtFP, "getAccessibleHypertextExt");
+ LOAD_FP(getAccessibleHypertextLinkIndex, getAccessibleHypertextLinkIndexFP, "getAccessibleHypertextLinkIndex");
+ LOAD_FP(getAccessibleHyperlink, getAccessibleHyperlinkFP, "getAccessibleHyperlink");
+
+ /* Accessible KeyBinding, Icon and Action */
+ LOAD_FP(getAccessibleKeyBindings, getAccessibleKeyBindingsFP, "getAccessibleKeyBindings");
+ LOAD_FP(getAccessibleIcons, getAccessibleIconsFP, "getAccessibleIcons");
+ LOAD_FP(getAccessibleActions, getAccessibleActionsFP, "getAccessibleActions");
+ LOAD_FP(doAccessibleActions, doAccessibleActionsFP, "doAccessibleActions");
+
+ /* AccessibleText */
+ LOAD_FP(GetAccessibleTextInfo, GetAccessibleTextInfoFP, "getAccessibleTextInfo");
+ LOAD_FP(GetAccessibleTextItems, GetAccessibleTextItemsFP, "getAccessibleTextItems");
+ LOAD_FP(GetAccessibleTextSelectionInfo, GetAccessibleTextSelectionInfoFP, "getAccessibleTextSelectionInfo");
+ LOAD_FP(GetAccessibleTextAttributes, GetAccessibleTextAttributesFP, "getAccessibleTextAttributes");
+ LOAD_FP(GetAccessibleTextRect, GetAccessibleTextRectFP, "getAccessibleTextRect");
+ LOAD_FP(GetAccessibleTextLineBounds, GetAccessibleTextLineBoundsFP, "getAccessibleTextLineBounds");
+ LOAD_FP(GetAccessibleTextRange, GetAccessibleTextRangeFP, "getAccessibleTextRange");
+
+ LOAD_FP(GetCurrentAccessibleValueFromContext, GetCurrentAccessibleValueFromContextFP, "getCurrentAccessibleValueFromContext");
+ LOAD_FP(GetMaximumAccessibleValueFromContext, GetMaximumAccessibleValueFromContextFP, "getMaximumAccessibleValueFromContext");
+ LOAD_FP(GetMinimumAccessibleValueFromContext, GetMinimumAccessibleValueFromContextFP, "getMinimumAccessibleValueFromContext");
+
+ LOAD_FP(AddAccessibleSelectionFromContext, AddAccessibleSelectionFromContextFP, "addAccessibleSelectionFromContext");
+ LOAD_FP(ClearAccessibleSelectionFromContext, ClearAccessibleSelectionFromContextFP, "clearAccessibleSelectionFromContext");
+ LOAD_FP(GetAccessibleSelectionFromContext, GetAccessibleSelectionFromContextFP, "getAccessibleSelectionFromContext");
+ LOAD_FP(GetAccessibleSelectionCountFromContext, GetAccessibleSelectionCountFromContextFP, "getAccessibleSelectionCountFromContext");
+ LOAD_FP(IsAccessibleChildSelectedFromContext, IsAccessibleChildSelectedFromContextFP, "isAccessibleChildSelectedFromContext");
+ LOAD_FP(RemoveAccessibleSelectionFromContext, RemoveAccessibleSelectionFromContextFP, "removeAccessibleSelectionFromContext");
+ LOAD_FP(SelectAllAccessibleSelectionFromContext, SelectAllAccessibleSelectionFromContextFP, "selectAllAccessibleSelectionFromContext");
+
+ LOAD_FP(setTextContents, setTextContentsFP, "setTextContents");
+ LOAD_FP(getParentWithRole, getParentWithRoleFP, "getParentWithRole");
+ LOAD_FP(getTopLevelObject, getTopLevelObjectFP, "getTopLevelObject");
+ LOAD_FP(getParentWithRoleElseRoot, getParentWithRoleElseRootFP, "getParentWithRoleElseRoot");
+ LOAD_FP(getObjectDepth, getObjectDepthFP, "getObjectDepth");
+ LOAD_FP(getActiveDescendent, getActiveDescendentFP, "getActiveDescendent");
+
+ // additional methods for Teton
+ LOAD_FP(getVirtualAccessibleName, getVirtualAccessibleNameFP, "getVirtualAccessibleName");
+ LOAD_FP(requestFocus, requestFocusFP, "requestFocus");
+ LOAD_FP(selectTextRange, selectTextRangeFP, "selectTextRange");
+ LOAD_FP(getTextAttributesInRange, getTextAttributesInRangeFP, "getTextAttributesInRange");
+ LOAD_FP(getVisibleChildrenCount, getVisibleChildrenCountFP, "getVisibleChildrenCount");
+ LOAD_FP(getVisibleChildren, getVisibleChildrenFP, "getVisibleChildren");
+ LOAD_FP(setCaretPosition, setCaretPositionFP, "setCaretPosition");
+ LOAD_FP(getCaretLocation, getCaretLocationFP, "getCaretLocation");
+
+ LOAD_FP(getEventsWaiting, getEventsWaitingFP, "getEventsWaiting");
+
+ theAccessBridge.Windows_run();
+
+ theAccessBridgeInitializedFlag = TRUE;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+
+
+ BOOL shutdownAccessBridge() {
+ BOOL result;
+ DWORD error;
+ theAccessBridgeInitializedFlag = FALSE;
+ if (theAccessBridgeInstance != (HANDLE) 0) {
+ result = FreeLibrary(theAccessBridgeInstance);
+ if (result != TRUE) {
+ error = GetLastError();
+ }
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+
+ void SetJavaShutdown(AccessBridge_JavaShutdownFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetJavaShutdown(fp);
+ }
+ }
+
+ void SetFocusGained(AccessBridge_FocusGainedFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetFocusGained(fp);
+ }
+ }
+
+ void SetFocusLost(AccessBridge_FocusLostFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetFocusLost(fp);
+ }
+ }
+
+
+ void SetCaretUpdate(AccessBridge_CaretUpdateFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetCaretUpdate(fp);
+ }
+ }
+
+
+ void SetMouseClicked(AccessBridge_MouseClickedFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMouseClicked(fp);
+ }
+ }
+
+ void SetMouseEntered(AccessBridge_MouseEnteredFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMouseEntered(fp);
+ }
+ }
+
+ void SetMouseExited(AccessBridge_MouseExitedFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMouseExited(fp);
+ }
+ }
+
+ void SetMousePressed(AccessBridge_MousePressedFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMousePressed(fp);
+ }
+ }
+
+ void SetMouseReleased(AccessBridge_MouseReleasedFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMouseReleased(fp);
+ }
+ }
+
+
+ void SetMenuCanceled(AccessBridge_MenuCanceledFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMenuCanceled(fp);
+ }
+ }
+
+ void SetMenuDeselected(AccessBridge_MenuDeselectedFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMenuDeselected(fp);
+ }
+ }
+
+ void SetMenuSelected(AccessBridge_MenuSelectedFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetMenuSelected(fp);
+ }
+ }
+
+ void SetPopupMenuCanceled(AccessBridge_PopupMenuCanceledFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPopupMenuCanceled(fp);
+ }
+ }
+
+ void SetPopupMenuWillBecomeInvisible(AccessBridge_PopupMenuWillBecomeInvisibleFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPopupMenuWillBecomeInvisible(fp);
+ }
+ }
+
+ void SetPopupMenuWillBecomeVisible(AccessBridge_PopupMenuWillBecomeVisibleFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPopupMenuWillBecomeVisible(fp);
+ }
+ }
+
+
+ void SetPropertyNameChange(AccessBridge_PropertyNameChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyNameChange(fp);
+ }
+ }
+
+ void SetPropertyDescriptionChange(AccessBridge_PropertyDescriptionChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyDescriptionChange(fp);
+ }
+ }
+
+ void SetPropertyStateChange(AccessBridge_PropertyStateChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyStateChange(fp);
+ }
+ }
+
+ void SetPropertyValueChange(AccessBridge_PropertyValueChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyValueChange(fp);
+ }
+ }
+
+ void SetPropertySelectionChange(AccessBridge_PropertySelectionChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertySelectionChange(fp);
+ }
+ }
+
+ void SetPropertyTextChange(AccessBridge_PropertyTextChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyTextChange(fp);
+ }
+ }
+
+ void SetPropertyCaretChange(AccessBridge_PropertyCaretChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyCaretChange(fp);
+ }
+ }
+
+ void SetPropertyVisibleDataChange(AccessBridge_PropertyVisibleDataChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyVisibleDataChange(fp);
+ }
+ }
+
+ void SetPropertyChildChange(AccessBridge_PropertyChildChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyChildChange(fp);
+ }
+ }
+
+ void SetPropertyActiveDescendentChange(AccessBridge_PropertyActiveDescendentChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyActiveDescendentChange(fp);
+ }
+ }
+
+ void SetPropertyTableModelChange(AccessBridge_PropertyTableModelChangeFP fp) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SetPropertyTableModelChange(fp);
+ }
+ }
+
+ /**
+ * General routines
+ */
+ void ReleaseJavaObject(long vmID, Java_Object object) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.ReleaseJavaObject(vmID, object);
+ }
+ }
+
+ BOOL GetVersionInfo(long vmID, AccessBridgeVersionInfo *info) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetVersionInfo(vmID, info);
+ }
+ return FALSE;
+ }
+
+
+ /**
+ * Window routines
+ */
+ BOOL IsJavaWindow(HWND window) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ BOOL ret ;
+ ret = theAccessBridge.IsJavaWindow(window);
+ return ret ;
+
+ }
+ return FALSE;
+ }
+
+
+ /**
+ * Returns the virtual machine ID and AccessibleContext for a top-level window
+ */
+ BOOL GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleContextFromHWND(target, vmID, ac);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Returns the HWND from the AccessibleContext of a top-level window. Returns 0
+ * on error or if the AccessibleContext does not refer to a top-level window.
+ */
+ HWND getHWNDFromAccessibleContext(long vmID, JOBJECT64 accesibleContext) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getHWNDFromAccessibleContext(vmID, accesibleContext);
+ }
+ return (HWND)0;
+ }
+
+ /**
+ * returns whether two objects are the same
+ */
+ BOOL IsSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.IsSameObject(vmID, obj1, obj2);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Sets editable text contents. The AccessibleContext must implement AccessibleEditableText and
+ * be editable. The maximum text length is MAX_STRING_SIZE - 1.
+ * Returns whether successful
+ */
+ BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.setTextContents(vmID, accessibleContext, text);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Returns the Accessible Context with the specified role that is the
+ * ancestor of a given object. The role is one of the role strings
+ * defined in AccessBridgePackages.h
+ * If there is no ancestor object that has the specified role,
+ * returns (AccessibleContext)0.
+ */
+ AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext,
+ const wchar_t *role) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getParentWithRole(vmID, accessibleContext, role);
+ }
+ return (AccessibleContext)0;
+ }
+
+ /**
+ * Returns the Accessible Context with the specified role that is the
+ * ancestor of a given object. The role is one of the role strings
+ * defined in AccessBridgePackages.h. If an object with the specified
+ * role does not exist, returns the top level object for the Java Window.
+ * Returns (AccessibleContext)0 on error.
+ */
+ AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext,
+ const wchar_t *role) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getParentWithRoleElseRoot(vmID, accessibleContext, role);
+ }
+ return (AccessibleContext)0;
+ }
+
+ /**
+ * Returns the Accessible Context for the top level object in
+ * a Java Window. This is same Accessible Context that is obtained
+ * from GetAccessibleContextFromHWND for that window. Returns
+ * (AccessibleContext)0 on error.
+ */
+ AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getTopLevelObject(vmID, accessibleContext);
+ }
+ return (AccessibleContext)0;
+ }
+
+ /**
+ * Returns how deep in the object hierarchy a given object is.
+ * The top most object in the object hierarchy has an object depth of 0.
+ * Returns -1 on error.
+ */
+ int getObjectDepth (const long vmID, const AccessibleContext accessibleContext) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getObjectDepth(vmID, accessibleContext);
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the Accessible Context of the current ActiveDescendent of an object.
+ * This method assumes the ActiveDescendent is the component that is currently
+ * selected in a container object.
+ * Returns (AccessibleContext)0 on error or if there is no selection.
+ */
+ AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getActiveDescendent(vmID, accessibleContext);
+ }
+ return (AccessibleContext)0;
+ }
+
+
+ /**
+ * Accessible Context routines
+ */
+ BOOL GetAccessibleContextAt(long vmID, AccessibleContext acParent,
+ jint x, jint y, AccessibleContext *ac) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleContextAt(vmID, acParent, x, y, ac);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleContextWithFocus(HWND window, long *vmID, AccessibleContext *ac) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleContextWithFocus(window, vmID, ac);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleContextInfo(long vmID, AccessibleContext ac, AccessibleContextInfo *info) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleContextInfo(vmID, ac, info);
+ }
+ return FALSE;
+ }
+
+ AccessibleContext GetAccessibleChildFromContext(long vmID, AccessibleContext ac, jint index) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleChildFromContext(vmID, ac, index);
+ }
+ return (AccessibleContext) 0;
+ }
+
+ AccessibleContext GetAccessibleParentFromContext(long vmID, AccessibleContext ac) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleParentFromContext(vmID, ac);
+ }
+ return (AccessibleContext) 0;
+ }
+
+ /* begin AccessibleTable routines */
+
+ /*
+ * get information about an AccessibleTable
+ */
+ BOOL getAccessibleTableInfo(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableInfo(vmID, acParent, tableInfo);
+ }
+ return FALSE;
+ }
+
+ /*
+ * get information about an AccessibleTable cell
+ */
+ BOOL getAccessibleTableCellInfo(long vmID, AccessibleTable accessibleTable,
+ jint row, jint column, AccessibleTableCellInfo *tableCellInfo) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableCellInfo(vmID, accessibleTable, row, column, tableCellInfo);
+ }
+ return FALSE;
+ }
+
+ /*
+ * get information about an AccessibleTable row header
+ */
+ BOOL getAccessibleTableRowHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableRowHeader(vmID, acParent, tableInfo);
+ }
+ return FALSE;
+ }
+
+ /*
+ * get information about an AccessibleTable column header
+ */
+ BOOL getAccessibleTableColumnHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableColumnHeader(vmID, acParent, tableInfo);
+ }
+ return FALSE;
+ }
+
+ /*
+ * return a description of an AccessibleTable row header
+ */
+ AccessibleContext getAccessibleTableRowDescription(long vmID, AccessibleContext acParent, jint row) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableRowDescription(vmID, acParent, row);
+ }
+ return (AccessibleContext)0;
+ }
+
+ /*
+ * return a description of an AccessibleTable column header
+ */
+ AccessibleContext getAccessibleTableColumnDescription(long vmID, AccessibleContext acParent, jint column) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableColumnDescription(vmID, acParent, column);
+ }
+ return (AccessibleContext)0;
+ }
+
+ /*
+ * return the number of rows selected in an AccessibleTable
+ */
+ jint getAccessibleTableRowSelectionCount(long vmID, AccessibleTable table) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableRowSelectionCount(vmID, table);
+ }
+ return -1;
+ }
+
+ /*
+ * return whether a row is selected in an AccessibleTable
+ */
+ BOOL isAccessibleTableRowSelected(long vmID, AccessibleTable table, jint row) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.isAccessibleTableRowSelected(vmID, table, row);
+ }
+ return FALSE;
+ }
+
+ /*
+ * get an array of selected rows in an AccessibleTable
+ */
+ BOOL getAccessibleTableRowSelections(long vmID, AccessibleTable table, jint count, jint *selections) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableRowSelections(vmID, table, count, selections);
+ }
+ return FALSE;
+ }
+
+ /*
+ * return the number of columns selected in an AccessibleTable
+ */
+ jint getAccessibleTableColumnSelectionCount(long vmID, AccessibleTable table) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableColumnSelectionCount(vmID, table);
+ }
+ return -1;
+ }
+
+ /*
+ * return whether a column is selected in an AccessibleTable
+ */
+ BOOL isAccessibleTableColumnSelected(long vmID, AccessibleTable table, jint column) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.isAccessibleTableColumnSelected(vmID, table, column);
+ }
+ return FALSE;
+ }
+
+ /*
+ * get an array of columns selected in an AccessibleTable
+ */
+ BOOL getAccessibleTableColumnSelections(long vmID, AccessibleTable table, jint count, jint *selections) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableColumnSelections(vmID, table, count, selections);
+ }
+ return FALSE;
+ }
+
+ /*
+ * return the row number for a cell at a given index
+ */
+ jint
+ getAccessibleTableRow(long vmID, AccessibleTable table, jint index) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableRow(vmID, table, index);
+ }
+ return -1;
+ }
+
+ /*
+ * return the column number for a cell at a given index
+ */
+ jint
+ getAccessibleTableColumn(long vmID, AccessibleTable table, jint index) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableColumn(vmID, table, index);
+ }
+ return -1;
+ }
+
+ /*
+ * return the index of a cell at a given row and column
+ */
+ jint
+ getAccessibleTableIndex(long vmID, AccessibleTable table, jint row, jint column) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleTableIndex(vmID, table, row, column);
+ }
+ return -1;
+ }
+
+ /* end AccessibleTable routines */
+
+
+ /**
+ * Accessible Text routines
+ */
+ BOOL GetAccessibleTextInfo(long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleTextInfo(vmID, at, textInfo, x, y);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleTextItems(long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleTextItems(vmID, at, textItems, index);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleTextSelectionInfo(long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleTextSelectionInfo(vmID, at, textSelection);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleTextAttributes(long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleTextAttributes(vmID, at, index, attributes);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleTextRect(long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleTextRect(vmID, at, rectInfo, index);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleTextLineBounds(long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleTextLineBounds(vmID, at, index, startIndex, endIndex);
+ }
+ return FALSE;
+ }
+
+ BOOL GetAccessibleTextRange(long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleTextRange(vmID, at, start, end, text, len);
+ }
+ return FALSE;
+ }
+
+ /**
+ * AccessibleRelationSet routines
+ */
+ BOOL getAccessibleRelationSet(long vmID, AccessibleContext accessibleContext,
+ AccessibleRelationSetInfo *relationSetInfo) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleRelationSet(vmID, accessibleContext, relationSetInfo);
+ }
+ return FALSE;
+ }
+
+ /**
+ * AccessibleHypertext routines
+ */
+
+ // Gets AccessibleHypertext for an AccessibleContext
+ BOOL getAccessibleHypertext(long vmID, AccessibleContext accessibleContext,
+ AccessibleHypertextInfo *hypertextInfo) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleHypertext(vmID, accessibleContext, hypertextInfo);
+ }
+ return FALSE;
+ }
+
+ // Activates an AccessibleHyperlink for an AccessibleContext
+ BOOL activateAccessibleHyperlink(long vmID, AccessibleContext accessibleContext,
+ AccessibleHyperlink accessibleHyperlink) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.activateAccessibleHyperlink(vmID, accessibleContext, accessibleHyperlink);
+ }
+ return FALSE;
+ }
+
+ /*
+ * Returns the number of hyperlinks in a component
+ * Maps to AccessibleHypertext.getLinkCount.
+ * Returns -1 on error.
+ */
+ jint getAccessibleHyperlinkCount(const long vmID,
+ const AccessibleContext accessibleContext) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleHyperlinkCount(vmID, accessibleContext);
+ }
+ return -1;
+ }
+
+ /*
+ * This method is used to iterate through the hyperlinks in a component. It
+ * returns hypertext information for a component starting at hyperlink index
+ * nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will
+ * be returned for each call to this method.
+ * returns FALSE on error.
+ */
+ BOOL getAccessibleHypertextExt(const long vmID,
+ const AccessibleContext accessibleContext,
+ const jint nStartIndex,
+ /* OUT */ AccessibleHypertextInfo *hypertextInfo) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleHypertextExt(vmID,
+ accessibleContext,
+ nStartIndex,
+ hypertextInfo);
+ }
+ return FALSE;
+ }
+
+ /*
+ * Returns the index into an array of hyperlinks that is associated with
+ * a character index in document;
+ * Maps to AccessibleHypertext.getLinkIndex.
+ * Returns -1 on error.
+ */
+ jint getAccessibleHypertextLinkIndex(const long vmID,
+ const AccessibleHypertext hypertext,
+ const jint nIndex) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleHypertextLinkIndex(vmID,
+ hypertext,
+ nIndex);
+ }
+ return -1;
+ }
+
+ /*
+ * Returns the nth hyperlink in a document.
+ * Maps to AccessibleHypertext.getLink.
+ * Returns -1 on error
+ */
+ BOOL getAccessibleHyperlink(const long vmID,
+ const AccessibleHypertext hypertext,
+ const jint nIndex,
+ /* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo) {
+
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleHyperlink(vmID,
+ hypertext,
+ nIndex,
+ hyperlinkInfo);
+ }
+ return FALSE;
+ }
+
+
+ /* Accessible KeyBindings, Icons and Actions */
+ BOOL getAccessibleKeyBindings(long vmID, AccessibleContext accessibleContext,
+ AccessibleKeyBindings *keyBindings) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleKeyBindings(vmID, accessibleContext, keyBindings);
+ }
+ return FALSE;
+ }
+
+ BOOL getAccessibleIcons(long vmID, AccessibleContext accessibleContext,
+ AccessibleIcons *icons) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleIcons(vmID, accessibleContext, icons);
+ }
+ return FALSE;
+ }
+
+ BOOL getAccessibleActions(long vmID, AccessibleContext accessibleContext,
+ AccessibleActions *actions) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getAccessibleActions(vmID, accessibleContext, actions);
+ }
+ return FALSE;
+ }
+
+ BOOL doAccessibleActions(long vmID, AccessibleContext accessibleContext,
+ AccessibleActionsToDo *actionsToDo, jint *failure) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.doAccessibleActions(vmID, accessibleContext, actionsToDo, failure);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Accessible Value routines
+ */
+ BOOL GetCurrentAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetCurrentAccessibleValueFromContext(vmID, av, value, len);
+ }
+ return FALSE;
+ }
+
+ BOOL GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetMaximumAccessibleValueFromContext(vmID, av, value, len);
+ }
+ return FALSE;
+ }
+
+ BOOL GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetMinimumAccessibleValueFromContext(vmID, av, value, len);
+ }
+ return FALSE;
+ }
+
+
+ /**
+ * Accessible Selection routines
+ */
+ void addAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.AddAccessibleSelectionFromContext(vmID, as, i);
+ }
+ }
+
+ void clearAccessibleSelectionFromContext(long vmID, AccessibleSelection as) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.ClearAccessibleSelectionFromContext(vmID, as);
+ }
+ }
+
+ JOBJECT64 GetAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleSelectionFromContext(vmID, as, i);
+ }
+ return (JOBJECT64) 0;
+ }
+
+ int GetAccessibleSelectionCountFromContext(long vmID, AccessibleSelection as) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.GetAccessibleSelectionCountFromContext(vmID, as);
+ }
+ return -1;
+ }
+
+ BOOL IsAccessibleChildSelectedFromContext(long vmID, AccessibleSelection as, int i) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.IsAccessibleChildSelectedFromContext(vmID, as, i);
+ }
+ return FALSE;
+ }
+
+ void RemoveAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.RemoveAccessibleSelectionFromContext(vmID, as, i);
+ }
+ }
+
+ void SelectAllAccessibleSelectionFromContext(long vmID, AccessibleSelection as) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ theAccessBridge.SelectAllAccessibleSelectionFromContext(vmID, as);
+ }
+ }
+
+ /**
+ * Additional methods for Teton
+ */
+
+ /**
+ * Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
+ * whether successful.
+ *
+ * Bug ID 4916682 - Implement JAWS AccessibleName policy
+ */
+ BOOL getVirtualAccessibleName(const long vmID, const AccessibleContext accessibleContext,
+ wchar_t *name, int len) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getVirtualAccessibleName(vmID, accessibleContext, name, len);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Request focus for a component. Returns whether successful;
+ *
+ * Bug ID 4944757 - requestFocus method needed
+ */
+ BOOL requestFocus(const long vmID, const AccessibleContext accessibleContext) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.requestFocus(vmID, accessibleContext);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Selects text between two indices. Selection includes the text at the start index
+ * and the text at the end index. Returns whether successful;
+ *
+ * Bug ID 4944758 - selectTextRange method needed
+ */
+ BOOL selectTextRange(const long vmID, const AccessibleContext accessibleContext,
+ const int startIndex, const int endIndex) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.selectTextRange(vmID, accessibleContext, startIndex, endIndex);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Get text attributes between two indices. The attribute list includes the text at the
+ * start index and the text at the end index. Returns whether successful;
+ *
+ * Bug ID 4944761 - getTextAttributes between two indices method needed
+ */
+ BOOL getTextAttributesInRange(const long vmID, const AccessibleContext accessibleContext,
+ const int startIndex, const int endIndex,
+ AccessibleTextAttributesInfo *attributes, short *len) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getTextAttributesInRange(vmID, accessibleContext, startIndex,
+ endIndex, attributes, len);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Returns the number of visible children of a component. Returns -1 on error.
+ *
+ * Bug ID 4944762- getVisibleChildren for list-like components needed
+ */
+ int getVisibleChildrenCount(const long vmID, const AccessibleContext accessibleContext) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getVisibleChildrenCount(vmID, accessibleContext);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Gets the visible children of an AccessibleContext. Returns whether successful;
+ *
+ * Bug ID 4944762- getVisibleChildren for list-like components needed
+ */
+ BOOL getVisibleChildren(const long vmID, const AccessibleContext accessibleContext,
+ const int startIndex, VisibleChildrenInfo *visibleChildrenInfo) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getVisibleChildren(vmID, accessibleContext, startIndex,
+ visibleChildrenInfo);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Set the caret to a text position. Returns whether successful;
+ *
+ * Bug ID 4944770 - setCaretPosition method needed
+ */
+ BOOL setCaretPosition(const long vmID, const AccessibleContext accessibleContext,
+ const int position) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.setCaretPosition(vmID, accessibleContext, position);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Gets the text caret location
+ */
+ BOOL getCaretLocation(long vmID, AccessibleContext ac, AccessibleTextRectInfo *rectInfo, jint index) {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getCaretLocation(vmID, ac, rectInfo, index);
+ }
+ return FALSE;
+ }
+
+ /**
+ * Gets the number of events waiting to fire
+ */
+ int getEventsWaiting() {
+ if (theAccessBridgeInitializedFlag == TRUE) {
+ return theAccessBridge.getEventsWaiting();
+ }
+ return FALSE;
+ }
+
+#ifdef __cplusplus
+}
+#endif
--- a/jdk/src/jdk.accessibility/windows/native/include/bridge/AccessBridgeCallbacks.h Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/include/bridge/AccessBridgeCallbacks.h Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -24,10 +24,6 @@
*/
/*
- * AccessBridgeCallbacks.h 1.17 05/03/21
- */
-
-/*
* Header file defining callback typedefs for Windows routines
* which are called from Java (responding to events, etc.).
*/
--- a/jdk/src/jdk.accessibility/windows/native/include/bridge/AccessBridgeCalls.c Tue Nov 08 16:18:41 2016 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1131 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @(#)AccessBridgeCalls.c 1.25 05/08/22
- */
-
-/*
- * Wrapper functions around calls to the AccessBridge DLL
- */
-
-
-#include <windows.h>
-#include <jni.h>
-
-
-//#define ACCESSBRIDGE_32
-//#define ACCESSBRIDGE_64
-
-#include "AccessBridgeCalls.h"
-#include "AccessBridgeDebug.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- HINSTANCE theAccessBridgeInstance;
- AccessBridgeFPs theAccessBridge;
-
- BOOL theAccessBridgeInitializedFlag = FALSE;
-
-#define LOAD_FP(result, type, name) \
- PrintDebugString("LOAD_FP loading: %s ...", name); \
- if ((theAccessBridge.result = \
- (type) GetProcAddress(theAccessBridgeInstance, name)) == (type) 0) { \
- PrintDebugString("LOAD_FP failed: %s", name); \
- return FALSE; \
- }
-
- BOOL initializeAccessBridge() {
-
-#ifdef ACCESSBRIDGE_ARCH_32 // For 32bit AT new bridge
- theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE-32");
-#else
-#ifdef ACCESSBRIDGE_ARCH_64 // For 64bit AT new bridge
- theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE-64");
-#else // legacy
- theAccessBridgeInstance = LoadLibrary("WINDOWSACCESSBRIDGE");
-#endif
-#endif
- if (theAccessBridgeInstance != 0) {
- LOAD_FP(Windows_run, Windows_runFP, "Windows_run");
-
- LOAD_FP(SetJavaShutdown, SetJavaShutdownFP, "setJavaShutdownFP");
- LOAD_FP(SetFocusGained, SetFocusGainedFP, "setFocusGainedFP");
- LOAD_FP(SetFocusLost, SetFocusLostFP, "setFocusLostFP");
-
- LOAD_FP(SetCaretUpdate, SetCaretUpdateFP, "setCaretUpdateFP");
-
- LOAD_FP(SetMouseClicked, SetMouseClickedFP, "setMouseClickedFP");
- LOAD_FP(SetMouseEntered, SetMouseEnteredFP, "setMouseEnteredFP");
- LOAD_FP(SetMouseExited, SetMouseExitedFP, "setMouseExitedFP");
- LOAD_FP(SetMousePressed, SetMousePressedFP, "setMousePressedFP");
- LOAD_FP(SetMouseReleased, SetMouseReleasedFP, "setMouseReleasedFP");
-
- LOAD_FP(SetMenuCanceled, SetMenuCanceledFP, "setMenuCanceledFP");
- LOAD_FP(SetMenuDeselected, SetMenuDeselectedFP, "setMenuDeselectedFP");
- LOAD_FP(SetMenuSelected, SetMenuSelectedFP, "setMenuSelectedFP");
- LOAD_FP(SetPopupMenuCanceled, SetPopupMenuCanceledFP, "setPopupMenuCanceledFP");
- LOAD_FP(SetPopupMenuWillBecomeInvisible, SetPopupMenuWillBecomeInvisibleFP, "setPopupMenuWillBecomeInvisibleFP");
- LOAD_FP(SetPopupMenuWillBecomeVisible, SetPopupMenuWillBecomeVisibleFP, "setPopupMenuWillBecomeVisibleFP");
-
- LOAD_FP(SetPropertyNameChange, SetPropertyNameChangeFP, "setPropertyNameChangeFP");
- LOAD_FP(SetPropertyDescriptionChange, SetPropertyDescriptionChangeFP, "setPropertyDescriptionChangeFP");
- LOAD_FP(SetPropertyStateChange, SetPropertyStateChangeFP, "setPropertyStateChangeFP");
- LOAD_FP(SetPropertyValueChange, SetPropertyValueChangeFP, "setPropertyValueChangeFP");
- LOAD_FP(SetPropertySelectionChange, SetPropertySelectionChangeFP, "setPropertySelectionChangeFP");
- LOAD_FP(SetPropertyTextChange, SetPropertyTextChangeFP, "setPropertyTextChangeFP");
- LOAD_FP(SetPropertyCaretChange, SetPropertyCaretChangeFP, "setPropertyCaretChangeFP");
- LOAD_FP(SetPropertyVisibleDataChange, SetPropertyVisibleDataChangeFP, "setPropertyVisibleDataChangeFP");
- LOAD_FP(SetPropertyChildChange, SetPropertyChildChangeFP, "setPropertyChildChangeFP");
- LOAD_FP(SetPropertyActiveDescendentChange, SetPropertyActiveDescendentChangeFP, "setPropertyActiveDescendentChangeFP");
-
- LOAD_FP(SetPropertyTableModelChange, SetPropertyTableModelChangeFP, "setPropertyTableModelChangeFP");
-
- LOAD_FP(ReleaseJavaObject, ReleaseJavaObjectFP, "releaseJavaObject");
- LOAD_FP(GetVersionInfo, GetVersionInfoFP, "getVersionInfo");
-
- LOAD_FP(IsJavaWindow, IsJavaWindowFP, "isJavaWindow");
- LOAD_FP(IsSameObject, IsSameObjectFP, "isSameObject");
- LOAD_FP(GetAccessibleContextFromHWND, GetAccessibleContextFromHWNDFP, "getAccessibleContextFromHWND");
- LOAD_FP(getHWNDFromAccessibleContext, getHWNDFromAccessibleContextFP, "getHWNDFromAccessibleContext");
-
- LOAD_FP(GetAccessibleContextAt, GetAccessibleContextAtFP, "getAccessibleContextAt");
- LOAD_FP(GetAccessibleContextWithFocus, GetAccessibleContextWithFocusFP, "getAccessibleContextWithFocus");
- LOAD_FP(GetAccessibleContextInfo, GetAccessibleContextInfoFP, "getAccessibleContextInfo");
- LOAD_FP(GetAccessibleChildFromContext, GetAccessibleChildFromContextFP, "getAccessibleChildFromContext");
- LOAD_FP(GetAccessibleParentFromContext, GetAccessibleParentFromContextFP, "getAccessibleParentFromContext");
-
- /* begin AccessibleTable */
- LOAD_FP(getAccessibleTableInfo, getAccessibleTableInfoFP, "getAccessibleTableInfo");
- LOAD_FP(getAccessibleTableCellInfo, getAccessibleTableCellInfoFP, "getAccessibleTableCellInfo");
-
- LOAD_FP(getAccessibleTableRowHeader, getAccessibleTableRowHeaderFP, "getAccessibleTableRowHeader");
- LOAD_FP(getAccessibleTableColumnHeader, getAccessibleTableColumnHeaderFP, "getAccessibleTableColumnHeader");
-
- LOAD_FP(getAccessibleTableRowDescription, getAccessibleTableRowDescriptionFP, "getAccessibleTableRowDescription");
- LOAD_FP(getAccessibleTableColumnDescription, getAccessibleTableColumnDescriptionFP, "getAccessibleTableColumnDescription");
-
- LOAD_FP(getAccessibleTableRowSelectionCount, getAccessibleTableRowSelectionCountFP,
- "getAccessibleTableRowSelectionCount");
- LOAD_FP(isAccessibleTableRowSelected, isAccessibleTableRowSelectedFP,
- "isAccessibleTableRowSelected");
- LOAD_FP(getAccessibleTableRowSelections, getAccessibleTableRowSelectionsFP,
- "getAccessibleTableRowSelections");
-
- LOAD_FP(getAccessibleTableColumnSelectionCount, getAccessibleTableColumnSelectionCountFP,
- "getAccessibleTableColumnSelectionCount");
- LOAD_FP(isAccessibleTableColumnSelected, isAccessibleTableColumnSelectedFP,
- "isAccessibleTableColumnSelected");
- LOAD_FP(getAccessibleTableColumnSelections, getAccessibleTableColumnSelectionsFP,
- "getAccessibleTableColumnSelections");
-
- LOAD_FP(getAccessibleTableRow, getAccessibleTableRowFP,
- "getAccessibleTableRow");
- LOAD_FP(getAccessibleTableColumn, getAccessibleTableColumnFP,
- "getAccessibleTableColumn");
- LOAD_FP(getAccessibleTableIndex, getAccessibleTableIndexFP,
- "getAccessibleTableIndex");
-
- /* end AccessibleTable */
-
- /* AccessibleRelationSet */
- LOAD_FP(getAccessibleRelationSet, getAccessibleRelationSetFP, "getAccessibleRelationSet");
-
- /* AccessibleHypertext */
- LOAD_FP(getAccessibleHypertext, getAccessibleHypertextFP, "getAccessibleHypertext");
- LOAD_FP(activateAccessibleHyperlink, activateAccessibleHyperlinkFP, "activateAccessibleHyperlink");
- LOAD_FP(getAccessibleHyperlinkCount, getAccessibleHyperlinkCountFP, "getAccessibleHyperlinkCount");
- LOAD_FP(getAccessibleHypertextExt, getAccessibleHypertextExtFP, "getAccessibleHypertextExt");
- LOAD_FP(getAccessibleHypertextLinkIndex, getAccessibleHypertextLinkIndexFP, "getAccessibleHypertextLinkIndex");
- LOAD_FP(getAccessibleHyperlink, getAccessibleHyperlinkFP, "getAccessibleHyperlink");
-
- /* Accessible KeyBinding, Icon and Action */
- LOAD_FP(getAccessibleKeyBindings, getAccessibleKeyBindingsFP, "getAccessibleKeyBindings");
- LOAD_FP(getAccessibleIcons, getAccessibleIconsFP, "getAccessibleIcons");
- LOAD_FP(getAccessibleActions, getAccessibleActionsFP, "getAccessibleActions");
- LOAD_FP(doAccessibleActions, doAccessibleActionsFP, "doAccessibleActions");
-
- /* AccessibleText */
- LOAD_FP(GetAccessibleTextInfo, GetAccessibleTextInfoFP, "getAccessibleTextInfo");
- LOAD_FP(GetAccessibleTextItems, GetAccessibleTextItemsFP, "getAccessibleTextItems");
- LOAD_FP(GetAccessibleTextSelectionInfo, GetAccessibleTextSelectionInfoFP, "getAccessibleTextSelectionInfo");
- LOAD_FP(GetAccessibleTextAttributes, GetAccessibleTextAttributesFP, "getAccessibleTextAttributes");
- LOAD_FP(GetAccessibleTextRect, GetAccessibleTextRectFP, "getAccessibleTextRect");
- LOAD_FP(GetAccessibleTextLineBounds, GetAccessibleTextLineBoundsFP, "getAccessibleTextLineBounds");
- LOAD_FP(GetAccessibleTextRange, GetAccessibleTextRangeFP, "getAccessibleTextRange");
-
- LOAD_FP(GetCurrentAccessibleValueFromContext, GetCurrentAccessibleValueFromContextFP, "getCurrentAccessibleValueFromContext");
- LOAD_FP(GetMaximumAccessibleValueFromContext, GetMaximumAccessibleValueFromContextFP, "getMaximumAccessibleValueFromContext");
- LOAD_FP(GetMinimumAccessibleValueFromContext, GetMinimumAccessibleValueFromContextFP, "getMinimumAccessibleValueFromContext");
-
- LOAD_FP(AddAccessibleSelectionFromContext, AddAccessibleSelectionFromContextFP, "addAccessibleSelectionFromContext");
- LOAD_FP(ClearAccessibleSelectionFromContext, ClearAccessibleSelectionFromContextFP, "clearAccessibleSelectionFromContext");
- LOAD_FP(GetAccessibleSelectionFromContext, GetAccessibleSelectionFromContextFP, "getAccessibleSelectionFromContext");
- LOAD_FP(GetAccessibleSelectionCountFromContext, GetAccessibleSelectionCountFromContextFP, "getAccessibleSelectionCountFromContext");
- LOAD_FP(IsAccessibleChildSelectedFromContext, IsAccessibleChildSelectedFromContextFP, "isAccessibleChildSelectedFromContext");
- LOAD_FP(RemoveAccessibleSelectionFromContext, RemoveAccessibleSelectionFromContextFP, "removeAccessibleSelectionFromContext");
- LOAD_FP(SelectAllAccessibleSelectionFromContext, SelectAllAccessibleSelectionFromContextFP, "selectAllAccessibleSelectionFromContext");
-
- LOAD_FP(setTextContents, setTextContentsFP, "setTextContents");
- LOAD_FP(getParentWithRole, getParentWithRoleFP, "getParentWithRole");
- LOAD_FP(getTopLevelObject, getTopLevelObjectFP, "getTopLevelObject");
- LOAD_FP(getParentWithRoleElseRoot, getParentWithRoleElseRootFP, "getParentWithRoleElseRoot");
- LOAD_FP(getObjectDepth, getObjectDepthFP, "getObjectDepth");
- LOAD_FP(getActiveDescendent, getActiveDescendentFP, "getActiveDescendent");
-
- // additional methods for Teton
- LOAD_FP(getVirtualAccessibleName, getVirtualAccessibleNameFP, "getVirtualAccessibleName");
- LOAD_FP(requestFocus, requestFocusFP, "requestFocus");
- LOAD_FP(selectTextRange, selectTextRangeFP, "selectTextRange");
- LOAD_FP(getTextAttributesInRange, getTextAttributesInRangeFP, "getTextAttributesInRange");
- LOAD_FP(getVisibleChildrenCount, getVisibleChildrenCountFP, "getVisibleChildrenCount");
- LOAD_FP(getVisibleChildren, getVisibleChildrenFP, "getVisibleChildren");
- LOAD_FP(setCaretPosition, setCaretPositionFP, "setCaretPosition");
- LOAD_FP(getCaretLocation, getCaretLocationFP, "getCaretLocation");
-
- LOAD_FP(getEventsWaiting, getEventsWaitingFP, "getEventsWaiting");
-
- theAccessBridge.Windows_run();
-
- theAccessBridgeInitializedFlag = TRUE;
- PrintDebugString("theAccessBridgeInitializedFlag = TRUE");
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
-
- BOOL shutdownAccessBridge() {
- BOOL result;
- DWORD error;
- theAccessBridgeInitializedFlag = FALSE;
- if (theAccessBridgeInstance != (HANDLE) 0) {
- result = FreeLibrary(theAccessBridgeInstance);
- if (result != TRUE) {
- error = GetLastError();
- }
- return TRUE;
- }
- return FALSE;
- }
-
-
- void SetJavaShutdown(AccessBridge_JavaShutdownFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetJavaShutdown(fp);
- }
- }
-
- void SetFocusGained(AccessBridge_FocusGainedFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetFocusGained(fp);
- }
- }
-
- void SetFocusLost(AccessBridge_FocusLostFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetFocusLost(fp);
- }
- }
-
-
- void SetCaretUpdate(AccessBridge_CaretUpdateFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetCaretUpdate(fp);
- }
- }
-
-
- void SetMouseClicked(AccessBridge_MouseClickedFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMouseClicked(fp);
- }
- }
-
- void SetMouseEntered(AccessBridge_MouseEnteredFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMouseEntered(fp);
- }
- }
-
- void SetMouseExited(AccessBridge_MouseExitedFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMouseExited(fp);
- }
- }
-
- void SetMousePressed(AccessBridge_MousePressedFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMousePressed(fp);
- }
- }
-
- void SetMouseReleased(AccessBridge_MouseReleasedFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMouseReleased(fp);
- }
- }
-
-
- void SetMenuCanceled(AccessBridge_MenuCanceledFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMenuCanceled(fp);
- }
- }
-
- void SetMenuDeselected(AccessBridge_MenuDeselectedFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMenuDeselected(fp);
- }
- }
-
- void SetMenuSelected(AccessBridge_MenuSelectedFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetMenuSelected(fp);
- }
- }
-
- void SetPopupMenuCanceled(AccessBridge_PopupMenuCanceledFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPopupMenuCanceled(fp);
- }
- }
-
- void SetPopupMenuWillBecomeInvisible(AccessBridge_PopupMenuWillBecomeInvisibleFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPopupMenuWillBecomeInvisible(fp);
- }
- }
-
- void SetPopupMenuWillBecomeVisible(AccessBridge_PopupMenuWillBecomeVisibleFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPopupMenuWillBecomeVisible(fp);
- }
- }
-
-
- void SetPropertyNameChange(AccessBridge_PropertyNameChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyNameChange(fp);
- }
- }
-
- void SetPropertyDescriptionChange(AccessBridge_PropertyDescriptionChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyDescriptionChange(fp);
- }
- }
-
- void SetPropertyStateChange(AccessBridge_PropertyStateChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyStateChange(fp);
- }
- }
-
- void SetPropertyValueChange(AccessBridge_PropertyValueChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyValueChange(fp);
- }
- }
-
- void SetPropertySelectionChange(AccessBridge_PropertySelectionChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertySelectionChange(fp);
- }
- }
-
- void SetPropertyTextChange(AccessBridge_PropertyTextChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyTextChange(fp);
- }
- }
-
- void SetPropertyCaretChange(AccessBridge_PropertyCaretChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyCaretChange(fp);
- }
- }
-
- void SetPropertyVisibleDataChange(AccessBridge_PropertyVisibleDataChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyVisibleDataChange(fp);
- }
- }
-
- void SetPropertyChildChange(AccessBridge_PropertyChildChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyChildChange(fp);
- }
- }
-
- void SetPropertyActiveDescendentChange(AccessBridge_PropertyActiveDescendentChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyActiveDescendentChange(fp);
- }
- }
-
- void SetPropertyTableModelChange(AccessBridge_PropertyTableModelChangeFP fp) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SetPropertyTableModelChange(fp);
- }
- }
-
- /**
- * General routines
- */
- void ReleaseJavaObject(long vmID, Java_Object object) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.ReleaseJavaObject(vmID, object);
- }
- }
-
- BOOL GetVersionInfo(long vmID, AccessBridgeVersionInfo *info) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetVersionInfo(vmID, info);
- }
- return FALSE;
- }
-
-
- /**
- * Window routines
- */
- BOOL IsJavaWindow(HWND window) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- BOOL ret ;
- ret = theAccessBridge.IsJavaWindow(window);
- return ret ;
-
- }
- return FALSE;
- }
-
-
- /**
- * Returns the virtual machine ID and AccessibleContext for a top-level window
- */
- BOOL GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleContextFromHWND(target, vmID, ac);
- }
- return FALSE;
- }
-
- /**
- * Returns the HWND from the AccessibleContext of a top-level window. Returns 0
- * on error or if the AccessibleContext does not refer to a top-level window.
- */
- HWND getHWNDFromAccessibleContext(long vmID, JOBJECT64 accesibleContext) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getHWNDFromAccessibleContext(vmID, accesibleContext);
- }
- return (HWND)0;
- }
-
- /**
- * returns whether two objects are the same
- */
- BOOL IsSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.IsSameObject(vmID, obj1, obj2);
- }
- return FALSE;
- }
-
- /**
- * Sets editable text contents. The AccessibleContext must implement AccessibleEditableText and
- * be editable. The maximum text length is MAX_STRING_SIZE - 1.
- * Returns whether successful
- */
- BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext, const wchar_t *text) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.setTextContents(vmID, accessibleContext, text);
- }
- return FALSE;
- }
-
- /**
- * Returns the Accessible Context with the specified role that is the
- * ancestor of a given object. The role is one of the role strings
- * defined in AccessBridgePackages.h
- * If there is no ancestor object that has the specified role,
- * returns (AccessibleContext)0.
- */
- AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext,
- const wchar_t *role) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getParentWithRole(vmID, accessibleContext, role);
- }
- return (AccessibleContext)0;
- }
-
- /**
- * Returns the Accessible Context with the specified role that is the
- * ancestor of a given object. The role is one of the role strings
- * defined in AccessBridgePackages.h. If an object with the specified
- * role does not exist, returns the top level object for the Java Window.
- * Returns (AccessibleContext)0 on error.
- */
- AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext,
- const wchar_t *role) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getParentWithRoleElseRoot(vmID, accessibleContext, role);
- }
- return (AccessibleContext)0;
- }
-
- /**
- * Returns the Accessible Context for the top level object in
- * a Java Window. This is same Accessible Context that is obtained
- * from GetAccessibleContextFromHWND for that window. Returns
- * (AccessibleContext)0 on error.
- */
- AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getTopLevelObject(vmID, accessibleContext);
- }
- return (AccessibleContext)0;
- }
-
- /**
- * Returns how deep in the object hierarchy a given object is.
- * The top most object in the object hierarchy has an object depth of 0.
- * Returns -1 on error.
- */
- int getObjectDepth (const long vmID, const AccessibleContext accessibleContext) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getObjectDepth(vmID, accessibleContext);
- }
- return -1;
- }
-
- /**
- * Returns the Accessible Context of the current ActiveDescendent of an object.
- * This method assumes the ActiveDescendent is the component that is currently
- * selected in a container object.
- * Returns (AccessibleContext)0 on error or if there is no selection.
- */
- AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getActiveDescendent(vmID, accessibleContext);
- }
- return (AccessibleContext)0;
- }
-
-
- /**
- * Accessible Context routines
- */
- BOOL GetAccessibleContextAt(long vmID, AccessibleContext acParent,
- jint x, jint y, AccessibleContext *ac) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleContextAt(vmID, acParent, x, y, ac);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleContextWithFocus(HWND window, long *vmID, AccessibleContext *ac) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleContextWithFocus(window, vmID, ac);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleContextInfo(long vmID, AccessibleContext ac, AccessibleContextInfo *info) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleContextInfo(vmID, ac, info);
- }
- return FALSE;
- }
-
- AccessibleContext GetAccessibleChildFromContext(long vmID, AccessibleContext ac, jint index) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleChildFromContext(vmID, ac, index);
- }
- return (AccessibleContext) 0;
- }
-
- AccessibleContext GetAccessibleParentFromContext(long vmID, AccessibleContext ac) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleParentFromContext(vmID, ac);
- }
- return (AccessibleContext) 0;
- }
-
- /* begin AccessibleTable routines */
-
- /*
- * get information about an AccessibleTable
- */
- BOOL getAccessibleTableInfo(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableInfo(vmID, acParent, tableInfo);
- }
- return FALSE;
- }
-
- /*
- * get information about an AccessibleTable cell
- */
- BOOL getAccessibleTableCellInfo(long vmID, AccessibleTable accessibleTable,
- jint row, jint column, AccessibleTableCellInfo *tableCellInfo) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableCellInfo(vmID, accessibleTable, row, column, tableCellInfo);
- }
- return FALSE;
- }
-
- /*
- * get information about an AccessibleTable row header
- */
- BOOL getAccessibleTableRowHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableRowHeader(vmID, acParent, tableInfo);
- }
- return FALSE;
- }
-
- /*
- * get information about an AccessibleTable column header
- */
- BOOL getAccessibleTableColumnHeader(long vmID, AccessibleContext acParent, AccessibleTableInfo *tableInfo) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableColumnHeader(vmID, acParent, tableInfo);
- }
- return FALSE;
- }
-
- /*
- * return a description of an AccessibleTable row header
- */
- AccessibleContext getAccessibleTableRowDescription(long vmID, AccessibleContext acParent, jint row) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableRowDescription(vmID, acParent, row);
- }
- return (AccessibleContext)0;
- }
-
- /*
- * return a description of an AccessibleTable column header
- */
- AccessibleContext getAccessibleTableColumnDescription(long vmID, AccessibleContext acParent, jint column) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableColumnDescription(vmID, acParent, column);
- }
- return (AccessibleContext)0;
- }
-
- /*
- * return the number of rows selected in an AccessibleTable
- */
- jint getAccessibleTableRowSelectionCount(long vmID, AccessibleTable table) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableRowSelectionCount(vmID, table);
- }
- return -1;
- }
-
- /*
- * return whether a row is selected in an AccessibleTable
- */
- BOOL isAccessibleTableRowSelected(long vmID, AccessibleTable table, jint row) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.isAccessibleTableRowSelected(vmID, table, row);
- }
- return FALSE;
- }
-
- /*
- * get an array of selected rows in an AccessibleTable
- */
- BOOL getAccessibleTableRowSelections(long vmID, AccessibleTable table, jint count, jint *selections) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableRowSelections(vmID, table, count, selections);
- }
- return FALSE;
- }
-
- /*
- * return the number of columns selected in an AccessibleTable
- */
- jint getAccessibleTableColumnSelectionCount(long vmID, AccessibleTable table) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableColumnSelectionCount(vmID, table);
- }
- return -1;
- }
-
- /*
- * return whether a column is selected in an AccessibleTable
- */
- BOOL isAccessibleTableColumnSelected(long vmID, AccessibleTable table, jint column) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.isAccessibleTableColumnSelected(vmID, table, column);
- }
- return FALSE;
- }
-
- /*
- * get an array of columns selected in an AccessibleTable
- */
- BOOL getAccessibleTableColumnSelections(long vmID, AccessibleTable table, jint count, jint *selections) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableColumnSelections(vmID, table, count, selections);
- }
- return FALSE;
- }
-
- /*
- * return the row number for a cell at a given index
- */
- jint
- getAccessibleTableRow(long vmID, AccessibleTable table, jint index) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableRow(vmID, table, index);
- }
- return -1;
- }
-
- /*
- * return the column number for a cell at a given index
- */
- jint
- getAccessibleTableColumn(long vmID, AccessibleTable table, jint index) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableColumn(vmID, table, index);
- }
- return -1;
- }
-
- /*
- * return the index of a cell at a given row and column
- */
- jint
- getAccessibleTableIndex(long vmID, AccessibleTable table, jint row, jint column) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleTableIndex(vmID, table, row, column);
- }
- return -1;
- }
-
- /* end AccessibleTable routines */
-
-
- /**
- * Accessible Text routines
- */
- BOOL GetAccessibleTextInfo(long vmID, AccessibleText at, AccessibleTextInfo *textInfo, jint x, jint y) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleTextInfo(vmID, at, textInfo, x, y);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleTextItems(long vmID, AccessibleText at, AccessibleTextItemsInfo *textItems, jint index) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleTextItems(vmID, at, textItems, index);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleTextSelectionInfo(long vmID, AccessibleText at, AccessibleTextSelectionInfo *textSelection) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleTextSelectionInfo(vmID, at, textSelection);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleTextAttributes(long vmID, AccessibleText at, jint index, AccessibleTextAttributesInfo *attributes) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleTextAttributes(vmID, at, index, attributes);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleTextRect(long vmID, AccessibleText at, AccessibleTextRectInfo *rectInfo, jint index) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleTextRect(vmID, at, rectInfo, index);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleTextLineBounds(long vmID, AccessibleText at, jint index, jint *startIndex, jint *endIndex) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleTextLineBounds(vmID, at, index, startIndex, endIndex);
- }
- return FALSE;
- }
-
- BOOL GetAccessibleTextRange(long vmID, AccessibleText at, jint start, jint end, wchar_t *text, short len) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleTextRange(vmID, at, start, end, text, len);
- }
- return FALSE;
- }
-
- /**
- * AccessibleRelationSet routines
- */
- BOOL getAccessibleRelationSet(long vmID, AccessibleContext accessibleContext,
- AccessibleRelationSetInfo *relationSetInfo) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleRelationSet(vmID, accessibleContext, relationSetInfo);
- }
- return FALSE;
- }
-
- /**
- * AccessibleHypertext routines
- */
-
- // Gets AccessibleHypertext for an AccessibleContext
- BOOL getAccessibleHypertext(long vmID, AccessibleContext accessibleContext,
- AccessibleHypertextInfo *hypertextInfo) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleHypertext(vmID, accessibleContext, hypertextInfo);
- }
- return FALSE;
- }
-
- // Activates an AccessibleHyperlink for an AccessibleContext
- BOOL activateAccessibleHyperlink(long vmID, AccessibleContext accessibleContext,
- AccessibleHyperlink accessibleHyperlink) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.activateAccessibleHyperlink(vmID, accessibleContext, accessibleHyperlink);
- }
- return FALSE;
- }
-
- /*
- * Returns the number of hyperlinks in a component
- * Maps to AccessibleHypertext.getLinkCount.
- * Returns -1 on error.
- */
- jint getAccessibleHyperlinkCount(const long vmID,
- const AccessibleContext accessibleContext) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleHyperlinkCount(vmID, accessibleContext);
- }
- return -1;
- }
-
- /*
- * This method is used to iterate through the hyperlinks in a component. It
- * returns hypertext information for a component starting at hyperlink index
- * nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will
- * be returned for each call to this method.
- * returns FALSE on error.
- */
- BOOL getAccessibleHypertextExt(const long vmID,
- const AccessibleContext accessibleContext,
- const jint nStartIndex,
- /* OUT */ AccessibleHypertextInfo *hypertextInfo) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleHypertextExt(vmID,
- accessibleContext,
- nStartIndex,
- hypertextInfo);
- }
- return FALSE;
- }
-
- /*
- * Returns the index into an array of hyperlinks that is associated with
- * a character index in document;
- * Maps to AccessibleHypertext.getLinkIndex.
- * Returns -1 on error.
- */
- jint getAccessibleHypertextLinkIndex(const long vmID,
- const AccessibleHypertext hypertext,
- const jint nIndex) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleHypertextLinkIndex(vmID,
- hypertext,
- nIndex);
- }
- return -1;
- }
-
- /*
- * Returns the nth hyperlink in a document.
- * Maps to AccessibleHypertext.getLink.
- * Returns -1 on error
- */
- BOOL getAccessibleHyperlink(const long vmID,
- const AccessibleHypertext hypertext,
- const jint nIndex,
- /* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo) {
-
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleHyperlink(vmID,
- hypertext,
- nIndex,
- hyperlinkInfo);
- }
- return FALSE;
- }
-
-
- /* Accessible KeyBindings, Icons and Actions */
- BOOL getAccessibleKeyBindings(long vmID, AccessibleContext accessibleContext,
- AccessibleKeyBindings *keyBindings) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleKeyBindings(vmID, accessibleContext, keyBindings);
- }
- return FALSE;
- }
-
- BOOL getAccessibleIcons(long vmID, AccessibleContext accessibleContext,
- AccessibleIcons *icons) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleIcons(vmID, accessibleContext, icons);
- }
- return FALSE;
- }
-
- BOOL getAccessibleActions(long vmID, AccessibleContext accessibleContext,
- AccessibleActions *actions) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getAccessibleActions(vmID, accessibleContext, actions);
- }
- return FALSE;
- }
-
- BOOL doAccessibleActions(long vmID, AccessibleContext accessibleContext,
- AccessibleActionsToDo *actionsToDo, jint *failure) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.doAccessibleActions(vmID, accessibleContext, actionsToDo, failure);
- }
- return FALSE;
- }
-
- /**
- * Accessible Value routines
- */
- BOOL GetCurrentAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetCurrentAccessibleValueFromContext(vmID, av, value, len);
- }
- return FALSE;
- }
-
- BOOL GetMaximumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetMaximumAccessibleValueFromContext(vmID, av, value, len);
- }
- return FALSE;
- }
-
- BOOL GetMinimumAccessibleValueFromContext(long vmID, AccessibleValue av, wchar_t *value, short len) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetMinimumAccessibleValueFromContext(vmID, av, value, len);
- }
- return FALSE;
- }
-
-
- /**
- * Accessible Selection routines
- */
- void addAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.AddAccessibleSelectionFromContext(vmID, as, i);
- }
- }
-
- void clearAccessibleSelectionFromContext(long vmID, AccessibleSelection as) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.ClearAccessibleSelectionFromContext(vmID, as);
- }
- }
-
- JOBJECT64 GetAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleSelectionFromContext(vmID, as, i);
- }
- return (JOBJECT64) 0;
- }
-
- int GetAccessibleSelectionCountFromContext(long vmID, AccessibleSelection as) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.GetAccessibleSelectionCountFromContext(vmID, as);
- }
- return -1;
- }
-
- BOOL IsAccessibleChildSelectedFromContext(long vmID, AccessibleSelection as, int i) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.IsAccessibleChildSelectedFromContext(vmID, as, i);
- }
- return FALSE;
- }
-
- void RemoveAccessibleSelectionFromContext(long vmID, AccessibleSelection as, int i) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.RemoveAccessibleSelectionFromContext(vmID, as, i);
- }
- }
-
- void SelectAllAccessibleSelectionFromContext(long vmID, AccessibleSelection as) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- theAccessBridge.SelectAllAccessibleSelectionFromContext(vmID, as);
- }
- }
-
- /**
- * Additional methods for Teton
- */
-
- /**
- * Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
- * whether successful.
- *
- * Bug ID 4916682 - Implement JAWS AccessibleName policy
- */
- BOOL getVirtualAccessibleName(const long vmID, const AccessibleContext accessibleContext,
- wchar_t *name, int len) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getVirtualAccessibleName(vmID, accessibleContext, name, len);
- }
- return FALSE;
- }
-
- /**
- * Request focus for a component. Returns whether successful;
- *
- * Bug ID 4944757 - requestFocus method needed
- */
- BOOL requestFocus(const long vmID, const AccessibleContext accessibleContext) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.requestFocus(vmID, accessibleContext);
- }
- return FALSE;
- }
-
- /**
- * Selects text between two indices. Selection includes the text at the start index
- * and the text at the end index. Returns whether successful;
- *
- * Bug ID 4944758 - selectTextRange method needed
- */
- BOOL selectTextRange(const long vmID, const AccessibleContext accessibleContext,
- const int startIndex, const int endIndex) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.selectTextRange(vmID, accessibleContext, startIndex, endIndex);
- }
- return FALSE;
- }
-
- /**
- * Get text attributes between two indices. The attribute list includes the text at the
- * start index and the text at the end index. Returns whether successful;
- *
- * Bug ID 4944761 - getTextAttributes between two indices method needed
- */
- BOOL getTextAttributesInRange(const long vmID, const AccessibleContext accessibleContext,
- const int startIndex, const int endIndex,
- AccessibleTextAttributesInfo *attributes, short *len) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getTextAttributesInRange(vmID, accessibleContext, startIndex,
- endIndex, attributes, len);
- }
- return FALSE;
- }
-
- /**
- * Returns the number of visible children of a component. Returns -1 on error.
- *
- * Bug ID 4944762- getVisibleChildren for list-like components needed
- */
- int getVisibleChildrenCount(const long vmID, const AccessibleContext accessibleContext) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getVisibleChildrenCount(vmID, accessibleContext);
- }
- return FALSE;
- }
-
- /**
- * Gets the visible children of an AccessibleContext. Returns whether successful;
- *
- * Bug ID 4944762- getVisibleChildren for list-like components needed
- */
- BOOL getVisibleChildren(const long vmID, const AccessibleContext accessibleContext,
- const int startIndex, VisibleChildrenInfo *visibleChildrenInfo) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getVisibleChildren(vmID, accessibleContext, startIndex,
- visibleChildrenInfo);
- }
- return FALSE;
- }
-
- /**
- * Set the caret to a text position. Returns whether successful;
- *
- * Bug ID 4944770 - setCaretPosition method needed
- */
- BOOL setCaretPosition(const long vmID, const AccessibleContext accessibleContext,
- const int position) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.setCaretPosition(vmID, accessibleContext, position);
- }
- return FALSE;
- }
-
- /**
- * Gets the text caret location
- */
- BOOL getCaretLocation(long vmID, AccessibleContext ac, AccessibleTextRectInfo *rectInfo, jint index) {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getCaretLocation(vmID, ac, rectInfo, index);
- }
- return FALSE;
- }
-
- /**
- * Gets the number of events waiting to fire
- */
- int getEventsWaiting() {
- if (theAccessBridgeInitializedFlag == TRUE) {
- return theAccessBridge.getEventsWaiting();
- }
- return FALSE;
- }
-
-#ifdef __cplusplus
-}
-#endif
--- a/jdk/src/jdk.accessibility/windows/native/include/bridge/AccessBridgeCalls.h Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/src/jdk.accessibility/windows/native/include/bridge/AccessBridgeCalls.h Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -23,6 +23,25 @@
* questions.
*/
+/* Note: In addition to this header file AccessBridgeCalls.c must be compiled and
+ * linked to your application. AccessBridgeCalls.c implements the Java Access
+ * Bridge API and also hides the complexities associated with interfacing to the
+ * associated Java Access Bridge DLL which is installed when Java is installed.
+ *
+ * AccessBridgeCalls.c is available for download from the OpenJDK repository using
+ * the following link:
+ *
+ * http://hg.openjdk.java.net/jdk9/jdk9/jdk/raw-file/tip/src/jdk.accessibility/windows/native/bridge/AccessBridgeCalls.c
+ *
+ * Also note that the API is used in the jaccessinspector and jaccesswalker tools.
+ * The source for those tools is available in the OpenJDK repository at these links:
+ *
+ * http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/src/jdk.accessibility/windows/native/jaccessinspector/jaccessinspector.cpp
+ * http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/tip/src/jdk.accessibility/windows/native/jaccesswalker/jaccesswalker.cpp
+ *
+ *
+ */
+
/*
* Wrapper functions around calls to the AccessBridge DLL
*/
--- a/jdk/test/java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/test/java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java Mon Nov 14 09:03:07 2016 -0800
@@ -22,21 +22,28 @@
*/
/* @test
- * @bug 8157163
+ * @bug 8157163 8159132
* @summary AWT FileDialog does not inherit icon image from parent Frame
* @requires os.family=="windows"
* @run main FileDialogIconTest
*/
-import javax.swing.*;
-import java.awt.*;
+
+import java.awt.Color;
+import java.awt.Dialog;
+import java.awt.FileDialog;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Image;
import java.awt.image.BufferedImage;
-import java.lang.reflect.InvocationTargetException;
+import javax.swing.SwingUtilities;
public class FileDialogIconTest {
private static Frame frame;
private static Dialog dialog;
- public static void main(final String[] args) throws InterruptedException, InvocationTargetException, AWTException {
+ public static void main(final String[] args) throws Exception {
Robot robot;
Point p;
try {
@@ -51,9 +58,9 @@
dialog.setModal(false);
dialog.setVisible(true);
robot.waitForIdle();
- robot.delay(200);
+ robot.delay(1000);
- p = new Point(10, 10);
+ p = new Point(20, 20);
SwingUtilities.convertPointToScreen(p, dialog);
Color color = robot.getPixelColor(p.x, p.y);
if (!Color.RED.equals(color)) {
--- a/jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/test/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, 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
@@ -22,237 +22,103 @@
*/
/*
- test
- @bug 6386592
- @summary Tests that disposing a dialog doesn't activate its invisible owner.
- @author anton.tarasov@sun.com: area=awt.focus
- @run applet DisposeDialogNotActivateOwnerTest.html
+ @test
+ @key headful
+ @bug 6386592 8160766
+ @summary Tests that disposing a dialog doesn't activate its invisible owner.
*/
-import java.awt.*;
-import java.awt.event.*;
-import java.applet.Applet;
+import java.awt.AWTException;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.InputEvent;
-public class DisposeDialogNotActivateOwnerTest extends Applet {
+public class DisposeDialogNotActivateOwnerTest {
Robot robot;
-
- Frame frame = new Frame("Owner Frame");
- Dialog dialog = new Dialog(new Frame(), "Owned Dialog");
- Button frameButton = new Button("button");
-
- static boolean passed = false;
+ Frame frame;
+ Frame dialogInvisibleOwner;
+ Dialog dialog;
+ Button frameButton;
+ static volatile boolean buttonReceivedFocus = false;
public static void main(String[] args) {
- DisposeDialogNotActivateOwnerTest app = new DisposeDialogNotActivateOwnerTest();
- app.init();
- app.start();
+ DisposeDialogNotActivateOwnerTest test =
+ new DisposeDialogNotActivateOwnerTest();
+ test.performTest();
+ test.dispose();
}
- public void init() {
+ public DisposeDialogNotActivateOwnerTest() {
try {
robot = new Robot();
} catch (AWTException e) {
- throw new RuntimeException("Error: unable to create robot", e);
+ throw new RuntimeException("Error: unable to create robot");
}
- // Create instructions for the user here, as well as set up
- // the environment -- set the layout manager, add buttons,
- // etc.
- this.setLayout (new BorderLayout ());
- Sysout.createDialogWithInstructions(new String[]
- {"This is automatic test. Simply wait until it is done."
- });
+
+ dialogInvisibleOwner = new Frame("Dialog Invisible Owner Frame");
+ dialog = new Dialog(dialogInvisibleOwner, "Owned Dialog");
- frame.setBounds(800, 50, 200, 100);
+ frame = new Frame("A Frame");
+ frameButton = new Button("button");
+ frameButton.addFocusListener(new FocusAdapter() {
+ public void focusGained(FocusEvent e) {
+ buttonReceivedFocus = true;
+ }
+ });
+ frame.setBounds(0, 0, 400, 200);
frame.add(frameButton);
- dialog.setBounds(800, 300, 200, 100);
+ dialog.setBounds(100, 50, 200, 100);
}
- public void start() {
-
- frameButton.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- passed = true;
- }
- });
-
+ public void performTest() {
frame.setVisible(true);
robot.waitForIdle();
-
- // make sure the frame is focused
- clickOn(frame);
+ clickOnTitle(frame);
+ robot.waitForIdle();
+ robot.delay(200);
if (!frame.isFocused()) {
- throw new RuntimeException("Error: a frame didn't get initial focus.");
+ dispose();
+ throw new RuntimeException("Error: frame didn't get initial focus");
}
dialog.setVisible(true);
robot.waitForIdle();
-
- // make sure the dialog is focused
+ robot.delay(200);
if (!dialog.isFocused()) {
- throw new RuntimeException("Error: a dialog didn't get initial focus.");
+ dispose();
+ throw new RuntimeException("Error: dialog didn't get initial focus");
}
dialog.dispose();
robot.waitForIdle();
-
- if (passed) {
- Sysout.println("Test passed.");
- } else {
- throw new RuntimeException("Test failed: a dialog activates invisible owner when disposed!");
+ robot.delay(200);
+ if (!buttonReceivedFocus) {
+ dispose();
+ throw new RuntimeException(
+ "Test failed: Dialog activates invisible owner when disposed!");
}
}
- void clickOn(Component c) {
+ public void dispose() {
+ frame.dispose();
+ dialog.dispose();
+ dialogInvisibleOwner.dispose();
+ }
+
+ void clickOnTitle(Component c) {
Point p = c.getLocationOnScreen();
Dimension d = c.getSize();
-
- if (c instanceof Frame) {
- robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
- } else {
- robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
- }
-
+ robot.mouseMove(p.x + (int)(d.getWidth() / 2),
+ p.y + ((Frame)c).getInsets().top / 2);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.delay(20);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
-
- robot.waitForIdle();
}
}
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
- chunk of code whose purpose is to make user
- interaction uniform, and thereby make it simpler
- to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method. Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
- as standalone.
- */
-
-class Sysout
-{
- static TestDialog dialog;
-
- public static void createDialogWithInstructions( String[] instructions )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- dialog.printInstructions( instructions );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
- public static void createDialog( )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- String[] defInstr = { "Instructions will appear here. ", "" } ;
- dialog.printInstructions( defInstr );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
-
- public static void printInstructions( String[] instructions )
- {
- dialog.printInstructions( instructions );
- }
-
-
- public static void println( String messageIn )
- {
- dialog.displayMessage( messageIn );
- }
-
-}// Sysout class
-
-/**
- This is part of the standard test machinery. It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
-class TestDialog extends Dialog
-{
-
- TextArea instructionsText;
- TextArea messageText;
- int maxStringLength = 80;
-
- //DO NOT call this directly, go through Sysout
- public TestDialog( Frame frame, String name )
- {
- super( frame, name );
- int scrollBoth = TextArea.SCROLLBARS_BOTH;
- instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
- add( "North", instructionsText );
-
- messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
- add("Center", messageText);
-
- pack();
-
- setVisible(true);
- }// TestDialog()
-
- //DO NOT call this directly, go through Sysout
- public void printInstructions( String[] instructions )
- {
- //Clear out any current instructions
- instructionsText.setText( "" );
-
- //Go down array of instruction strings
-
- String printStr, remainingStr;
- for( int i=0; i < instructions.length; i++ )
- {
- //chop up each into pieces maxSringLength long
- remainingStr = instructions[ i ];
- while( remainingStr.length() > 0 )
- {
- //if longer than max then chop off first max chars to print
- if( remainingStr.length() >= maxStringLength )
- {
- //Try to chop on a word boundary
- int posOfSpace = remainingStr.
- lastIndexOf( ' ', maxStringLength - 1 );
-
- if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
- printStr = remainingStr.substring( 0, posOfSpace + 1 );
- remainingStr = remainingStr.substring( posOfSpace + 1 );
- }
- //else just print
- else
- {
- printStr = remainingStr;
- remainingStr = "";
- }
-
- instructionsText.append( printStr + "\n" );
-
- }// while
-
- }// for
-
- }//printInstructions()
-
- //DO NOT call this directly, go through Sysout
- public void displayMessage( String messageIn )
- {
- messageText.append( messageIn + "\n" );
- System.out.println(messageIn);
- }
-
-}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/InputMethods/SpanishDiacriticsTest/SpanishDiacriticsTest.html Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,40 @@
+<!--
+Copyright (c) 2016, 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
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<html>
+<head>
+<title> SpanishDiacriticsTest </title>
+</head>
+<body>
+<applet code="SpanishDiacriticsTest.class" width=350 height=200></applet>
+
+Test run requires the following keyboard layout to be installed:
+Windows OS: Spanish (United States) with 'Latin American' keyboard layout
+
+1. A frame with a text field should be displayed at upper left corner
+2. Set focus to the text field and switch to Spanish with 'Latin American' keyboard layout
+3. Type the following: ' ' o - i.e. single quote two times (using [ key on US keyboard) then o character.
+
+If you the text field displays ''o, (i.e. o should be without acute) then the test is passed; otherwise failed.
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/InputMethods/SpanishDiacriticsTest/SpanishDiacriticsTest.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8169355
+ * @summary Check if Spanish diacritical signs could be typed for TextField
+ * @author Dmitry Markov
+ * @run applet/manual=yesno SpanishDiacriticsTest.html
+*/
+
+import javax.swing.*;
+import java.applet.Applet;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.concurrent.locks.LockSupport;
+
+public class SpanishDiacriticsTest extends Applet {
+ @Override
+ public void init() {
+ SwingUtilities.invokeLater(() -> {
+ JFrame frame = new JFrame();
+ JTextField textField = new JTextField(20);
+ textField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyTyped(KeyEvent e) {
+ LockSupport.parkNanos(1_000_000_000L);
+ }
+ });
+ frame.add(textField);
+ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+ });
+ }
+}
+
--- a/jdk/test/java/awt/KeyboardFocusmanager/DefaultPolicyChange/DefaultPolicyChange_Swing.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/test/java/awt/KeyboardFocusmanager/DefaultPolicyChange/DefaultPolicyChange_Swing.java Mon Nov 14 09:03:07 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -23,32 +23,25 @@
/*
@test
- @bug 6741526
+ @bug 6741526 8004693
@summary KeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy) affects created components
- @library ../../regtesthelpers
- @build Sysout
@author Andrei Dmitriev : area=awt-focus
@run main DefaultPolicyChange_Swing
*/
import java.awt.*;
+
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
-import test.java.awt.regtesthelpers.Sysout;
public class DefaultPolicyChange_Swing {
- public static void main(String []s) {
- EventQueue.invokeLater(new Runnable(){
- public void run (){
- DefaultPolicyChange_Swing.runTestSwing();
- }
- });
+
+ public static void main(final String[] s) throws Exception {
+ EventQueue.invokeAndWait(DefaultPolicyChange_Swing::runTestSwing);
}
+
private static void runTestSwing(){
KeyboardFocusManager currentKFM = KeyboardFocusManager.getCurrentKeyboardFocusManager();
- FocusTraversalPolicy defaultFTP = currentKFM.getDefaultFocusTraversalPolicy();
- ContainerOrderFocusTraversalPolicy newFTP = new ContainerOrderFocusTraversalPolicy();
-
JFrame jf = new JFrame("Test1");
JWindow jw = new JWindow(jf);
@@ -71,22 +64,35 @@
throw new RuntimeException("Failure! Swing toplevel must have LayoutFocusTraversalPolicy installed");
}
+ FocusTraversalPolicy[] defaultFTP = {
+ jf.getFocusTraversalPolicy(), jw.getFocusTraversalPolicy(),
+ jd.getFocusTraversalPolicy()
+ };
+
jf.setVisible(true);
System.out.println("Now will set another policy.");
+ ContainerOrderFocusTraversalPolicy newFTP = new ContainerOrderFocusTraversalPolicy();
currentKFM.setDefaultFocusTraversalPolicy(newFTP);
- FocusTraversalPolicy resultFTP = jw.getFocusTraversalPolicy();
+ FocusTraversalPolicy[] resultFTP = {
+ jf.getFocusTraversalPolicy(), jw.getFocusTraversalPolicy(),
+ jd.getFocusTraversalPolicy()
+ };
System.out.println("FTP current on jf= " + jf.getFocusTraversalPolicy());
System.out.println("FTP current on jw= " + jw.getFocusTraversalPolicy());
System.out.println("FTP current on jd= " + jd.getFocusTraversalPolicy());
- if (!resultFTP.equals(defaultFTP)) {
- Sysout.println("Failure! FocusTraversalPolicy should not change");
- Sysout.println("Was: " + defaultFTP);
- Sysout.println("Become: " + resultFTP);
- throw new RuntimeException("Failure! FocusTraversalPolicy should not change");
+ jf.dispose();
+
+ for (int i=0; i < 3; i++) {
+ if (!resultFTP[i].equals(defaultFTP[i])) {
+ System.out.println("Failure! FocusTraversalPolicy should not change");
+ System.out.println("Was: " + defaultFTP[i]);
+ System.out.println("Become: " + resultFTP[i]);
+ throw new RuntimeException("Failure! FocusTraversalPolicy should not change");
+ }
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/VolatileImage/VolatileImageConfigurationTest.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8165212
+ * @summary This manual test case displays scale values of Graphics and the
+ * underlying device configuration. Any change to host display's DPI
+ * value should reflect corresponding changes in the scale values
+ * of both Frame and Backbuffer (VolatileImage).
+ * @run main/othervm/manual -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false VolatileImageConfigurationTest
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.geom.AffineTransform;
+import java.awt.image.VolatileImage;
+import java.awt.HeadlessException;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.JButton;
+import javax.swing.SwingUtilities;
+
+public class VolatileImageConfigurationTest
+ extends JFrame
+ implements ActionListener {
+ /* Test frame and completion status */
+ private static JFrame testFrame;
+ private static volatile boolean testComplete = false;
+ private static volatile boolean testResult = false;
+
+ /* Main frame's dimensions */
+ private static final int TEST_WIDTH = 600;
+ private static final int TEST_HEIGHT = 600;
+ private static final int TEST_MIN_DURATION = 3000;
+ private static final int TEST_TOTAL_DURATION = 45000;
+
+ /*
+ * Frame will display information text explaining how to run the manual
+ * test, and two buttons- Pass and Fail to determine the end-result.
+ */
+ private JTextArea infoTextArea;
+ private JPanel buttonPanel;
+ private JPanel testPanel;
+ private JButton passButton;
+ private JButton failButton;
+
+ public VolatileImageConfigurationTest() {
+ /* Default constructor. Initialize the UI components */
+ super("Volatile Image Configuration Update Test");
+ initComponents();
+ }
+
+ private void initComponents() {
+ /* Create the text area with steps to execute the test */
+ String description
+ = "\n Volatile Image Configuration Update Test.\n"
+ + " 1. The test displays scale values of component and the"
+ + " underlying graphics device configuration.\n"
+ + " 2. Kindly change the display's DPI settings from OS"
+ + " control panel and observe the application.\n"
+ + " 3. Select Pass if the scale values for both component & "
+ + "underlying device configuration are updated as per the "
+ + "\ndisplay's DPI value.\n";
+ infoTextArea = new JTextArea(description);
+
+ /* Create the test panel where user will observe the drawing */
+ testPanel = new DisplayPanel();
+
+ /* Create the buttons with event listeners */
+ passButton = new JButton("Pass");
+ passButton.setActionCommand("Pass");
+ passButton.setEnabled(true);
+ passButton.addActionListener(this);
+
+ failButton = new JButton("Fail");
+ failButton.setActionCommand("Fail");
+ failButton.setEnabled(true);
+ failButton.addActionListener(this);
+
+ /* Add the buttons to a separate panel with flowlayout */
+ buttonPanel = new JPanel(new FlowLayout());
+ buttonPanel.add(passButton);
+ buttonPanel.add(failButton);
+
+ /* Add all the created components to the master frame */
+ setLayout(new BorderLayout(10, 10));
+ add(infoTextArea, BorderLayout.NORTH);
+ add(buttonPanel, BorderLayout.SOUTH);
+ add(testPanel, BorderLayout.CENTER);
+
+ /* Set the dimensions */
+ setSize(TEST_WIDTH, TEST_HEIGHT);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ /* Button event listener */
+ String command = e.getActionCommand();
+
+ if (command.equals("Pass")) {
+ /* Test has passed. Dispose the frame with success message */
+ testComplete = true;
+ testResult = true;
+ System.out.println("Test Passed.");
+ } else if (command.equals("Fail")) {
+ /* Test has failed. Dispose the frame and throw exception */
+ testComplete = true;
+ testResult = false;
+ }
+ }
+
+ private static void constructTestUI() {
+ /* Construct the test's user interface */
+ testFrame = new VolatileImageConfigurationTest();
+ testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ testFrame.setLocationRelativeTo(null);
+ testFrame.setVisible(true);
+ }
+
+ private static void destructTestUI() {
+ /* Destroy the test's user interface */
+ testFrame.dispose();
+ }
+
+ static class DisplayPanel extends JPanel {
+ /* Display panel settings */
+ private static final int PANEL_WIDTH = 600;
+ private static final int PANEL_HEIGHT = 500;
+ private static final int PANEL_X = 20;
+ private static final int PANEL_Y = 80;
+ private static final String MSG = "%s scale: [%2.2f, %2.2f]";
+ private VolatileImage vImg;
+
+ public DisplayPanel() throws HeadlessException {
+ setSize(PANEL_WIDTH, PANEL_HEIGHT);
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ super.paint(g);
+
+ g.setColor(Color.WHITE);
+ g.fillRect(0, 0, PANEL_WIDTH, PANEL_HEIGHT);
+ /* Display graphics configuration values of the component */
+ drawInfo(g, PANEL_X, PANEL_Y, "Frame", Color.BLUE);
+ int attempts = 0;
+ do {
+ /* Display graphics configuration values of volatile image */
+ drawBackingStoreImage(g);
+ } while (vImg.contentsLost() && ++attempts < 3);
+ }
+
+ private void drawInfo(Graphics g, int x, int y,
+ String msg, Color color) {
+ g.setColor(color);
+ g.setFont(g.getFont().deriveFont(24f));
+ Graphics2D g2d = (Graphics2D) g;
+ AffineTransform tx = g2d.getTransform();
+
+ g.drawString(msg, x, y);
+ String text = String.format(MSG,
+ "Graphics",
+ tx.getScaleX(),
+ tx.getScaleY());
+ int dy = 20;
+ g.drawString(text, x, y + dy);
+
+ tx = g2d.getDeviceConfiguration().getDefaultTransform();
+ text = String.format(MSG,
+ "Device Config",
+ tx.getScaleX(),
+ tx.getScaleY());
+ g.drawString(text, x, y + 2 * dy);
+ }
+
+ private void drawBackingStoreImage(Graphics g) {
+ Graphics2D g2d = (Graphics2D) g;
+ GraphicsConfiguration gc = g2d.getDeviceConfiguration();
+ if (vImg == null ||
+ vImg.validate(gc) == VolatileImage.IMAGE_INCOMPATIBLE) {
+ /* Create a new volatile image */
+ vImg = createVolatileImage(PANEL_WIDTH, PANEL_HEIGHT / 3);
+ }
+
+ Graphics vImgGraphics = vImg.createGraphics();
+ vImgGraphics.setColor(Color.WHITE);
+ vImgGraphics.fillRect(0, 0, PANEL_WIDTH, PANEL_HEIGHT / 3);
+ drawInfo(vImgGraphics,
+ PANEL_X,
+ PANEL_Y,
+ "Backbuffer",
+ Color.MAGENTA);
+ g.drawImage(vImg, 0, PANEL_Y * 2, this);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ /* Construct the test interface */
+ constructTestUI();
+ } catch (Exception ex) {
+ /* Throw an exception indicating error while creating UI */
+ throw new RuntimeException("Test Failed. Error while "
+ + "creating the test interface.");
+ }
+ }
+ });
+
+ try {
+ /* Provide sufficient time for user to act upon the manual test */
+ long totalWaitDuration = 0;
+ do {
+ Thread.sleep(TEST_MIN_DURATION);
+ totalWaitDuration += TEST_MIN_DURATION;
+ } while (!testComplete && totalWaitDuration < TEST_TOTAL_DURATION);
+ } catch(InterruptedException ite) {
+ /* No-op. The thread continues execution further */
+ }
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ /* Destroy the test interface */
+ destructTestUI();
+ } catch (Exception ex) {
+ /* No-op */
+ }
+ }
+ });
+
+ /* Check for the test result and throw exception if required */
+ if (testResult == false) {
+ throw new RuntimeException("Test Failed. Incorrect scale values "
+ + "were seen during the test execution.");
+ }
+ }
+}
\ No newline at end of file
--- a/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/MultiResIconTest.java Mon Nov 14 09:03:07 2016 -0800
@@ -24,9 +24,10 @@
/**
* @test
* @key headful
- * @bug 8149371
+ * @bug 8149371 8169043
* @summary multi-res. image: -Dsun.java2d.uiScale does not work for Window
* icons (some ambiguity for Window.setIconImages()?)
+ * @requires (os.family == "windows")
* @run main/othervm/manual -Dsun.java2d.uiScale=2 MultiResIconTest
*/
import java.awt.Color;
@@ -58,6 +59,7 @@
private static JDialog f;
private static CountDownLatch latch;
private static TestFrame frame;
+ private static boolean testPassed;
private static BufferedImage generateImage(int x, Color c) {
@@ -70,12 +72,13 @@
return img;
}
- public MultiResIconTest() {
- try {
- latch = new CountDownLatch(1);
- createUI();
- latch.await();
- } catch (Exception ex) {
+ public MultiResIconTest() throws Exception {
+ latch = new CountDownLatch(1);
+ createUI();
+ latch.await();
+
+ if (!testPassed) {
+ throw new RuntimeException("User Pressed Failed Button");
}
}
@@ -89,7 +92,10 @@
resultButtonPanel = new JPanel(layout);
GridBagConstraints gbc = new GridBagConstraints();
String instructions
- = "<html> INSTRUCTIONS:<br><br>"
+ = "<html> INSTRUCTIONS:<br>"
+ + "This test is for Windows OS only.<br>"
+ + "Make sure that 'Use Small Icons' setting is not set<br>"
+ + "on Windows Taskbar Properties <br>"
+ "1) Test frame title icon and frame color should be green."
+ "<br>"
+ "2) Test frame task bar icon should be blue<br>"
@@ -106,6 +112,7 @@
passButton = new JButton("Pass");
passButton.setActionCommand("Pass");
passButton.addActionListener((ActionEvent e) -> {
+ testPassed = true;
latch.countDown();
f.dispose();
frame.dispose();
@@ -115,6 +122,7 @@
failButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
+ testPassed = false;
latch.countDown();
f.dispose();
frame.dispose();
@@ -140,6 +148,7 @@
f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
+ testPassed = false;
latch.countDown();
f.dispose();
frame.dispose();
@@ -191,7 +200,7 @@
}
}
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
new MultiResIconTest();
}
}
--- a/jdk/test/java/awt/print/PrinterJob/Margins.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/test/java/awt/print/PrinterJob/Margins.java Mon Nov 14 09:03:07 2016 -0800
@@ -23,12 +23,12 @@
/**
* @test
- * @bug 6543815 6601097
+ * @bug 6543815 6601097 8160888
* @summary Image should be sent to printer, no exceptions thrown.
* The 3 printouts should have a rectangle which is the minimum
* possible margins ie, the margins should be hardware margins
* and not java default 1 inch margins.
- * @run main/manual Margins
+ * @run main Margins
*/
import java.awt.print.PrinterJob;
@@ -39,16 +39,36 @@
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Color;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
public class Margins implements Printable {
- public static void main(String args[]) {
+ public static void main(String args[]) throws Exception {
+ Robot robot = new Robot();
+ Thread t = new Thread (() -> {
+ robot.waitForIdle();
+ robot.delay(5000);
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ robot.waitForIdle();
+ robot.delay(5000);
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ robot.waitForIdle();
+ robot.delay(5000);
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ });
+
PrinterJob job = PrinterJob.getPrinterJob();
PageFormat pageFormat = job.defaultPage();
Paper paper = pageFormat.getPaper();
double wid = paper.getWidth();
double hgt = paper.getHeight();
paper.setImageableArea(0, -10, wid, hgt);
+ t.start();
+
pageFormat = job.pageDialog(pageFormat);
pageFormat.setPaper(paper);
job.setPrintable(new Margins(), pageFormat);
@@ -57,7 +77,7 @@
} catch (PrinterException e) {
}
- paper.setImageableArea(0, 0, wid, hgt+72);
+ paper.setImageableArea(0, 0, wid, hgt + 72);
pageFormat = job.pageDialog(pageFormat);
pageFormat.setPaper(paper);
@@ -100,12 +120,13 @@
Paper paper = pf.getPaper();
- double wid = paper.getWidth();
- double hgt = paper.getHeight();
-
- /* If imageable width/height is -ve, then print was done with 1" margin
- * ie ix=72 iy=72 iw=451 ih=697 and wid=595
- * but with fix, we get print with hardware margin ie
+ int wid = (int)paper.getWidth();
+ int hgt = (int)paper.getHeight();
+ System.out.println("wid="+wid+" hgt="+hgt);
+ /*
+ * If imageable width/height is -ve, then print was done with 1" margin
+ * e.g. ix=72 iy=72 iw=451 ih=697 and paper wid=595
+ * but with fix, we get print with hardware margin e.g.
* ix=12, iy=12, iw=571, ih=817
*/
if ((wid - iw > 72) || (hgt - ih > 72)) {
@@ -115,6 +136,12 @@
throw new RuntimeException("Printable width or height "
+ "exceeds paper width or height.");
}
+ // runtime checking to see if the margins/printable area
+ // correspond to the entire size of the paper, for now, make it pass
+ // as for linux, the hwmargin is not taken into account - bug6574279
+ if (ix == 0 && iy == 0 && (ix+iw == wid) && (iy+ih == hgt)) {
+ return PAGE_EXISTS;
+ }
Graphics2D g2d = (Graphics2D)g;
g2d.translate(ix, iy);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/TexturePaintPrintingTest.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8040635
+ * @summary Verifies if TexturePaint is printed in osx
+ * @run main/manual TexturePaintPrintingTest
+ */
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.TexturePaint;
+import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import static java.awt.print.Printable.NO_SUCH_PAGE;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+
+public class TexturePaintPrintingTest extends Component implements Printable {
+ private static void printTexture() {
+ f = new JFrame("Texture Printing Test");
+ f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ final TexturePaintPrintingTest gpt = new TexturePaintPrintingTest();
+ Container c = f.getContentPane();
+ c.add(BorderLayout.CENTER, gpt);
+
+ final JButton print = new JButton("Print");
+ print.addActionListener(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ PrinterJob job = PrinterJob.getPrinterJob();
+ job.setPrintable(gpt);
+ final boolean doPrint = job.printDialog();
+ if (doPrint) {
+ try {
+ job.print();
+ } catch (PrinterException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ });
+ c.add(print, BorderLayout.SOUTH);
+
+ f.pack();
+ f.setVisible(true);
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(500,500);
+ }
+
+ public void paint(Graphics g) {
+ doPaint((Graphics2D)g);
+ }
+
+ public int print( Graphics graphics, PageFormat format, int index ) {
+ Graphics2D g2d = (Graphics2D)graphics;
+ g2d.translate(format.getImageableX(), format.getImageableY());
+ doPaint(g2d);
+ return index == 0 ? PAGE_EXISTS : NO_SUCH_PAGE;
+ }
+
+ static final float DIM = 100;
+ public void doPaint(Graphics2D g2d) {
+ BufferedImage patternImage = new BufferedImage(2,2,BufferedImage.TYPE_INT_ARGB);
+ Graphics gImage = patternImage.getGraphics();
+ gImage.setColor(Color.WHITE);
+ gImage.drawLine(0,1,1,0);
+ gImage.setColor(Color.BLACK);
+ gImage.drawLine(0,0,1,1);
+ gImage.dispose();
+
+ Rectangle2D.Double shape = new Rectangle2D.Double(0,0,DIM*6/5, DIM*8/5);
+ g2d.setPaint(new TexturePaint(patternImage, new Rectangle2D.Double(0,0,
+ DIM*6/50, DIM*8/50)));
+ g2d.fill(shape);
+ g2d.setPaint(Color.BLACK);
+ g2d.draw(shape);
+ }
+
+ public static synchronized void pass() {
+ testPassed = true;
+ testGeneratedInterrupt = true;
+ mainThread.interrupt();
+ }
+
+ public static synchronized void fail() {
+ testPassed = false;
+ testGeneratedInterrupt = true;
+ mainThread.interrupt();
+ }
+
+ private static Thread mainThread;
+ private static boolean testPassed;
+ private static boolean testGeneratedInterrupt;
+ private static JFrame f = null;
+
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ //createUI();
+ doTest(TexturePaintPrintingTest::printTexture);
+ }
+ });
+ mainThread = Thread.currentThread();
+ try {
+ Thread.sleep(120000);
+ } catch (InterruptedException e) {
+ if (!testPassed && testGeneratedInterrupt) {
+ throw new RuntimeException("TexturePaint did not print");
+ }
+ }
+ if (!testGeneratedInterrupt) {
+ throw new RuntimeException("user has not executed the test");
+ }
+ }
+
+ private static void doTest(Runnable action) {
+ String description
+ = " A TexturePaint graphics will be shown on console.\n"
+ + " The same graphics is sent to printer.\n"
+ + " Please verify if TexturePaint shading is printed.\n"
+ + " If none is printed, press FAIL else press PASS";
+
+ final JDialog dialog = new JDialog();
+ dialog.setTitle("printSelectionTest");
+ JTextArea textArea = new JTextArea(description);
+ textArea.setEditable(false);
+ final JButton testButton = new JButton("Start Test");
+ final JButton passButton = new JButton("PASS");
+ passButton.setEnabled(false);
+ passButton.addActionListener((e) -> {
+ f.dispose();
+ dialog.dispose();
+ pass();
+ });
+ final JButton failButton = new JButton("FAIL");
+ failButton.setEnabled(false);
+ failButton.addActionListener((e) -> {
+ f.dispose();
+ dialog.dispose();
+ fail();
+ });
+ testButton.addActionListener((e) -> {
+ testButton.setEnabled(false);
+ action.run();
+ passButton.setEnabled(true);
+ failButton.setEnabled(true);
+ });
+ JPanel mainPanel = new JPanel(new BorderLayout());
+ mainPanel.add(textArea, BorderLayout.CENTER);
+ JPanel buttonPanel = new JPanel(new FlowLayout());
+ buttonPanel.add(testButton);
+ buttonPanel.add(passButton);
+ buttonPanel.add(failButton);
+ mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+ dialog.add(mainPanel);
+
+ dialog.pack();
+ dialog.setVisible(true);
+ dialog.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ System.out.println("main dialog closing");
+ testGeneratedInterrupt = false;
+ mainThread.interrupt();
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/ReadWithoutBaselineTagSet.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8164750
+ * @summary Verify reader does not fail when the BaselineTIFFTagSet is
+ * removed via the TIFFImageReadParam both when ignoring and
+ * not ignoring metadata.
+ */
+
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Map;
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.ImageWriter;
+import javax.imageio.plugins.tiff.BaselineTIFFTagSet;
+import javax.imageio.plugins.tiff.TIFFImageReadParam;
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.stream.ImageOutputStream;
+import javax.imageio.stream.MemoryCacheImageInputStream;
+import javax.imageio.stream.MemoryCacheImageOutputStream;
+
+public class ReadWithoutBaselineTagSet {
+ private static final int WIDTH = 47;
+ private static final int HEIGHT = 53;
+
+ private static final Map<Integer,String[]> typeToCompression =
+ Map.of(BufferedImage.TYPE_3BYTE_BGR,
+ new String[] {null, "LZW", "JPEG", "ZLib", "PackBits"},
+ BufferedImage.TYPE_BYTE_BINARY,
+ new String[] {null, "CCITT RLE", "CCITT T.4", "CCITT T.6",
+ "LZW", "PackBits"},
+ BufferedImage.TYPE_BYTE_GRAY,
+ new String[] {null, "LZW", "JPEG", "ZLib", "PackBits"},
+ BufferedImage.TYPE_USHORT_GRAY,
+ new String[] {null, "LZW", "ZLib", "PackBits"});
+
+ public static void main(String[] args) throws IOException {
+ test();
+ }
+
+ private static void test() throws IOException {
+ int failures = 0;
+
+ for (int imageType : typeToCompression.keySet()) {
+ BufferedImage image = new BufferedImage(WIDTH, HEIGHT, imageType);
+ System.out.println("Image: " + image.toString());
+
+ for (String compression : typeToCompression.get(imageType)) {
+ System.out.println("Compression: "
+ + (compression == null ? "None" : compression));
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ ImageOutputStream ios = new MemoryCacheImageOutputStream(output);
+ ImageWriter writer =
+ ImageIO.getImageWritersByFormatName("TIFF").next();
+ ImageWriteParam wparam = writer.getDefaultWriteParam();
+ if (compression == null) {
+ wparam.setCompressionMode(ImageWriteParam.MODE_DEFAULT);
+ } else {
+ wparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
+ wparam.setCompressionType(compression);
+ }
+ writer.setOutput(ios);
+ writer.write(null, new IIOImage(image, null, null), wparam);
+ ios.flush();
+
+ ImageReader reader =
+ ImageIO.getImageReadersByFormatName("TIFF").next();
+ ByteArrayInputStream input
+ = new ByteArrayInputStream(output.toByteArray());
+ ImageInputStream iis = new MemoryCacheImageInputStream(input);
+ iis.mark();
+
+ TIFFImageReadParam rparam = new TIFFImageReadParam();
+ rparam.removeAllowedTagSet(BaselineTIFFTagSet.getInstance());
+
+ reader.setInput(iis, false, false);
+ BufferedImage resultFalse = reader.read(0, rparam);
+ if (resultFalse.getWidth() != WIDTH
+ || resultFalse.getHeight() != HEIGHT) {
+ System.err.printf("Read image dimensions != %d x %d%n",
+ WIDTH, HEIGHT);
+ failures++;
+ } else {
+ System.out.println("ignoreMetadata == false test passed");
+ }
+
+ iis.reset();
+ reader.setInput(iis, false, true);
+ BufferedImage resultTrue;
+ try {
+ resultTrue = reader.read(0, rparam);
+ if (resultTrue.getWidth() != WIDTH
+ || resultTrue.getHeight() != HEIGHT) {
+ System.err.printf("Read image dimensions != %d x %d%n",
+ WIDTH, HEIGHT);
+ failures++;
+ } else {
+ System.out.println("ignoreMetadata == true test passed");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ failures++;
+ }
+ }
+ }
+
+ if (failures != 0) {
+ throw new RuntimeException("Test failed with "
+ + failures + " errors!");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/sampled/AudioFileFormat/TypeEqualsToNull.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.sound.sampled.AudioFileFormat;
+
+/**
+ * @test
+ * @bug 8168998
+ */
+public final class TypeEqualsToNull {
+
+ public static void main(final String[] args) {
+ final AudioFileFormat.Type type;
+ try {
+ type = new AudioFileFormat.Type(null, null);
+ } catch (final Exception ignored) {
+ // behaviour of null is not specified so ignore possible exceptions
+ return;
+ }
+ final Object stub = new Object() {
+ @Override
+ public String toString() {
+ return null;
+ }
+ };
+ if (stub.equals(type) || type.equals(stub)) {
+ throw new RuntimeException("Should not be equal");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/sampled/AudioFormat/EncodingEqualsToNull.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.sound.sampled.AudioFormat;
+
+/**
+ * @test
+ * @bug 8168998
+ */
+public final class EncodingEqualsToNull {
+
+ public static void main(final String[] args) {
+ final AudioFormat.Encoding enc;
+ try {
+ enc = new AudioFormat.Encoding(null);
+ } catch (final Exception ignored) {
+ // behaviour of null is not specified so ignore possible exceptions
+ return;
+ }
+ final Object stub = new Object() {
+ @Override
+ public String toString() {
+ return null;
+ }
+ };
+ if (stub.equals(enc) || enc.equals(stub)) {
+ throw new RuntimeException("Should not be equal");
+ }
+ }
+}
--- a/jdk/test/javax/sound/sampled/Clip/OpenNonIntegralNumberOfSampleframes.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/test/javax/sound/sampled/Clip/OpenNonIntegralNumberOfSampleframes.java Mon Nov 14 09:03:07 2016 -0800
@@ -97,7 +97,8 @@
System.err.println("af = " + af);
System.err.println("bufferSize = " + bufferSize);
throw new RuntimeException("Expected exception is not thrown");
- } catch (final LineUnavailableException ignored) {
+ } catch (IllegalArgumentException
+ | LineUnavailableException ignored) {
// the test is not applicable
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JViewport/8164032/JViewPortBackingStoreImageTest.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.HashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextPane;
+import javax.swing.JViewport;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultStyledDocument;
+import javax.swing.text.Style;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyleContext;
+
+/*
+ * @test
+ * @bug 8164032 8156217
+ * @summary JViewport backing store image is not scaled on HiDPI display
+ * @run main/manual JViewPortBackingStoreImageTest
+ */
+public class JViewPortBackingStoreImageTest {
+
+ private static volatile boolean testResult = false;
+ private static volatile CountDownLatch countDownLatch;
+ private static final String INSTRUCTIONS = "INSTRUCTIONS:\n\n"
+ + "Verify text is drawn with high resolution and text selection "
+ + "is not shifted when JViewPort is used on HiDPI display.\n\n"
+ + "If the display does not support HiDPI mode press PASS.\n\n"
+ + "1. Check that the text does not have low resolution.\n"
+ + "If no, press FAIL.\n\n"
+ + "2. Select the current text from the end to the beginning.\n"
+ + "\n"
+ + "If the text is slightly shiftted from one side to another\n"
+ + "and back during selection press Fail.\n"
+ + "Otherwise, press Pass.";
+
+ private static DefaultStyledDocument doc;
+ private static StyleContext styles;
+ private static HashMap<String, Style> contentAttributes;
+
+ public static void main(String args[]) throws Exception {
+ countDownLatch = new CountDownLatch(1);
+
+ SwingUtilities.invokeLater(JViewPortBackingStoreImageTest::createUI);
+ countDownLatch.await(15, TimeUnit.MINUTES);
+
+ if (!testResult) {
+ throw new RuntimeException("Test fails!");
+ }
+ }
+
+ private static void createUI() {
+
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ final JFrame mainFrame = new JFrame();
+ GridBagLayout layout = new GridBagLayout();
+ JPanel mainControlPanel = new JPanel(layout);
+ JPanel resultButtonPanel = new JPanel(layout);
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.insets = new Insets(5, 15, 5, 15);
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ mainControlPanel.add(createComponent(), gbc);
+
+ JTextArea instructionTextArea = new JTextArea();
+ instructionTextArea.setText(INSTRUCTIONS);
+ instructionTextArea.setEditable(false);
+ instructionTextArea.setBackground(Color.white);
+
+ gbc.gridx = 0;
+ gbc.gridy = 1;
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+ mainControlPanel.add(instructionTextArea, gbc);
+
+ JButton passButton = new JButton("Pass");
+ passButton.setActionCommand("Pass");
+ passButton.addActionListener((ActionEvent e) -> {
+ testResult = true;
+ mainFrame.dispose();
+ countDownLatch.countDown();
+
+ });
+
+ JButton failButton = new JButton("Fail");
+ failButton.setActionCommand("Fail");
+ failButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ mainFrame.dispose();
+ countDownLatch.countDown();
+ }
+ });
+
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+
+ resultButtonPanel.add(passButton, gbc);
+
+ gbc.gridx = 1;
+ gbc.gridy = 0;
+ resultButtonPanel.add(failButton, gbc);
+
+ gbc.gridx = 0;
+ gbc.gridy = 2;
+ mainControlPanel.add(resultButtonPanel, gbc);
+
+ mainFrame.add(mainControlPanel);
+ mainFrame.pack();
+
+ mainFrame.addWindowListener(new WindowAdapter() {
+
+ @Override
+ public void windowClosing(WindowEvent e) {
+ mainFrame.dispose();
+ countDownLatch.countDown();
+ }
+ });
+ mainFrame.setVisible(true);
+ }
+
+ private static JComponent createComponent() {
+ createStyles();
+ for (int i = 0; i < data.length; i++) {
+ Paragraph p = data[i];
+ addParagraph(p);
+ }
+
+ JTextPane textPane = new JTextPane(doc);
+
+ JScrollPane scroller = new JScrollPane();
+ JViewport port = scroller.getViewport();
+ port.setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
+ port.add(textPane);
+
+ return scroller;
+ }
+
+ static void createStyles() {
+ styles = new StyleContext();
+ doc = new DefaultStyledDocument(styles);
+ contentAttributes = new HashMap<>();
+
+ // no attributes defined
+ Style s = styles.addStyle(null, null);
+ contentAttributes.put("none", s);
+
+ Style def = styles.getStyle(StyleContext.DEFAULT_STYLE);
+
+ Style heading = styles.addStyle("heading", def);
+ StyleConstants.setFontFamily(heading, "SansSerif");
+ StyleConstants.setBold(heading, true);
+ StyleConstants.setAlignment(heading, StyleConstants.ALIGN_CENTER);
+ StyleConstants.setSpaceAbove(heading, 10);
+ StyleConstants.setSpaceBelow(heading, 10);
+ StyleConstants.setFontSize(heading, 18);
+
+ // Title
+ Style sty = styles.addStyle("title", heading);
+ StyleConstants.setFontSize(sty, 32);
+
+ // author
+ sty = styles.addStyle("author", heading);
+ StyleConstants.setItalic(sty, true);
+ StyleConstants.setSpaceBelow(sty, 25);
+ }
+
+ static void addParagraph(Paragraph p) {
+ try {
+ Style s = null;
+ for (int i = 0; i < p.data.length; i++) {
+ AttributedContent run = p.data[i];
+ s = contentAttributes.get(run.attr);
+ doc.insertString(doc.getLength(), run.content, s);
+ }
+
+ Style ls = styles.getStyle(p.logical);
+ doc.setLogicalStyle(doc.getLength() - 1, ls);
+ doc.insertString(doc.getLength(), "\n", null);
+ } catch (BadLocationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Paragraph[] data = new Paragraph[]{
+ new Paragraph("title", new AttributedContent[]{
+ new AttributedContent("none", "ALICE'S ADVENTURES IN WONDERLAND")
+ }),
+ new Paragraph("author", new AttributedContent[]{
+ new AttributedContent("none", "Lewis Carroll")
+ }),
+ new Paragraph("heading", new AttributedContent[]{
+ new AttributedContent("alice", " ")
+ })};
+
+ static class Paragraph {
+
+ Paragraph(String logical, AttributedContent[] data) {
+ this.logical = logical;
+ this.data = data;
+ }
+ String logical;
+ AttributedContent[] data;
+ }
+
+ static class AttributedContent {
+
+ AttributedContent(String attr, String content) {
+ this.attr = attr;
+ this.content = content;
+ }
+ String attr;
+ String content;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java Mon Nov 14 09:03:07 2016 -0800
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
+import java.awt.font.FontRenderContext;
+import java.awt.font.NumericShaper;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextLayout;
+import java.awt.image.BufferedImage;
+import java.util.HashMap;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicGraphicsUtils;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+/**
+ * @test
+ * @bug 8132119 8168992
+ * @author Alexandr Scherbatiy
+ * @summary Provide public API for text related methods in SwingBasicGraphicsUtils2
+ */
+public class bug8132119 {
+
+ private static final int WIDTH = 50;
+ private static final int HEIGHT = 50;
+ private static final Color DRAW_COLOR = Color.RED;
+ private static final Color BACKGROUND_COLOR = Color.GREEN;
+ private static final NumericShaper NUMERIC_SHAPER = NumericShaper.getShaper(
+ NumericShaper.ARABIC);
+
+ public static void main(String[] args) throws Exception {
+ SwingUtilities.invokeAndWait(bug8132119::testStringMethods);
+ }
+
+ private static void testStringMethods() {
+ setMetalLAF();
+ testStringWidth();
+ testStringClip();
+ testDrawEmptyString();
+ testDrawString(false);
+ testDrawString(true);
+ checkNullArguments();
+ }
+
+ private static void testStringWidth() {
+
+ String str = "12345678910\u036F";
+ JComponent comp = createComponent(str);
+ Font font = comp.getFont();
+ FontMetrics fontMetrics = comp.getFontMetrics(font);
+ float stringWidth = BasicGraphicsUtils.getStringWidth(comp, fontMetrics, str);
+
+ if (stringWidth == fontMetrics.stringWidth(str)) {
+ throw new RuntimeException("Numeric shaper is not used!");
+ }
+
+ if (stringWidth != getLayoutWidth(str, font, NUMERIC_SHAPER)) {
+ throw new RuntimeException("Wrong text width!");
+ }
+ }
+
+ private static void testStringClip() {
+
+ String str = "1234567890";
+ JComponent comp = createComponent(str);
+ FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont());
+
+ int width = (int) BasicGraphicsUtils.getStringWidth(comp, fontMetrics, str);
+
+ String clip = BasicGraphicsUtils.getClippedString(comp, fontMetrics, str, width);
+ checkClippedString(str, clip, str);
+
+ clip = BasicGraphicsUtils.getClippedString(comp, fontMetrics, str, width + 1);
+ checkClippedString(str, clip, str);
+
+ clip = BasicGraphicsUtils.getClippedString(comp, fontMetrics, str, -1);
+ checkClippedString(str, clip, "...");
+
+ clip = BasicGraphicsUtils.getClippedString(comp, fontMetrics, str, 0);
+ checkClippedString(str, clip, "...");
+
+ clip = BasicGraphicsUtils.getClippedString(comp, fontMetrics,
+ str, width - width / str.length());
+ int endIndex = str.length() - 3;
+ checkClippedString(str, clip, str.substring(0, endIndex) + "...");
+ }
+
+ private static void checkClippedString(String str, String res, String golden) {
+ if (!golden.equals(res)) {
+ throw new RuntimeException(String.format("The string '%s' is not "
+ + "properly clipped. The result is '%s' instead of '%s'",
+ str, res, golden));
+ }
+ }
+
+ private static void testDrawEmptyString() {
+ JLabel label = new JLabel();
+ BufferedImage buffImage = createBufferedImage(50, 50);
+ Graphics2D g2 = buffImage.createGraphics();
+ g2.setColor(DRAW_COLOR);
+ BasicGraphicsUtils.drawString(null, g2, null, 0, 0);
+ BasicGraphicsUtils.drawString(label, g2, null, 0, 0);
+ BasicGraphicsUtils.drawString(null, g2, "", 0, 0);
+ BasicGraphicsUtils.drawString(label, g2, "", 0, 0);
+ BasicGraphicsUtils.drawStringUnderlineCharAt(null, g2, null, 3, 0, 0);
+ BasicGraphicsUtils.drawStringUnderlineCharAt(label, g2, null, 3, 0, 0);
+ BasicGraphicsUtils.drawStringUnderlineCharAt(null, g2, "", 3, 0, 0);
+ BasicGraphicsUtils.drawStringUnderlineCharAt(label, g2, "", 3, 0, 0);
+ g2.dispose();
+ checkImageIsEmpty(buffImage);
+ }
+
+ private static void testDrawString(boolean underlined) {
+ String str = "AOB";
+ JComponent comp = createComponent(str);
+
+ BufferedImage buffImage = createBufferedImage(WIDTH, HEIGHT);
+ Graphics2D g2 = buffImage.createGraphics();
+
+ g2.setColor(DRAW_COLOR);
+ g2.setFont(comp.getFont());
+
+ FontMetrics fontMetrices = comp.getFontMetrics(comp.getFont());
+ float width = BasicGraphicsUtils.getStringWidth(comp, fontMetrices, str);
+ float x = (WIDTH - width) / 2;
+ int y = 3 * HEIGHT / 4;
+
+ if (underlined) {
+ BasicGraphicsUtils.drawStringUnderlineCharAt(comp, g2, str, 1, x, y);
+ } else {
+ BasicGraphicsUtils.drawString(comp, g2, str, x, y);
+ }
+ g2.dispose();
+
+ float xx = (WIDTH - width / 8) / 2;
+ checkImageContainsSymbol(buffImage, (int) xx, underlined ? 3 : 2);
+ }
+
+ private static void checkNullArguments() {
+
+ Graphics2D g = null;
+ try {
+ String text = "Test";
+ JComponent component = new JLabel(text);
+ BufferedImage img = createBufferedImage(100, 100);
+ g = img.createGraphics();
+ checkNullArguments(component, g, text);
+ } finally {
+ g.dispose();
+ }
+ }
+
+ private static void checkNullArguments(JComponent comp, Graphics2D g,
+ String text) {
+
+ checkNullArgumentsDrawString(comp, g, text);
+ checkNullArgumentsDrawStringUnderlineCharAt(comp, g, text);
+ checkNullArgumentsGetClippedString(comp, text);
+ checkNullArgumentsGetStringWidth(comp, text);
+ }
+
+ private static void checkNullArgumentsDrawString(JComponent comp, Graphics2D g,
+ String text) {
+
+ float x = 50;
+ float y = 50;
+ BasicGraphicsUtils.drawString(null, g, text, x, y);
+ BasicGraphicsUtils.drawString(comp, g, null, x, y);
+
+ try {
+ BasicGraphicsUtils.drawString(comp, null, text, x, y);
+ } catch (NullPointerException e) {
+ return;
+ }
+
+ throw new RuntimeException("NPE is not thrown");
+ }
+
+ private static void checkNullArgumentsDrawStringUnderlineCharAt(
+ JComponent comp, Graphics2D g, String text) {
+
+ int x = 50;
+ int y = 50;
+ BasicGraphicsUtils.drawStringUnderlineCharAt(null, g, text, 1, x, y);
+ BasicGraphicsUtils.drawStringUnderlineCharAt(comp, g, null, 1, x, y);
+
+ try {
+ BasicGraphicsUtils.drawStringUnderlineCharAt(comp, null, text, 1, x, y);
+ } catch (NullPointerException e) {
+ return;
+ }
+
+ throw new RuntimeException("NPE is not thrown");
+ }
+
+ private static void checkNullArgumentsGetClippedString(
+ JComponent comp, String text) {
+
+ FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont());
+
+ BasicGraphicsUtils.getClippedString(null, fontMetrics, text, 1);
+ String result = BasicGraphicsUtils.getClippedString(comp, fontMetrics, null, 1);
+ if (!"".equals(result)) {
+ throw new RuntimeException("Empty string is not returned!");
+ }
+
+ try {
+ BasicGraphicsUtils.getClippedString(comp, null, text, 1);
+ } catch (NullPointerException e) {
+ return;
+ }
+
+ throw new RuntimeException("NPE is not thrown");
+ }
+
+ private static void checkNullArgumentsGetStringWidth(JComponent comp,
+ String text) {
+
+ FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont());
+ BasicGraphicsUtils.getStringWidth(null, fontMetrics, text);
+ float result = BasicGraphicsUtils.getStringWidth(comp, fontMetrics, null);
+
+ if (result != 0) {
+ throw new RuntimeException("The string length is not 0");
+ }
+
+ try {
+ BasicGraphicsUtils.getStringWidth(comp, null, text);
+ } catch (NullPointerException e) {
+ return;
+ }
+
+ throw new RuntimeException("NPE is not thrown");
+ }
+
+ private static void setMetalLAF() {
+ try {
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static JComponent createComponent(String str) {
+ JComponent comp = new JLabel(str);
+ comp.setSize(WIDTH, HEIGHT);
+ comp.putClientProperty(TextAttribute.NUMERIC_SHAPING, NUMERIC_SHAPER);
+ comp.setFont(getFont());
+ return comp;
+ }
+
+ private static Font getFont() {
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ String[] fontNames = ge.getAvailableFontFamilyNames();
+ String fontName = fontNames[0];
+ for (String name : fontNames) {
+ if ("Arial".equals(name)) {
+ fontName = name;
+ break;
+ }
+ }
+ return new Font(fontName, Font.PLAIN, 28);
+ }
+
+ private static float getLayoutWidth(String text, Font font, NumericShaper shaper) {
+ HashMap map = new HashMap();
+ map.put(TextAttribute.FONT, font);
+ map.put(TextAttribute.NUMERIC_SHAPING, shaper);
+ FontRenderContext frc = new FontRenderContext(null, false, false);
+ TextLayout layout = new TextLayout(text, map, frc);
+ return layout.getAdvance();
+ }
+
+ private static void checkImageIsEmpty(BufferedImage buffImage) {
+ int background = BACKGROUND_COLOR.getRGB();
+
+ for (int i = 0; i < buffImage.getWidth(); i++) {
+ for (int j = 0; j < buffImage.getHeight(); j++) {
+ if (background != buffImage.getRGB(i, j)) {
+ throw new RuntimeException("Image is not empty!");
+ }
+ }
+ }
+ }
+
+ private static void checkImageContainsSymbol(BufferedImage buffImage,
+ int x, int intersections) {
+ int background = BACKGROUND_COLOR.getRGB();
+ boolean isBackground = true;
+ int backgroundChangesCount = 0;
+
+ for (int y = 0; y < buffImage.getHeight(); y++) {
+ if (!(isBackground ^ (background != buffImage.getRGB(x, y)))) {
+ isBackground = !isBackground;
+ backgroundChangesCount++;
+ }
+ }
+ if (backgroundChangesCount != intersections * 2) {
+ throw new RuntimeException("String is not properly drawn!");
+ }
+ }
+
+ private static BufferedImage createBufferedImage(int width, int height) {
+ BufferedImage bufffImage = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+
+ Graphics2D g = bufffImage.createGraphics();
+ g.setColor(BACKGROUND_COLOR);
+ g.fillRect(0, 0, width, height);
+ g.dispose();
+ return bufffImage;
+ }
+}
--- a/jdk/test/javax/swing/text/GlyphPainter2/6427244/bug6427244.java Tue Nov 08 16:18:41 2016 +0300
+++ b/jdk/test/javax/swing/text/GlyphPainter2/6427244/bug6427244.java Mon Nov 14 09:03:07 2016 -0800
@@ -23,11 +23,11 @@
*/
/* @test
- @bug 6427244 8144240
+ @bug 6427244 8144240 8166003
@summary Test that pressing HOME correctly moves caret in I18N document.
@author Sergey Groznyh
@library ../../../regtesthelpers
- @build JRobot Util TestCase
+ @build JRobot
@run main bug6427244
*/
@@ -36,12 +36,13 @@
import java.awt.Point;
import java.awt.Shape;
import java.awt.event.KeyEvent;
+import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.SwingUtilities;
import javax.swing.text.Position;
-public class bug6427244 extends TestCase {
+public class bug6427244 {
private static final JRobot ROBOT = JRobot.getRobot();
final static int TP_SIZE = 200;
@@ -105,13 +106,25 @@
dim = c.getSize();
}
});
- Util.blockTillDisplayed(tp);
+ blockTillDisplayed(tp);
ROBOT.waitForIdle();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
+ void blockTillDisplayed(JComponent comp) {
+ if(comp != null) {
+ while (!comp.isVisible()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ /* No-op */
+ }
+ }
+ }
+ }
+
public void testCaretPosition() {
Point p = tp.getLocationOnScreen();
// the right-top corner position
@@ -122,7 +135,9 @@
ROBOT.hitKey(KeyEvent.VK_HOME);
ROBOT.waitForIdle();
// this will fail if caret moves out of the 1st line.
- assertEquals(0, getCaretOrdinate());
+ if (getCaretOrdinate() != 0) {
+ throw new RuntimeException("Test Failed.");
+ }
}
int getCaretOrdinate() {