Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: dr/clipboard/ClipboardEvent.java


1   package dr.clipboard;
2   
3   /** A semantic event which indicates that clipboard event occured.
4   
5    Objects that implements the ClipboardEventListener interface and
6    that is registered as listener gets this ClipboardEvent when a
7    event occured.
8    *@author Daniel Rohde
9    */
10  public class ClipboardEvent implements ClipTypes
11  { 
12  
13    private int eventType = -1;
14    private Object data = null;
15    private Object clipboardOwner = null;
16  
17    private boolean consumed = false;
18  
19    /** Creates a new ClipboardEvent instance. 
20     *@param eventType is one of the event types: CUT, COPY, PASTE, CLEAR
21     *@param data is the clipped data.
22     *@param clipboardOwner is the component that clipped the data.
23     */
24    public ClipboardEvent(int eventType, Object data, Object clipboardOwner) {
25      this.eventType=eventType;
26      this.data=data;
27      this.clipboardOwner=clipboardOwner;
28    }
29    /** Returns the event type. 
30     *@return the event type.
31     *@see #COPY 
32     *@see #CUT 
33     *@see #PASTE
34     *@see #CLEAR
35     */
36    public int getEventType() {
37      return eventType;
38    }
39    
40    /** Returns the clipped data.
41     *@return clipped data if clipboard was not cleaned; null otherwise.
42     */
43    public Object getData() {
44      return data;
45    }
46  
47    /** Returns the clipboard owner.
48     *@return component that clipped the data if clipboard was 
49       not cleaned; null otherwise.
50     */
51    public Object getClipboardOwner() {
52      return clipboardOwner;
53    }
54  
55    /** Checks the consumed flag.
56     *@return true if event was consumed; false otherwise
57     */
58    public boolean isConsumed() {
59      return consumed;
60    }
61  
62    /** Sets the consumed flag.
63     *@param consumed true if event was consumed; false otherwise
64     */
65    public void setConsumed(boolean consumed) {
66      this.consumed=consumed;
67    }
68  
69    /** Returns the Clipboard instance that invoked the event.
70     *@return Clipboard instance.
71     */
72    public Object getSource() {
73      return Clipboard.getInstance();
74    }
75  }