8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by: darcy, prr, flar
This commit is contained in:
parent
c7f7685c50
commit
cb91afdb8c
@ -66,7 +66,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
|
|||||||
|
|
||||||
AWTAccessor.setMenuAccessor(
|
AWTAccessor.setMenuAccessor(
|
||||||
new AWTAccessor.MenuAccessor() {
|
new AWTAccessor.MenuAccessor() {
|
||||||
public Vector<MenuComponent> getItems(Menu menu) {
|
public Vector<MenuItem> getItems(Menu menu) {
|
||||||
return menu.items;
|
return menu.items;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -78,7 +78,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
|
|||||||
* @serial
|
* @serial
|
||||||
* @see #countItems()
|
* @see #countItems()
|
||||||
*/
|
*/
|
||||||
Vector<MenuComponent> items = new Vector<>();
|
Vector<MenuItem> items = new Vector<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This field indicates whether the menu has the
|
* This field indicates whether the menu has the
|
||||||
@ -252,7 +252,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
|
|||||||
* be called on the toolkit thread.
|
* be called on the toolkit thread.
|
||||||
*/
|
*/
|
||||||
final MenuItem getItemImpl(int index) {
|
final MenuItem getItemImpl(int index) {
|
||||||
return (MenuItem)items.elementAt(index);
|
return items.elementAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -544,7 +544,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible {
|
|||||||
// HeadlessException will be thrown from MenuComponent's readObject
|
// HeadlessException will be thrown from MenuComponent's readObject
|
||||||
s.defaultReadObject();
|
s.defaultReadObject();
|
||||||
for(int i = 0; i < items.size(); i++) {
|
for(int i = 0; i < items.size(); i++) {
|
||||||
MenuItem item = (MenuItem)items.elementAt(i);
|
MenuItem item = items.elementAt(i);
|
||||||
item.parent = this;
|
item.parent = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ public final class AWTAccessor {
|
|||||||
/**
|
/**
|
||||||
* Returns menus
|
* Returns menus
|
||||||
*/
|
*/
|
||||||
Vector getMenus(MenuBar menuBar);
|
Vector<Menu> getMenus(MenuBar menuBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -663,7 +663,7 @@ public final class AWTAccessor {
|
|||||||
/**
|
/**
|
||||||
* Returns vector of the items that are part of the Menu
|
* Returns vector of the items that are part of the Menu
|
||||||
*/
|
*/
|
||||||
Vector getItems(Menu menu);
|
Vector<MenuItem> getItems(Menu menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -890,6 +890,7 @@ public final class AppContext {
|
|||||||
Supplier<T> supplier) {
|
Supplier<T> supplier) {
|
||||||
|
|
||||||
final AppContext appContext = AppContext.getAppContext();
|
final AppContext appContext = AppContext.getAppContext();
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
SoftReference<T> ref = (SoftReference<T>) appContext.get(key);
|
SoftReference<T> ref = (SoftReference<T>) appContext.get(key);
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
final T object = ref.get();
|
final T object = ref.get();
|
||||||
|
@ -64,7 +64,7 @@ public abstract class FontConfiguration {
|
|||||||
protected static String osName;
|
protected static String osName;
|
||||||
protected static String encoding; // canonical name of default nio charset
|
protected static String encoding; // canonical name of default nio charset
|
||||||
protected static Locale startupLocale = null;
|
protected static Locale startupLocale = null;
|
||||||
protected static Hashtable localeMap = null;
|
protected static Hashtable<String, String> localeMap = null;
|
||||||
private static FontConfiguration fontConfig;
|
private static FontConfiguration fontConfig;
|
||||||
private static PlatformLogger logger;
|
private static PlatformLogger logger;
|
||||||
protected static boolean isProperties = true;
|
protected static boolean isProperties = true;
|
||||||
@ -159,15 +159,15 @@ public abstract class FontConfiguration {
|
|||||||
short fontNameID = compFontNameIDs[0][0][0];
|
short fontNameID = compFontNameIDs[0][0][0];
|
||||||
short fileNameID = getComponentFileID(fontNameID);
|
short fileNameID = getComponentFileID(fontNameID);
|
||||||
final String fileName = mapFileName(getComponentFileName(fileNameID));
|
final String fileName = mapFileName(getComponentFileName(fileNameID));
|
||||||
Boolean exists = (Boolean)java.security.AccessController.doPrivileged(
|
Boolean exists = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction() {
|
new java.security.PrivilegedAction<Boolean>() {
|
||||||
public Object run() {
|
public Boolean run() {
|
||||||
try {
|
try {
|
||||||
File f = new File(fileName);
|
File f = new File(fileName);
|
||||||
return Boolean.valueOf(f.exists());
|
return Boolean.valueOf(f.exists());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
return false;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -534,11 +534,11 @@ public abstract class FontConfiguration {
|
|||||||
private short remapLocaleMap(int fontIndex, int styleIndex, short scriptID, short fontID) {
|
private short remapLocaleMap(int fontIndex, int styleIndex, short scriptID, short fontID) {
|
||||||
String scriptName = getString(table_scriptIDs[scriptID]);
|
String scriptName = getString(table_scriptIDs[scriptID]);
|
||||||
|
|
||||||
String value = (String)localeMap.get(scriptName);
|
String value = localeMap.get(scriptName);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
String fontName = fontNames[fontIndex];
|
String fontName = fontNames[fontIndex];
|
||||||
String styleName = styleNames[styleIndex];
|
String styleName = styleNames[styleIndex];
|
||||||
value = (String)localeMap.get(fontName + "." + styleName + "." + scriptName);
|
value = localeMap.get(fontName + "." + styleName + "." + scriptName);
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return fontID;
|
return fontID;
|
||||||
@ -746,7 +746,7 @@ public abstract class FontConfiguration {
|
|||||||
/* Mappings from file encoding to font config name for font supporting
|
/* Mappings from file encoding to font config name for font supporting
|
||||||
* the corresponding language. This is filled in by initReorderMap()
|
* the corresponding language. This is filled in by initReorderMap()
|
||||||
*/
|
*/
|
||||||
protected HashMap reorderMap = null;
|
protected HashMap<String, Object> reorderMap = null;
|
||||||
|
|
||||||
/* Platform-specific mappings */
|
/* Platform-specific mappings */
|
||||||
protected abstract void initReorderMap();
|
protected abstract void initReorderMap();
|
||||||
@ -777,7 +777,7 @@ public abstract class FontConfiguration {
|
|||||||
if (fontConfig.reorderMap == null) {
|
if (fontConfig.reorderMap == null) {
|
||||||
fontConfig.initReorderMap();
|
fontConfig.initReorderMap();
|
||||||
}
|
}
|
||||||
HashMap reorderMap = fontConfig.reorderMap;
|
HashMap<String, Object> reorderMap = fontConfig.reorderMap;
|
||||||
|
|
||||||
/* Find the most specific mapping */
|
/* Find the most specific mapping */
|
||||||
String language = startupLocale.getLanguage();
|
String language = startupLocale.getLanguage();
|
||||||
@ -817,9 +817,9 @@ public abstract class FontConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector splitSequence(String sequence) {
|
private static Vector<String> splitSequence(String sequence) {
|
||||||
//String.split would be more convenient, but incurs big performance penalty
|
//String.split would be more convenient, but incurs big performance penalty
|
||||||
Vector parts = new Vector();
|
Vector<String> parts = new Vector<>();
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int end;
|
int end;
|
||||||
while ((end = sequence.indexOf(',', start)) >= 0) {
|
while ((end = sequence.indexOf(',', start)) >= 0) {
|
||||||
@ -833,14 +833,14 @@ public abstract class FontConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String[] split(String sequence) {
|
protected String[] split(String sequence) {
|
||||||
Vector v = splitSequence(sequence);
|
Vector<String> v = splitSequence(sequence);
|
||||||
return (String[])v.toArray(new String[0]);
|
return v.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Methods for extracting information from the fontconfig data for AWT//
|
// Methods for extracting information from the fontconfig data for AWT//
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
private Hashtable charsetRegistry = new Hashtable(5);
|
private Hashtable<String, Charset> charsetRegistry = new Hashtable<>(5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns FontDescriptors describing the physical fonts used for the
|
* Returns FontDescriptors describing the physical fonts used for the
|
||||||
@ -932,9 +932,9 @@ public abstract class FontConfiguration {
|
|||||||
|
|
||||||
Charset fc = null;
|
Charset fc = null;
|
||||||
if (charsetName.equals("default")) {
|
if (charsetName.equals("default")) {
|
||||||
fc = (Charset) charsetRegistry.get(fontName);
|
fc = charsetRegistry.get(fontName);
|
||||||
} else {
|
} else {
|
||||||
fc = (Charset) charsetRegistry.get(charsetName);
|
fc = charsetRegistry.get(charsetName);
|
||||||
}
|
}
|
||||||
if (fc != null) {
|
if (fc != null) {
|
||||||
return fc.newEncoder();
|
return fc.newEncoder();
|
||||||
@ -943,8 +943,8 @@ public abstract class FontConfiguration {
|
|||||||
if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
|
if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
|
||||||
fc = Charset.forName(charsetName);
|
fc = Charset.forName(charsetName);
|
||||||
} else {
|
} else {
|
||||||
Class fcc = (Class) AccessController.doPrivileged(new PrivilegedAction() {
|
Class<?> fcc = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
|
||||||
public Object run() {
|
public Class<?> run() {
|
||||||
try {
|
try {
|
||||||
return Class.forName(charsetName, true,
|
return Class.forName(charsetName, true,
|
||||||
ClassLoader.getSystemClassLoader());
|
ClassLoader.getSystemClassLoader());
|
||||||
@ -1377,9 +1377,9 @@ public abstract class FontConfiguration {
|
|||||||
|
|
||||||
//This method will only be called during build time, do we
|
//This method will only be called during build time, do we
|
||||||
//need do PrivilegedAction?
|
//need do PrivilegedAction?
|
||||||
String osName = (String)java.security.AccessController.doPrivileged(
|
String osName = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction() {
|
new java.security.PrivilegedAction<String>() {
|
||||||
public Object run() {
|
public String run() {
|
||||||
return System.getProperty("os.name");
|
return System.getProperty("os.name");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -2139,7 +2139,7 @@ public abstract class FontConfiguration {
|
|||||||
boolean has1252 = false;
|
boolean has1252 = false;
|
||||||
|
|
||||||
//get the scriptID list
|
//get the scriptID list
|
||||||
String[] ss = (String[])splitSequence(value).toArray(EMPTY_STRING_ARRAY);
|
String[] ss = splitSequence(value).toArray(EMPTY_STRING_ARRAY);
|
||||||
short [] sa = new short[ss.length];
|
short [] sa = new short[ss.length];
|
||||||
for (int i = 0; i < ss.length; i++) {
|
for (int i = 0; i < ss.length; i++) {
|
||||||
if ("alphabetic/default".equals(ss[i])) {
|
if ("alphabetic/default".equals(ss[i])) {
|
||||||
|
@ -214,7 +214,8 @@ public class HToolkit extends SunToolkit
|
|||||||
throw new HeadlessException();
|
throw new HeadlessException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
|
public Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlight(
|
||||||
|
InputMethodHighlight highlight)
|
||||||
throws HeadlessException {
|
throws HeadlessException {
|
||||||
throw new HeadlessException();
|
throw new HeadlessException();
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import java.awt.*;
|
|||||||
import java.awt.dnd.*;
|
import java.awt.dnd.*;
|
||||||
import java.awt.dnd.peer.DragSourceContextPeer;
|
import java.awt.dnd.peer.DragSourceContextPeer;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
import java.awt.font.TextAttribute;
|
||||||
import java.awt.im.InputMethodHighlight;
|
import java.awt.im.InputMethodHighlight;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.datatransfer.Clipboard;
|
||||||
@ -224,7 +225,7 @@ public class HeadlessToolkit extends Toolkit
|
|||||||
throw new HeadlessException();
|
throw new HeadlessException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
|
public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
|
||||||
throws HeadlessException {
|
throws HeadlessException {
|
||||||
throw new HeadlessException();
|
throw new HeadlessException();
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ public abstract class PlatformFont implements FontPeer {
|
|||||||
if (len < 1) {
|
if (len < 1) {
|
||||||
return new CharsetString[0];
|
return new CharsetString[0];
|
||||||
}
|
}
|
||||||
Vector mcs = null;
|
Vector<CharsetString> mcs = null;
|
||||||
char[] tmpStr = new char[len];
|
char[] tmpStr = new char[len];
|
||||||
char tmpChar = defaultChar;
|
char tmpChar = defaultChar;
|
||||||
boolean encoded = false;
|
boolean encoded = false;
|
||||||
@ -198,7 +198,7 @@ public abstract class PlatformFont implements FontPeer {
|
|||||||
}
|
}
|
||||||
if (currentFont != fd){
|
if (currentFont != fd){
|
||||||
if (mcs == null) {
|
if (mcs == null) {
|
||||||
mcs = new Vector(3);
|
mcs = new Vector<>(3);
|
||||||
}
|
}
|
||||||
mcs.addElement(new CharsetString(tmpStr, lastIndex,
|
mcs.addElement(new CharsetString(tmpStr, lastIndex,
|
||||||
i-lastIndex, currentFont));
|
i-lastIndex, currentFont));
|
||||||
@ -209,16 +209,13 @@ public abstract class PlatformFont implements FontPeer {
|
|||||||
}
|
}
|
||||||
CharsetString[] result;
|
CharsetString[] result;
|
||||||
CharsetString cs = new CharsetString(tmpStr, lastIndex,
|
CharsetString cs = new CharsetString(tmpStr, lastIndex,
|
||||||
len-lastIndex, currentFont);
|
len-lastIndex, currentFont);
|
||||||
if (mcs == null) {
|
if (mcs == null) {
|
||||||
result = new CharsetString[1];
|
result = new CharsetString[1];
|
||||||
result[0] = cs;
|
result[0] = cs;
|
||||||
} else {
|
} else {
|
||||||
mcs.addElement(cs);
|
mcs.addElement(cs);
|
||||||
result = new CharsetString[mcs.size()];
|
result = mcs.toArray(new CharsetString[mcs.size()]);
|
||||||
for (int i = 0; i < mcs.size(); i++){
|
|
||||||
result[i] = (CharsetString)mcs.elementAt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1915,6 +1915,7 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
|
|
||||||
public synchronized void setWindowDeactivationTime(Window w, long time) {
|
public synchronized void setWindowDeactivationTime(Window w, long time) {
|
||||||
AppContext ctx = getAppContext(w);
|
AppContext ctx = getAppContext(w);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
|
WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
map = new WeakHashMap<Window, Long>();
|
map = new WeakHashMap<Window, Long>();
|
||||||
@ -1925,6 +1926,7 @@ public abstract class SunToolkit extends Toolkit
|
|||||||
|
|
||||||
public synchronized long getWindowDeactivationTime(Window w) {
|
public synchronized long getWindowDeactivationTime(Window w) {
|
||||||
AppContext ctx = getAppContext(w);
|
AppContext ctx = getAppContext(w);
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
|
WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -324,7 +324,7 @@ public abstract class DataTransferer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Class rep_class = flavor.getRepresentationClass();
|
Class<?> rep_class = flavor.getRepresentationClass();
|
||||||
|
|
||||||
if (flavor.isRepresentationClassReader() ||
|
if (flavor.isRepresentationClassReader() ||
|
||||||
String.class.equals(rep_class) ||
|
String.class.equals(rep_class) ||
|
||||||
@ -696,7 +696,7 @@ public abstract class DataTransferer {
|
|||||||
* DataFlavors and data formats
|
* DataFlavors and data formats
|
||||||
* @throws NullPointerException if formats or map is <code>null</code>
|
* @throws NullPointerException if formats or map is <code>null</code>
|
||||||
*/
|
*/
|
||||||
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
|
public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
|
||||||
Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
|
Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
|
||||||
|
|
||||||
for (long format : formats) {
|
for (long format : formats) {
|
||||||
@ -1085,7 +1085,7 @@ search:
|
|||||||
throw new IOException("data translation failed");
|
throw new IOException("data translation failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
final List list = (List)obj;
|
final List<?> list = (List<?>)obj;
|
||||||
|
|
||||||
final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
|
final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
|
||||||
|
|
||||||
@ -1113,7 +1113,7 @@ search:
|
|||||||
if (targetCharset == null) {
|
if (targetCharset == null) {
|
||||||
targetCharset = "UTF-8";
|
targetCharset = "UTF-8";
|
||||||
}
|
}
|
||||||
final List list = (List)obj;
|
final List<?> list = (List<?>)obj;
|
||||||
final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
|
final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
|
||||||
final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
|
final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
|
||||||
final ArrayList<String> uriList = new ArrayList<>(fileList.size());
|
final ArrayList<String> uriList = new ArrayList<>(fileList.size());
|
||||||
@ -1258,7 +1258,7 @@ search:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<String> castToFiles(final List files,
|
private ArrayList<String> castToFiles(final List<?> files,
|
||||||
final ProtectionDomain userProtectionDomain) throws IOException {
|
final ProtectionDomain userProtectionDomain) throws IOException {
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged((PrivilegedExceptionAction<ArrayList<String>>) () -> {
|
return AccessController.doPrivileged((PrivilegedExceptionAction<ArrayList<String>>) () -> {
|
||||||
@ -1636,7 +1636,7 @@ search:
|
|||||||
* instance of the Class as its sole parameter.
|
* instance of the Class as its sole parameter.
|
||||||
*/
|
*/
|
||||||
private Object constructFlavoredObject(Object arg, DataFlavor flavor,
|
private Object constructFlavoredObject(Object arg, DataFlavor flavor,
|
||||||
Class clazz)
|
Class<?> clazz)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
final Class<?> dfrc = flavor.getRepresentationClass();
|
final Class<?> dfrc = flavor.getRepresentationClass();
|
||||||
@ -1644,19 +1644,19 @@ search:
|
|||||||
if (clazz.equals(dfrc)) {
|
if (clazz.equals(dfrc)) {
|
||||||
return arg; // simple case
|
return arg; // simple case
|
||||||
} else {
|
} else {
|
||||||
Constructor[] constructors;
|
Constructor<?>[] constructors;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
constructors = AccessController.doPrivileged(
|
constructors = AccessController.doPrivileged(
|
||||||
(PrivilegedAction<Constructor[]>) dfrc::getConstructors);
|
(PrivilegedAction<Constructor<?>[]>) dfrc::getConstructors);
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
throw new IOException(se.getMessage());
|
throw new IOException(se.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Constructor constructor = Stream.of(constructors)
|
Constructor<?> constructor = Stream.of(constructors)
|
||||||
.filter(c -> Modifier.isPublic(c.getModifiers()))
|
.filter(c -> Modifier.isPublic(c.getModifiers()))
|
||||||
.filter(c -> {
|
.filter(c -> {
|
||||||
Class[] ptypes = c.getParameterTypes();
|
Class<?>[] ptypes = c.getParameterTypes();
|
||||||
return ptypes != null
|
return ptypes != null
|
||||||
&& ptypes.length == 1
|
&& ptypes.length == 1
|
||||||
&& clazz.equals(ptypes[0]);
|
&& clazz.equals(ptypes[0]);
|
||||||
@ -1865,7 +1865,8 @@ search:
|
|||||||
byte[] bytes, String mimeType) throws IOException
|
byte[] bytes, String mimeType) throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
Iterator readerIterator = ImageIO.getImageReadersByMIMEType(mimeType);
|
Iterator<ImageReader> readerIterator =
|
||||||
|
ImageIO.getImageReadersByMIMEType(mimeType);
|
||||||
|
|
||||||
if (!readerIterator.hasNext()) {
|
if (!readerIterator.hasNext()) {
|
||||||
throw new IOException("No registered service provider can decode " +
|
throw new IOException("No registered service provider can decode " +
|
||||||
@ -1875,7 +1876,7 @@ search:
|
|||||||
IOException ioe = null;
|
IOException ioe = null;
|
||||||
|
|
||||||
while (readerIterator.hasNext()) {
|
while (readerIterator.hasNext()) {
|
||||||
ImageReader imageReader = (ImageReader)readerIterator.next();
|
ImageReader imageReader = readerIterator.next();
|
||||||
try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
|
try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
|
||||||
try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) {
|
try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) {
|
||||||
ImageReadParam param = imageReader.getDefaultReadParam();
|
ImageReadParam param = imageReader.getDefaultReadParam();
|
||||||
@ -1918,7 +1919,8 @@ search:
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
IOException originalIOE = null;
|
IOException originalIOE = null;
|
||||||
|
|
||||||
Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType);
|
Iterator<ImageWriter> writerIterator =
|
||||||
|
ImageIO.getImageWritersByMIMEType(mimeType);
|
||||||
|
|
||||||
if (!writerIterator.hasNext()) {
|
if (!writerIterator.hasNext()) {
|
||||||
throw new IOException("No registered service provider can encode " +
|
throw new IOException("No registered service provider can encode " +
|
||||||
@ -1977,7 +1979,8 @@ search:
|
|||||||
String mimeType)
|
String mimeType)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType);
|
Iterator<ImageWriter> writerIterator =
|
||||||
|
ImageIO.getImageWritersByMIMEType(mimeType);
|
||||||
|
|
||||||
ImageTypeSpecifier typeSpecifier =
|
ImageTypeSpecifier typeSpecifier =
|
||||||
new ImageTypeSpecifier(renderedImage);
|
new ImageTypeSpecifier(renderedImage);
|
||||||
@ -1986,7 +1989,7 @@ search:
|
|||||||
IOException ioe = null;
|
IOException ioe = null;
|
||||||
|
|
||||||
while (writerIterator.hasNext()) {
|
while (writerIterator.hasNext()) {
|
||||||
ImageWriter imageWriter = (ImageWriter)writerIterator.next();
|
ImageWriter imageWriter = writerIterator.next();
|
||||||
ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider();
|
ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider();
|
||||||
|
|
||||||
if (!writerSpi.canEncodeImage(typeSpecifier)) {
|
if (!writerSpi.canEncodeImage(typeSpecifier)) {
|
||||||
@ -2070,7 +2073,7 @@ search:
|
|||||||
public byte[] convertData(final Object source,
|
public byte[] convertData(final Object source,
|
||||||
final Transferable contents,
|
final Transferable contents,
|
||||||
final long format,
|
final long format,
|
||||||
final Map formatMap,
|
final Map<Long, DataFlavor> formatMap,
|
||||||
final boolean isToolkitThread)
|
final boolean isToolkitThread)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -2093,7 +2096,7 @@ search:
|
|||||||
}
|
}
|
||||||
byte[] data = null;
|
byte[] data = null;
|
||||||
try {
|
try {
|
||||||
DataFlavor flavor = (DataFlavor)formatMap.get(format);
|
DataFlavor flavor = formatMap.get(format);
|
||||||
if (flavor != null) {
|
if (flavor != null) {
|
||||||
data = translateTransferable(contents, flavor, format);
|
data = translateTransferable(contents, flavor, format);
|
||||||
}
|
}
|
||||||
@ -2134,7 +2137,7 @@ search:
|
|||||||
} finally {
|
} finally {
|
||||||
getToolkitThreadBlockedHandler().unlock();
|
getToolkitThreadBlockedHandler().unlock();
|
||||||
} else {
|
} else {
|
||||||
DataFlavor flavor = (DataFlavor)formatMap.get(format);
|
DataFlavor flavor = formatMap.get(format);
|
||||||
if (flavor != null) {
|
if (flavor != null) {
|
||||||
ret = translateTransferable(contents, flavor, format);
|
ret = translateTransferable(contents, flavor, format);
|
||||||
}
|
}
|
||||||
@ -2183,7 +2186,7 @@ search:
|
|||||||
* Helper function to convert a Set of DataFlavors to a sorted array.
|
* Helper function to convert a Set of DataFlavors to a sorted array.
|
||||||
* The array will be sorted according to <code>DataFlavorComparator</code>.
|
* The array will be sorted according to <code>DataFlavorComparator</code>.
|
||||||
*/
|
*/
|
||||||
public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) {
|
public static DataFlavor[] setToSortedDataFlavorArray(Set<DataFlavor> flavorsSet) {
|
||||||
DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
|
DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
|
||||||
flavorsSet.toArray(flavors);
|
flavorsSet.toArray(flavors);
|
||||||
final Comparator<DataFlavor> comparator =
|
final Comparator<DataFlavor> comparator =
|
||||||
@ -2544,12 +2547,12 @@ search:
|
|||||||
String primaryType1 = flavor1.getPrimaryType();
|
String primaryType1 = flavor1.getPrimaryType();
|
||||||
String subType1 = flavor1.getSubType();
|
String subType1 = flavor1.getSubType();
|
||||||
String mimeType1 = primaryType1 + "/" + subType1;
|
String mimeType1 = primaryType1 + "/" + subType1;
|
||||||
Class class1 = flavor1.getRepresentationClass();
|
Class<?> class1 = flavor1.getRepresentationClass();
|
||||||
|
|
||||||
String primaryType2 = flavor2.getPrimaryType();
|
String primaryType2 = flavor2.getPrimaryType();
|
||||||
String subType2 = flavor2.getSubType();
|
String subType2 = flavor2.getSubType();
|
||||||
String mimeType2 = primaryType2 + "/" + subType2;
|
String mimeType2 = primaryType2 + "/" + subType2;
|
||||||
Class class2 = flavor2.getRepresentationClass();
|
Class<?> class2 = flavor2.getRepresentationClass();
|
||||||
|
|
||||||
if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) {
|
if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) {
|
||||||
// First, compare MIME types
|
// First, compare MIME types
|
||||||
|
@ -78,7 +78,7 @@ public abstract class SunClipboard extends Clipboard
|
|||||||
* this clipboard. It is used for tracking changes
|
* this clipboard. It is used for tracking changes
|
||||||
* of <code>DataFlavor</code>s available on this clipboard.
|
* of <code>DataFlavor</code>s available on this clipboard.
|
||||||
*/
|
*/
|
||||||
private volatile Set currentDataFlavors;
|
private volatile Set<DataFlavor> currentDataFlavors;
|
||||||
|
|
||||||
|
|
||||||
public SunClipboard(String name) {
|
public SunClipboard(String name) {
|
||||||
@ -338,7 +338,7 @@ public abstract class SunClipboard extends Clipboard
|
|||||||
protected abstract byte[] getClipboardData(long format) throws IOException;
|
protected abstract byte[] getClipboardData(long format) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
private static Set formatArrayAsDataFlavorSet(long[] formats) {
|
private static Set<DataFlavor> formatArrayAsDataFlavorSet(long[] formats) {
|
||||||
return (formats == null) ? null :
|
return (formats == null) ? null :
|
||||||
DataTransferer.getInstance().
|
DataTransferer.getInstance().
|
||||||
getFlavorsForFormatsAsSet(formats, getDefaultFlavorTable());
|
getFlavorsForFormatsAsSet(formats, getDefaultFlavorTable());
|
||||||
@ -417,7 +417,7 @@ public abstract class SunClipboard extends Clipboard
|
|||||||
* this clipboard
|
* this clipboard
|
||||||
*/
|
*/
|
||||||
public void checkChange(long[] formats) {
|
public void checkChange(long[] formats) {
|
||||||
Set prevDataFlavors = currentDataFlavors;
|
Set<DataFlavor> prevDataFlavors = currentDataFlavors;
|
||||||
currentDataFlavors = formatArrayAsDataFlavorSet(formats);
|
currentDataFlavors = formatArrayAsDataFlavorSet(formats);
|
||||||
|
|
||||||
if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
|
if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
|
||||||
|
@ -111,9 +111,9 @@ final class ClassLoaderObjectOutputStream extends ObjectOutputStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void annotateClass(final Class<?> cl) throws IOException {
|
protected void annotateClass(final Class<?> cl) throws IOException {
|
||||||
ClassLoader classLoader =
|
ClassLoader classLoader = AccessController.doPrivileged(
|
||||||
(ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
|
new PrivilegedAction<ClassLoader>() {
|
||||||
public Object run() {
|
public ClassLoader run() {
|
||||||
return cl.getClassLoader();
|
return cl.getClassLoader();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -124,14 +124,14 @@ final class ClassLoaderObjectOutputStream extends ObjectOutputStream {
|
|||||||
map.put(s, classLoader);
|
map.put(s, classLoader);
|
||||||
}
|
}
|
||||||
protected void annotateProxyClass(final Class<?> cl) throws IOException {
|
protected void annotateProxyClass(final Class<?> cl) throws IOException {
|
||||||
ClassLoader classLoader =
|
ClassLoader classLoader = AccessController.doPrivileged(
|
||||||
(ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
|
new PrivilegedAction<ClassLoader>() {
|
||||||
public Object run() {
|
public ClassLoader run() {
|
||||||
return cl.getClassLoader();
|
return cl.getClassLoader();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Class[] interfaces = cl.getInterfaces();
|
Class<?>[] interfaces = cl.getInterfaces();
|
||||||
Set<String> s = new HashSet<String>(interfaces.length);
|
Set<String> s = new HashSet<String>(interfaces.length);
|
||||||
for (int i = 0; i < interfaces.length; i++) {
|
for (int i = 0; i < interfaces.length; i++) {
|
||||||
s.add(interfaces[i].getName());
|
s.add(interfaces[i].getName());
|
||||||
@ -141,7 +141,7 @@ final class ClassLoaderObjectOutputStream extends ObjectOutputStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<Set<String>, ClassLoader> getClassLoaderMap() {
|
Map<Set<String>, ClassLoader> getClassLoaderMap() {
|
||||||
return new HashMap(map);
|
return new HashMap<>(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,9 +191,9 @@ final class ClassLoaderObjectInputStream extends ObjectInputStream {
|
|||||||
boolean hasNonPublicInterface = false;
|
boolean hasNonPublicInterface = false;
|
||||||
|
|
||||||
// define proxy in class loader of non-public interface(s), if any
|
// define proxy in class loader of non-public interface(s), if any
|
||||||
Class[] classObjs = new Class[interfaces.length];
|
Class<?>[] classObjs = new Class<?>[interfaces.length];
|
||||||
for (int i = 0; i < interfaces.length; i++) {
|
for (int i = 0; i < interfaces.length; i++) {
|
||||||
Class cl = Class.forName(interfaces[i], false, classLoader);
|
Class<?> cl = Class.forName(interfaces[i], false, classLoader);
|
||||||
if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
|
if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
|
||||||
if (hasNonPublicInterface) {
|
if (hasNonPublicInterface) {
|
||||||
if (nonPublicLoader != cl.getClassLoader()) {
|
if (nonPublicLoader != cl.getClassLoader()) {
|
||||||
|
@ -146,7 +146,7 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void startDrag(Transferable trans,
|
protected abstract void startDrag(Transferable trans,
|
||||||
long[] formats, Map formatMap);
|
long[] formats, Map<Long, DataFlavor> formatMap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set cursor
|
* set cursor
|
||||||
|
@ -252,11 +252,11 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
|
|||||||
throw new InvalidDnDOperationException("No drop current");
|
throw new InvalidDnDOperationException("No drop current");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map flavorMap = DataTransferer.getInstance().getFlavorsForFormats
|
Map<DataFlavor, Long> flavorMap = DataTransferer.getInstance()
|
||||||
(currentT, DataTransferer.adaptFlavorMap
|
.getFlavorsForFormats(currentT, DataTransferer.adaptFlavorMap
|
||||||
(currentDT.getFlavorMap()));
|
(currentDT.getFlavorMap()));
|
||||||
|
|
||||||
lFormat = (Long)flavorMap.get(df);
|
lFormat = flavorMap.get(df);
|
||||||
if (lFormat == null) {
|
if (lFormat == null) {
|
||||||
throw new UnsupportedFlavorException(df);
|
throw new UnsupportedFlavorException(df);
|
||||||
}
|
}
|
||||||
@ -745,7 +745,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
|
|||||||
// dispatcher state fields
|
// dispatcher state fields
|
||||||
private int returnValue = 0;
|
private int returnValue = 0;
|
||||||
// set of events to be dispatched by this dispatcher
|
// set of events to be dispatched by this dispatcher
|
||||||
private final HashSet eventSet = new HashSet(3);
|
private final HashSet<SunDropTargetEvent> eventSet = new HashSet<>(3);
|
||||||
|
|
||||||
static final ToolkitThreadBlockedHandler handler =
|
static final ToolkitThreadBlockedHandler handler =
|
||||||
DataTransferer.getInstance().getToolkitThreadBlockedHandler();
|
DataTransferer.getInstance().getToolkitThreadBlockedHandler();
|
||||||
|
@ -152,36 +152,36 @@ public abstract class AreaOp {
|
|||||||
|
|
||||||
public abstract int getState();
|
public abstract int getState();
|
||||||
|
|
||||||
public Vector calculate(Vector left, Vector right) {
|
public Vector<Curve> calculate(Vector<Curve> left, Vector<Curve> right) {
|
||||||
Vector edges = new Vector();
|
Vector<Edge> edges = new Vector<>();
|
||||||
addEdges(edges, left, AreaOp.CTAG_LEFT);
|
addEdges(edges, left, AreaOp.CTAG_LEFT);
|
||||||
addEdges(edges, right, AreaOp.CTAG_RIGHT);
|
addEdges(edges, right, AreaOp.CTAG_RIGHT);
|
||||||
edges = pruneEdges(edges);
|
Vector<Curve> curves = pruneEdges(edges);
|
||||||
if (false) {
|
if (false) {
|
||||||
System.out.println("result: ");
|
System.out.println("result: ");
|
||||||
int numcurves = edges.size();
|
int numcurves = curves.size();
|
||||||
Curve[] curvelist = (Curve[]) edges.toArray(new Curve[numcurves]);
|
Curve[] curvelist = curves.toArray(new Curve[numcurves]);
|
||||||
for (int i = 0; i < numcurves; i++) {
|
for (int i = 0; i < numcurves; i++) {
|
||||||
System.out.println("curvelist["+i+"] = "+curvelist[i]);
|
System.out.println("curvelist["+i+"] = "+curvelist[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return edges;
|
return curves;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addEdges(Vector edges, Vector curves, int curvetag) {
|
private static void addEdges(Vector<Edge> edges, Vector<Curve> curves, int curvetag) {
|
||||||
Enumeration enum_ = curves.elements();
|
Enumeration<Curve> enum_ = curves.elements();
|
||||||
while (enum_.hasMoreElements()) {
|
while (enum_.hasMoreElements()) {
|
||||||
Curve c = (Curve) enum_.nextElement();
|
Curve c = enum_.nextElement();
|
||||||
if (c.getOrder() > 0) {
|
if (c.getOrder() > 0) {
|
||||||
edges.add(new Edge(c, curvetag));
|
edges.add(new Edge(c, curvetag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Comparator YXTopComparator = new Comparator() {
|
private static Comparator<Edge> YXTopComparator = new Comparator<Edge>() {
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Edge o1, Edge o2) {
|
||||||
Curve c1 = ((Edge) o1).getCurve();
|
Curve c1 = o1.getCurve();
|
||||||
Curve c2 = ((Edge) o2).getCurve();
|
Curve c2 = o2.getCurve();
|
||||||
double v1, v2;
|
double v1, v2;
|
||||||
if ((v1 = c1.getYTop()) == (v2 = c2.getYTop())) {
|
if ((v1 = c1.getYTop()) == (v2 = c2.getYTop())) {
|
||||||
if ((v1 = c1.getXTop()) == (v2 = c2.getXTop())) {
|
if ((v1 = c1.getXTop()) == (v2 = c2.getXTop())) {
|
||||||
@ -195,12 +195,13 @@ public abstract class AreaOp {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Vector pruneEdges(Vector edges) {
|
private Vector<Curve> pruneEdges(Vector<Edge> edges) {
|
||||||
int numedges = edges.size();
|
int numedges = edges.size();
|
||||||
if (numedges < 2) {
|
if (numedges < 2) {
|
||||||
return edges;
|
// empty vector is expected with less than 2 edges
|
||||||
|
return new Vector<>();
|
||||||
}
|
}
|
||||||
Edge[] edgelist = (Edge[]) edges.toArray(new Edge[numedges]);
|
Edge[] edgelist = edges.toArray(new Edge[numedges]);
|
||||||
Arrays.sort(edgelist, YXTopComparator);
|
Arrays.sort(edgelist, YXTopComparator);
|
||||||
if (false) {
|
if (false) {
|
||||||
System.out.println("pruning: ");
|
System.out.println("pruning: ");
|
||||||
@ -214,9 +215,9 @@ public abstract class AreaOp {
|
|||||||
int cur = 0;
|
int cur = 0;
|
||||||
int next = 0;
|
int next = 0;
|
||||||
double yrange[] = new double[2];
|
double yrange[] = new double[2];
|
||||||
Vector subcurves = new Vector();
|
Vector<CurveLink> subcurves = new Vector<>();
|
||||||
Vector chains = new Vector();
|
Vector<ChainEnd> chains = new Vector<>();
|
||||||
Vector links = new Vector();
|
Vector<CurveLink> links = new Vector<>();
|
||||||
// Active edges are between left (inclusive) and right (exclusive)
|
// Active edges are between left (inclusive) and right (exclusive)
|
||||||
while (left < numedges) {
|
while (left < numedges) {
|
||||||
double y = yrange[0];
|
double y = yrange[0];
|
||||||
@ -385,7 +386,7 @@ public abstract class AreaOp {
|
|||||||
if (false) {
|
if (false) {
|
||||||
System.out.println("new links:");
|
System.out.println("new links:");
|
||||||
for (int i = 0; i < links.size(); i++) {
|
for (int i = 0; i < links.size(); i++) {
|
||||||
CurveLink link = (CurveLink) links.elementAt(i);
|
CurveLink link = links.elementAt(i);
|
||||||
System.out.println(" "+link.getSubCurve());
|
System.out.println(" "+link.getSubCurve());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -396,10 +397,10 @@ public abstract class AreaOp {
|
|||||||
yrange[0] = yend;
|
yrange[0] = yend;
|
||||||
}
|
}
|
||||||
finalizeSubCurves(subcurves, chains);
|
finalizeSubCurves(subcurves, chains);
|
||||||
Vector ret = new Vector();
|
Vector<Curve> ret = new Vector<>();
|
||||||
Enumeration enum_ = subcurves.elements();
|
Enumeration<CurveLink> enum_ = subcurves.elements();
|
||||||
while (enum_.hasMoreElements()) {
|
while (enum_.hasMoreElements()) {
|
||||||
CurveLink link = (CurveLink) enum_.nextElement();
|
CurveLink link = enum_.nextElement();
|
||||||
ret.add(link.getMoveto());
|
ret.add(link.getMoveto());
|
||||||
CurveLink nextlink = link;
|
CurveLink nextlink = link;
|
||||||
while ((nextlink = nextlink.getNext()) != null) {
|
while ((nextlink = nextlink.getNext()) != null) {
|
||||||
@ -413,7 +414,8 @@ public abstract class AreaOp {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void finalizeSubCurves(Vector subcurves, Vector chains) {
|
public static void finalizeSubCurves(Vector<CurveLink> subcurves,
|
||||||
|
Vector<ChainEnd> chains) {
|
||||||
int numchains = chains.size();
|
int numchains = chains.size();
|
||||||
if (numchains == 0) {
|
if (numchains == 0) {
|
||||||
return;
|
return;
|
||||||
@ -437,9 +439,9 @@ public abstract class AreaOp {
|
|||||||
private static CurveLink[] EmptyLinkList = new CurveLink[2];
|
private static CurveLink[] EmptyLinkList = new CurveLink[2];
|
||||||
private static ChainEnd[] EmptyChainList = new ChainEnd[2];
|
private static ChainEnd[] EmptyChainList = new ChainEnd[2];
|
||||||
|
|
||||||
public static void resolveLinks(Vector subcurves,
|
public static void resolveLinks(Vector<CurveLink> subcurves,
|
||||||
Vector chains,
|
Vector<ChainEnd> chains,
|
||||||
Vector links)
|
Vector<CurveLink> links)
|
||||||
{
|
{
|
||||||
int numlinks = links.size();
|
int numlinks = links.size();
|
||||||
CurveLink[] linklist;
|
CurveLink[] linklist;
|
||||||
|
@ -77,14 +77,14 @@ public abstract class Crossings {
|
|||||||
|
|
||||||
public abstract boolean covers(double ystart, double yend);
|
public abstract boolean covers(double ystart, double yend);
|
||||||
|
|
||||||
public static Crossings findCrossings(Vector curves,
|
public static Crossings findCrossings(Vector<? extends Curve> curves,
|
||||||
double xlo, double ylo,
|
double xlo, double ylo,
|
||||||
double xhi, double yhi)
|
double xhi, double yhi)
|
||||||
{
|
{
|
||||||
Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi);
|
Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi);
|
||||||
Enumeration enum_ = curves.elements();
|
Enumeration<? extends Curve> enum_ = curves.elements();
|
||||||
while (enum_.hasMoreElements()) {
|
while (enum_.hasMoreElements()) {
|
||||||
Curve c = (Curve) enum_.nextElement();
|
Curve c = enum_.nextElement();
|
||||||
if (c.accumulateCrossings(cross)) {
|
if (c.accumulateCrossings(cross)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ public abstract class Crossings {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector tmp = new Vector();
|
private Vector<Curve> tmp = new Vector<>();
|
||||||
|
|
||||||
public boolean accumulateQuad(double x0, double y0, double coords[]) {
|
public boolean accumulateQuad(double x0, double y0, double coords[]) {
|
||||||
if (y0 < ylo && coords[1] < ylo && coords[3] < ylo) {
|
if (y0 < ylo && coords[1] < ylo && coords[3] < ylo) {
|
||||||
@ -258,9 +258,9 @@ public abstract class Crossings {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Curve.insertQuad(tmp, x0, y0, coords);
|
Curve.insertQuad(tmp, x0, y0, coords);
|
||||||
Enumeration enum_ = tmp.elements();
|
Enumeration<Curve> enum_ = tmp.elements();
|
||||||
while (enum_.hasMoreElements()) {
|
while (enum_.hasMoreElements()) {
|
||||||
Curve c = (Curve) enum_.nextElement();
|
Curve c = enum_.nextElement();
|
||||||
if (c.accumulateCrossings(this)) {
|
if (c.accumulateCrossings(this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -296,9 +296,9 @@ public abstract class Crossings {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Curve.insertCubic(tmp, x0, y0, coords);
|
Curve.insertCubic(tmp, x0, y0, coords);
|
||||||
Enumeration enum_ = tmp.elements();
|
Enumeration<Curve> enum_ = tmp.elements();
|
||||||
while (enum_.hasMoreElements()) {
|
while (enum_.hasMoreElements()) {
|
||||||
Curve c = (Curve) enum_.nextElement();
|
Curve c = enum_.nextElement();
|
||||||
if (c.accumulateCrossings(this)) {
|
if (c.accumulateCrossings(this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,11 @@ public abstract class Curve {
|
|||||||
|
|
||||||
protected int direction;
|
protected int direction;
|
||||||
|
|
||||||
public static void insertMove(Vector curves, double x, double y) {
|
public static void insertMove(Vector<Curve> curves, double x, double y) {
|
||||||
curves.add(new Order0(x, y));
|
curves.add(new Order0(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void insertLine(Vector curves,
|
public static void insertLine(Vector<Curve> curves,
|
||||||
double x0, double y0,
|
double x0, double y0,
|
||||||
double x1, double y1)
|
double x1, double y1)
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ public abstract class Curve {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void insertQuad(Vector curves,
|
public static void insertQuad(Vector<Curve> curves,
|
||||||
double x0, double y0,
|
double x0, double y0,
|
||||||
double coords[])
|
double coords[])
|
||||||
{
|
{
|
||||||
@ -82,7 +82,7 @@ public abstract class Curve {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void insertCubic(Vector curves,
|
public static void insertCubic(Vector<Curve> curves,
|
||||||
double x0, double y0,
|
double x0, double y0,
|
||||||
double coords[])
|
double coords[])
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ final class Order2 extends Curve {
|
|||||||
private double ycoeff1;
|
private double ycoeff1;
|
||||||
private double ycoeff2;
|
private double ycoeff2;
|
||||||
|
|
||||||
public static void insert(Vector curves, double tmp[],
|
public static void insert(Vector<Curve> curves, double tmp[],
|
||||||
double x0, double y0,
|
double x0, double y0,
|
||||||
double cx0, double cy0,
|
double cx0, double cy0,
|
||||||
double x1, double y1,
|
double x1, double y1,
|
||||||
@ -74,7 +74,7 @@ final class Order2 extends Curve {
|
|||||||
tmp[i1 + 4], tmp[i1 + 5], direction);
|
tmp[i1 + 4], tmp[i1 + 5], direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addInstance(Vector curves,
|
public static void addInstance(Vector<Curve> curves,
|
||||||
double x0, double y0,
|
double x0, double y0,
|
||||||
double cx0, double cy0,
|
double cx0, double cy0,
|
||||||
double x1, double y1,
|
double x1, double y1,
|
||||||
|
@ -53,7 +53,7 @@ final class Order3 extends Curve {
|
|||||||
private double ycoeff2;
|
private double ycoeff2;
|
||||||
private double ycoeff3;
|
private double ycoeff3;
|
||||||
|
|
||||||
public static void insert(Vector curves, double tmp[],
|
public static void insert(Vector<Curve> curves, double tmp[],
|
||||||
double x0, double y0,
|
double x0, double y0,
|
||||||
double cx0, double cy0,
|
double cx0, double cy0,
|
||||||
double cx1, double cy1,
|
double cx1, double cy1,
|
||||||
@ -105,7 +105,7 @@ final class Order3 extends Curve {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addInstance(Vector curves,
|
public static void addInstance(Vector<Curve> curves,
|
||||||
double x0, double y0,
|
double x0, double y0,
|
||||||
double cx0, double cy0,
|
double cx0, double cy0,
|
||||||
double cx1, double cy1,
|
double cx1, double cy1,
|
||||||
|
@ -51,7 +51,7 @@ public class BufImgSurfaceData extends SurfaceData {
|
|||||||
private BufferedImageGraphicsConfig graphicsConfig;
|
private BufferedImageGraphicsConfig graphicsConfig;
|
||||||
RenderLoops solidloops;
|
RenderLoops solidloops;
|
||||||
|
|
||||||
private static native void initIDs(Class ICM, Class ICMColorData);
|
private static native void initIDs(Class<?> ICM, Class<?> ICMColorData);
|
||||||
|
|
||||||
private static final int DCM_RGBX_RED_MASK = 0xff000000;
|
private static final int DCM_RGBX_RED_MASK = 0xff000000;
|
||||||
private static final int DCM_RGBX_GREEN_MASK = 0x00ff0000;
|
private static final int DCM_RGBX_GREEN_MASK = 0x00ff0000;
|
||||||
|
@ -61,7 +61,7 @@ public class GifImageDecoder extends ImageDecoder {
|
|||||||
int trans_pixel = -1;
|
int trans_pixel = -1;
|
||||||
IndexColorModel global_model;
|
IndexColorModel global_model;
|
||||||
|
|
||||||
Hashtable props = new Hashtable();
|
Hashtable<String, Object> props = new Hashtable<>();
|
||||||
|
|
||||||
byte[] saved_image;
|
byte[] saved_image;
|
||||||
IndexColorModel saved_model;
|
IndexColorModel saved_model;
|
||||||
|
@ -83,7 +83,7 @@ public abstract class ImageDecoder {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int setProperties(Hashtable props) {
|
protected int setProperties(Hashtable<?,?> props) {
|
||||||
ImageConsumerQueue cq = null;
|
ImageConsumerQueue cq = null;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while ((cq = nextConsumer(cq)) != null) {
|
while ((cq = nextConsumer(cq)) != null) {
|
||||||
@ -164,7 +164,7 @@ public abstract class ImageDecoder {
|
|||||||
source.doneDecoding(this);
|
source.doneDecoding(this);
|
||||||
close();
|
close();
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction() {
|
new java.security.PrivilegedAction<Object>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
feeder.interrupt();
|
feeder.interrupt();
|
||||||
return null;
|
return null;
|
||||||
|
@ -152,7 +152,7 @@ class ImageFetcher extends Thread {
|
|||||||
info.numWaiting--;
|
info.numWaiting--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
src = (ImageFetchable) info.waitList.elementAt(0);
|
src = info.waitList.elementAt(0);
|
||||||
info.waitList.removeElement(src);
|
info.waitList.removeElement(src);
|
||||||
}
|
}
|
||||||
return src;
|
return src;
|
||||||
@ -303,26 +303,25 @@ class ImageFetcher extends Thread {
|
|||||||
final ThreadGroup fetcherGroup = fetcherThreadGroup;
|
final ThreadGroup fetcherGroup = fetcherThreadGroup;
|
||||||
|
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction() {
|
new java.security.PrivilegedAction<Object>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
for (int i = 0; i < info.fetchers.length; i++) {
|
for (int i = 0; i < info.fetchers.length; i++) {
|
||||||
if (info.fetchers[i] == null) {
|
if (info.fetchers[i] == null) {
|
||||||
ImageFetcher f = new ImageFetcher(
|
ImageFetcher f = new ImageFetcher(fetcherGroup, i);
|
||||||
fetcherGroup, i);
|
try {
|
||||||
try {
|
f.start();
|
||||||
f.start();
|
info.fetchers[i] = f;
|
||||||
info.fetchers[i] = f;
|
info.numFetchers++;
|
||||||
info.numFetchers++;
|
break;
|
||||||
break;
|
} catch (Error e) {
|
||||||
} catch (Error e) {
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,13 +336,13 @@ class FetcherInfo {
|
|||||||
Thread[] fetchers;
|
Thread[] fetchers;
|
||||||
int numFetchers;
|
int numFetchers;
|
||||||
int numWaiting;
|
int numWaiting;
|
||||||
Vector waitList;
|
Vector<ImageFetchable> waitList;
|
||||||
|
|
||||||
private FetcherInfo() {
|
private FetcherInfo() {
|
||||||
fetchers = new Thread[MAX_NUM_FETCHERS_PER_APPCONTEXT];
|
fetchers = new Thread[MAX_NUM_FETCHERS_PER_APPCONTEXT];
|
||||||
numFetchers = 0;
|
numFetchers = 0;
|
||||||
numWaiting = 0;
|
numWaiting = 0;
|
||||||
waitList = new Vector();
|
waitList = new Vector<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The key to put()/get() the FetcherInfo into/from the AppContext. */
|
/* The key to put()/get() the FetcherInfo into/from the AppContext. */
|
||||||
|
@ -185,7 +185,7 @@ public class ImageRepresentation extends ImageWatched implements ImageConsumer
|
|||||||
protected BufferedImage createImage(ColorModel cm,
|
protected BufferedImage createImage(ColorModel cm,
|
||||||
WritableRaster raster,
|
WritableRaster raster,
|
||||||
boolean isRasterPremultiplied,
|
boolean isRasterPremultiplied,
|
||||||
Hashtable properties)
|
Hashtable<?,?> properties)
|
||||||
{
|
{
|
||||||
BufferedImage bi =
|
BufferedImage bi =
|
||||||
new BufferedImage(cm, raster, isRasterPremultiplied, null);
|
new BufferedImage(cm, raster, isRasterPremultiplied, null);
|
||||||
|
@ -61,7 +61,7 @@ public class ImagingLib {
|
|||||||
private static final int AFFINE_OP = 1;
|
private static final int AFFINE_OP = 1;
|
||||||
private static final int CONVOLVE_OP = 2;
|
private static final int CONVOLVE_OP = 2;
|
||||||
|
|
||||||
private static Class[] nativeOpClass = new Class[NUM_NATIVE_OPS];
|
private static Class<?>[] nativeOpClass = new Class<?>[NUM_NATIVE_OPS];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned value indicates whether the library initailization was
|
* Returned value indicates whether the library initailization was
|
||||||
@ -134,7 +134,7 @@ public class ImagingLib {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getNativeOpIndex(Class opClass) {
|
private static int getNativeOpIndex(Class<?> opClass) {
|
||||||
//
|
//
|
||||||
// Search for this class in cached list of
|
// Search for this class in cached list of
|
||||||
// classes supplying native acceleration
|
// classes supplying native acceleration
|
||||||
|
@ -47,8 +47,8 @@ public class JPEGImageDecoder extends ImageDecoder {
|
|||||||
private static ColorModel ARGBcolormodel;
|
private static ColorModel ARGBcolormodel;
|
||||||
private static ColorModel Graycolormodel;
|
private static ColorModel Graycolormodel;
|
||||||
|
|
||||||
private static final Class InputStreamClass = InputStream.class;
|
private static final Class<?> InputStreamClass = InputStream.class;
|
||||||
private static native void initIDs(Class InputStreamClass);
|
private static native void initIDs(Class<?> InputStreamClass);
|
||||||
|
|
||||||
private ColorModel colormodel;
|
private ColorModel colormodel;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ public class JPEGImageDecoder extends ImageDecoder {
|
|||||||
private native void readImage(InputStream is, byte buf[])
|
private native void readImage(InputStream is, byte buf[])
|
||||||
throws ImageFormatException, IOException;
|
throws ImageFormatException, IOException;
|
||||||
|
|
||||||
Hashtable props = new Hashtable();
|
Hashtable<String, Object> props = new Hashtable<>();
|
||||||
|
|
||||||
public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
|
public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
|
||||||
super(src, is);
|
super(src, is);
|
||||||
|
@ -40,15 +40,15 @@ public class OffScreenImageSource implements ImageProducer {
|
|||||||
BufferedImage image;
|
BufferedImage image;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
Hashtable properties;
|
Hashtable<?, ?> properties;
|
||||||
|
|
||||||
public OffScreenImageSource(BufferedImage image,
|
public OffScreenImageSource(BufferedImage image,
|
||||||
Hashtable properties) {
|
Hashtable<?, ?> properties) {
|
||||||
this.image = image;
|
this.image = image;
|
||||||
if (properties != null) {
|
if (properties != null) {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
} else {
|
} else {
|
||||||
this.properties = new Hashtable();
|
this.properties = new Hashtable<String, Object>();
|
||||||
}
|
}
|
||||||
width = image.getWidth();
|
width = image.getWidth();
|
||||||
height = image.getHeight();
|
height = image.getHeight();
|
||||||
|
@ -68,7 +68,7 @@ public class PNGImageDecoder extends ImageDecoder
|
|||||||
private int filterMethod;
|
private int filterMethod;
|
||||||
private int interlaceMethod;
|
private int interlaceMethod;
|
||||||
private int gamma = 100000;
|
private int gamma = 100000;
|
||||||
private java.util.Hashtable properties;
|
private java.util.Hashtable<String, Object> properties;
|
||||||
/* this is not needed
|
/* this is not needed
|
||||||
ImageConsumer target;
|
ImageConsumer target;
|
||||||
*/
|
*/
|
||||||
@ -83,7 +83,7 @@ public class PNGImageDecoder extends ImageDecoder
|
|||||||
|
|
||||||
private void property(String key,Object value) {
|
private void property(String key,Object value) {
|
||||||
if(value==null) return;
|
if(value==null) return;
|
||||||
if(properties==null) properties=new java.util.Hashtable();
|
if(properties==null) properties=new java.util.Hashtable<>();
|
||||||
properties.put(key,value);
|
properties.put(key,value);
|
||||||
}
|
}
|
||||||
private void property(String key,float value) {
|
private void property(String key,float value) {
|
||||||
|
@ -79,7 +79,7 @@ public class ToolkitImage extends Image {
|
|||||||
|
|
||||||
private int width = -1;
|
private int width = -1;
|
||||||
private int height = -1;
|
private int height = -1;
|
||||||
private Hashtable properties;
|
private Hashtable<?, ?> properties;
|
||||||
|
|
||||||
private int availinfo;
|
private int availinfo;
|
||||||
|
|
||||||
@ -254,9 +254,9 @@ public class ToolkitImage extends Image {
|
|||||||
addInfo(ImageObserver.WIDTH | ImageObserver.HEIGHT);
|
addInfo(ImageObserver.WIDTH | ImageObserver.HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setProperties(Hashtable props) {
|
void setProperties(Hashtable<?, ?> props) {
|
||||||
if (props == null) {
|
if (props == null) {
|
||||||
props = new Hashtable();
|
props = new Hashtable<String, Object>();
|
||||||
}
|
}
|
||||||
properties = props;
|
properties = props;
|
||||||
addInfo(ImageObserver.PROPERTIES);
|
addInfo(ImageObserver.PROPERTIES);
|
||||||
|
@ -127,14 +127,14 @@ public abstract class ShellFolder extends File {
|
|||||||
File[] files = super.listFiles();
|
File[] files = super.listFiles();
|
||||||
|
|
||||||
if (!includeHiddenFiles) {
|
if (!includeHiddenFiles) {
|
||||||
Vector v = new Vector();
|
Vector<File> v = new Vector<>();
|
||||||
int nameCount = (files == null) ? 0 : files.length;
|
int nameCount = (files == null) ? 0 : files.length;
|
||||||
for (int i = 0; i < nameCount; i++) {
|
for (int i = 0; i < nameCount; i++) {
|
||||||
if (!files[i].isHidden()) {
|
if (!files[i].isHidden()) {
|
||||||
v.addElement(files[i]);
|
v.addElement(files[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
files = (File[])v.toArray(new File[v.size()]);
|
files = v.toArray(new File[v.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return files;
|
return files;
|
||||||
@ -208,7 +208,7 @@ public abstract class ShellFolder extends File {
|
|||||||
static {
|
static {
|
||||||
String managerClassName = (String)Toolkit.getDefaultToolkit().
|
String managerClassName = (String)Toolkit.getDefaultToolkit().
|
||||||
getDesktopProperty("Shell.shellFolderManager");
|
getDesktopProperty("Shell.shellFolderManager");
|
||||||
Class managerClass = null;
|
Class<?> managerClass = null;
|
||||||
try {
|
try {
|
||||||
managerClass = ReflectUtil.forName(managerClassName);
|
managerClass = ReflectUtil.forName(managerClassName);
|
||||||
// swallow the exceptions below and use default shell folder
|
// swallow the exceptions below and use default shell folder
|
||||||
@ -554,7 +554,7 @@ public abstract class ShellFolder extends File {
|
|||||||
/**
|
/**
|
||||||
* Provides a default comparator for the default column set
|
* Provides a default comparator for the default column set
|
||||||
*/
|
*/
|
||||||
private static final Comparator DEFAULT_COMPARATOR = new Comparator() {
|
private static final Comparator<Object> DEFAULT_COMPARATOR = new Comparator<Object>() {
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
int gt;
|
int gt;
|
||||||
|
|
||||||
@ -565,7 +565,9 @@ public abstract class ShellFolder extends File {
|
|||||||
} else if (o1 == null && o2 != null) {
|
} else if (o1 == null && o2 != null) {
|
||||||
gt = -1;
|
gt = -1;
|
||||||
} else if (o1 instanceof Comparable) {
|
} else if (o1 instanceof Comparable) {
|
||||||
gt = ((Comparable) o1).compareTo(o2);
|
@SuppressWarnings("unchecked")
|
||||||
|
Comparable<Object> o = (Comparable<Object>) o1;
|
||||||
|
gt = o.compareTo(o2);
|
||||||
} else {
|
} else {
|
||||||
gt = 0;
|
gt = 0;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class ShellFolderColumnInfo {
|
|||||||
*/
|
*/
|
||||||
private Integer alignment;
|
private Integer alignment;
|
||||||
private SortOrder sortOrder;
|
private SortOrder sortOrder;
|
||||||
private Comparator comparator;
|
private Comparator<?> comparator;
|
||||||
/**
|
/**
|
||||||
* <code>false</code> (default) if the {@link comparator} expects folders as arguments,
|
* <code>false</code> (default) if the {@link comparator} expects folders as arguments,
|
||||||
* and <code>true</code> if folder's column values. The first option is used default for comparison
|
* and <code>true</code> if folder's column values. The first option is used default for comparison
|
||||||
@ -49,7 +49,7 @@ public class ShellFolderColumnInfo {
|
|||||||
|
|
||||||
public ShellFolderColumnInfo(String title, Integer width,
|
public ShellFolderColumnInfo(String title, Integer width,
|
||||||
Integer alignment, boolean visible,
|
Integer alignment, boolean visible,
|
||||||
SortOrder sortOrder, Comparator comparator,
|
SortOrder sortOrder, Comparator<?> comparator,
|
||||||
boolean compareByColumn) {
|
boolean compareByColumn) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
@ -62,7 +62,7 @@ public class ShellFolderColumnInfo {
|
|||||||
|
|
||||||
public ShellFolderColumnInfo(String title, Integer width,
|
public ShellFolderColumnInfo(String title, Integer width,
|
||||||
Integer alignment, boolean visible,
|
Integer alignment, boolean visible,
|
||||||
SortOrder sortOrder, Comparator comparator) {
|
SortOrder sortOrder, Comparator<?> comparator) {
|
||||||
this(title, width, alignment, visible, sortOrder, comparator, false);
|
this(title, width, alignment, visible, sortOrder, comparator, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,11 +115,11 @@ public class ShellFolderColumnInfo {
|
|||||||
this.sortOrder = sortOrder;
|
this.sortOrder = sortOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Comparator getComparator() {
|
public Comparator<?> getComparator() {
|
||||||
return comparator;
|
return comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setComparator(Comparator comparator) {
|
public void setComparator(Comparator<?> comparator) {
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,6 +285,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
|
|||||||
* this list
|
* this list
|
||||||
* @throws NullPointerException if the specified array is null
|
* @throws NullPointerException if the specified array is null
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T[] toArray(T[] a) {
|
public <T> T[] toArray(T[] a) {
|
||||||
if (a.length < size)
|
if (a.length < size)
|
||||||
// Make a new array of a's runtime type, but my contents:
|
// Make a new array of a's runtime type, but my contents:
|
||||||
@ -307,7 +308,9 @@ public class IdentityArrayList<E> extends AbstractList<E>
|
|||||||
public E get(int index) {
|
public E get(int index) {
|
||||||
rangeCheck(index);
|
rangeCheck(index);
|
||||||
|
|
||||||
return (E) elementData[index];
|
@SuppressWarnings("unchecked")
|
||||||
|
E rv = (E) elementData[index];
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -322,6 +325,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
|
|||||||
public E set(int index, E element) {
|
public E set(int index, E element) {
|
||||||
rangeCheck(index);
|
rangeCheck(index);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
E oldValue = (E) elementData[index];
|
E oldValue = (E) elementData[index];
|
||||||
elementData[index] = element;
|
elementData[index] = element;
|
||||||
return oldValue;
|
return oldValue;
|
||||||
@ -371,6 +375,7 @@ public class IdentityArrayList<E> extends AbstractList<E>
|
|||||||
rangeCheck(index);
|
rangeCheck(index);
|
||||||
|
|
||||||
modCount++;
|
modCount++;
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
E oldValue = (E) elementData[index];
|
E oldValue = (E) elementData[index];
|
||||||
|
|
||||||
int numMoved = size - index - 1;
|
int numMoved = size - index - 1;
|
||||||
|
@ -280,7 +280,9 @@ public class IdentityLinkedList<E>
|
|||||||
Entry<E> successor = (index==size ? header : entry(index));
|
Entry<E> successor = (index==size ? header : entry(index));
|
||||||
Entry<E> predecessor = successor.previous;
|
Entry<E> predecessor = successor.previous;
|
||||||
for (int i=0; i<numNew; i++) {
|
for (int i=0; i<numNew; i++) {
|
||||||
Entry<E> e = new Entry<E>((E)a[i], successor, predecessor);
|
@SuppressWarnings("unchecked")
|
||||||
|
E tmp = (E) a[i];
|
||||||
|
Entry<E> e = new Entry<E>(tmp, successor, predecessor);
|
||||||
predecessor.next = e;
|
predecessor.next = e;
|
||||||
predecessor = e;
|
predecessor = e;
|
||||||
}
|
}
|
||||||
@ -396,7 +398,7 @@ public class IdentityLinkedList<E>
|
|||||||
*/
|
*/
|
||||||
public int indexOf(Object o) {
|
public int indexOf(Object o) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Entry e = header.next; e != header; e = e.next) {
|
for (Entry<E> e = header.next; e != header; e = e.next) {
|
||||||
if (o == e.element) {
|
if (o == e.element) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
@ -418,7 +420,7 @@ public class IdentityLinkedList<E>
|
|||||||
*/
|
*/
|
||||||
public int lastIndexOf(Object o) {
|
public int lastIndexOf(Object o) {
|
||||||
int index = size;
|
int index = size;
|
||||||
for (Entry e = header.previous; e != header; e = e.previous) {
|
for (Entry<E> e = header.previous; e != header; e = e.previous) {
|
||||||
index--;
|
index--;
|
||||||
if (o == e.element) {
|
if (o == e.element) {
|
||||||
return index;
|
return index;
|
||||||
@ -787,7 +789,7 @@ public class IdentityLinkedList<E>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Adapter to provide descending iterators via ListItr.previous */
|
/** Adapter to provide descending iterators via ListItr.previous */
|
||||||
private class DescendingIterator implements Iterator {
|
private class DescendingIterator implements Iterator<E> {
|
||||||
final ListItr itr = new ListItr(size());
|
final ListItr itr = new ListItr(size());
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
return itr.hasPrevious();
|
return itr.hasPrevious();
|
||||||
@ -860,6 +862,7 @@ public class IdentityLinkedList<E>
|
|||||||
* this list
|
* this list
|
||||||
* @throws NullPointerException if the specified array is null
|
* @throws NullPointerException if the specified array is null
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T[] toArray(T[] a) {
|
public <T> T[] toArray(T[] a) {
|
||||||
if (a.length < size)
|
if (a.length < size)
|
||||||
a = (T[])java.lang.reflect.Array.newInstance(
|
a = (T[])java.lang.reflect.Array.newInstance(
|
||||||
|
@ -207,8 +207,9 @@ public abstract class InfoWindow extends Window {
|
|||||||
textLabel.setText(tooltipString);
|
textLabel.setText(tooltipString);
|
||||||
}
|
}
|
||||||
|
|
||||||
Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() {
|
Point pointer = AccessController.doPrivileged(
|
||||||
public Object run() {
|
new PrivilegedAction<Point>() {
|
||||||
|
public Point run() {
|
||||||
if (!isPointerOverTrayIcon(liveArguments.getBounds())) {
|
if (!isPointerOverTrayIcon(liveArguments.getBounds())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,10 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
|
|
||||||
private final int SCROLLBAR_WIDTH; // Width of a scrollbar
|
private final int SCROLLBAR_WIDTH; // Width of a scrollbar
|
||||||
|
|
||||||
private java.util.List items; // List of items
|
private java.util.List<String> items; // List of items
|
||||||
|
|
||||||
// TODO: maybe this would be better as a simple int[]
|
// TODO: maybe this would be better as a simple int[]
|
||||||
private java.util.List selected; // List of selected items
|
private java.util.List<Integer> selected; // List of selected items
|
||||||
private boolean multiSelect; // Can multiple items be selected
|
private boolean multiSelect; // Can multiple items be selected
|
||||||
// at once?
|
// at once?
|
||||||
private int focusedIndex;
|
private int focusedIndex;
|
||||||
@ -100,8 +100,8 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
this.peer = peer;
|
this.peer = peer;
|
||||||
this.colors = colors;
|
this.colors = colors;
|
||||||
this.multiSelect = multiSelect;
|
this.multiSelect = multiSelect;
|
||||||
items = new ArrayList(initialSize);
|
items = new ArrayList<>(initialSize);
|
||||||
selected = new ArrayList(1);
|
selected = new ArrayList<>(1);
|
||||||
selected.add(Integer.valueOf(-1));
|
selected.add(Integer.valueOf(-1));
|
||||||
|
|
||||||
this.maxVisItems = maxVisItems;
|
this.maxVisItems = maxVisItems;
|
||||||
@ -190,7 +190,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
/* if called for multiselect, return -1 */
|
/* if called for multiselect, return -1 */
|
||||||
public int getSelectedIndex() {
|
public int getSelectedIndex() {
|
||||||
if (!multiSelect) {
|
if (!multiSelect) {
|
||||||
Integer val = (Integer)selected.get(0);
|
Integer val = selected.get(0);
|
||||||
return val.intValue();
|
return val.intValue();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -217,7 +217,7 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getItem(int index) {
|
public String getItem(int index) {
|
||||||
return (String) items.get(index);
|
return items.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@ -576,9 +576,9 @@ public class ListHelper implements XScrollbarClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isItemSelected(int index) {
|
boolean isItemSelected(int index) {
|
||||||
Iterator itr = selected.iterator();
|
Iterator<Integer> itr = selected.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
Integer val = (Integer)itr.next();
|
Integer val = itr.next();
|
||||||
if (val.intValue() == index) {
|
if (val.intValue() == index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
|
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
|
import java.awt.datatransfer.DataFlavor;
|
||||||
|
|
||||||
import java.awt.dnd.DnDConstants;
|
import java.awt.dnd.DnDConstants;
|
||||||
import java.awt.dnd.InvalidDnDOperationException;
|
import java.awt.dnd.InvalidDnDOperationException;
|
||||||
@ -65,7 +66,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeDragImpl(int actions, Transferable contents,
|
protected void initializeDragImpl(int actions, Transferable contents,
|
||||||
Map formatMap, long[] formats)
|
Map<Long, DataFlavor> formatMap, long[] formats)
|
||||||
throws InvalidDnDOperationException,
|
throws InvalidDnDOperationException,
|
||||||
IllegalArgumentException, XException {
|
IllegalArgumentException, XException {
|
||||||
|
|
||||||
|
@ -43,13 +43,12 @@ class Native {
|
|||||||
|
|
||||||
static int dataModel;
|
static int dataModel;
|
||||||
static {
|
static {
|
||||||
String dataModelProp = (String)AccessController.
|
String dataModelProp = AccessController.doPrivileged(
|
||||||
doPrivileged(
|
new PrivilegedAction<String>() {
|
||||||
new PrivilegedAction() {
|
public String run() {
|
||||||
public Object run() {
|
return System.getProperty("sun.arch.data.model");
|
||||||
return System.getProperty("sun.arch.data.model");
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
try {
|
try {
|
||||||
dataModel = Integer.parseInt(dataModelProp);
|
dataModel = Integer.parseInt(dataModelProp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -333,9 +332,9 @@ class Native {
|
|||||||
* Stores Java Vector of Longs into memory. Memory location is treated as array
|
* Stores Java Vector of Longs into memory. Memory location is treated as array
|
||||||
* of native <code>long</code>s
|
* of native <code>long</code>s
|
||||||
*/
|
*/
|
||||||
static void putLong(long ptr, Vector arr) {
|
static void putLong(long ptr, Vector<Long> arr) {
|
||||||
for (int i = 0; i < arr.size(); i ++, ptr += getLongSize()) {
|
for (int i = 0; i < arr.size(); i ++, ptr += getLongSize()) {
|
||||||
putLong(ptr, ((Long)arr.elementAt(i)).longValue());
|
putLong(ptr, arr.elementAt(i).longValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,9 +342,9 @@ class Native {
|
|||||||
* Stores Java Vector of Longs into memory. Memory location is treated as array
|
* Stores Java Vector of Longs into memory. Memory location is treated as array
|
||||||
* of native <code>long</code>s. Array is stored in reverse order
|
* of native <code>long</code>s. Array is stored in reverse order
|
||||||
*/
|
*/
|
||||||
static void putLongReverse(long ptr, Vector arr) {
|
static void putLongReverse(long ptr, Vector<Long> arr) {
|
||||||
for (int i = arr.size()-1; i >= 0; i--, ptr += getLongSize()) {
|
for (int i = arr.size()-1; i >= 0; i--, ptr += getLongSize()) {
|
||||||
putLong(ptr, ((Long)arr.elementAt(i)).longValue());
|
putLong(ptr, arr.elementAt(i).longValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +98,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
|||||||
* should be "good enough" for most cases.
|
* should be "good enough" for most cases.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Map updatedSettings = null;
|
Map<String, Object> updatedSettings = null;
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
try {
|
try {
|
||||||
long display = XToolkit.getDisplay();
|
long display = XToolkit.getDisplay();
|
||||||
@ -112,7 +112,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateXSettings(int screen, long owner) {
|
private void updateXSettings(int screen, long owner) {
|
||||||
final Map updatedSettings = getUpdatedSettings(owner);
|
final Map<String, Object> updatedSettings = getUpdatedSettings(owner);
|
||||||
// this method is called under awt lock and usually on toolkit thread
|
// this method is called under awt lock and usually on toolkit thread
|
||||||
// but parseXSettings() causes public code execution, so we need to transfer
|
// but parseXSettings() causes public code execution, so we need to transfer
|
||||||
// this to EDT
|
// this to EDT
|
||||||
@ -123,7 +123,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map getUpdatedSettings(final long owner) {
|
private Map<String, Object> getUpdatedSettings(final long owner) {
|
||||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
log.fine("owner =" + owner);
|
log.fine("owner =" + owner);
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map settings = null;
|
Map<String, Object> settings = null;
|
||||||
try {
|
try {
|
||||||
WindowPropertyGetter getter =
|
WindowPropertyGetter getter =
|
||||||
new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH,
|
new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH,
|
||||||
|
@ -157,7 +157,7 @@ class XAtomList {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append("[");
|
buf.append("[");
|
||||||
Iterator iter = atoms.iterator();
|
Iterator<XAtom> iter = atoms.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
buf.append(iter.next().toString());
|
buf.append(iter.next().toString());
|
||||||
if (iter.hasNext()) {
|
if (iter.hasNext()) {
|
||||||
|
@ -40,7 +40,7 @@ class XAwtState {
|
|||||||
* The mouse is over this component.
|
* The mouse is over this component.
|
||||||
* If the component is not disabled, it received MOUSE_ENTERED but no MOUSE_EXITED.
|
* If the component is not disabled, it received MOUSE_ENTERED but no MOUSE_EXITED.
|
||||||
*/
|
*/
|
||||||
private static WeakReference componentMouseEnteredRef = null;
|
private static WeakReference<Component> componentMouseEnteredRef = null;
|
||||||
|
|
||||||
static void setComponentMouseEntered(Component component) {
|
static void setComponentMouseEntered(Component component) {
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
@ -50,7 +50,7 @@ class XAwtState {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (component != getComponentMouseEntered()) {
|
if (component != getComponentMouseEntered()) {
|
||||||
componentMouseEnteredRef = new WeakReference(component);
|
componentMouseEnteredRef = new WeakReference<>(component);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
XToolkit.awtUnlock();
|
XToolkit.awtUnlock();
|
||||||
@ -63,7 +63,7 @@ class XAwtState {
|
|||||||
if (componentMouseEnteredRef == null) {
|
if (componentMouseEnteredRef == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (Component)componentMouseEnteredRef.get();
|
return componentMouseEnteredRef.get();
|
||||||
} finally {
|
} finally {
|
||||||
XToolkit.awtUnlock();
|
XToolkit.awtUnlock();
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ class XAwtState {
|
|||||||
return inManualGrab;
|
return inManualGrab;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static WeakReference grabWindowRef = null;
|
private static WeakReference<XBaseWindow> grabWindowRef = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The X Active Grab overrides any other active grab by the same
|
* The X Active Grab overrides any other active grab by the same
|
||||||
@ -112,7 +112,7 @@ class XAwtState {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (grabWindow != getGrabWindow()) {
|
if (grabWindow != getGrabWindow()) {
|
||||||
grabWindowRef = new WeakReference(grabWindow);
|
grabWindowRef = new WeakReference<>(grabWindow);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
XToolkit.awtUnlock();
|
XToolkit.awtUnlock();
|
||||||
@ -125,7 +125,7 @@ class XAwtState {
|
|||||||
if (grabWindowRef == null) {
|
if (grabWindowRef == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
XBaseWindow xbw = (XBaseWindow)grabWindowRef.get();
|
XBaseWindow xbw = grabWindowRef.get();
|
||||||
if( xbw != null && xbw.isDisposed() ) {
|
if( xbw != null && xbw.isDisposed() ) {
|
||||||
xbw = null;
|
xbw = null;
|
||||||
grabWindowRef = null;
|
grabWindowRef = null;
|
||||||
|
@ -231,7 +231,7 @@ abstract public class XBaseMenuWindow extends XWindow {
|
|||||||
*/
|
*/
|
||||||
void instantPreInit(XCreateWindowParams params) {
|
void instantPreInit(XCreateWindowParams params) {
|
||||||
super.instantPreInit(params);
|
super.instantPreInit(params);
|
||||||
items = new ArrayList();
|
items = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************
|
/************************************************
|
||||||
@ -367,10 +367,10 @@ abstract public class XBaseMenuWindow extends XWindow {
|
|||||||
* Clears items vector and loads specified vector
|
* Clears items vector and loads specified vector
|
||||||
* @param items vector to be loaded
|
* @param items vector to be loaded
|
||||||
*/
|
*/
|
||||||
public void reloadItems(Vector items) {
|
public void reloadItems(Vector<? extends MenuItem> items) {
|
||||||
synchronized(getMenuTreeLock()) {
|
synchronized(getMenuTreeLock()) {
|
||||||
this.items.clear();
|
this.items.clear();
|
||||||
MenuItem[] itemArray = (MenuItem[])items.toArray(new MenuItem[] {});
|
MenuItem[] itemArray = items.toArray(new MenuItem[] {});
|
||||||
int itemCnt = itemArray.length;
|
int itemCnt = itemArray.length;
|
||||||
for(int i = 0; i < itemCnt; i++) {
|
for(int i = 0; i < itemCnt; i++) {
|
||||||
addItem(itemArray[i]);
|
addItem(itemArray[i]);
|
||||||
|
@ -236,8 +236,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Class seClass;
|
private static Class<?> seClass;
|
||||||
private static Constructor seCtor;
|
private static Constructor<?> seCtor;
|
||||||
|
|
||||||
final static AWTEvent wrapInSequenced(AWTEvent event) {
|
final static AWTEvent wrapInSequenced(AWTEvent event) {
|
||||||
try {
|
try {
|
||||||
@ -246,9 +246,11 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (seCtor == null) {
|
if (seCtor == null) {
|
||||||
seCtor = (Constructor) AccessController.doPrivileged(new PrivilegedExceptionAction() {
|
seCtor = AccessController.doPrivileged(new
|
||||||
public Object run() throws Exception {
|
PrivilegedExceptionAction<Constructor<?>>() {
|
||||||
Constructor ctor = seClass.getConstructor(new Class[] { AWTEvent.class });
|
public Constructor<?> run() throws Exception {
|
||||||
|
Constructor<?> ctor = seClass.getConstructor(
|
||||||
|
new Class<?>[] { AWTEvent.class });
|
||||||
ctor.setAccessible(true);
|
ctor.setAccessible(true);
|
||||||
return ctor;
|
return ctor;
|
||||||
}
|
}
|
||||||
@ -1322,7 +1324,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTree(Collection order, Set set, Container cont) {
|
private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
|
||||||
for (int i = 0; i < cont.getComponentCount(); i++) {
|
for (int i = 0; i < cont.getComponentCount(); i++) {
|
||||||
Component comp = cont.getComponent(i);
|
Component comp = cont.getComponent(i);
|
||||||
ComponentPeer peer = comp.getPeer();
|
ComponentPeer peer = comp.getPeer();
|
||||||
|
@ -30,7 +30,7 @@ import java.util.Iterator;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@SuppressWarnings("serial") // JDK-implementation class
|
@SuppressWarnings("serial") // JDK-implementation class
|
||||||
public class XCreateWindowParams extends HashMap {
|
public class XCreateWindowParams extends HashMap<Object, Object> {
|
||||||
public XCreateWindowParams() {
|
public XCreateWindowParams() {
|
||||||
}
|
}
|
||||||
public XCreateWindowParams(Object[] map) {
|
public XCreateWindowParams(Object[] map) {
|
||||||
@ -82,9 +82,9 @@ public class XCreateWindowParams extends HashMap {
|
|||||||
}
|
}
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
Iterator eIter = entrySet().iterator();
|
Iterator<Map.Entry<Object, Object>> eIter = entrySet().iterator();
|
||||||
while (eIter.hasNext()) {
|
while (eIter.hasNext()) {
|
||||||
Map.Entry entry = (Map.Entry)eIter.next();
|
Map.Entry<Object, Object> entry = eIter.next();
|
||||||
buf.append(entry.getKey() + ": " + entry.getValue() + "\n");
|
buf.append(entry.getKey() + ": " + entry.getValue() + "\n");
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
@ -49,6 +49,7 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.imageio.ImageReader;
|
||||||
import javax.imageio.ImageTypeSpecifier;
|
import javax.imageio.ImageTypeSpecifier;
|
||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.spi.ImageWriterSpi;
|
import javax.imageio.spi.ImageWriterSpi;
|
||||||
@ -333,7 +334,7 @@ public class XDataTransferer extends DataTransferer {
|
|||||||
// flavors to enable dynamic text native-to-flavor mapping generation.
|
// flavors to enable dynamic text native-to-flavor mapping generation.
|
||||||
// See SystemFlavorMap.getFlavorsForNative() for details.
|
// See SystemFlavorMap.getFlavorsForNative() for details.
|
||||||
if ("image".equals(primaryType)) {
|
if ("image".equals(primaryType)) {
|
||||||
Iterator readers = ImageIO.getImageReadersByMIMEType(baseType);
|
Iterator<ImageReader> readers = ImageIO.getImageReadersByMIMEType(baseType);
|
||||||
if (readers.hasNext()) {
|
if (readers.hasNext()) {
|
||||||
flavors.add(DataFlavor.imageFlavor);
|
flavors.add(DataFlavor.imageFlavor);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
|
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
|
import java.awt.datatransfer.DataFlavor;
|
||||||
|
|
||||||
import java.awt.dnd.DnDConstants;
|
import java.awt.dnd.DnDConstants;
|
||||||
import java.awt.dnd.InvalidDnDOperationException;
|
import java.awt.dnd.InvalidDnDOperationException;
|
||||||
@ -70,7 +71,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
|
|||||||
* @returns true if the initialized successfully.
|
* @returns true if the initialized successfully.
|
||||||
*/
|
*/
|
||||||
protected void initializeDragImpl(int actions, Transferable contents,
|
protected void initializeDragImpl(int actions, Transferable contents,
|
||||||
Map formatMap, long[] formats)
|
Map<Long, DataFlavor> formatMap, long[] formats)
|
||||||
throws InvalidDnDOperationException,
|
throws InvalidDnDOperationException,
|
||||||
IllegalArgumentException, XException {
|
IllegalArgumentException, XException {
|
||||||
assert XToolkit.isAWTLockHeldByCurrentThread();
|
assert XToolkit.isAWTLockHeldByCurrentThread();
|
||||||
|
@ -36,8 +36,8 @@ import java.util.List;
|
|||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
final class XDragAndDropProtocols {
|
final class XDragAndDropProtocols {
|
||||||
private final static List dragProtocols;
|
private final static List<XDragSourceProtocol> dragProtocols;
|
||||||
private final static List dropProtocols;
|
private final static List<XDropTargetProtocol> dropProtocols;
|
||||||
|
|
||||||
public static final String XDnD = "XDnD";
|
public static final String XDnD = "XDnD";
|
||||||
public static final String MotifDnD = "MotifDnD";
|
public static final String MotifDnD = "MotifDnD";
|
||||||
@ -50,7 +50,7 @@ final class XDragAndDropProtocols {
|
|||||||
XDropTargetProtocolListener dropTargetProtocolListener =
|
XDropTargetProtocolListener dropTargetProtocolListener =
|
||||||
XDropTargetContextPeer.getXDropTargetProtocolListener();
|
XDropTargetContextPeer.getXDropTargetProtocolListener();
|
||||||
|
|
||||||
List tDragSourceProtocols = new ArrayList();
|
List<XDragSourceProtocol> tDragSourceProtocols = new ArrayList<>();
|
||||||
XDragSourceProtocol xdndDragSourceProtocol =
|
XDragSourceProtocol xdndDragSourceProtocol =
|
||||||
XDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
|
XDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
|
||||||
tDragSourceProtocols.add(xdndDragSourceProtocol);
|
tDragSourceProtocols.add(xdndDragSourceProtocol);
|
||||||
@ -58,7 +58,7 @@ final class XDragAndDropProtocols {
|
|||||||
MotifDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
|
MotifDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
|
||||||
tDragSourceProtocols.add(motifdndDragSourceProtocol);
|
tDragSourceProtocols.add(motifdndDragSourceProtocol);
|
||||||
|
|
||||||
List tDropTargetProtocols = new ArrayList();
|
List<XDropTargetProtocol> tDropTargetProtocols = new ArrayList<>();
|
||||||
XDropTargetProtocol xdndDropTargetProtocol =
|
XDropTargetProtocol xdndDropTargetProtocol =
|
||||||
XDnDDropTargetProtocol.createInstance(dropTargetProtocolListener);
|
XDnDDropTargetProtocol.createInstance(dropTargetProtocolListener);
|
||||||
tDropTargetProtocols.add(xdndDropTargetProtocol);
|
tDropTargetProtocols.add(xdndDropTargetProtocol);
|
||||||
@ -70,11 +70,11 @@ final class XDragAndDropProtocols {
|
|||||||
dropProtocols = Collections.unmodifiableList(tDropTargetProtocols);
|
dropProtocols = Collections.unmodifiableList(tDropTargetProtocols);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iterator getDragSourceProtocols() {
|
static Iterator<XDragSourceProtocol> getDragSourceProtocols() {
|
||||||
return dragProtocols.iterator();
|
return dragProtocols.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Iterator getDropTargetProtocols() {
|
static Iterator<XDropTargetProtocol> getDropTargetProtocols() {
|
||||||
return dropProtocols.iterator();
|
return dropProtocols.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,10 +88,10 @@ final class XDragAndDropProtocols {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
|
Iterator<XDragSourceProtocol> dragProtocols =
|
||||||
|
XDragAndDropProtocols.getDragSourceProtocols();
|
||||||
while (dragProtocols.hasNext()) {
|
while (dragProtocols.hasNext()) {
|
||||||
XDragSourceProtocol dragProtocol =
|
XDragSourceProtocol dragProtocol = dragProtocols.next();
|
||||||
(XDragSourceProtocol)dragProtocols.next();
|
|
||||||
if (dragProtocol.getProtocolName().equals(name)) {
|
if (dragProtocol.getProtocolName().equals(name)) {
|
||||||
return dragProtocol;
|
return dragProtocol;
|
||||||
}
|
}
|
||||||
@ -110,10 +110,10 @@ final class XDragAndDropProtocols {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator dropProtocols = XDragAndDropProtocols.getDropTargetProtocols();
|
Iterator<XDropTargetProtocol> dropProtocols =
|
||||||
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
while (dropProtocols.hasNext()) {
|
while (dropProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropProtocol =
|
XDropTargetProtocol dropProtocol = dropProtocols.next();
|
||||||
(XDropTargetProtocol)dropProtocols.next();
|
|
||||||
if (dropProtocol.getProtocolName().equals(name)) {
|
if (dropProtocol.getProtocolName().equals(name)) {
|
||||||
return dropProtocol;
|
return dropProtocol;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import java.awt.Component;
|
|||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
|
|
||||||
|
import java.awt.datatransfer.DataFlavor;
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
|
|
||||||
import java.awt.dnd.DnDConstants;
|
import java.awt.dnd.DnDConstants;
|
||||||
@ -110,7 +111,7 @@ public final class XDragSourceContextPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void startDrag(Transferable transferable,
|
protected void startDrag(Transferable transferable,
|
||||||
long[] formats, Map formatMap) {
|
long[] formats, Map<Long, DataFlavor> formatMap) {
|
||||||
Component component = getTrigger().getComponent();
|
Component component = getTrigger().getComponent();
|
||||||
Component c = null;
|
Component c = null;
|
||||||
XWindowPeer wpeer = null;
|
XWindowPeer wpeer = null;
|
||||||
@ -161,9 +162,10 @@ public final class XDragSourceContextPeer
|
|||||||
|
|
||||||
int dropActions = getDragSourceContext().getSourceActions();
|
int dropActions = getDragSourceContext().getSourceActions();
|
||||||
|
|
||||||
Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
|
Iterator<XDragSourceProtocol> dragProtocols =
|
||||||
|
XDragAndDropProtocols.getDragSourceProtocols();
|
||||||
while (dragProtocols.hasNext()) {
|
while (dragProtocols.hasNext()) {
|
||||||
XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
|
XDragSourceProtocol dragProtocol = dragProtocols.next();
|
||||||
try {
|
try {
|
||||||
dragProtocol.initializeDrag(dropActions, transferable,
|
dragProtocol.initializeDrag(dropActions, transferable,
|
||||||
formatMap, formats);
|
formatMap, formats);
|
||||||
@ -313,9 +315,10 @@ public final class XDragSourceContextPeer
|
|||||||
dragDropFinished(false, DnDConstants.ACTION_NONE, xRoot, yRoot);
|
dragDropFinished(false, DnDConstants.ACTION_NONE, xRoot, yRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
|
Iterator<XDragSourceProtocol> dragProtocols =
|
||||||
|
XDragAndDropProtocols.getDragSourceProtocols();
|
||||||
while (dragProtocols.hasNext()) {
|
while (dragProtocols.hasNext()) {
|
||||||
XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
|
XDragSourceProtocol dragProtocol = dragProtocols.next();
|
||||||
try {
|
try {
|
||||||
dragProtocol.cleanup();
|
dragProtocol.cleanup();
|
||||||
} catch (XException xe) {
|
} catch (XException xe) {
|
||||||
@ -418,9 +421,10 @@ public final class XDragSourceContextPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (clientWindow != 0) {
|
if (clientWindow != 0) {
|
||||||
Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
|
Iterator<XDragSourceProtocol> dragProtocols =
|
||||||
|
XDragAndDropProtocols.getDragSourceProtocols();
|
||||||
while (dragProtocols.hasNext()) {
|
while (dragProtocols.hasNext()) {
|
||||||
XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
|
XDragSourceProtocol dragProtocol = dragProtocols.next();
|
||||||
if (dragProtocol.attachTargetWindow(clientWindow, time)) {
|
if (dragProtocol.attachTargetWindow(clientWindow, time)) {
|
||||||
protocol = dragProtocol;
|
protocol = dragProtocol;
|
||||||
break;
|
break;
|
||||||
@ -550,10 +554,10 @@ public final class XDragSourceContextPeer
|
|||||||
|
|
||||||
XClientMessageEvent xclient = ev.get_xclient();
|
XClientMessageEvent xclient = ev.get_xclient();
|
||||||
|
|
||||||
Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
|
Iterator<XDragSourceProtocol> dragProtocols =
|
||||||
|
XDragAndDropProtocols.getDragSourceProtocols();
|
||||||
while (dragProtocols.hasNext()) {
|
while (dragProtocols.hasNext()) {
|
||||||
XDragSourceProtocol dragProtocol =
|
XDragSourceProtocol dragProtocol = dragProtocols.next();
|
||||||
(XDragSourceProtocol)dragProtocols.next();
|
|
||||||
if (dragProtocol.processProxyModeEvent(xclient,
|
if (dragProtocol.processProxyModeEvent(xclient,
|
||||||
getProxyModeSourceWindow())) {
|
getProxyModeSourceWindow())) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
|
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
|
import java.awt.datatransfer.DataFlavor;
|
||||||
|
|
||||||
import java.awt.dnd.DnDConstants;
|
import java.awt.dnd.DnDConstants;
|
||||||
import java.awt.dnd.InvalidDnDOperationException;
|
import java.awt.dnd.InvalidDnDOperationException;
|
||||||
@ -84,7 +85,7 @@ abstract class XDragSourceProtocol {
|
|||||||
* @throws XException if some X call failed.
|
* @throws XException if some X call failed.
|
||||||
*/
|
*/
|
||||||
public final void initializeDrag(int actions, Transferable contents,
|
public final void initializeDrag(int actions, Transferable contents,
|
||||||
Map formatMap, long[] formats)
|
Map<Long, DataFlavor> formatMap, long[] formats)
|
||||||
throws InvalidDnDOperationException,
|
throws InvalidDnDOperationException,
|
||||||
IllegalArgumentException, XException {
|
IllegalArgumentException, XException {
|
||||||
XToolkit.awtLock();
|
XToolkit.awtLock();
|
||||||
@ -110,7 +111,8 @@ abstract class XDragSourceProtocol {
|
|||||||
/* The caller must hold AWT_LOCK. */
|
/* The caller must hold AWT_LOCK. */
|
||||||
protected abstract void initializeDragImpl(int actions,
|
protected abstract void initializeDragImpl(int actions,
|
||||||
Transferable contents,
|
Transferable contents,
|
||||||
Map formatMap, long[] formats)
|
Map<Long, DataFlavor> formatMap,
|
||||||
|
long[] formats)
|
||||||
throws InvalidDnDOperationException, IllegalArgumentException, XException;
|
throws InvalidDnDOperationException, IllegalArgumentException, XException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,12 +89,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer {
|
|||||||
/* If the event was not consumed, send a response to the source. */
|
/* If the event was not consumed, send a response to the source. */
|
||||||
try {
|
try {
|
||||||
if (ctxt != 0 && !e.isConsumed()) {
|
if (ctxt != 0 && !e.isConsumed()) {
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol =
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
dropTargetProtocols.next();
|
||||||
if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
|
if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
|
||||||
returnValue)) {
|
returnValue)) {
|
||||||
break;
|
break;
|
||||||
@ -116,12 +116,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer {
|
|||||||
|
|
||||||
if (ctxt != 0) {
|
if (ctxt != 0) {
|
||||||
try {
|
try {
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol =
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
dropTargetProtocols.next();
|
||||||
if (dropTargetProtocol.sendDropDone(ctxt, success,
|
if (dropTargetProtocol.sendDropDone(ctxt, success,
|
||||||
dropAction)) {
|
dropAction)) {
|
||||||
break;
|
break;
|
||||||
@ -140,12 +140,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer {
|
|||||||
long ctxt = getNativeDragContext();
|
long ctxt = getNativeDragContext();
|
||||||
|
|
||||||
if (ctxt != 0) {
|
if (ctxt != 0) {
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol =
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
dropTargetProtocols.next();
|
||||||
// getData throws IAE if ctxt is not for this protocol.
|
// getData throws IAE if ctxt is not for this protocol.
|
||||||
try {
|
try {
|
||||||
return dropTargetProtocol.getData(ctxt, format);
|
return dropTargetProtocol.getData(ctxt, format);
|
||||||
@ -221,12 +221,11 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer {
|
|||||||
|
|
||||||
public void forwardEventToEmbedded(long embedded, long ctxt,
|
public void forwardEventToEmbedded(long embedded, long ctxt,
|
||||||
int eventID) {
|
int eventID) {
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
if (dropTargetProtocol.forwardEventToEmbedded(embedded, ctxt,
|
if (dropTargetProtocol.forwardEventToEmbedded(embedded, ctxt,
|
||||||
eventID)) {
|
eventID)) {
|
||||||
break;
|
break;
|
||||||
|
@ -79,12 +79,11 @@ final class XDropTargetEventProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (protocol == null) {
|
if (protocol == null) {
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
// Don't try to process it again with the current protocol.
|
// Don't try to process it again with the current protocol.
|
||||||
if (dropTargetProtocol == curProtocol) {
|
if (dropTargetProtocol == curProtocol) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -295,7 +295,8 @@ abstract class XDropTargetProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Access to HashMap is synchronized on this XDropTargetProtocol instance. */
|
/* Access to HashMap is synchronized on this XDropTargetProtocol instance. */
|
||||||
private final HashMap embedderRegistry = new HashMap();
|
private final HashMap<Long, EmbedderRegistryEntry> embedderRegistry =
|
||||||
|
new HashMap<>();
|
||||||
|
|
||||||
protected final void putEmbedderRegistryEntry(long embedder,
|
protected final void putEmbedderRegistryEntry(long embedder,
|
||||||
boolean overriden,
|
boolean overriden,
|
||||||
@ -310,8 +311,7 @@ abstract class XDropTargetProtocol {
|
|||||||
|
|
||||||
protected final EmbedderRegistryEntry getEmbedderRegistryEntry(long embedder) {
|
protected final EmbedderRegistryEntry getEmbedderRegistryEntry(long embedder) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return
|
return embedderRegistry.get(Long.valueOf(embedder));
|
||||||
(EmbedderRegistryEntry)embedderRegistry.get(Long.valueOf(embedder));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +141,10 @@ final class XDropTargetRegistry {
|
|||||||
}
|
}
|
||||||
public long[] getSites() {
|
public long[] getSites() {
|
||||||
long[] ret = new long[sites.size()];
|
long[] ret = new long[sites.size()];
|
||||||
Iterator iter = sites.iterator();
|
Iterator<Long> iter = sites.iterator();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Long l = (Long)iter.next();
|
Long l = iter.next();
|
||||||
ret[index++] = l.longValue();
|
ret[index++] = l.longValue();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -199,14 +199,13 @@ final class XDropTargetRegistry {
|
|||||||
private EmbeddedDropSiteEntry registerEmbedderDropSite(long embedder) {
|
private EmbeddedDropSiteEntry registerEmbedderDropSite(long embedder) {
|
||||||
assert XToolkit.isAWTLockHeldByCurrentThread();
|
assert XToolkit.isAWTLockHeldByCurrentThread();
|
||||||
|
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
// The list of protocols supported by the embedder.
|
// The list of protocols supported by the embedder.
|
||||||
List<XDropTargetProtocol> embedderProtocols = new ArrayList();
|
List<XDropTargetProtocol> embedderProtocols = new ArrayList<>();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
if (dropTargetProtocol.isProtocolSupported(embedder)) {
|
if (dropTargetProtocol.isProtocolSupported(embedder)) {
|
||||||
embedderProtocols.add(dropTargetProtocol);
|
embedderProtocols.add(dropTargetProtocol);
|
||||||
}
|
}
|
||||||
@ -262,7 +261,7 @@ final class XDropTargetRegistry {
|
|||||||
|
|
||||||
private void registerProtocols(long embedder, boolean protocols,
|
private void registerProtocols(long embedder, boolean protocols,
|
||||||
List<XDropTargetProtocol> supportedProtocols) {
|
List<XDropTargetProtocol> supportedProtocols) {
|
||||||
Iterator dropTargetProtocols = null;
|
Iterator<XDropTargetProtocol> dropTargetProtocols = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* By default, we register a drop site that supports all dnd
|
* By default, we register a drop site that supports all dnd
|
||||||
@ -289,8 +288,7 @@ final class XDropTargetRegistry {
|
|||||||
XlibWrapper.XGrabServer(XToolkit.getDisplay());
|
XlibWrapper.XGrabServer(XToolkit.getDisplay());
|
||||||
try {
|
try {
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
if ((protocols == XEMBED_PROTOCOLS) ==
|
if ((protocols == XEMBED_PROTOCOLS) ==
|
||||||
dropTargetProtocol.isXEmbedSupported()) {
|
dropTargetProtocol.isXEmbedSupported()) {
|
||||||
dropTargetProtocol.registerEmbedderDropSite(embedder);
|
dropTargetProtocol.registerEmbedderDropSite(embedder);
|
||||||
@ -310,14 +308,13 @@ final class XDropTargetRegistry {
|
|||||||
|
|
||||||
assert XToolkit.isAWTLockHeldByCurrentThread();
|
assert XToolkit.isAWTLockHeldByCurrentThread();
|
||||||
|
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
// The list of protocols supported by the embedder.
|
// The list of protocols supported by the embedder.
|
||||||
List<XDropTargetProtocol> embedderProtocols = new ArrayList();
|
List<XDropTargetProtocol> embedderProtocols = new ArrayList<>();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
if (dropTargetProtocol.isProtocolSupported(embedder)) {
|
if (dropTargetProtocol.isProtocolSupported(embedder)) {
|
||||||
embedderProtocols.add(dropTargetProtocol);
|
embedderProtocols.add(dropTargetProtocol);
|
||||||
}
|
}
|
||||||
@ -361,8 +358,7 @@ final class XDropTargetRegistry {
|
|||||||
XlibWrapper.XGrabServer(XToolkit.getDisplay());
|
XlibWrapper.XGrabServer(XToolkit.getDisplay());
|
||||||
try {
|
try {
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
if (!isXEmbedServer || !dropTargetProtocol.isXEmbedSupported()) {
|
if (!isXEmbedServer || !dropTargetProtocol.isXEmbedSupported()) {
|
||||||
dropTargetProtocol.registerEmbedderDropSite(embedder);
|
dropTargetProtocol.registerEmbedderDropSite(embedder);
|
||||||
}
|
}
|
||||||
@ -376,7 +372,7 @@ final class XDropTargetRegistry {
|
|||||||
EmbeddedDropSiteEntry entry) {
|
EmbeddedDropSiteEntry entry) {
|
||||||
assert XToolkit.isAWTLockHeldByCurrentThread();
|
assert XToolkit.isAWTLockHeldByCurrentThread();
|
||||||
|
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
/* Grab server, since we are working with the window that belongs to
|
/* Grab server, since we are working with the window that belongs to
|
||||||
@ -384,8 +380,7 @@ final class XDropTargetRegistry {
|
|||||||
XlibWrapper.XGrabServer(XToolkit.getDisplay());
|
XlibWrapper.XGrabServer(XToolkit.getDisplay());
|
||||||
try {
|
try {
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
dropTargetProtocol.unregisterEmbedderDropSite(embedder);
|
dropTargetProtocol.unregisterEmbedderDropSite(embedder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,14 +465,14 @@ final class XDropTargetRegistry {
|
|||||||
registerProtocols(toplevel, XEMBED_PROTOCOLS,
|
registerProtocols(toplevel, XEMBED_PROTOCOLS,
|
||||||
entry.getSupportedProtocols());
|
entry.getSupportedProtocols());
|
||||||
} else {
|
} else {
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
// Register the embedded window as a plain drop site with
|
// Register the embedded window as a plain drop site with
|
||||||
// all DnD protocols that are supported by XEmbed.
|
// all DnD protocols that are supported by XEmbed.
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol =
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
dropTargetProtocols.next();
|
||||||
if (dropTargetProtocol.isXEmbedSupported()) {
|
if (dropTargetProtocol.isXEmbedSupported()) {
|
||||||
dropTargetProtocol.registerEmbedderDropSite(window);
|
dropTargetProtocol.registerEmbedderDropSite(window);
|
||||||
}
|
}
|
||||||
@ -558,12 +553,12 @@ final class XDropTargetRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toplevel == window) {
|
if (toplevel == window) {
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol =
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
dropTargetProtocols.next();
|
||||||
dropTargetProtocol.registerDropTarget(toplevel);
|
dropTargetProtocol.registerDropTarget(toplevel);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -584,13 +579,13 @@ final class XDropTargetRegistry {
|
|||||||
long toplevel = getToplevelWindow(window);
|
long toplevel = getToplevelWindow(window);
|
||||||
|
|
||||||
if (toplevel == window) {
|
if (toplevel == window) {
|
||||||
Iterator dropProtocols =
|
Iterator<XDropTargetProtocol> dropProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
removeDelayedRegistrationEntry(window);
|
removeDelayedRegistrationEntry(window);
|
||||||
|
|
||||||
while (dropProtocols.hasNext()) {
|
while (dropProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropProtocol = (XDropTargetProtocol)dropProtocols.next();
|
XDropTargetProtocol dropProtocol = dropProtocols.next();
|
||||||
dropProtocol.unregisterDropTarget(window);
|
dropProtocol.unregisterDropTarget(window);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -615,12 +610,11 @@ final class XDropTargetRegistry {
|
|||||||
}
|
}
|
||||||
registerEmbeddedDropSite(canvasWindow, clientWindow);
|
registerEmbeddedDropSite(canvasWindow, clientWindow);
|
||||||
|
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
dropTargetProtocol.registerEmbeddedDropSite(clientWindow);
|
dropTargetProtocol.registerEmbeddedDropSite(clientWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,12 +628,11 @@ final class XDropTargetRegistry {
|
|||||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
logger.fine(" XEmbed drop site will be unregistered for " + Long.toHexString(clientWindow));
|
logger.fine(" XEmbed drop site will be unregistered for " + Long.toHexString(clientWindow));
|
||||||
}
|
}
|
||||||
Iterator dropTargetProtocols =
|
Iterator<XDropTargetProtocol> dropTargetProtocols =
|
||||||
XDragAndDropProtocols.getDropTargetProtocols();
|
XDragAndDropProtocols.getDropTargetProtocols();
|
||||||
|
|
||||||
while (dropTargetProtocols.hasNext()) {
|
while (dropTargetProtocols.hasNext()) {
|
||||||
XDropTargetProtocol dropTargetProtocol =
|
XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
|
||||||
(XDropTargetProtocol)dropTargetProtocols.next();
|
|
||||||
dropTargetProtocol.unregisterEmbeddedDropSite(clientWindow);
|
dropTargetProtocol.unregisterEmbeddedDropSite(clientWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import java.lang.reflect.*;
|
|||||||
import sun.awt.AWTAccessor;
|
import sun.awt.AWTAccessor;
|
||||||
|
|
||||||
public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
|
public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
|
||||||
HashMap children = new HashMap();
|
HashMap<Long, java.awt.peer.ComponentPeer> children = new HashMap<>();
|
||||||
|
|
||||||
XEmbeddingContainer() {
|
XEmbeddingContainer() {
|
||||||
}
|
}
|
||||||
|
@ -146,9 +146,9 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
|
|||||||
savedDir = target.getDirectory();
|
savedDir = target.getDirectory();
|
||||||
// Shouldn't save 'user.dir' to 'savedDir'
|
// Shouldn't save 'user.dir' to 'savedDir'
|
||||||
// since getDirectory() will be incorrect after handleCancel
|
// since getDirectory() will be incorrect after handleCancel
|
||||||
userDir = (String)AccessController.doPrivileged(
|
userDir = AccessController.doPrivileged(
|
||||||
new PrivilegedAction() {
|
new PrivilegedAction<String>() {
|
||||||
public Object run() {
|
public String run() {
|
||||||
return System.getProperty("user.dir");
|
return System.getProperty("user.dir");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -70,7 +70,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
ListPainter painter;
|
ListPainter painter;
|
||||||
|
|
||||||
// TODO: ick - Vector?
|
// TODO: ick - Vector?
|
||||||
Vector items;
|
Vector<String> items;
|
||||||
boolean multipleSelections;
|
boolean multipleSelections;
|
||||||
int active = NONE;
|
int active = NONE;
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
super.preInit(params);
|
super.preInit(params);
|
||||||
|
|
||||||
// Stuff that must be initialized before layout() is called
|
// Stuff that must be initialized before layout() is called
|
||||||
items = new Vector();
|
items = new Vector<>();
|
||||||
createVerScrollbar();
|
createVerScrollbar();
|
||||||
createHorScrollbar();
|
createHorScrollbar();
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
int m = 0;
|
int m = 0;
|
||||||
int end = items.size();
|
int end = items.size();
|
||||||
for(int i = 0 ; i < end ; i++) {
|
for(int i = 0 ; i < end ; i++) {
|
||||||
int l = fm.stringWidth(((String)items.elementAt(i)));
|
int l = fm.stringWidth(items.elementAt(i));
|
||||||
m = Math.max(m, l);
|
m = Math.max(m, l);
|
||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
@ -292,7 +292,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
*/
|
*/
|
||||||
int getItemWidth(int i) {
|
int getItemWidth(int i) {
|
||||||
FontMetrics fm = getFontMetrics(getFont());
|
FontMetrics fm = getFontMetrics(getFont());
|
||||||
return fm.stringWidth((String)items.elementAt(i));
|
return fm.stringWidth(items.elementAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -659,7 +659,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
( clickCount % 2 == 0 ) ) {
|
( clickCount % 2 == 0 ) ) {
|
||||||
postEvent(new ActionEvent(target,
|
postEvent(new ActionEvent(target,
|
||||||
ActionEvent.ACTION_PERFORMED,
|
ActionEvent.ACTION_PERFORMED,
|
||||||
(String)items.elementAt(currentIndex),
|
items.elementAt(currentIndex),
|
||||||
mouseEvent.getWhen(),
|
mouseEvent.getWhen(),
|
||||||
mouseEvent.getModifiers())); // No ext mods
|
mouseEvent.getModifiers())); // No ext mods
|
||||||
} else if (active == WINDOW) {
|
} else if (active == WINDOW) {
|
||||||
@ -986,7 +986,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
if (selected.length > 0) {
|
if (selected.length > 0) {
|
||||||
postEvent(new ActionEvent((List)target,
|
postEvent(new ActionEvent((List)target,
|
||||||
ActionEvent.ACTION_PERFORMED,
|
ActionEvent.ACTION_PERFORMED,
|
||||||
(String)items.elementAt(getFocusIndex()),
|
items.elementAt(getFocusIndex()),
|
||||||
e.getWhen(),
|
e.getWhen(),
|
||||||
e.getModifiers())); // ActionEvent doesn't have
|
e.getModifiers())); // ActionEvent doesn't have
|
||||||
// extended modifiers.
|
// extended modifiers.
|
||||||
@ -1343,7 +1343,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
*/
|
*/
|
||||||
public void clear() {
|
public void clear() {
|
||||||
selected = new int[0];
|
selected = new int[0];
|
||||||
items = new Vector();
|
items = new Vector<>();
|
||||||
currentIndex = -1;
|
currentIndex = -1;
|
||||||
// Fixed 6291736: ITEM_STATE_CHANGED triggered after List.removeAll(), XToolkit
|
// Fixed 6291736: ITEM_STATE_CHANGED triggered after List.removeAll(), XToolkit
|
||||||
// We should update 'focusIndex' variable more carefully
|
// We should update 'focusIndex' variable more carefully
|
||||||
@ -1926,7 +1926,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
|
|||||||
} else {
|
} else {
|
||||||
g.setColor(getListForeground());
|
g.setColor(getListForeground());
|
||||||
}
|
}
|
||||||
String str = (String)items.elementAt(index);
|
String str = items.elementAt(index);
|
||||||
g.drawString(str, x - hsb.getValue(), y + fontAscent);
|
g.drawString(str, x - hsb.getValue(), y + fontAscent);
|
||||||
} else {
|
} else {
|
||||||
// Clear the remaining area around the item - focus area and the rest of border
|
// Clear the remaining area around the item - focus area and the rest of border
|
||||||
|
@ -60,7 +60,7 @@ public class XMSelection {
|
|||||||
String selectionName;
|
String selectionName;
|
||||||
|
|
||||||
/* list of listeners to be called for events */
|
/* list of listeners to be called for events */
|
||||||
Vector listeners;
|
Vector<XMSelectionListener> listeners;
|
||||||
|
|
||||||
/* X atom array (one per screen) for this selection */
|
/* X atom array (one per screen) for this selection */
|
||||||
XAtom atoms[];
|
XAtom atoms[];
|
||||||
@ -75,7 +75,7 @@ public class XMSelection {
|
|||||||
|
|
||||||
static XAtom XA_MANAGER;
|
static XAtom XA_MANAGER;
|
||||||
|
|
||||||
static HashMap selectionMap;
|
static HashMap<Long, XMSelection> selectionMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
long display = XToolkit.getDisplay();
|
long display = XToolkit.getDisplay();
|
||||||
@ -90,7 +90,7 @@ public class XMSelection {
|
|||||||
initScreen(display,screen);
|
initScreen(display,screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectionMap = new HashMap();
|
selectionMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initScreen(long display, final int screen) {
|
static void initScreen(long display, final int screen) {
|
||||||
@ -227,7 +227,7 @@ public class XMSelection {
|
|||||||
|
|
||||||
|
|
||||||
static XMSelection getInstance(long selection) {
|
static XMSelection getInstance(long selection) {
|
||||||
return (XMSelection) selectionMap.get(Long.valueOf(selection));
|
return selectionMap.get(Long.valueOf(selection));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ public class XMSelection {
|
|||||||
|
|
||||||
public synchronized void addSelectionListener(XMSelectionListener listener) {
|
public synchronized void addSelectionListener(XMSelectionListener listener) {
|
||||||
if (listeners == null) {
|
if (listeners == null) {
|
||||||
listeners = new Vector();
|
listeners = new Vector<>();
|
||||||
}
|
}
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ public class XMSelection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized Collection getListeners() {
|
synchronized Collection<XMSelectionListener> getListeners() {
|
||||||
return listeners;
|
return listeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,9 +310,9 @@ public class XMSelection {
|
|||||||
log.fine("Selection Changed : Screen = " + screen + "Event =" + ev);
|
log.fine("Selection Changed : Screen = " + screen + "Event =" + ev);
|
||||||
}
|
}
|
||||||
if (listeners != null) {
|
if (listeners != null) {
|
||||||
Iterator iter = listeners.iterator();
|
Iterator<XMSelectionListener> iter = listeners.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
XMSelectionListener disp = (XMSelectionListener) iter.next();
|
XMSelectionListener disp = iter.next();
|
||||||
disp.selectionChanged(screen, this, ev.get_window(), ev);
|
disp.selectionChanged(screen, this, ev.get_window(), ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,9 +323,9 @@ public class XMSelection {
|
|||||||
log.fine("Owner dead : Screen = " + screen + "Event =" + de);
|
log.fine("Owner dead : Screen = " + screen + "Event =" + de);
|
||||||
}
|
}
|
||||||
if (listeners != null) {
|
if (listeners != null) {
|
||||||
Iterator iter = listeners.iterator();
|
Iterator<XMSelectionListener> iter = listeners.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
XMSelectionListener disp = (XMSelectionListener) iter.next();
|
XMSelectionListener disp = iter.next();
|
||||||
disp.ownerDeath(screen, this, de.get_window());
|
disp.ownerDeath(screen, this, de.get_window());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -349,9 +349,9 @@ public class XMSelection {
|
|||||||
|
|
||||||
synchronized void dispatchOwnerChangedEvent(XEvent ev, int screen, long owner, long data, long timestamp) {
|
synchronized void dispatchOwnerChangedEvent(XEvent ev, int screen, long owner, long data, long timestamp) {
|
||||||
if (listeners != null) {
|
if (listeners != null) {
|
||||||
Iterator iter = listeners.iterator();
|
Iterator<XMSelectionListener> iter = listeners.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
XMSelectionListener disp = (XMSelectionListener) iter.next();
|
XMSelectionListener disp = iter.next();
|
||||||
disp.ownerChanged(screen,this, owner, data, timestamp);
|
disp.ownerChanged(screen,this, owner, data, timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,10 +195,10 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
|
|||||||
void postInit(XCreateWindowParams params) {
|
void postInit(XCreateWindowParams params) {
|
||||||
super.postInit(params);
|
super.postInit(params);
|
||||||
// Get menus from the target.
|
// Get menus from the target.
|
||||||
Vector targetMenuVector = AWTAccessor.getMenuBarAccessor()
|
Vector<Menu> targetMenuVector = AWTAccessor.getMenuBarAccessor()
|
||||||
.getMenus(menuBarTarget);
|
.getMenus(menuBarTarget);
|
||||||
Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor()
|
Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor()
|
||||||
.getHelpMenu(menuBarTarget);
|
.getHelpMenu(menuBarTarget);
|
||||||
reloadItems(targetMenuVector);
|
reloadItems(targetMenuVector);
|
||||||
if (targetHelpMenu != null) {
|
if (targetHelpMenu != null) {
|
||||||
addHelpMenu(targetHelpMenu);
|
addHelpMenu(targetHelpMenu);
|
||||||
|
@ -143,7 +143,7 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
|
|||||||
* Access to target's fields
|
* Access to target's fields
|
||||||
*
|
*
|
||||||
************************************************/
|
************************************************/
|
||||||
Vector getTargetItems() {
|
Vector<MenuItem> getTargetItems() {
|
||||||
return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget());
|
return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public class XMenuWindow extends XBaseMenuWindow {
|
|||||||
this.menuPeer = menuPeer;
|
this.menuPeer = menuPeer;
|
||||||
this.target = menuPeer.getContainer().target;
|
this.target = menuPeer.getContainer().target;
|
||||||
// Get menus from the target.
|
// Get menus from the target.
|
||||||
Vector targetItemVector = null;
|
Vector<MenuItem> targetItemVector = null;
|
||||||
targetItemVector = getMenuTargetItems();
|
targetItemVector = getMenuTargetItems();
|
||||||
reloadItems(targetItemVector);
|
reloadItems(targetItemVector);
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ public class XMenuWindow extends XBaseMenuWindow {
|
|||||||
* Reads vector of items from target
|
* Reads vector of items from target
|
||||||
* This function is overriden in XPopupMenuPeer
|
* This function is overriden in XPopupMenuPeer
|
||||||
*/
|
*/
|
||||||
Vector getMenuTargetItems() {
|
Vector<MenuItem> getMenuTargetItems() {
|
||||||
return menuPeer.getTargetItems();
|
return menuPeer.getTargetItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
|||||||
public void show(Event e) {
|
public void show(Event e) {
|
||||||
target = (Component)e.target;
|
target = (Component)e.target;
|
||||||
// Get menus from the target.
|
// Get menus from the target.
|
||||||
Vector targetItemVector = getMenuTargetItems();
|
Vector<MenuItem> targetItemVector = getMenuTargetItems();
|
||||||
if (targetItemVector != null) {
|
if (targetItemVector != null) {
|
||||||
reloadItems(targetItemVector);
|
reloadItems(targetItemVector);
|
||||||
//Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang
|
//Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang
|
||||||
@ -188,7 +188,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
|
|||||||
return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
|
return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector getMenuTargetItems() {
|
Vector<MenuItem> getMenuTargetItems() {
|
||||||
if (popupMenuTarget == null) {
|
if (popupMenuTarget == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package sun.awt.X11;
|
package sun.awt.X11;
|
||||||
|
|
||||||
|
import java.awt.datatransfer.DataFlavor;
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -87,7 +88,7 @@ public final class XSelection {
|
|||||||
/* The contents supplied by the current owner. */
|
/* The contents supplied by the current owner. */
|
||||||
private Transferable contents = null;
|
private Transferable contents = null;
|
||||||
/* The format-to-flavor map for the current owner. */
|
/* The format-to-flavor map for the current owner. */
|
||||||
private Map formatMap = null;
|
private Map<Long, DataFlavor> formatMap = null;
|
||||||
/* The formats supported by the current owner was set. */
|
/* The formats supported by the current owner was set. */
|
||||||
private long[] formats = null;
|
private long[] formats = null;
|
||||||
/* The AppContext in which the current owner was set. */
|
/* The AppContext in which the current owner was set. */
|
||||||
@ -134,7 +135,8 @@ public final class XSelection {
|
|||||||
return selectionAtom;
|
return selectionAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean setOwner(Transferable contents, Map formatMap,
|
public synchronized boolean setOwner(Transferable contents,
|
||||||
|
Map<Long, DataFlavor> formatMap,
|
||||||
long[] formats, long time)
|
long[] formats, long time)
|
||||||
{
|
{
|
||||||
long owner = XWindow.getXAWTRootWindow().getWindow();
|
long owner = XWindow.getXAWTRootWindow().getWindow();
|
||||||
|
@ -36,6 +36,7 @@ import java.awt.dnd.DragGestureRecognizer;
|
|||||||
import java.awt.dnd.MouseDragGestureRecognizer;
|
import java.awt.dnd.MouseDragGestureRecognizer;
|
||||||
import java.awt.dnd.InvalidDnDOperationException;
|
import java.awt.dnd.InvalidDnDOperationException;
|
||||||
import java.awt.dnd.peer.DragSourceContextPeer;
|
import java.awt.dnd.peer.DragSourceContextPeer;
|
||||||
|
import java.awt.font.TextAttribute;
|
||||||
import java.awt.im.InputMethodHighlight;
|
import java.awt.im.InputMethodHighlight;
|
||||||
import java.awt.im.spi.InputMethodDescriptor;
|
import java.awt.im.spi.InputMethodDescriptor;
|
||||||
import java.awt.image.ColorModel;
|
import java.awt.image.ColorModel;
|
||||||
@ -99,9 +100,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
private FontConfigManager fcManager = new FontConfigManager();
|
private FontConfigManager fcManager = new FontConfigManager();
|
||||||
|
|
||||||
static int arrowCursor;
|
static int arrowCursor;
|
||||||
static TreeMap winMap = new TreeMap();
|
static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
|
||||||
static HashMap specialPeerMap = new HashMap();
|
static HashMap<Object, Object> specialPeerMap = new HashMap<>();
|
||||||
static HashMap winToDispatcher = new HashMap();
|
static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
|
||||||
private static long _display;
|
private static long _display;
|
||||||
static UIDefaults uidefaults;
|
static UIDefaults uidefaults;
|
||||||
static X11GraphicsEnvironment localEnv;
|
static X11GraphicsEnvironment localEnv;
|
||||||
@ -358,16 +359,16 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
static XBaseWindow windowToXWindow(long window) {
|
static XBaseWindow windowToXWindow(long window) {
|
||||||
synchronized(winMap) {
|
synchronized(winMap) {
|
||||||
return (XBaseWindow) winMap.get(Long.valueOf(window));
|
return winMap.get(Long.valueOf(window));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addEventDispatcher(long window, XEventDispatcher dispatcher) {
|
static void addEventDispatcher(long window, XEventDispatcher dispatcher) {
|
||||||
synchronized(winToDispatcher) {
|
synchronized(winToDispatcher) {
|
||||||
Long key = Long.valueOf(window);
|
Long key = Long.valueOf(window);
|
||||||
Collection dispatchers = (Collection)winToDispatcher.get(key);
|
Collection<XEventDispatcher> dispatchers = winToDispatcher.get(key);
|
||||||
if (dispatchers == null) {
|
if (dispatchers == null) {
|
||||||
dispatchers = new Vector();
|
dispatchers = new Vector<>();
|
||||||
winToDispatcher.put(key, dispatchers);
|
winToDispatcher.put(key, dispatchers);
|
||||||
}
|
}
|
||||||
dispatchers.add(dispatcher);
|
dispatchers.add(dispatcher);
|
||||||
@ -376,7 +377,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
static void removeEventDispatcher(long window, XEventDispatcher dispatcher) {
|
static void removeEventDispatcher(long window, XEventDispatcher dispatcher) {
|
||||||
synchronized(winToDispatcher) {
|
synchronized(winToDispatcher) {
|
||||||
Long key = Long.valueOf(window);
|
Long key = Long.valueOf(window);
|
||||||
Collection dispatchers = (Collection)winToDispatcher.get(key);
|
Collection<XEventDispatcher> dispatchers = winToDispatcher.get(key);
|
||||||
if (dispatchers != null) {
|
if (dispatchers != null) {
|
||||||
dispatchers.remove(dispatcher);
|
dispatchers.remove(dispatcher);
|
||||||
}
|
}
|
||||||
@ -493,18 +494,18 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
XBaseWindow.dispatchToWindow(ev);
|
XBaseWindow.dispatchToWindow(ev);
|
||||||
|
|
||||||
Collection dispatchers = null;
|
Collection<XEventDispatcher> dispatchers = null;
|
||||||
synchronized(winToDispatcher) {
|
synchronized(winToDispatcher) {
|
||||||
Long key = Long.valueOf(xany.get_window());
|
Long key = Long.valueOf(xany.get_window());
|
||||||
dispatchers = (Collection)winToDispatcher.get(key);
|
dispatchers = winToDispatcher.get(key);
|
||||||
if (dispatchers != null) { // Clone it to avoid synchronization during dispatching
|
if (dispatchers != null) { // Clone it to avoid synchronization during dispatching
|
||||||
dispatchers = new Vector(dispatchers);
|
dispatchers = new Vector<>(dispatchers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dispatchers != null) {
|
if (dispatchers != null) {
|
||||||
Iterator iter = dispatchers.iterator();
|
Iterator<XEventDispatcher> iter = dispatchers.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
XEventDispatcher disp = (XEventDispatcher)iter.next();
|
XEventDispatcher disp = iter.next();
|
||||||
disp.dispatchEvent(ev);
|
disp.dispatchEvent(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -764,7 +765,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
|
|
||||||
Insets insets = new Insets(0, 0, 0, 0);
|
Insets insets = new Insets(0, 0, 0, 0);
|
||||||
|
|
||||||
java.util.List search = new LinkedList();
|
java.util.List<Object> search = new LinkedList<>();
|
||||||
search.add(root);
|
search.add(root);
|
||||||
search.add(0);
|
search.add(0);
|
||||||
while (!search.isEmpty())
|
while (!search.isEmpty())
|
||||||
@ -929,6 +930,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
return XDragSourceContextPeer.createDragSourceContextPeer(dge);
|
return XDragSourceContextPeer.createDragSourceContextPeer(dge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends DragGestureRecognizer> T
|
public <T extends DragGestureRecognizer> T
|
||||||
createDragGestureRecognizer(Class<T> recognizerClass,
|
createDragGestureRecognizer(Class<T> recognizerClass,
|
||||||
DragSource ds,
|
DragSource ds,
|
||||||
@ -1147,7 +1149,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
return 2; // Black and white.
|
return 2; // Black and white.
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
|
public Map<TextAttribute, ?> mapInputMethodHighlight( InputMethodHighlight highlight) {
|
||||||
return XInputMethod.mapInputMethodHighlight(highlight);
|
return XInputMethod.mapInputMethodHighlight(highlight);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -1338,31 +1340,25 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
static void dumpPeers() {
|
static void dumpPeers() {
|
||||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||||
log.fine("Mapped windows:");
|
log.fine("Mapped windows:");
|
||||||
Iterator iter = winMap.entrySet().iterator();
|
winMap.forEach((k, v) -> {
|
||||||
while (iter.hasNext()) {
|
log.fine(k + "->" + v);
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
if (v instanceof XComponentPeer) {
|
||||||
log.fine(entry.getKey() + "->" + entry.getValue());
|
Component target = (Component)((XComponentPeer)v).getTarget();
|
||||||
if (entry.getValue() instanceof XComponentPeer) {
|
|
||||||
Component target = (Component)((XComponentPeer)entry.getValue()).getTarget();
|
|
||||||
log.fine("\ttarget: " + target);
|
log.fine("\ttarget: " + target);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
SunToolkit.dumpPeers(log);
|
SunToolkit.dumpPeers(log);
|
||||||
|
|
||||||
log.fine("Mapped special peers:");
|
log.fine("Mapped special peers:");
|
||||||
iter = specialPeerMap.entrySet().iterator();
|
specialPeerMap.forEach((k, v) -> {
|
||||||
while (iter.hasNext()) {
|
log.fine(k + "->" + v);
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
});
|
||||||
log.fine(entry.getKey() + "->" + entry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
log.fine("Mapped dispatchers:");
|
log.fine("Mapped dispatchers:");
|
||||||
iter = winToDispatcher.entrySet().iterator();
|
winToDispatcher.forEach((k, v) -> {
|
||||||
while (iter.hasNext()) {
|
log.fine(k + "->" + v);
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
});
|
||||||
log.fine(entry.getKey() + "->" + entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1586,16 +1582,16 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
* <code>loadXSettings</code>. It is called from the System EDT
|
* <code>loadXSettings</code>. It is called from the System EDT
|
||||||
* if triggered by an XSETTINGS change.
|
* if triggered by an XSETTINGS change.
|
||||||
*/
|
*/
|
||||||
void parseXSettings(int screen_XXX_ignored,Map updatedSettings) {
|
void parseXSettings(int screen_XXX_ignored,Map<String, Object> updatedSettings) {
|
||||||
|
|
||||||
if (updatedSettings == null || updatedSettings.isEmpty()) {
|
if (updatedSettings == null || updatedSettings.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator i = updatedSettings.entrySet().iterator();
|
Iterator<Map.Entry<String, Object>> i = updatedSettings.entrySet().iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
Map.Entry e = (Map.Entry)i.next();
|
Map.Entry<String, Object> e = i.next();
|
||||||
String name = (String)e.getKey();
|
String name = e.getKey();
|
||||||
|
|
||||||
name = "gnome." + name;
|
name = "gnome." + name;
|
||||||
setDesktopProperty(name, e.getValue());
|
setDesktopProperty(name, e.getValue());
|
||||||
@ -1692,7 +1688,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
long window = 0;
|
long window = 0;
|
||||||
try{
|
try{
|
||||||
// get any application window
|
// get any application window
|
||||||
window = ((Long)(winMap.firstKey())).longValue();
|
window = winMap.firstKey().longValue();
|
||||||
}catch(NoSuchElementException nex) {
|
}catch(NoSuchElementException nex) {
|
||||||
// get root window
|
// get root window
|
||||||
window = getDefaultRootWindow();
|
window = getDefaultRootWindow();
|
||||||
@ -1798,7 +1794,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static SortedMap timeoutTasks;
|
private static SortedMap<Long, java.util.List<Runnable>> timeoutTasks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removed the task from the list of waiting-to-be called tasks.
|
* Removed the task from the list of waiting-to-be called tasks.
|
||||||
@ -1819,10 +1815,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Collection values = timeoutTasks.values();
|
Collection<java.util.List<Runnable>> values = timeoutTasks.values();
|
||||||
Iterator iter = values.iterator();
|
Iterator<java.util.List<Runnable>> iter = values.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
java.util.List list = (java.util.List)iter.next();
|
java.util.List<Runnable> list = iter.next();
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
if (list.contains(task)) {
|
if (list.contains(task)) {
|
||||||
list.remove(task);
|
list.remove(task);
|
||||||
@ -1869,13 +1865,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (timeoutTasks == null) {
|
if (timeoutTasks == null) {
|
||||||
timeoutTasks = new TreeMap();
|
timeoutTasks = new TreeMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Long time = Long.valueOf(System.currentTimeMillis() + interval);
|
Long time = Long.valueOf(System.currentTimeMillis() + interval);
|
||||||
java.util.List tasks = (java.util.List)timeoutTasks.get(time);
|
java.util.List<Runnable> tasks = timeoutTasks.get(time);
|
||||||
if (tasks == null) {
|
if (tasks == null) {
|
||||||
tasks = new ArrayList(1);
|
tasks = new ArrayList<>(1);
|
||||||
timeoutTasks.put(time, tasks);
|
timeoutTasks.put(time, tasks);
|
||||||
}
|
}
|
||||||
tasks.add(task);
|
tasks.add(task);
|
||||||
@ -1897,7 +1893,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
if (timeoutTasks == null || timeoutTasks.isEmpty()) {
|
if (timeoutTasks == null || timeoutTasks.isEmpty()) {
|
||||||
return -1L;
|
return -1L;
|
||||||
}
|
}
|
||||||
return (Long)timeoutTasks.firstKey();
|
return timeoutTasks.firstKey();
|
||||||
} finally {
|
} finally {
|
||||||
awtUnlock();
|
awtUnlock();
|
||||||
}
|
}
|
||||||
@ -1918,13 +1914,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Long currentTime = Long.valueOf(System.currentTimeMillis());
|
Long currentTime = Long.valueOf(System.currentTimeMillis());
|
||||||
Long time = (Long)timeoutTasks.firstKey();
|
Long time = timeoutTasks.firstKey();
|
||||||
|
|
||||||
while (time.compareTo(currentTime) <= 0) {
|
while (time.compareTo(currentTime) <= 0) {
|
||||||
java.util.List tasks = (java.util.List)timeoutTasks.remove(time);
|
java.util.List<Runnable> tasks = timeoutTasks.remove(time);
|
||||||
|
|
||||||
for (Iterator iter = tasks.iterator(); iter.hasNext();) {
|
for (Iterator<Runnable> iter = tasks.iterator(); iter.hasNext();) {
|
||||||
Runnable task = (Runnable)iter.next();
|
Runnable task = iter.next();
|
||||||
|
|
||||||
if (timeoutTaskLog.isLoggable(PlatformLogger.Level.FINER)) {
|
if (timeoutTaskLog.isLoggable(PlatformLogger.Level.FINER)) {
|
||||||
timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" +
|
timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" +
|
||||||
@ -1943,7 +1939,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
|||||||
if (timeoutTasks.isEmpty()) {
|
if (timeoutTasks.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
time = (Long)timeoutTasks.firstKey();
|
time = timeoutTasks.firstKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class XTrayIconPeer implements TrayIconPeer,
|
|||||||
// Fix for 6317038: as EmbeddedFrame is instance of Frame, it is blocked
|
// Fix for 6317038: as EmbeddedFrame is instance of Frame, it is blocked
|
||||||
// by modal dialogs, but in the case of TrayIcon it shouldn't. So we
|
// by modal dialogs, but in the case of TrayIcon it shouldn't. So we
|
||||||
// set ModalExclusion property on it.
|
// set ModalExclusion property on it.
|
||||||
AccessController.doPrivileged(new PrivilegedAction() {
|
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
eframe.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
|
eframe.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
|
||||||
return null;
|
return null;
|
||||||
|
@ -1072,6 +1072,7 @@ final class XWM
|
|||||||
* Returns all protocols supporting given protocol interface
|
* Returns all protocols supporting given protocol interface
|
||||||
*/
|
*/
|
||||||
<T> Collection<T> getProtocols(Class<T> protocolInterface) {
|
<T> Collection<T> getProtocols(Class<T> protocolInterface) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
Collection<T> res = (Collection<T>) protocolsMap.get(protocolInterface);
|
Collection<T> res = (Collection<T>) protocolsMap.get(protocolInterface);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
return res;
|
return res;
|
||||||
@ -1322,9 +1323,9 @@ final class XWM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap storedInsets = new HashMap();
|
HashMap<Class<?>, Insets> storedInsets = new HashMap<>();
|
||||||
Insets guessInsets(XDecoratedPeer window) {
|
Insets guessInsets(XDecoratedPeer window) {
|
||||||
Insets res = (Insets)storedInsets.get(window.getClass());
|
Insets res = storedInsets.get(window.getClass());
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
switch (WMID) {
|
switch (WMID) {
|
||||||
case ENLIGHTEN_WM:
|
case ENLIGHTEN_WM:
|
||||||
|
@ -59,7 +59,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
static int lastX = 0, lastY = 0;
|
static int lastX = 0, lastY = 0;
|
||||||
static long lastTime = 0;
|
static long lastTime = 0;
|
||||||
static long lastButton = 0;
|
static long lastButton = 0;
|
||||||
static WeakReference lastWindowRef = null;
|
static WeakReference<XWindow> lastWindowRef = null;
|
||||||
static int clickCount = 0;
|
static int clickCount = 0;
|
||||||
|
|
||||||
// used to check if we need to re-create surfaceData.
|
// used to check if we need to re-create surfaceData.
|
||||||
@ -692,7 +692,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
if (type == XConstants.ButtonPress) {
|
if (type == XConstants.ButtonPress) {
|
||||||
//Allow this mouse button to generate CLICK event on next ButtonRelease
|
//Allow this mouse button to generate CLICK event on next ButtonRelease
|
||||||
mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton);
|
mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton);
|
||||||
XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
|
XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
|
||||||
/*
|
/*
|
||||||
multiclick checking
|
multiclick checking
|
||||||
*/
|
*/
|
||||||
@ -705,7 +705,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
clickCount++;
|
clickCount++;
|
||||||
} else {
|
} else {
|
||||||
clickCount = 1;
|
clickCount = 1;
|
||||||
lastWindowRef = new WeakReference(this);
|
lastWindowRef = new WeakReference<>(this);
|
||||||
lastButton = lbutton;
|
lastButton = lbutton;
|
||||||
lastX = x;
|
lastX = x;
|
||||||
lastY = y;
|
lastY = y;
|
||||||
@ -820,7 +820,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
|||||||
*/
|
*/
|
||||||
int x = xme.get_x();
|
int x = xme.get_x();
|
||||||
int y = xme.get_y();
|
int y = xme.get_y();
|
||||||
XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
|
XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
|
||||||
|
|
||||||
if (!(lastWindow == this &&
|
if (!(lastWindow == this &&
|
||||||
(xme.get_time() - lastTime) < XToolkit.getMultiClickTime() &&
|
(xme.get_time() - lastTime) < XToolkit.getMultiClickTime() &&
|
||||||
|
@ -950,7 +950,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
|||||||
// make new hash of toplevels of all windows from 'windows' hash.
|
// make new hash of toplevels of all windows from 'windows' hash.
|
||||||
// FIXME: do not call them "toplevel" as it is misleading.
|
// FIXME: do not call them "toplevel" as it is misleading.
|
||||||
//
|
//
|
||||||
HashSet toplevels = new HashSet();
|
HashSet<Long> toplevels = new HashSet<>();
|
||||||
long topl = 0, mytopl = 0;
|
long topl = 0, mytopl = 0;
|
||||||
|
|
||||||
for (XWindowPeer xp : windows) {
|
for (XWindowPeer xp : windows) {
|
||||||
|
@ -47,7 +47,7 @@ public abstract class X11CustomCursor extends CustomCursor {
|
|||||||
protected void createNativeCursor(Image im, int[] pixels, int width, int height,
|
protected void createNativeCursor(Image im, int[] pixels, int width, int height,
|
||||||
int xHotSpot, int yHotSpot) {
|
int xHotSpot, int yHotSpot) {
|
||||||
|
|
||||||
class CCount implements Comparable {
|
class CCount implements Comparable<CCount> {
|
||||||
int color;
|
int color;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ public abstract class X11CustomCursor extends CustomCursor {
|
|||||||
count = ct;
|
count = ct;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(Object cc) {
|
public int compareTo(CCount cc) {
|
||||||
return ((CCount)cc).count - count;
|
return cc.count - count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
* E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font
|
* E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font
|
||||||
* configuration files. We need to remove that part for comparisons.
|
* configuration files. We need to remove that part for comparisons.
|
||||||
*/
|
*/
|
||||||
private static Map fontNameMap = new HashMap();
|
private static Map<String, String> fontNameMap = new HashMap<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xlfdMap is a map from a platform path like
|
* xlfdMap is a map from a platform path like
|
||||||
@ -72,7 +72,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
* the full XLFD string like :-
|
* the full XLFD string like :-
|
||||||
* "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0"
|
* "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0"
|
||||||
*/
|
*/
|
||||||
private static Map xlfdMap = new HashMap();
|
private static Map<String, Vector<String>> xlfdMap = new HashMap<>();
|
||||||
|
|
||||||
/* xFontDirsMap is also a map from a font ID to a font filepath.
|
/* xFontDirsMap is also a map from a font ID to a font filepath.
|
||||||
* The difference from fontNameMap is just that it does not have
|
* The difference from fontNameMap is just that it does not have
|
||||||
@ -88,7 +88,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
* X11 font directory, then precautions must be taken to include both
|
* X11 font directory, then precautions must be taken to include both
|
||||||
* directories.
|
* directories.
|
||||||
*/
|
*/
|
||||||
private static Map xFontDirsMap;
|
private static Map<String, String> xFontDirsMap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the set of font directories needed to be on the X font path
|
* This is the set of font directories needed to be on the X font path
|
||||||
@ -121,7 +121,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
* of the singleton GE instance is already synchronised and that is
|
* of the singleton GE instance is already synchronised and that is
|
||||||
* the only code path that accesses this map.
|
* the only code path that accesses this map.
|
||||||
*/
|
*/
|
||||||
private static HashMap registeredDirs = new HashMap();
|
private static HashMap<String, Object> registeredDirs = new HashMap<>();
|
||||||
|
|
||||||
/* Array of directories to be added to the X11 font path.
|
/* Array of directories to be added to the X11 font path.
|
||||||
* Used by static method called from Toolkits which use X11 fonts.
|
* Used by static method called from Toolkits which use X11 fonts.
|
||||||
@ -183,7 +183,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
* Add this XLFD (platform name) to the list of known
|
* Add this XLFD (platform name) to the list of known
|
||||||
* ones for this file.
|
* ones for this file.
|
||||||
*/
|
*/
|
||||||
Vector xVal = (Vector) xlfdMap.get(fileName);
|
Vector<String> xVal = xlfdMap.get(fileName);
|
||||||
if (xVal == null) {
|
if (xVal == null) {
|
||||||
/* Try to be robust on Linux distros which move fonts
|
/* Try to be robust on Linux distros which move fonts
|
||||||
* around by verifying that the fileName represents a
|
* around by verifying that the fileName represents a
|
||||||
@ -194,7 +194,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
fileName = null;
|
fileName = null;
|
||||||
}
|
}
|
||||||
if (fileName != null) {
|
if (fileName != null) {
|
||||||
xVal = new Vector();
|
xVal = new Vector<>();
|
||||||
xVal.add(platName);
|
xVal.add(platName);
|
||||||
xlfdMap.put(fileName, xVal);
|
xlfdMap.put(fileName, xVal);
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fontID != null) {
|
if (fontID != null) {
|
||||||
fileName = (String)fontNameMap.get(fontID);
|
fileName = fontNameMap.get(fontID);
|
||||||
/* On Linux check for the Lucida Oblique fonts */
|
/* On Linux check for the Lucida Oblique fonts */
|
||||||
if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) {
|
if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) {
|
||||||
if (oblmap == null) {
|
if (oblmap == null) {
|
||||||
@ -235,7 +235,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
FontUtilities.getLogger()
|
FontUtilities.getLogger()
|
||||||
.warning("** Finished registering all font paths");
|
.warning("** Finished registering all font paths");
|
||||||
}
|
}
|
||||||
fileName = (String)fontNameMap.get(fontID);
|
fileName = fontNameMap.get(fontID);
|
||||||
}
|
}
|
||||||
if (fileName == null && !isHeadless()) {
|
if (fileName == null && !isHeadless()) {
|
||||||
/* Query X11 directly to see if this font is available
|
/* Query X11 directly to see if this font is available
|
||||||
@ -245,7 +245,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
}
|
}
|
||||||
if (fileName == null) {
|
if (fileName == null) {
|
||||||
fontID = switchFontIDForName(platName);
|
fontID = switchFontIDForName(platName);
|
||||||
fileName = (String)fontNameMap.get(fontID);
|
fileName = fontNameMap.get(fontID);
|
||||||
}
|
}
|
||||||
if (fileName != null) {
|
if (fileName != null) {
|
||||||
fontNameMap.put(fontID, fileName);
|
fontNameMap.put(fontID, fileName);
|
||||||
@ -257,8 +257,8 @@ public class X11FontManager extends SunFontManager {
|
|||||||
@Override
|
@Override
|
||||||
protected String[] getNativeNames(String fontFileName,
|
protected String[] getNativeNames(String fontFileName,
|
||||||
String platformName) {
|
String platformName) {
|
||||||
Vector nativeNames;
|
Vector<String> nativeNames;
|
||||||
if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) {
|
if ((nativeNames=xlfdMap.get(fontFileName))==null) {
|
||||||
if (platformName == null) {
|
if (platformName == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -271,7 +271,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int len = nativeNames.size();
|
int len = nativeNames.size();
|
||||||
return (String[])nativeNames.toArray(new String[len]);
|
return nativeNames.toArray(new String[len]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
}
|
}
|
||||||
String fontPart = st.sval.substring(breakPos+1);
|
String fontPart = st.sval.substring(breakPos+1);
|
||||||
String fontID = specificFontIDForName(fontPart);
|
String fontID = specificFontIDForName(fontPart);
|
||||||
String sVal = (String) fontNameMap.get(fontID);
|
String sVal = fontNameMap.get(fontID);
|
||||||
|
|
||||||
if (FontUtilities.debugFonts()) {
|
if (FontUtilities.debugFonts()) {
|
||||||
PlatformLogger logger = FontUtilities.getLogger();
|
PlatformLogger logger = FontUtilities.getLogger();
|
||||||
@ -386,14 +386,14 @@ public class X11FontManager extends SunFontManager {
|
|||||||
* wants to use the native rasteriser.
|
* wants to use the native rasteriser.
|
||||||
*/
|
*/
|
||||||
if (xFontDirsMap == null) {
|
if (xFontDirsMap == null) {
|
||||||
xFontDirsMap = new HashMap();
|
xFontDirsMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
xFontDirsMap.put(fontID, path);
|
xFontDirsMap.put(fontID, path);
|
||||||
fullPath = file.getCanonicalPath();
|
fullPath = file.getCanonicalPath();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
fullPath = path + File.separator + fileName;
|
fullPath = path + File.separator + fileName;
|
||||||
}
|
}
|
||||||
Vector xVal = (Vector) xlfdMap.get(fullPath);
|
Vector<String> xVal = xlfdMap.get(fullPath);
|
||||||
if (FontUtilities.debugFonts()) {
|
if (FontUtilities.debugFonts()) {
|
||||||
FontUtilities.getLogger()
|
FontUtilities.getLogger()
|
||||||
.info("fullPath=" + fullPath +
|
.info("fullPath=" + fullPath +
|
||||||
@ -408,7 +408,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
}
|
}
|
||||||
fontNameMap.put(fontID, fullPath);
|
fontNameMap.put(fontID, fullPath);
|
||||||
if (xVal == null) {
|
if (xVal == null) {
|
||||||
xVal = new Vector();
|
xVal = new Vector<>();
|
||||||
xlfdMap.put (fullPath, xVal);
|
xlfdMap.put (fullPath, xVal);
|
||||||
}
|
}
|
||||||
xVal.add(fontPart);
|
xVal.add(fontPart);
|
||||||
@ -447,8 +447,8 @@ public class X11FontManager extends SunFontManager {
|
|||||||
* will typically not ever need to initialise it so it can be null.
|
* will typically not ever need to initialise it so it can be null.
|
||||||
*/
|
*/
|
||||||
xFontDirsMap = null;
|
xFontDirsMap = null;
|
||||||
xlfdMap = new HashMap(1);
|
xlfdMap = new HashMap<>(1);
|
||||||
fontNameMap = new HashMap(1);
|
fontNameMap = new HashMap<>(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getObliqueLucidaFontID(String fontID) {
|
private String getObliqueLucidaFontID(String fontID) {
|
||||||
@ -579,10 +579,10 @@ public class X11FontManager extends SunFontManager {
|
|||||||
String fileName = null;
|
String fileName = null;
|
||||||
String fontID = specificFontIDForName(name);
|
String fontID = specificFontIDForName(name);
|
||||||
if (fontID != null) {
|
if (fontID != null) {
|
||||||
fileName = (String)fontNameMap.get(fontID);
|
fileName = fontNameMap.get(fontID);
|
||||||
if (fileName == null) {
|
if (fileName == null) {
|
||||||
fontID = switchFontIDForName(name);
|
fontID = switchFontIDForName(name);
|
||||||
fileName = (String)fontNameMap.get(fontID);
|
fileName = fontNameMap.get(fontID);
|
||||||
}
|
}
|
||||||
if (fileName == null) {
|
if (fileName == null) {
|
||||||
fileName = getDefaultFontFile();
|
fileName = getDefaultFontFile();
|
||||||
@ -685,7 +685,7 @@ public class X11FontManager extends SunFontManager {
|
|||||||
getPlatformFontPathFromFontConfig();
|
getPlatformFontPathFromFontConfig();
|
||||||
if (xFontDirsMap != null) {
|
if (xFontDirsMap != null) {
|
||||||
String fontID = specificFontIDForName(platformName);
|
String fontID = specificFontIDForName(platformName);
|
||||||
String dirName = (String)xFontDirsMap.get(fontID);
|
String dirName = xFontDirsMap.get(fontID);
|
||||||
if (dirName != null) {
|
if (dirName != null) {
|
||||||
fontConfigDirs.add(dirName);
|
fontConfigDirs.add(dirName);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class X11GraphicsDevice
|
|||||||
implements DisplayChangedListener
|
implements DisplayChangedListener
|
||||||
{
|
{
|
||||||
int screen;
|
int screen;
|
||||||
HashMap x11ProxyKeyMap = new HashMap();
|
HashMap<SurfaceType, Object> x11ProxyKeyMap = new HashMap<>();
|
||||||
|
|
||||||
private static AWTPermission fullScreenExclusivePermission;
|
private static AWTPermission fullScreenExclusivePermission;
|
||||||
private static Boolean xrandrExtSupported;
|
private static Boolean xrandrExtSupported;
|
||||||
@ -127,7 +127,7 @@ public class X11GraphicsDevice
|
|||||||
|
|
||||||
GraphicsConfiguration[] configs;
|
GraphicsConfiguration[] configs;
|
||||||
GraphicsConfiguration defaultConfig;
|
GraphicsConfiguration defaultConfig;
|
||||||
HashSet doubleBufferVisuals;
|
HashSet<Integer> doubleBufferVisuals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all of the graphics
|
* Returns all of the graphics
|
||||||
@ -159,7 +159,7 @@ public class X11GraphicsDevice
|
|||||||
|
|
||||||
boolean dbeSupported = isDBESupported();
|
boolean dbeSupported = isDBESupported();
|
||||||
if (dbeSupported && doubleBufferVisuals == null) {
|
if (dbeSupported && doubleBufferVisuals == null) {
|
||||||
doubleBufferVisuals = new HashSet();
|
doubleBufferVisuals = new HashSet<>();
|
||||||
getDoubleBufferVisuals(screen);
|
getDoubleBufferVisuals(screen);
|
||||||
}
|
}
|
||||||
for ( ; i < num; i++) {
|
for ( ; i < num; i++) {
|
||||||
@ -249,7 +249,7 @@ public class X11GraphicsDevice
|
|||||||
int depth = getConfigDepth(0, screen);
|
int depth = getConfigDepth(0, screen);
|
||||||
boolean doubleBuffer = false;
|
boolean doubleBuffer = false;
|
||||||
if (isDBESupported() && doubleBufferVisuals == null) {
|
if (isDBESupported() && doubleBufferVisuals == null) {
|
||||||
doubleBufferVisuals = new HashSet();
|
doubleBufferVisuals = new HashSet<>();
|
||||||
getDoubleBufferVisuals(screen);
|
getDoubleBufferVisuals(screen);
|
||||||
doubleBuffer =
|
doubleBuffer =
|
||||||
doubleBufferVisuals.contains(Integer.valueOf(visNum));
|
doubleBufferVisuals.contains(Integer.valueOf(visNum));
|
||||||
|
@ -72,7 +72,7 @@ public class X11GraphicsEnvironment
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction() {
|
new java.security.PrivilegedAction<Object>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
System.loadLibrary("awt");
|
System.loadLibrary("awt");
|
||||||
|
|
||||||
@ -254,12 +254,12 @@ public class X11GraphicsEnvironment
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean result = (Boolean)java.security.AccessController.doPrivileged(
|
Boolean result = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction() {
|
new java.security.PrivilegedAction<Boolean>() {
|
||||||
public Object run() {
|
public Boolean run() {
|
||||||
InetAddress remAddr[] = null;
|
InetAddress remAddr[] = null;
|
||||||
Enumeration locals = null;
|
Enumeration<InetAddress> locals = null;
|
||||||
Enumeration interfaces = null;
|
Enumeration<NetworkInterface> interfaces = null;
|
||||||
try {
|
try {
|
||||||
interfaces = NetworkInterface.getNetworkInterfaces();
|
interfaces = NetworkInterface.getNetworkInterfaces();
|
||||||
remAddr = InetAddress.getAllByName(hostName);
|
remAddr = InetAddress.getAllByName(hostName);
|
||||||
@ -275,7 +275,7 @@ public class X11GraphicsEnvironment
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (; interfaces.hasMoreElements();) {
|
for (; interfaces.hasMoreElements();) {
|
||||||
locals = ((NetworkInterface)interfaces.nextElement()).getInetAddresses();
|
locals = interfaces.nextElement().getInetAddresses();
|
||||||
for (; locals.hasMoreElements();) {
|
for (; locals.hasMoreElements();) {
|
||||||
for (int i = 0; i < remAddr.length; i++) {
|
for (int i = 0; i < remAddr.length; i++) {
|
||||||
if (locals.nextElement().equals(remAddr[i])) {
|
if (locals.nextElement().equals(remAddr[i])) {
|
||||||
|
@ -100,7 +100,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
|||||||
private boolean isLastTemporary = false;
|
private boolean isLastTemporary = false;
|
||||||
private boolean isActive = false;
|
private boolean isActive = false;
|
||||||
private boolean isActiveClient = false;
|
private boolean isActiveClient = false;
|
||||||
private static Map[] highlightStyles;
|
private static Map<TextAttribute, ?>[] highlightStyles;
|
||||||
private boolean disposed = false;
|
private boolean disposed = false;
|
||||||
|
|
||||||
//reset the XIC if necessary
|
//reset the XIC if necessary
|
||||||
@ -136,31 +136,29 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
|||||||
|
|
||||||
// Initialize highlight mapping table
|
// Initialize highlight mapping table
|
||||||
static {
|
static {
|
||||||
Map styles[] = new Map[4];
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
HashMap map;
|
Map<TextAttribute, ?> styles[] = new Map[4];
|
||||||
|
HashMap<TextAttribute, Object> map;
|
||||||
|
|
||||||
// UNSELECTED_RAW_TEXT_HIGHLIGHT
|
// UNSELECTED_RAW_TEXT_HIGHLIGHT
|
||||||
map = new HashMap(1);
|
map = new HashMap<>(1);
|
||||||
map.put(TextAttribute.WEIGHT,
|
map.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
|
||||||
TextAttribute.WEIGHT_BOLD);
|
|
||||||
styles[0] = Collections.unmodifiableMap(map);
|
styles[0] = Collections.unmodifiableMap(map);
|
||||||
|
|
||||||
// SELECTED_RAW_TEXT_HIGHLIGHT
|
// SELECTED_RAW_TEXT_HIGHLIGHT
|
||||||
map = new HashMap(1);
|
map = new HashMap<>(1);
|
||||||
map.put(TextAttribute.SWAP_COLORS,
|
map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
|
||||||
TextAttribute.SWAP_COLORS_ON);
|
|
||||||
styles[1] = Collections.unmodifiableMap(map);
|
styles[1] = Collections.unmodifiableMap(map);
|
||||||
|
|
||||||
// UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
|
// UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||||
map = new HashMap(1);
|
map = new HashMap<>(1);
|
||||||
map.put(TextAttribute.INPUT_METHOD_UNDERLINE,
|
map.put(TextAttribute.INPUT_METHOD_UNDERLINE,
|
||||||
TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
|
TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
|
||||||
styles[2] = Collections.unmodifiableMap(map);
|
styles[2] = Collections.unmodifiableMap(map);
|
||||||
|
|
||||||
// SELECTED_CONVERTED_TEXT_HIGHLIGHT
|
// SELECTED_CONVERTED_TEXT_HIGHLIGHT
|
||||||
map = new HashMap(1);
|
map = new HashMap<>(1);
|
||||||
map.put(TextAttribute.SWAP_COLORS,
|
map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
|
||||||
TextAttribute.SWAP_COLORS_ON);
|
|
||||||
styles[3] = Collections.unmodifiableMap(map);
|
styles[3] = Collections.unmodifiableMap(map);
|
||||||
|
|
||||||
highlightStyles = styles;
|
highlightStyles = styles;
|
||||||
@ -433,7 +431,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
|||||||
/**
|
/**
|
||||||
* @see java.awt.Toolkit#mapInputMethodHighlight
|
* @see java.awt.Toolkit#mapInputMethodHighlight
|
||||||
*/
|
*/
|
||||||
public static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
|
public static Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
|
||||||
int index;
|
int index;
|
||||||
int state = highlight.getState();
|
int state = highlight.getState();
|
||||||
if (state == InputMethodHighlight.RAW_TEXT) {
|
if (state == InputMethodHighlight.RAW_TEXT) {
|
||||||
|
@ -52,7 +52,7 @@ public class XSettings {
|
|||||||
* settings manager.
|
* settings manager.
|
||||||
* @return a <code>Map</code> of changed settings.
|
* @return a <code>Map</code> of changed settings.
|
||||||
*/
|
*/
|
||||||
public Map update(byte[] data) {
|
public Map<String, Object> update(byte[] data) {
|
||||||
return (new Update(data)).update();
|
return (new Update(data)).update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class XSettings {
|
|||||||
private int nsettings = 0;
|
private int nsettings = 0;
|
||||||
private boolean isValid;
|
private boolean isValid;
|
||||||
|
|
||||||
private HashMap updatedSettings;
|
private HashMap<String, Object> updatedSettings;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,7 +113,7 @@ public class XSettings {
|
|||||||
idx = 8;
|
idx = 8;
|
||||||
nsettings = getINT32();
|
nsettings = getINT32();
|
||||||
|
|
||||||
updatedSettings = new HashMap();
|
updatedSettings = new HashMap<>();
|
||||||
|
|
||||||
isValid = true;
|
isValid = true;
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ public class XSettings {
|
|||||||
/**
|
/**
|
||||||
* Update settings.
|
* Update settings.
|
||||||
*/
|
*/
|
||||||
public Map update() {
|
public Map<String, Object> update() {
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class MFontConfiguration extends FontConfiguration {
|
|||||||
* the fontconfig files.
|
* the fontconfig files.
|
||||||
*/
|
*/
|
||||||
protected void initReorderMap() {
|
protected void initReorderMap() {
|
||||||
reorderMap = new HashMap();
|
reorderMap = new HashMap<>();
|
||||||
if (osName == null) { /* null means SunOS */
|
if (osName == null) { /* null means SunOS */
|
||||||
initReorderMapForSolaris();
|
initReorderMapForSolaris();
|
||||||
} else {
|
} else {
|
||||||
@ -240,7 +240,7 @@ public class MFontConfiguration extends FontConfiguration {
|
|||||||
return "sun.awt.Symbol";
|
return "sun.awt.Symbol";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String encoding = (String) encodingMap.get(xlfdEncoding);
|
String encoding = encodingMap.get(xlfdEncoding);
|
||||||
if (encoding == null) {
|
if (encoding == null) {
|
||||||
encoding = "default";
|
encoding = "default";
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ public class MFontConfiguration extends FontConfiguration {
|
|||||||
|
|
||||||
/* methods for table setup ***********************************************/
|
/* methods for table setup ***********************************************/
|
||||||
|
|
||||||
private static HashMap encodingMap = new HashMap();
|
private static HashMap<String, String> encodingMap = new HashMap<>();
|
||||||
|
|
||||||
private void initTables() {
|
private void initTables() {
|
||||||
// encodingMap maps XLFD encoding component to
|
// encodingMap maps XLFD encoding component to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user