提交 4ee9f87d 编写于 作者: L lana

Merge

......@@ -127,8 +127,21 @@ public class CEmbeddedFrame extends EmbeddedFrame {
}
}
/**
* When the parent window is activated this method is called for all EmbeddedFrames in it.
*
* For the CEmbeddedFrame which had focus before the deactivation this method triggers
* focus events in the following order:
* 1. WINDOW_ACTIVATED for this EmbeddedFrame
* 2. WINDOW_GAINED_FOCUS for this EmbeddedFrame
* 3. FOCUS_GAINED for the most recent focus owner in this EmbeddedFrame
*
* The caller must not requestFocus on the EmbeddedFrame together with calling this method.
*
* @param parentWindowActive true if the window is activated, false otherwise
*/
// handleWindowFocusEvent is called for all applets, when the browser
// becames active/inactive. This event should be filtered out for
// becomes active/inactive. This event should be filtered out for
// non-focused applet. This method can be called from different threads.
public void handleWindowFocusEvent(boolean parentWindowActive) {
this.parentWindowActive = parentWindowActive;
......
......@@ -377,7 +377,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
Object arg = args[i];
mark(arg, true);
}
mark(stm.getTarget(), false);
mark(stm.getTarget(), stm instanceof Expression);
}
......
/*
* Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -904,11 +904,12 @@ abstract public class XBaseMenuWindow extends XWindow {
*/
public void dispose() {
setDisposed(true);
EventQueue.invokeLater(new Runnable() {
InvocationEvent ev = new InvocationEvent(target, new Runnable() {
public void run() {
doDispose();
}
});
super.postEvent(ev);
}
/**
......@@ -933,11 +934,12 @@ abstract public class XBaseMenuWindow extends XWindow {
* so events can not be processed using standart means
*/
void postEvent(final AWTEvent event) {
EventQueue.invokeLater(new Runnable() {
public void run() {
handleEvent(event);
}
});
InvocationEvent ev = new InvocationEvent(event.getSource(), new Runnable() {
public void run() {
handleEvent(event);
}
});
super.postEvent(ev);
}
/**
......
/*
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1033,15 +1033,17 @@ public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelS
//fix 6252982: PIT: Keyboard FocusTraversal not working when choice's drop-down is visible, on XToolkit
if (e instanceof KeyEvent){
// notify XWindow that this event had been already handled and no need to post it again
EventQueue.invokeLater(new Runnable() {
public void run() {
if(target.isFocusable() &&
getParentTopLevel().isFocusableWindow() )
{
handleJavaKeyEvent((KeyEvent)e);
}
InvocationEvent ev = new InvocationEvent(target, new Runnable() {
public void run() {
if(target.isFocusable() &&
getParentTopLevel().isFocusableWindow() )
{
handleJavaKeyEvent((KeyEvent)e);
}
});
}
});
postEvent(ev);
return true;
} else {
if (e instanceof MouseEvent){
......@@ -1083,11 +1085,13 @@ public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelS
//convenient method
//do not generate this kind of Events
public boolean handleMouseEventByChoice(final MouseEvent me){
EventQueue.invokeLater(new Runnable() {
public void run() {
handleJavaMouseEvent(me);
}
});
InvocationEvent ev = new InvocationEvent(target, new Runnable() {
public void run() {
handleJavaMouseEvent(me);
}
});
postEvent(ev);
return true;
}
......
/*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1669,11 +1669,12 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
* Do handleJavaMouseEvent on EDT
*/
void handleJavaMouseEventOnEDT(final MouseEvent me){
EventQueue.invokeLater(new Runnable() {
public void run() {
handleJavaMouseEvent(me);
}
});
InvocationEvent ev = new InvocationEvent(target, new Runnable() {
public void run() {
handleJavaMouseEvent(me);
}
});
postEvent(ev);
}
/*
......
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -28,11 +28,8 @@ package sun.print;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Vector;
import java.util.ArrayList;
import java.util.HashMap;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintService;
......@@ -69,22 +66,14 @@ import javax.print.attribute.standard.Severity;
import javax.print.attribute.standard.Sides;
import javax.print.attribute.standard.ColorSupported;
import javax.print.attribute.standard.PrintQuality;
import javax.print.attribute.ResolutionSyntax;
import javax.print.attribute.standard.PrinterResolution;
import javax.print.attribute.standard.SheetCollate;
import javax.print.event.PrintServiceAttributeListener;
import java.util.ArrayList;
import sun.print.SunPrinterJobService;
public class Win32PrintService implements PrintService, AttributeUpdater,
SunPrinterJobService {
public static MediaSize[] predefMedia;
static {
Class c = Win32MediaSize.class;
}
public static MediaSize[] predefMedia = Win32MediaSize.getPredefMedia();
private static final DocFlavor[] supportedFlavors = {
DocFlavor.BYTE_ARRAY.GIF,
......@@ -313,7 +302,9 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
public MediaSizeName findWin32Media(int dmIndex) {
if (dmIndex >= 1 && dmIndex <= dmPaperToPrintService.length) {
switch(dmIndex) {
return dmPaperToPrintService[dmIndex - 1];
}
switch(dmIndex) {
/* matching media sizes with indices beyond
dmPaperToPrintService's length */
case DMPAPER_A2:
......@@ -323,11 +314,8 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
case DMPAPER_B6_JIS:
return MediaSizeName.JIS_B6;
default:
return dmPaperToPrintService[dmIndex - 1];
}
return null;
}
return null;
}
private boolean addToUniqueList(ArrayList msnList, MediaSizeName mediaName) {
......@@ -353,6 +341,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
}
ArrayList msnList = new ArrayList();
ArrayList<Win32MediaSize> trailingWmsList = new ArrayList<Win32MediaSize>();
ArrayList printableList = new ArrayList();
MediaSizeName mediaName;
boolean added;
......@@ -371,7 +360,8 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
idList.add(Integer.valueOf(media[i]));
}
mediaSizes = getMediaSizes(idList, media);
ArrayList<String> dmPaperNameList = new ArrayList<String>();
mediaSizes = getMediaSizes(idList, media, dmPaperNameList);
for (int i = 0; i < idList.size(); i++) {
// match Win ID with our predefined ID using table
......@@ -390,6 +380,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
mediaName = null;
}
}
boolean dmPaperIDMatched = (mediaName != null);
// No match found, then we get the MediaSizeName out of the MediaSize
// This requires 1-1 correspondence, lengths must be checked.
......@@ -398,9 +389,32 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
}
// Add mediaName to the msnList
added = false;
if (mediaName != null) {
added = addToUniqueList(msnList, mediaName);
}
if ((!dmPaperIDMatched || !added) && (idList.size() == dmPaperNameList.size())) {
/* The following block allows to add such media names to the list, whose sizes
* matched with media sizes predefined in JDK, while whose paper IDs did not,
* or whose sizes and paper IDs both did not match with any predefined in JDK.
*/
Win32MediaSize wms = Win32MediaSize.findMediaName(dmPaperNameList.get(i));
if ((wms == null) && (idList.size() == mediaSizes.length)) {
wms = new Win32MediaSize(dmPaperNameList.get(i), (Integer)idList.get(i));
mediaSizes[i] = new MediaSize(mediaSizes[i].getX(MediaSize.MM),
mediaSizes[i].getY(MediaSize.MM), MediaSize.MM, wms);
}
if ((wms != null) && (wms != mediaName)) {
if (!added) {
added = addToUniqueList(msnList, mediaName = wms);
} else {
trailingWmsList.add(wms);
}
}
}
}
for (Win32MediaSize wms : trailingWmsList) {
added = addToUniqueList(msnList, wms);
}
// init mediaSizeNames
......@@ -591,7 +605,11 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
}
private MediaSize[] getMediaSizes(ArrayList idList, int[] media) {
private MediaSize[] getMediaSizes(ArrayList idList, int[] media, ArrayList<String> dmPaperNameList) {
if (dmPaperNameList == null) {
dmPaperNameList = new ArrayList<String>();
}
String prnPort = getPort();
int[] mediaSz = getAllMediaSizes(printer, prnPort);
String[] winMediaNames = getAllMediaNames(printer, prnPort);
......@@ -610,40 +628,43 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
wid = mediaSz[i*2]/10f;
ht = mediaSz[i*2+1]/10f;
// Make sure to validate wid & ht.
// HP LJ 4050 (german) causes IAE in Sonderformat paper, wid & ht
// returned is not constant.
if ((wid <= 0) || (ht <= 0)) {
//Remove corresponding ID from list
if (nMedia == media.length) {
Integer remObj = Integer.valueOf(media[i]);
idList.remove(idList.indexOf(remObj));
// Make sure to validate wid & ht.
// HP LJ 4050 (german) causes IAE in Sonderformat paper, wid & ht
// returned is not constant.
if ((wid <= 0) || (ht <= 0)) {
//Remove corresponding ID from list
if (nMedia == media.length) {
Integer remObj = Integer.valueOf(media[i]);
idList.remove(idList.indexOf(remObj));
}
continue;
}
continue;
}
// Find matching media using dimensions.
// This call matches only with our own predefined sizes.
msn = findMatchingMediaSizeNameMM(wid, ht);
if (msn != null) {
ms = MediaSize.getMediaSizeForName(msn);
}
if (ms != null) {
msList.add(ms);
} else {
Win32MediaSize wms =
new Win32MediaSize(winMediaNames[i], media[i]);
try {
ms = new MediaSize(wid, ht, MediaSize.MM, wms);
msList.add(ms);
} catch(IllegalArgumentException e) {
if (nMedia == media.length) {
Integer remObj = Integer.valueOf(media[i]);
idList.remove(idList.indexOf(remObj));
}
// Find matching media using dimensions.
// This call matches only with our own predefined sizes.
msn = findMatchingMediaSizeNameMM(wid, ht);
if (msn != null) {
ms = MediaSize.getMediaSizeForName(msn);
}
}
if (ms != null) {
msList.add(ms);
dmPaperNameList.add(winMediaNames[i]);
} else {
Win32MediaSize wms = Win32MediaSize.findMediaName(winMediaNames[i]);
if (wms == null) {
wms = new Win32MediaSize(winMediaNames[i], media[i]);
}
try {
ms = new MediaSize(wid, ht, MediaSize.MM, wms);
msList.add(ms);
dmPaperNameList.add(winMediaNames[i]);
} catch(IllegalArgumentException e) {
if (nMedia == media.length) {
Integer remObj = Integer.valueOf(media[i]);
idList.remove(idList.indexOf(remObj));
}
}
}
}
MediaSize[] arr2 = new MediaSize[msList.size()];
......@@ -1617,6 +1638,7 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
class Win32MediaSize extends MediaSizeName {
private static ArrayList winStringTable = new ArrayList();
private static ArrayList winEnumTable = new ArrayList();
private static MediaSize[] predefMedia;
private int dmPaperID; // driver ID for this paper.
......@@ -1630,6 +1652,18 @@ class Win32MediaSize extends MediaSizeName {
return (winStringTable.size()-1);
}
public static synchronized Win32MediaSize findMediaName(String name) {
int nameIndex = winStringTable.indexOf(name);
if (nameIndex != -1) {
return (Win32MediaSize)winEnumTable.get(nameIndex);
}
return null;
}
public static MediaSize[] getPredefMedia() {
return predefMedia;
}
public Win32MediaSize(String name, int dmPaper) {
super(nextValue(name));
dmPaperID = dmPaper;
......@@ -1641,18 +1675,17 @@ class Win32MediaSize extends MediaSizeName {
}
static {
/* initialize Win32PrintService.predefMedia */
/* initialize predefMedia */
{
Win32MediaSize winMedia = new Win32MediaSize(-1);
// cannot call getSuperEnumTable directly because of static context
MediaSizeName[] enumMedia = winMedia.getSuperEnumTable();
if (enumMedia != null) {
Win32PrintService.predefMedia = new MediaSize[enumMedia.length];
predefMedia = new MediaSize[enumMedia.length];
for (int i=0; i<enumMedia.length; i++) {
Win32PrintService.predefMedia[i] =
MediaSize.getMediaSizeForName(enumMedia[i]);
predefMedia[i] = MediaSize.getMediaSizeForName(enumMedia[i]);
}
}
}
......
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 8016545
* @summary Tests beans with predefined fields
* @author Sergey Malenkov
*/
public class Test8016545 extends AbstractTest {
public static void main(String[] args) {
new Test8016545().test(true);
}
@Override
protected Object getObject() {
Bean bean = new Bean();
bean.setUndefined(Boolean.FALSE);
Info info = new Info();
info.setEnabled(Boolean.TRUE);
info.setID(1);
bean.setInfo(info);
return bean;
}
@Override
protected Object getAnotherObject() {
Bean bean = new Bean();
bean.setUndefined(Boolean.TRUE);
bean.getInfo().setEnabled(Boolean.FALSE);
bean.getInfo().setID(2);
return bean;
}
public static class Bean {
private Info info = new Info(); // predefined
private Boolean defined = Boolean.TRUE;
private Boolean undefined;
public Info getInfo() {
return this.info;
}
public void setInfo(Info info) {
this.info = info;
}
public Boolean getDefined() {
return this.defined;
}
public void setDefined(Boolean defined) {
this.defined = defined;
}
public Boolean getUndefined() {
return this.undefined;
}
public void setUndefined(Boolean undefined) {
this.undefined = undefined;
}
}
public static class Info {
private Integer id;
private Boolean enabled;
public Integer getID() {
return this.id;
}
public void setID(Integer id) {
this.id = id;
}
public Boolean getEnabled() {
return this.enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
}
}
......@@ -136,9 +136,12 @@ public class bug8014863 {
"qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp" +
"</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>");
editorPane.setCaretPosition(1);
// An actual font size depends on OS and might be differnet on various OSs.
// It is necessary to calculate the width to meet the expected number of lines.
int width = SwingUtilities.computeStringWidth(editorPane.getFontMetrics(editorPane.getFont()),
"qqqq pp qqqq pp qqqq pp qqqqqqqq");
frame.add(editorPane);
frame.setSize(200, 200);
frame.setSize(width, 200);
frame.setVisible(true);
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册