diff options
Diffstat (limited to 'libjava/java/awt/datatransfer')
-rw-r--r-- | libjava/java/awt/datatransfer/Clipboard.java | 162 | ||||
-rw-r--r-- | libjava/java/awt/datatransfer/ClipboardOwner.java | 3 | ||||
-rw-r--r-- | libjava/java/awt/datatransfer/DataFlavor.java | 11 | ||||
-rw-r--r-- | libjava/java/awt/datatransfer/FlavorTable.java | 4 | ||||
-rw-r--r-- | libjava/java/awt/datatransfer/StringSelection.java | 33 | ||||
-rw-r--r-- | libjava/java/awt/datatransfer/SystemFlavorMap.java | 4 |
6 files changed, 89 insertions, 128 deletions
diff --git a/libjava/java/awt/datatransfer/Clipboard.java b/libjava/java/awt/datatransfer/Clipboard.java index 93bba7c1a3d..ca9b6ebdb0a 100644 --- a/libjava/java/awt/datatransfer/Clipboard.java +++ b/libjava/java/awt/datatransfer/Clipboard.java @@ -39,102 +39,76 @@ exception statement from your version. */ package java.awt.datatransfer; /** - * This class allows data to be transferred using a cut and paste type - * mechanism. - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public class Clipboard -{ - -/* - * Instance Variables - */ - -/** - * The data being transferred. - */ -protected Transferable contents; - -/** - * The owner of this clipboard. - */ -protected ClipboardOwner owner; - -// The clipboard name -private String name; - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * Initializes a new instance of <code>Clipboard</code> with the - * specified name. - * - * @param name The clipboard name. - */ -public -Clipboard(String name) -{ - this.name = name; -} - -/*************************************************************************/ - -/* - * Instance Methods + * This class allows data to be transferred using a cut and paste type + * mechanism. + * + * @author Aaron M. Renn (arenn@urbanophile.com) */ - -/** - * Returns the name of the clipboard. - */ -public String -getName() -{ - return(name); -} - -/*************************************************************************/ - -/** - * Returns the contents of the clipboard. - * - * @param requestor The object requesting the contents. - * - * @exception IllegalStateException If the clipboard is currently unavailable - */ -public synchronized Transferable -getContents(Object requestor) -{ - return(contents); -} - -/*************************************************************************/ - -/** - * Sets the content and owner of this clipboard. - * If the given owner is different from the current owner - * then lostOwnership is called on the current owner. - * XXX - is this called with the old or new contents. - * - * @param contents The new clipboard contents. - * @param owner The new clipboard owner - * - * @exception IllegalStateException If the clipboard is currently unavailable - */ -public synchronized void -setContents(Transferable contents, ClipboardOwner owner) +public class Clipboard { - if (this.owner != owner) - if (this.owner != null) - this.owner.lostOwnership(this, contents); + /** + * The data being transferred. + */ + protected Transferable contents; + + /** + * The owner of this clipboard. + */ + protected ClipboardOwner owner; + + // The clipboard name + private String name; + + /** + * Initializes a new instance of <code>Clipboard</code> with the + * specified name. + * + * @param name The clipboard name. + */ + public Clipboard(String name) + { + this.name = name; + } + + /** + * Returns the name of the clipboard. + */ + public String getName() + { + return name; + } + + /** + * Returns the contents of the clipboard. + * + * @param requestor The object requesting the contents. + * + * @exception IllegalStateException If the clipboard is currently unavailable + */ + public synchronized Transferable getContents(Object requestor) + { + return contents; + } + + /** + * Sets the content and owner of this clipboard. + * If the given owner is different from the current owner + * then lostOwnership is called on the current owner. + * XXX - is this called with the old or new contents. + * + * @param contents The new clipboard contents. + * @param owner The new clipboard owner + * + * @exception IllegalStateException If the clipboard is currently unavailable + */ + public synchronized void setContents(Transferable contents, ClipboardOwner owner) + { + if (this.owner != owner) + if (this.owner != null) + this.owner.lostOwnership(this, contents); - this.owner = owner; - this.contents = contents; + this.owner = owner; + this.contents = contents; + } } -} // class Clipboard - diff --git a/libjava/java/awt/datatransfer/ClipboardOwner.java b/libjava/java/awt/datatransfer/ClipboardOwner.java index 28e58aae184..b5ca9e37d8f 100644 --- a/libjava/java/awt/datatransfer/ClipboardOwner.java +++ b/libjava/java/awt/datatransfer/ClipboardOwner.java @@ -53,6 +53,5 @@ public interface ClipboardOwner * @param contents The contents of the clipboard which are no longer owned. */ void lostOwnership (Clipboard clipboard, Transferable contents); - -} // interface ClipboardOwner +} diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java index 3ec21911929..19f69d5c726 100644 --- a/libjava/java/awt/datatransfer/DataFlavor.java +++ b/libjava/java/awt/datatransfer/DataFlavor.java @@ -39,11 +39,11 @@ exception statement from your version. */ package java.awt.datatransfer; import java.io.ByteArrayInputStream; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.IOException; -import java.io.ObjectOutput; import java.io.ObjectInput; +import java.io.ObjectOutput; import java.io.Reader; import java.io.StringReader; import java.io.UnsupportedEncodingException; @@ -328,7 +328,6 @@ getRepresentationClassFromMime(String mimeString, ClassLoader classLoader) * * @param mimeType The MIME type for this flavor. * @param humanPresentableName The display name of this flavor. - * @param classLoader The class loader for finding classes. * * @exception IllegalArgumentException If the representation class * specified cannot be loaded. @@ -529,7 +528,7 @@ isMimeTypeEqual(String mimeType) * @return <code>true</code> if the flavor's MIME type is equal to this * object's MIME type, <code>false</code> otherwise. */ -public boolean +public final boolean isMimeTypeEqual(DataFlavor flavor) { return(isMimeTypeEqual(flavor.getMimeType())); @@ -555,7 +554,7 @@ isMimeTypeSerializedObject() * Tests whether or not this flavor has a representation class of * <code>java.io.InputStream</code>. * - * @param <code>true</code> if the representation class of this flavor + * @return <code>true</code> if the representation class of this flavor * is <code>java.io.InputStream</code>, <code>false</code> otherwise. */ public boolean @@ -570,7 +569,7 @@ isRepresentationClassInputStream() * Tests whether the representation class for this flavor is * serializable. * - * @param <code>true</code> if the representation class is serializable, + * @return <code>true</code> if the representation class is serializable, * <code>false</code> otherwise. */ public boolean diff --git a/libjava/java/awt/datatransfer/FlavorTable.java b/libjava/java/awt/datatransfer/FlavorTable.java index 23fa9fa1fc1..3822cdec60b 100644 --- a/libjava/java/awt/datatransfer/FlavorTable.java +++ b/libjava/java/awt/datatransfer/FlavorTable.java @@ -66,8 +66,8 @@ public interface FlavorTable extends FlavorMap * list should be sorted from best to worst. The list must be modifiable * without affecting this table. * - * @param native the native to look up, or null to return all flavors + * @param name the native name to look up, or null to return all flavors * @return the sorted list of flavors */ List getFlavorsForNative(String name); -} // interface FlavorTable +} diff --git a/libjava/java/awt/datatransfer/StringSelection.java b/libjava/java/awt/datatransfer/StringSelection.java index 51addb7296c..b41c936990d 100644 --- a/libjava/java/awt/datatransfer/StringSelection.java +++ b/libjava/java/awt/datatransfer/StringSelection.java @@ -1,5 +1,5 @@ /* StringSelection.java -- Clipboard handler for text. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,8 +38,8 @@ exception statement from your version. */ package java.awt.datatransfer; -import java.io.StringReader; import java.io.IOException; +import java.io.StringReader; /** * This class transfers a string as plain text using the clipboard. @@ -68,26 +68,15 @@ static final DataFlavor[] supported_flavors // This is the data to transfer private String data; -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * Transfer the specfied string as text. - */ -public -StringSelection(String data) -{ - this.data = data; -} - -/*************************************************************************/ - -/* - * Instance Methods - */ + /** + * Transfer the specfied string as text. + * + * @param data the data for the string selection + */ + public StringSelection(String data) + { + this.data = data; + } /** * Returns a list of supported data flavors. diff --git a/libjava/java/awt/datatransfer/SystemFlavorMap.java b/libjava/java/awt/datatransfer/SystemFlavorMap.java index 7d914120e8f..826992b7c7c 100644 --- a/libjava/java/awt/datatransfer/SystemFlavorMap.java +++ b/libjava/java/awt/datatransfer/SystemFlavorMap.java @@ -1,5 +1,5 @@ /* SystemFlavorMap.java -- Maps between native flavor names and MIME types. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,8 +39,8 @@ exception statement from your version. */ package java.awt.datatransfer; import java.util.HashMap; -import java.util.Map; import java.util.List; +import java.util.Map; /** * This class maps between native platform type names and DataFlavors. |