Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / java / awt / dnd / DragGestureRecognizer.java
blob07b822e7a68b7857f45a9208e36908d4eb7cfe8a
1 /* DragGestureRecognizer.java --
2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package java.awt.dnd;
41 import java.awt.Component;
42 import java.awt.Point;
43 import java.awt.event.InputEvent;
44 import java.io.IOException;
45 import java.io.ObjectInputStream;
46 import java.io.ObjectOutputStream;
47 import java.io.Serializable;
48 import java.util.ArrayList;
49 import java.util.TooManyListenersException;
51 /**
52 * STUBBED
53 * @since 1.2
55 public abstract class DragGestureRecognizer implements Serializable
57 /**
58 * Compatible with JDK 1.2+.
60 private static final long serialVersionUID = 8996673345831063337L;
62 protected DragSource dragSource;
63 protected Component component;
64 protected transient DragGestureListener dragGestureListener;
65 protected int sourceActions;
66 protected ArrayList events = new ArrayList();
68 protected DragGestureRecognizer(DragSource ds, Component c, int sa,
69 DragGestureListener dgl)
71 if (ds == null)
72 throw new IllegalArgumentException();
73 dragSource = ds;
74 component = c;
75 sourceActions = sa;
76 dragGestureListener = dgl;
79 protected DragGestureRecognizer(DragSource ds, Component c, int sa)
81 this(ds, c, sa, null);
84 protected DragGestureRecognizer(DragSource ds, Component c)
86 this(ds, c, 0, null);
89 protected DragGestureRecognizer(DragSource ds)
91 this(ds, null, 0, null);
94 protected abstract void registerListeners();
96 protected abstract void unregisterListeners();
98 public DragSource getDragSource()
100 return dragSource;
103 public Component getComponent()
105 return component;
108 public void setComponent(Component c)
110 component = c;
113 public int getSourceActions()
115 return sourceActions;
118 public void setSourceActions(int sa)
120 sourceActions = sa;
123 public InputEvent getTriggerEvent()
125 return events.size() > 0 ? (InputEvent) events.get(0) : null;
128 public void resetRecognizer()
130 throw new Error("not implemented");
134 * Register a new DragGestureListener.
136 * @exception TooManyListenersException If a DragGestureListener has already
137 * been added.
139 public void addDragGestureListener(DragGestureListener dgl)
140 throws TooManyListenersException
142 if (dragGestureListener != null)
143 throw new TooManyListenersException();
144 dragGestureListener = dgl;
147 public void removeDragGestureListener(DragGestureListener dgl)
149 if (dragGestureListener != dgl)
150 throw new IllegalArgumentException();
151 dragGestureListener = null;
154 protected void fireDragGestureRecognized(int dragAction, Point p)
156 throw new Error("not implemented");
159 protected void appendEvent(InputEvent e)
161 if (e == null)
162 return;
163 events.add(e);
166 private void readObject(ObjectInputStream s)
167 throws ClassNotFoundException, IOException
169 s.defaultReadObject();
170 dragGestureListener = (DragGestureListener) s.readObject();
173 private void writeObject(ObjectOutputStream s) throws IOException
175 s.defaultWriteObject();
176 s.writeObject(dragGestureListener instanceof Serializable
177 ? dragGestureListener : null);
179 } // class DragGestureRecognizer