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

Quick Search    Search Deep

Source code: com/paradoxpoint/libitina/gui/datatransfer/ProxyTransferHandler.java


1   /*
2    * Libitina - Funeral Monument Image Compositor
3    * Copyright (C) 2003,2004  Luke Imhoff
4    *
5    * Contact Info:
6    * luke@paradoxpoint.com
7    * Luke Imhoff
8    * 2514 Pied Piper Lane
9    * Wausau, WI 54403 
10   *
11   * This program is free software; you can redistribute it and/or
12   * modify it under the terms of the GNU General Public License
13   * as published by the Free Software Foundation; either version 2
14   * of the License, or (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   *
21   * You should have received a copy of the GNU General Public License
22   * along with this program; if not, write to the Free Software
23   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24   *
25   * ProxyTransferHandler.java
26   *
27   * Created on June 10, 2003, 3:57 AM
28   */
29  
30  package com.paradoxpoint.libitina.gui.datatransfer;
31  
32  import java.util.*;
33  
34  import javax.swing.*;
35  
36  /** <CODE>TransferHandler</CODE> that <I>always</I> uses the non-null source and target for
37   * data transfers
38   * @author Luke Imhoff
39   */
40  public class ProxyTransferHandler extends TransferHandler {
41      
42      private Vector proxyTargets = new Vector();
43      /** source of <CODE>Transeferable</CODE> data */    
44      private Object source;
45      /** target of <CODE>importData()</CODE> */    
46      private Object target;
47      
48      /** Creates a new instance of ProxyTransferHandler
49       * @param source source of transfer data
50       * @param target target of all transfers
51       * @throws NullPointerException if source or target is <CODE>null</CODE>
52       */
53      public ProxyTransferHandler(Object source, Object target) throws NullPointerException {
54          if (source == null || target == null)
55              throw new NullPointerException();
56          this.source = source;
57          this.target = target;
58      }
59      
60      /** Getter for property source.
61       * @return Value of property source.
62       *
63       */
64      public Object getSource() {
65          return source;
66      }
67      
68      /** Getter for property target.
69       * @return Value of property target.
70       *
71       */
72      public Object getTarget() {
73          return target;
74      }
75      
76      public void addProxyTarget(JComponent proxy) {
77          proxyTargets.add(proxy);
78      }
79      
80      public boolean isProxyTarget(JComponent c) {
81          return proxyTargets.contains(c);
82      }
83      
84      public void removeProxyTarget(JComponent proxy) {
85          proxyTargets.remove(proxy);
86      }
87      
88  }