/[classpath]/classpath/java/awt/datatransfer/Clipboard.java
ViewVC logotype

Diff of /classpath/java/awt/datatransfer/Clipboard.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by mkoch, Mon Dec 23 12:45:46 2002 UTC revision 1.7 by mkoch, Wed Sep 22 12:24:21 2004 UTC
# Line 39  exception statement from your version. * Line 39  exception statement from your version. *
39  package java.awt.datatransfer;  package java.awt.datatransfer;
40    
41  /**  /**
42    * This class allows data to be transferred using a cut and paste type   * This class allows data to be transferred using a cut and paste type
43    * mechanism.   * mechanism.
44    *   *
45    * @author Aaron M. Renn (arenn@urbanophile.com)   * @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  
46   */   */
47    public class Clipboard
 /**  
   * 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)  
48  {  {
49    if (this.owner != owner)    /**
50      if (this.owner != null)     * The data being transferred.
51        this.owner.lostOwnership(this, contents);     */
52      protected Transferable contents;
53    
54      /**
55       * The owner of this clipboard.
56       */
57      protected ClipboardOwner owner;
58    
59      // The clipboard name
60      private String name;
61    
62      /**
63       * Initializes a new instance of <code>Clipboard</code> with the
64       * specified name.
65       *
66       * @param name The clipboard name.
67       */
68      public Clipboard(String name)
69      {
70        this.name = name;
71      }
72    
73      /**
74        * Returns the name of the clipboard.
75        */
76      public String getName()
77      {
78        return name;
79      }
80    
81      /**
82       * Returns the contents of the clipboard.
83       *
84       * @param requestor The object requesting the contents.
85       *
86       * @exception IllegalStateException If the clipboard is currently unavailable
87       */
88      public synchronized Transferable getContents(Object requestor)
89      {
90        return contents;
91      }
92    
93      /**
94       * Sets the content and owner of this clipboard.
95       * If the given owner is different from the current owner
96       * then lostOwnership is called on the current owner.
97       * XXX - is this called with the old or new contents.
98       *
99       * @param contents The new clipboard contents.
100       * @param owner The new clipboard owner
101       *
102       * @exception IllegalStateException If the clipboard is currently unavailable
103       */
104      public synchronized void setContents(Transferable contents, ClipboardOwner owner)
105      {
106        if (this.owner != owner)
107          if (this.owner != null)
108            this.owner.lostOwnership(this, contents);
109    
110    this.owner = owner;      this.owner = owner;
111    this.contents = contents;      this.contents = contents;
112      }
113  }  }
114    
 } // class Clipboard  
   

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26