diff options
Diffstat (limited to 'libjava/classpath/java/awt/datatransfer')
10 files changed, 150 insertions, 154 deletions
diff --git a/libjava/classpath/java/awt/datatransfer/Clipboard.java b/libjava/classpath/java/awt/datatransfer/Clipboard.java index 2029e2c351b..d0a1d3a3ff3 100644 --- a/libjava/classpath/java/awt/datatransfer/Clipboard.java +++ b/libjava/classpath/java/awt/datatransfer/Clipboard.java @@ -111,43 +111,43 @@ public class Clipboard * @exception IllegalStateException If the clipboard is currently unavailable */ public synchronized void setContents(Transferable contents, - ClipboardOwner owner) + ClipboardOwner owner) { Transferable oldContents = getContents(null); this.contents = contents; if (this.owner != owner) { - ClipboardOwner oldOwner = this.owner; - this.owner = owner; - if (oldOwner != null) - oldOwner.lostOwnership(this, oldContents); + ClipboardOwner oldOwner = this.owner; + this.owner = owner; + if (oldOwner != null) + oldOwner.lostOwnership(this, oldContents); } FlavorListener[] fs = getFlavorListeners(); if (fs.length > 0) { - // We are a bit optimistic here. We assume DataFlavors will be - // given in the same order. If the number of flavors is - // different or the order of the DataFlavors in the list then - // fire a change event. - boolean newFlavors = ((contents != null && oldContents == null) - || (contents == null && oldContents != null)); - if (!newFlavors && contents != null && oldContents != null) - { - DataFlavor[] df1 = contents.getTransferDataFlavors(); - DataFlavor[] df2 = oldContents.getTransferDataFlavors(); - newFlavors = df1.length != df2.length; - - for (int i = 0; !newFlavors && i < df1.length; i++) - newFlavors = !df1[i].equals(df2[i]); - } - - if (newFlavors) - { - FlavorEvent e = new FlavorEvent(this); - for (int i = 0; i < fs.length; i++) - fs[i].flavorsChanged(e); - } + // We are a bit optimistic here. We assume DataFlavors will be + // given in the same order. If the number of flavors is + // different or the order of the DataFlavors in the list then + // fire a change event. + boolean newFlavors = ((contents != null && oldContents == null) + || (contents == null && oldContents != null)); + if (!newFlavors && contents != null && oldContents != null) + { + DataFlavor[] df1 = contents.getTransferDataFlavors(); + DataFlavor[] df2 = oldContents.getTransferDataFlavors(); + newFlavors = df1.length != df2.length; + + for (int i = 0; !newFlavors && i < df1.length; i++) + newFlavors = !df1[i].equals(df2[i]); + } + + if (newFlavors) + { + FlavorEvent e = new FlavorEvent(this); + for (int i = 0; i < fs.length; i++) + fs[i].flavorsChanged(e); + } } } @@ -165,7 +165,7 @@ public class Clipboard DataFlavor[] fs = getAvailableDataFlavors(); for (int i = 0; i < fs.length; i++) if (flavor.equals(fs[i])) - return true; + return true; return false; } @@ -187,7 +187,7 @@ public class Clipboard synchronized(listeners) { - listeners.add(listener); + listeners.add(listener); } } @@ -198,7 +198,7 @@ public class Clipboard synchronized(listeners) { - listeners.remove(listener); + listeners.remove(listener); } } @@ -206,8 +206,8 @@ public class Clipboard { synchronized(listeners) { - return (FlavorListener[]) - listeners.toArray(new FlavorListener[listeners.size()]); + return (FlavorListener[]) + listeners.toArray(new FlavorListener[listeners.size()]); } } } diff --git a/libjava/classpath/java/awt/datatransfer/ClipboardOwner.java b/libjava/classpath/java/awt/datatransfer/ClipboardOwner.java index df758254a55..b98059a0ea1 100644 --- a/libjava/classpath/java/awt/datatransfer/ClipboardOwner.java +++ b/libjava/classpath/java/awt/datatransfer/ClipboardOwner.java @@ -52,6 +52,5 @@ public interface ClipboardOwner * @param clipboard The clipboard for which ownership was lost. * @param contents The contents of the clipboard which are no longer owned. */ - void lostOwnership (Clipboard clipboard, Transferable contents); + void lostOwnership (Clipboard clipboard, Transferable contents); } - diff --git a/libjava/classpath/java/awt/datatransfer/DataFlavor.java b/libjava/classpath/java/awt/datatransfer/DataFlavor.java index baaf43d85bc..e5477043415 100644 --- a/libjava/classpath/java/awt/datatransfer/DataFlavor.java +++ b/libjava/classpath/java/awt/datatransfer/DataFlavor.java @@ -74,24 +74,24 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * @deprecated The charset unicode is platform specific and InputStream * deals with bytes not chars. Use <code>getRederForText()</code>. */ - public static final DataFlavor plainTextFlavor = + public static final DataFlavor plainTextFlavor = new DataFlavor("text/plain; charset=unicode; class=java.io.InputStream", "plain unicode text"); /** * This is the data flavor used for transferring Java strings. The - * MIME type is "application/x-java-serialized-object" and the + * MIME type is "application/x-java-serialized-object" and the * representation class is <code>java.lang.String</code>. */ - public static final DataFlavor stringFlavor = + public static final DataFlavor stringFlavor = new DataFlavor(java.lang.String.class, "Java Unicode String"); /** * This is a data flavor used for transferring lists of files. The - * representation type is a <code>java.util.List</code>, with each + * representation type is a <code>java.util.List</code>, with each * element of the list being a <code>java.io.File</code>. */ - public static final DataFlavor javaFileListFlavor = + public static final DataFlavor javaFileListFlavor = new DataFlavor("application/x-java-file-list; class=java.util.List", "Java File List"); @@ -99,7 +99,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * This is an image flavor used for transferring images. The * representation type is a <code>java.awt.Image</code>. */ - public static final DataFlavor imageFlavor = + public static final DataFlavor imageFlavor = new DataFlavor(java.awt.Image.class, "Java Image"); /** @@ -127,20 +127,20 @@ public class DataFlavor implements java.io.Externalizable, Cloneable /* * Instance Variables */ - + // The MIME type for this flavor private MimeType mimeType; - + // The representation class for this flavor private Class<?> representationClass; - + // The human readable name of this flavor private String humanPresentableName; /* * Static Methods */ - + /** * This method attempts to load the named class. The following class * loaders are searched in order: the bootstrap class loader, the @@ -154,7 +154,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * @exception ClassNotFoundException If the class cannot be loaded. */ protected static final Class<?> tryToLoadClass(String className, - ClassLoader classLoader) + ClassLoader classLoader) throws ClassNotFoundException { // Bootstrap @@ -164,37 +164,37 @@ public class DataFlavor implements java.io.Externalizable, Cloneable } catch(ClassNotFoundException cnfe) { - // Ignored. + // Ignored. } - + // System try { - ClassLoader loader = ClassLoader.getSystemClassLoader(); + ClassLoader loader = ClassLoader.getSystemClassLoader(); return Class.forName(className, true, loader); } catch(ClassNotFoundException cnfe) { - // Ignored. + // Ignored. } - + // Context try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); + ClassLoader loader = Thread.currentThread().getContextClassLoader(); return Class.forName(className, true, loader); } catch(ClassNotFoundException cnfe) { - // Ignored. + // Ignored. } - + if (classLoader != null) return Class.forName(className, true, classLoader); throw new ClassNotFoundException(className); } - + /** * XXX - Currently returns <code>plainTextFlavor</code>. */ @@ -202,7 +202,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable { return plainTextFlavor; } - + /** * Selects the best supported text flavor on this implementation. * Returns <code>null</code> when none of the given flavors is liked. @@ -213,19 +213,19 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * class which is (a subclass of) <code>InputStream</code> and has a * primary MIME type of "text" and has an supported encoding. */ - public static final DataFlavor + public static final DataFlavor selectBestTextFlavor(DataFlavor[] availableFlavors) { for(int i = 0; i < availableFlavors.length; i++) { DataFlavor df = availableFlavors[i]; Class c = df.representationClass; - + // A Reader or String is good. if ((Reader.class.isAssignableFrom(c)) || (String.class.isAssignableFrom(c))) return df; - + // A InputStream is good if the mime primary type is "text" if ((InputStream.class.isAssignableFrom(c)) && ("text".equals(df.getPrimaryType()))) @@ -246,7 +246,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable return df; } } - + // Nothing found return null; } @@ -255,14 +255,14 @@ public class DataFlavor implements java.io.Externalizable, Cloneable /* * Constructors */ - + /** * Empty public constructor needed for externalization. * Should not be used for normal instantiation. */ public DataFlavor() { - // Used for deserialization only, nothing to do here. + // Used for deserialization only, nothing to do here. } /** @@ -312,7 +312,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * specified cannot be loaded. * @exception ClassNotFoundException If the class is not loaded. */ - public DataFlavor(String mimeType, String humanPresentableName, + public DataFlavor(String mimeType, String humanPresentableName, ClassLoader classLoader) throws ClassNotFoundException { @@ -444,7 +444,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable public String getHumanPresentableName() { return(humanPresentableName); - } + } /** * Returns the primary MIME type for this flavor. @@ -478,7 +478,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable { if ("humanPresentableName".equals(paramName)) return getHumanPresentableName(); - + return mimeType.getParameter(paramName); } @@ -529,7 +529,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * * @param flavor The flavor to test against. * - * @return <code>true</code> if the flavor's MIME type is equal to this + * @return <code>true</code> if the flavor's MIME type is equal to this * object's MIME type, <code>false</code> otherwise. */ public final boolean isMimeTypeEqual(DataFlavor flavor) @@ -619,9 +619,9 @@ public class DataFlavor implements java.io.Externalizable, Cloneable if (getPrimaryType().equals(javaFileListFlavor.getPrimaryType()) && getSubType().equals(javaFileListFlavor.getSubType()) && javaFileListFlavor.representationClass - .isAssignableFrom(representationClass)) + .isAssignableFrom(representationClass)) return true; - + return false ; } @@ -681,19 +681,19 @@ public class DataFlavor implements java.io.Externalizable, Cloneable if (! isRepresentationClassCharBuffer() && ! isRepresentationClassReader() && representationClass != java.lang.String.class - && ! (representationClass.isArray() - && representationClass.getComponentType() == Character.TYPE)) - { - String charset = getParameter("charset"); - String otherset = flavor.getParameter("charset"); - String defaultset = Charset.defaultCharset().name(); - - if (charset == null || charset.equals(defaultset)) + && ! (representationClass.isArray() + && representationClass.getComponentType() == Character.TYPE)) + { + String charset = getParameter("charset"); + String otherset = flavor.getParameter("charset"); + String defaultset = Charset.defaultCharset().name(); + + if (charset == null || charset.equals(defaultset)) return (otherset == null || otherset.equals(defaultset)); - return charset.equals(otherset); - } - + return charset.equals(otherset); + } + return true; } @@ -718,7 +718,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable { if (! (obj instanceof DataFlavor)) return false; - + return equals((DataFlavor) obj); } @@ -780,7 +780,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * the MIME type string unchanged. * * @param type The MIME type. - * + * * @return The MIME type. * * @deprecated @@ -797,7 +797,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * * @exception IOException If an error occurs. */ - public void writeExternal(ObjectOutput stream) + public void writeExternal(ObjectOutput stream) throws IOException { if (mimeType != null) @@ -821,7 +821,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * @exception ClassNotFoundException If the class for an object being restored * cannot be found. */ - public void readExternal(ObjectInput stream) + public void readExternal(ObjectInput stream) throws IOException, ClassNotFoundException { mimeType = (MimeType) stream.readObject(); @@ -913,13 +913,13 @@ public class DataFlavor implements java.io.Externalizable, Cloneable { if (!transferable.isDataFlavorSupported(this)) throw new UnsupportedFlavorException(this); - + if (Reader.class.isAssignableFrom(representationClass)) return (Reader)transferable.getTransferData(this); - + if (String.class.isAssignableFrom(representationClass)) return new StringReader((String)transferable.getTransferData(this)); - + if (InputStream.class.isAssignableFrom(representationClass) && "text".equals(getPrimaryType())) { @@ -929,7 +929,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable encoding = "us-ascii"; return new InputStreamReader(in, encoding); } - + throw new UnsupportedFlavorException(this); } @@ -965,7 +965,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable { return Reader.class.isAssignableFrom(representationClass); } - + /** * Returns whether this <code>DataFlavor</code> is a valid text flavor for * this implementation of the Java platform. Only flavors equivalent to @@ -975,12 +975,12 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * If this flavor supports the charset parameter, it must be equivalent to * <code>DataFlavor.stringFlavor</code>, or its representation must be * <code>java.io.Reader</code>, <code>java.lang.String</code>, - * <code>java.nio.CharBuffer</code>, <code>java.io.InputStream</code> or + * <code>java.nio.CharBuffer</code>, <code>java.io.InputStream</code> or * <code>java.nio.ByteBuffer</code>, - * If the representation is <code>java.io.InputStream</code> or - * <code>java.nio.ByteBuffer</code>, then this flavor's <code>charset</code> - * parameter must be supported by this implementation of the Java platform. - * If a charset is not specified, then the platform default charset, which + * If the representation is <code>java.io.InputStream</code> or + * <code>java.nio.ByteBuffer</code>, then this flavor's <code>charset</code> + * parameter must be supported by this implementation of the Java platform. + * If a charset is not specified, then the platform default charset, which * is always supported, is assumed. * <p> * If this flavor does not support the charset parameter, its @@ -996,16 +996,16 @@ public class DataFlavor implements java.io.Externalizable, Cloneable * @since 1.4 */ public boolean isFlavorTextType() { - // FIXME: I'm not 100% sure if this implementation does the same like sun's does + // FIXME: I'm not 100% sure if this implementation does the same like sun's does if(equals(DataFlavor.stringFlavor) || getPrimaryType().equals("text")) { String charset = getParameter("charset"); Class c = getRepresentationClass(); - if(charset != null) - { - if(Reader.class.isAssignableFrom(c) - || CharBuffer.class.isAssignableFrom(c) - || String.class.isAssignableFrom(c)) + if(charset != null) + { + if(Reader.class.isAssignableFrom(c) + || CharBuffer.class.isAssignableFrom(c) + || String.class.isAssignableFrom(c)) { return true; } @@ -1024,4 +1024,3 @@ public class DataFlavor implements java.io.Externalizable, Cloneable return false; } } // class DataFlavor - diff --git a/libjava/classpath/java/awt/datatransfer/FlavorEvent.java b/libjava/classpath/java/awt/datatransfer/FlavorEvent.java index 38b48187175..8a292f85021 100644 --- a/libjava/classpath/java/awt/datatransfer/FlavorEvent.java +++ b/libjava/classpath/java/awt/datatransfer/FlavorEvent.java @@ -45,7 +45,7 @@ import java.util.EventObject; * Fired by a ClipBoard for registered FlavorListeners. * * @author Mark J. Wielaard (mark@klomp.org) - * + * * @since 1.5 */ public class FlavorEvent extends EventObject diff --git a/libjava/classpath/java/awt/datatransfer/FlavorListener.java b/libjava/classpath/java/awt/datatransfer/FlavorListener.java index 31b164d6b70..eb388aa8415 100644 --- a/libjava/classpath/java/awt/datatransfer/FlavorListener.java +++ b/libjava/classpath/java/awt/datatransfer/FlavorListener.java @@ -1,4 +1,4 @@ -/* FlavorListener -- Interface for tagging an interest in FlavorEvents. +/* FlavorListener -- Interface for tagging an interest in FlavorEvents. Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/classpath/java/awt/datatransfer/MimeType.java b/libjava/classpath/java/awt/datatransfer/MimeType.java index 8d2dcc01d1e..143e8700bda 100644 --- a/libjava/classpath/java/awt/datatransfer/MimeType.java +++ b/libjava/classpath/java/awt/datatransfer/MimeType.java @@ -124,7 +124,7 @@ class MimeType * Returns the parameter for the <code>key</code>. * * @param key the parameter key - * + * * @return the parameter for the <code>key</code> */ String getParameter(String key) diff --git a/libjava/classpath/java/awt/datatransfer/StringSelection.java b/libjava/classpath/java/awt/datatransfer/StringSelection.java index b74f2fa6418..4b64cda57c7 100644 --- a/libjava/classpath/java/awt/datatransfer/StringSelection.java +++ b/libjava/classpath/java/awt/datatransfer/StringSelection.java @@ -55,7 +55,7 @@ public class StringSelection implements Transferable, ClipboardOwner // List of flavors we support // XXX: DataFlavor.plainTextFlavor is deprecated. -static final DataFlavor[] supported_flavors +static final DataFlavor[] supported_flavors = { DataFlavor.stringFlavor, DataFlavor.plainTextFlavor }; @@ -154,5 +154,4 @@ lostOwnership(Clipboard clipboard, Transferable contents) // FIXME: What does this do? } -} // class StringSelection - +} // class StringSelection diff --git a/libjava/classpath/java/awt/datatransfer/SystemFlavorMap.java b/libjava/classpath/java/awt/datatransfer/SystemFlavorMap.java index 7f296b5941a..65c14c1ba1c 100644 --- a/libjava/classpath/java/awt/datatransfer/SystemFlavorMap.java +++ b/libjava/classpath/java/awt/datatransfer/SystemFlavorMap.java @@ -67,30 +67,30 @@ import java.util.WeakHashMap; public final class SystemFlavorMap implements FlavorMap, FlavorTable { /** - * The map which maps the thread's <code>ClassLoaders</code> to + * The map which maps the thread's <code>ClassLoaders</code> to * <code>SystemFlavorMaps</code>. */ private static final Map systemFlavorMaps = new WeakHashMap(); - + /** * Constant which is used to prefix encode Java MIME types. */ private static final String GNU_JAVA_MIME_PREFIX = "gnu.java:"; - + /** - * This map maps native <code>String</code>s to lists of + * This map maps native <code>String</code>s to lists of * <code>DataFlavor</code>s */ private HashMap<String,List<DataFlavor>> nativeToFlavorMap = new HashMap<String,List<DataFlavor>>(); - + /** - * This map maps <code>DataFlavor</code>s to lists of native + * This map maps <code>DataFlavor</code>s to lists of native * <code>String</code>s */ private HashMap<DataFlavor, List<String>> flavorToNativeMap = new HashMap<DataFlavor, List<String>>(); - + /** * Private constructor. */ @@ -152,7 +152,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable // Check valid mime type. MimeType type = new MimeType(mime); DataFlavor flav = new DataFlavor(mime); - + List<DataFlavor> flavs = nativeToFlavorMap.get(nat); if (flavs == null) { @@ -207,7 +207,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * @return A <code>Map</code> of data flavors to native type names. */ public Map<String, DataFlavor> getFlavorsForNatives (String[] natives) - { + { return new HashMap<String, DataFlavor>(); } @@ -219,18 +219,18 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); - - //if ContextClassLoader not set, use system default + + //if ContextClassLoader not set, use system default if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); } - + synchronized(systemFlavorMaps) { - FlavorMap map = (FlavorMap) + FlavorMap map = (FlavorMap) systemFlavorMaps.get(classLoader); - if (map == null) + if (map == null) { map = new SystemFlavorMap(); systemFlavorMaps.put(classLoader, map); @@ -268,7 +268,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable /** * Encodes a <code>DataFlavor</code> for use as a <code>String</code> - * native. The format of an encoded <code>DataFlavor</code> is + * native. The format of an encoded <code>DataFlavor</code> is * implementation-dependent. The only restrictions are: * <ul> * <li>The encoded representation is <code>null</code> if and only if the @@ -313,7 +313,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * Decodes a <code>String</code> native for use as a Java MIME type. * * @param name the <code>String</code> to decode - * @return the decoded Java MIME type, or <code>null</code> if nat + * @return the decoded Java MIME type, or <code>null</code> if nat * is not an encoded <code>String</code> native */ public static String decodeJavaMIMEType (String name) @@ -322,7 +322,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { return name.substring(GNU_JAVA_MIME_PREFIX.length()); } - else + else return null; } @@ -334,27 +334,27 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable throws ClassNotFoundException { String javaMIMEType = decodeJavaMIMEType (name); - + if (javaMIMEType != null) return new DataFlavor (javaMIMEType); else return null; } - /** - * Returns a List of <code>DataFlavors</code> to which the specified - * <code>String</code> native can be translated by the data transfer - * subsystem. The <code>List</code> will be sorted from best - * <code>DataFlavor</code> to worst. That is, the first <code>DataFlavor - * </code> will best reflect data in the specified native to a Java - * application. + /** + * Returns a List of <code>DataFlavors</code> to which the specified + * <code>String</code> native can be translated by the data transfer + * subsystem. The <code>List</code> will be sorted from best + * <code>DataFlavor</code> to worst. That is, the first <code>DataFlavor + * </code> will best reflect data in the specified native to a Java + * application. * <p> - * If the specified native is previously unknown to the data transfer - * subsystem, and that native has been properly encoded, then invoking - * this method will establish a mapping in both directions between the - * specified native and a DataFlavor whose MIME type is a decoded + * If the specified native is previously unknown to the data transfer + * subsystem, and that native has been properly encoded, then invoking + * this method will establish a mapping in both directions between the + * specified native and a DataFlavor whose MIME type is a decoded * version of the native. - */ + */ public List<DataFlavor> getFlavorsForNative(String nat) { List<DataFlavor> ret = new ArrayList<DataFlavor>(); @@ -402,7 +402,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable } return ret; } - + /** * Adds a mapping from a single <code>String</code> native to a single * <code>DataFlavor</code>. Unlike <code>getFlavorsForNative</code>, the @@ -421,13 +421,13 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * @see #addUnencodedNativeForFlavor * @since 1.4 */ - public synchronized void addFlavorForUnencodedNative(String nativeStr, + public synchronized void addFlavorForUnencodedNative(String nativeStr, DataFlavor flavor) { if ((nativeStr == null) || (flavor == null)) throw new NullPointerException(); List<DataFlavor> flavors = nativeToFlavorMap.get(nativeStr); - if (flavors == null) + if (flavors == null) { flavors = new ArrayList<DataFlavor>(); nativeToFlavorMap.put(nativeStr, flavors); @@ -438,7 +438,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable flavors.add(flavor); } } - + /** * Adds a mapping from the specified <code>DataFlavor</code> (and all * <code>DataFlavor</code>s equal to the specified <code>DataFlavor</code>) @@ -446,7 +446,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * Unlike <code>getNativesForFlavor</code>, the mapping will only be * established in one direction, and the native will not be encoded. To * establish a two-way mapping, call - * <code>addFlavorForUnencodedNative</code> as well. The new mapping will + * <code>addFlavorForUnencodedNative</code> as well. The new mapping will * be of lower priority than any existing mapping. * This method has no effect if a mapping from the specified or equal * <code>DataFlavor</code> to the specified <code>String</code> native @@ -460,12 +460,12 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * @since 1.4 */ public synchronized void addUnencodedNativeForFlavor(DataFlavor flavor, - String nativeStr) + String nativeStr) { if ((nativeStr == null) || (flavor == null)) throw new NullPointerException(); List<String> natives = flavorToNativeMap.get(flavor); - if (natives == null) + if (natives == null) { natives = new ArrayList<String>(); flavorToNativeMap.put(flavor, natives); @@ -476,11 +476,11 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable natives.add(nativeStr); } } - + /** * Discards the current mappings for the specified <code>DataFlavor</code> * and all <code>DataFlavor</code>s equal to the specified - * <code>DataFlavor</code>, and creates new mappings to the + * <code>DataFlavor</code>, and creates new mappings to the * specified <code>String</code> natives. * Unlike <code>getNativesForFlavor</code>, the mappings will only be * established in one direction, and the natives will not be encoded. To @@ -492,7 +492,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * If the array contains several elements that reference equal * <code>String</code> natives, this method will establish new mappings * for the first of those elements and ignore the rest of them. - * <p> + * <p> * It is recommended that client code not reset mappings established by the * data transfer subsystem. This method should only be used for * application-level mappings. @@ -506,18 +506,18 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * @since 1.4 */ public synchronized void setNativesForFlavor(DataFlavor flavor, - String[] natives) + String[] natives) { if ((natives == null) || (flavor == null)) throw new NullPointerException(); - + flavorToNativeMap.remove(flavor); - for (int i = 0; i < natives.length; i++) + for (int i = 0; i < natives.length; i++) { addUnencodedNativeForFlavor(flavor, natives[i]); } } - + /** * Discards the current mappings for the specified <code>String</code> * native, and creates new mappings to the specified @@ -546,13 +546,13 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable * @since 1.4 */ public synchronized void setFlavorsForNative(String nativeStr, - DataFlavor[] flavors) + DataFlavor[] flavors) { if ((nativeStr == null) || (flavors == null)) throw new NullPointerException(); - + nativeToFlavorMap.remove(nativeStr); - for (int i = 0; i < flavors.length; i++) + for (int i = 0; i < flavors.length; i++) { addFlavorForUnencodedNative(nativeStr, flavors[i]); } diff --git a/libjava/classpath/java/awt/datatransfer/Transferable.java b/libjava/classpath/java/awt/datatransfer/Transferable.java index 80753923618..99239fcc6c7 100644 --- a/libjava/classpath/java/awt/datatransfer/Transferable.java +++ b/libjava/classpath/java/awt/datatransfer/Transferable.java @@ -80,4 +80,3 @@ public interface Transferable throws UnsupportedFlavorException, IOException; } // interface Transferable - diff --git a/libjava/classpath/java/awt/datatransfer/UnsupportedFlavorException.java b/libjava/classpath/java/awt/datatransfer/UnsupportedFlavorException.java index 1c1da0348c3..0ca17b2e9d8 100644 --- a/libjava/classpath/java/awt/datatransfer/UnsupportedFlavorException.java +++ b/libjava/classpath/java/awt/datatransfer/UnsupportedFlavorException.java @@ -62,4 +62,4 @@ public class UnsupportedFlavorException extends Exception { super(flavor == null ? null : flavor.getHumanPresentableName()); } -} // class UnsupportedFlavorException +} // class UnsupportedFlavorException |