diff options
Diffstat (limited to 'libjava/classpath/javax/swing/event')
44 files changed, 4326 insertions, 0 deletions
diff --git a/libjava/classpath/javax/swing/event/AncestorEvent.java b/libjava/classpath/javax/swing/event/AncestorEvent.java new file mode 100644 index 000000000..27b469a8f --- /dev/null +++ b/libjava/classpath/javax/swing/event/AncestorEvent.java @@ -0,0 +1,100 @@ +/* AncestorEvent.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.awt.AWTEvent; +import java.awt.Container; + +import javax.swing.JComponent; + +/** + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class AncestorEvent extends AWTEvent +{ + private static final long serialVersionUID = -8079801679695605002L; + + public static final int ANCESTOR_ADDED = 1; + public static final int ANCESTOR_REMOVED = 2; + public static final int ANCESTOR_MOVED = 3; + + private JComponent sourceComponent; + private Container ancestor; + private Container ancestorParent; + + /** + * @param source Source component + * @param id ID + * @param ancestor ancestor + * @param ancestorParent parent ancestor + */ + public AncestorEvent(JComponent source, int id, Container ancestor, + Container ancestorParent) + { + super(source, id); + this.sourceComponent = source; + this.ancestor = ancestor; + this.ancestorParent = ancestorParent; + } + + /** + * Returns the ancestor of this event. + */ + public Container getAncestor() + { + return ancestor; + } + + /** + * Returns the ancester parent of this event. + */ + public Container getAncestorParent() + { + return ancestorParent; + } + + /** + * Returns the source of this event. + */ + public JComponent getComponent() + { + return sourceComponent; + } +} diff --git a/libjava/classpath/javax/swing/event/AncestorListener.java b/libjava/classpath/javax/swing/event/AncestorListener.java new file mode 100644 index 000000000..623956f6e --- /dev/null +++ b/libjava/classpath/javax/swing/event/AncestorListener.java @@ -0,0 +1,69 @@ +/* AncestorListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * AncestorListener Interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface AncestorListener extends EventListener { + + /** + * Ancestor Added + * @param event Ancestor Event + */ + void ancestorAdded(AncestorEvent event); + + /** + * Ancestor Removed + * @param event Ancestor Event + */ + void ancestorRemoved(AncestorEvent event); + + /** + * Ancestor Moved + * @param event Ancestor Event + */ + void ancestorMoved(AncestorEvent event); + + +} // AncestorListener diff --git a/libjava/classpath/javax/swing/event/CaretEvent.java b/libjava/classpath/javax/swing/event/CaretEvent.java new file mode 100644 index 000000000..ef0436d1c --- /dev/null +++ b/libjava/classpath/javax/swing/event/CaretEvent.java @@ -0,0 +1,70 @@ +/* CaretEvent.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventObject; + +/** + * CaretEvent + * @author Andrew Selkirk + */ +public abstract class CaretEvent extends EventObject +{ + + /** + * CaretEvent constructor + * @param source Source object + */ + public CaretEvent(Object source) + { + super(source); + } + + /** + * Get caret location + * @return the dot + */ + public abstract int getDot(); + + /** + * Get mark + * @return the mark + */ + public abstract int getMark(); + +} diff --git a/libjava/classpath/javax/swing/event/CaretListener.java b/libjava/classpath/javax/swing/event/CaretListener.java new file mode 100644 index 000000000..ab7305d5e --- /dev/null +++ b/libjava/classpath/javax/swing/event/CaretListener.java @@ -0,0 +1,56 @@ +/* CaretListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * CaretListener public interface + * @author Andrew Selkirk + */ +public interface CaretListener extends EventListener { + + /** + * Caret position has been updated + * @param event Caret Event + */ + void caretUpdate(CaretEvent event); + + +} // CaretListener diff --git a/libjava/classpath/javax/swing/event/CellEditorListener.java b/libjava/classpath/javax/swing/event/CellEditorListener.java new file mode 100644 index 000000000..4252c2712 --- /dev/null +++ b/libjava/classpath/javax/swing/event/CellEditorListener.java @@ -0,0 +1,62 @@ +/* CellEditorListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * CellEditorListener public interface + * @author Andrew Selkirk + */ +public interface CellEditorListener extends EventListener { + + /** + * Editing has been canceled + * @param event Change Event + */ + void editingCanceled(ChangeEvent event); + + /** + * Editing has been stopped + * @param event Change Event + */ + void editingStopped(ChangeEvent event); + + +} // CellEditorListener diff --git a/libjava/classpath/javax/swing/event/ChangeEvent.java b/libjava/classpath/javax/swing/event/ChangeEvent.java new file mode 100644 index 000000000..86834128d --- /dev/null +++ b/libjava/classpath/javax/swing/event/ChangeEvent.java @@ -0,0 +1,66 @@ +/* ChangeEvent.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventObject; + +/** + * An event used to signal a state change for an object. + * + * @see ChangeListener + * @see CellEditorListener + * @see TableColumnModelListener + * + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class ChangeEvent + extends EventObject +{ + + /** + * Creates a new <code>ChangeEvent</code> instance for the specified source. + * + * @param source the source for the event (<code>null</code> not permitted). + */ + public ChangeEvent(Object source) + { + super(source); + } + +} diff --git a/libjava/classpath/javax/swing/event/ChangeListener.java b/libjava/classpath/javax/swing/event/ChangeListener.java new file mode 100644 index 000000000..0f9d08774 --- /dev/null +++ b/libjava/classpath/javax/swing/event/ChangeListener.java @@ -0,0 +1,63 @@ +/* ChangeListener.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +/** + * A <code>ChangeListener</code> can register with an object to receive + * notification of state changes (for objects that support this mechanism). + * + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface ChangeListener + extends EventListener +{ + + /** + * Called by an object to notify the listener that the object's state has + * changed. The incoming <code>event</code> identifies the + * <code>source</code> of the event, allowing the listener to differentiate + * when it is listening for changes in multiple sources. + * + * @param event the change event. + */ + void stateChanged(ChangeEvent event); + +} diff --git a/libjava/classpath/javax/swing/event/DocumentEvent.java b/libjava/classpath/javax/swing/event/DocumentEvent.java new file mode 100644 index 000000000..4e1235542 --- /dev/null +++ b/libjava/classpath/javax/swing/event/DocumentEvent.java @@ -0,0 +1,156 @@ +/* DocumentEvent.java -- + Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import javax.swing.text.Document; +import javax.swing.text.Element; + +/** + * DocumentEvent public interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface DocumentEvent +{ + /** + * ElementChange public interface + */ + public static interface ElementChange + { + /** + * getIndex + * @return int + */ + int getIndex(); + + /** + * getElement + * @return Element + */ + Element getElement(); + + /** + * getChildrenRemoved + * @return Element[] + */ + Element[] getChildrenRemoved(); + + /** + * getChildrenAdded + * @return Element[] + */ + Element[] getChildrenAdded(); + + } + + /** + * EventType + */ + final class EventType + { + /** + * INSERT + */ + public static final EventType INSERT = new EventType("INSERT"); // TODO + + /** + * REMOVE + */ + public static final EventType REMOVE = new EventType("REMOVE"); // TODO + + /** + * CHANGE + */ + public static final EventType CHANGE = new EventType("CHANGE"); // TODO + + /** + * typeString + */ + private String type; + + /** + * Constructor EventType + * @param type TODO + */ + private EventType(String type) + { + this.type = type; + } + + /** + * toString + * @return String + */ + public String toString() + { + return type; + } + } + + /** + * getType + * @return EventType + */ + EventType getType(); + + /** + * getOffset + * @return int + */ + int getOffset(); + + /** + * getLength + * @return int + */ + int getLength(); + + /** + * getDocument + * @return Document + */ + Document getDocument(); + + /** + * getChange + * @param element TODO + * @return ElementChange + */ + ElementChange getChange(Element element); + +} diff --git a/libjava/classpath/javax/swing/event/DocumentListener.java b/libjava/classpath/javax/swing/event/DocumentListener.java new file mode 100644 index 000000000..28a7d9d0a --- /dev/null +++ b/libjava/classpath/javax/swing/event/DocumentListener.java @@ -0,0 +1,68 @@ +/* DocumentListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +/** + * DocumentListener public interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface DocumentListener extends EventListener { + + /** + * Changed update + * @param event Document Event + */ + void changedUpdate(DocumentEvent event); + + /** + * Insert update + * @param event Document Event + */ + void insertUpdate(DocumentEvent event); + + /** + * Remove update + * @param event Document Event + */ + void removeUpdate(DocumentEvent event); + + +} // DocumentListener diff --git a/libjava/classpath/javax/swing/event/EventListenerList.java b/libjava/classpath/javax/swing/event/EventListenerList.java new file mode 100644 index 000000000..940d1574c --- /dev/null +++ b/libjava/classpath/javax/swing/event/EventListenerList.java @@ -0,0 +1,359 @@ +/* EventListenerList.java -- + Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import gnu.java.lang.CPStringBuilder; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.lang.reflect.Array; +import java.util.EventListener; + + +/** + * A utility class for keeping track of {@link EventListener}s. + * + * <p><b>Example for using this class:</b> + * + * <blockquote><pre> import java.util.EventListener; + * import javax.swing.event.EventListenerList; + * + * class Foo + * { + * protected final EventListenerList listeners = new EventListenerList(); + * protected BarClosedEvent barClosedEvent = null; + * + * public void addBarListener(BarListener l) + * { + * listeners.<a href="#add(java.lang.Class, java.util.EventListener)" + * >add</a>(BarListener.class, l); + * } + * + * public void removeBarListener(BarListener l) + * { + * listeners.<a href="#remove(java.lang.Class, java.util.EventListener)" + * >remove</a>(BarListener.class, l); + * } + * + * protected void fireBarClosedEvent() + * { + * Object[] l = listeners.<a href="#getListenerList()" + * >getListenerList()</a>; + * + * for (int i = l.length - 2; i >= 0; i -= 2) + * if (l[i] == BarListener.class) + * { + * // Create the event on demand, when it is needed the first time. + * if (barClosedEvent == null) + * barClosedEvent = new BarClosedEvent(this); + * + * ((BarClosedListener) l[i + 1]).barClosed(barClosedEvent); + * } + * } + * }</pre></blockquote> + * + * @author Andrew Selkirk (aselkirk@sympatico.ca) + * @author Sascha Brawer (brawer@dandelis.ch) + */ +public class EventListenerList + implements Serializable +{ + /** + * An ID for serializing instances of this class; verified with the + * serialver tool of Sun J2SE 1.4.1_01. + */ + static final long serialVersionUID = -5677132037850737084L; + + + /** + * An empty array that is shared by all instances of this class that + * have no listeners. + */ + private static final Object[] NO_LISTENERS = new Object[0]; + + + /** + * An array with all currently registered listeners. The array has + * twice as many elements as there are listeners. For an even + * integer <code>i</code>, <code>listenerList[i]</code> indicates + * the registered class, and <code>listenerList[i + 1]</code> is the + * listener. + */ + protected transient Object[] listenerList = NO_LISTENERS; + + + /** + * EventListenerList constructor + */ + public EventListenerList() + { + // Nothing to do here. + } + + + /** + * Registers a listener of a specific type. + * + * @param t the type of the listener. + * + * @param listener the listener to add, which must be an instance of + * <code>t</code>, or of a subclass of <code>t</code>. + * + * @throws IllegalArgumentException if <code>listener</code> is not + * an instance of <code>t</code> (or a subclass thereof). + * + * @throws NullPointerException if <code>t</code> is <code>null</code>. + */ + public <T extends EventListener> void add(Class<T> t, T listener) + { + int oldLength; + Object[] newList; + + if (listener == null) + return; + + if (!t.isInstance(listener)) + throw new IllegalArgumentException(); + + oldLength = listenerList.length; + newList = new Object[oldLength + 2]; + if (oldLength > 0) + System.arraycopy(listenerList, 0, newList, 0, oldLength); + + newList[oldLength] = t; + newList[oldLength + 1] = listener; + listenerList = newList; + } + + + /** + * Determines the number of listeners. + */ + public int getListenerCount() + { + return listenerList.length / 2; + } + + + /** + * Determines the number of listeners of a particular class. + * + * @param t the type of listeners to be counted. In order to get + * counted, a subscribed listener must be exactly of class + * <code>t</code>. Thus, subclasses of <code>t</code> will not be + * counted. + */ + public int getListenerCount(Class<?> t) + { + int result = 0; + for (int i = 0; i < listenerList.length; i += 2) + if (t == listenerList[i]) + ++result; + + return result; + } + + + /** + * Returns an array containing a sequence of listenerType/listener pairs, one + * for each listener. + * + * @return An array containing the listener types and references. + */ + public Object[] getListenerList() + { + // returning the internal storage is a bad idea, but tests show that the + // reference implementation does this... + return listenerList; + } + + + /** + * Retrieves the currently subscribed listeners of a particular + * type. For a listener to be returned, it must have been + * registered with exactly the type <code>c</code>; subclasses are + * not considered equal. + * + * <p>The returned array can always be cast to <code>c[]</code>. + * Since it is a newly allocated copy, the caller may arbitrarily + * modify the array. + * + * @param c the class which was passed to {@link #add}. + * + * @throws ClassCastException if <code>c</code> does not implement + * the {@link EventListener} interface. + * + * @throws NullPointerException if <code>c</code> is + * <code>null</code>. + * + * @return an array of <code>c</code> whose elements are the + * currently subscribed listeners of the specified type. If there + * are no such listeners, an empty array is returned. + * + * @since 1.3 + */ + public <T extends EventListener> T[] getListeners(Class<T> c) + { + int count, f; + EventListener[] result; + + count = getListenerCount(c); + result = (EventListener[]) Array.newInstance(c, count); + f = 0; + for (int i = listenerList.length - 2; i >= 0; i -= 2) + if (listenerList[i] == c) + result[f++] = (EventListener) listenerList[i + 1]; + + return (T[]) result; + } + + + /** + * Removes a listener of a specific type. + * + * @param t the type of the listener. + * + * @param listener the listener to remove, which must be an instance + * of <code>t</code>, or of a subclass of <code>t</code>. + * + * @throws IllegalArgumentException if <code>listener</code> is not + * an instance of <code>t</code> (or a subclass thereof). + * + * @throws NullPointerException if <code>t</code> is <code>null</code>. + */ + public <T extends EventListener> void remove(Class<T> t, T listener) + { + Object[] oldList, newList; + int oldLength; + + if (listener == null) + return; + + if (!t.isInstance(listener)) + throw new IllegalArgumentException(); + + oldList = listenerList; + oldLength = oldList.length; + for (int i = 0; i < oldLength; i += 2) + if (oldList[i] == t && oldList[i + 1] == listener) + { + if (oldLength == 2) + newList = NO_LISTENERS; + else + { + newList = new Object[oldLength - 2]; + if (i > 0) + System.arraycopy(oldList, 0, newList, 0, i); + if (i < oldLength - 2) + System.arraycopy(oldList, i + 2, newList, i, + oldLength - 2 - i); + } + listenerList = newList; + return; + } + } + + + /** + * Returns a string representation of this object that may be useful + * for debugging purposes. + */ + public String toString() + { + CPStringBuilder buf = new CPStringBuilder("EventListenerList: "); + buf.append(listenerList.length / 2); + buf.append(" listeners: "); + for (int i = 0; i < listenerList.length; i += 2) + { + buf.append(" type "); + buf.append(((Class) listenerList[i]).getName()); + buf.append(" listener "); + buf.append(listenerList[i + 1]); + } + return buf.toString(); + } + + /** + * Serializes an instance to an ObjectOutputStream. + * + * @param out the stream to serialize to + * + * @throws IOException if something goes wrong + */ + private void writeObject(ObjectOutputStream out) + throws IOException + { + out.defaultWriteObject(); + for (int i = 0; i < listenerList.length; i += 2) + { + Class cl = (Class) listenerList[i]; + EventListener l = (EventListener) listenerList[i + 1]; + if (l != null && l instanceof Serializable) + { + out.writeObject(cl.getName()); + out.writeObject(l); + } + } + // Write end marker. + out.writeObject(null); + } + + /** + * Deserializes an instance from an ObjectInputStream. + * + * @param in the input stream + * + * @throws ClassNotFoundException if a serialized class can't be found + * @throws IOException if something goes wrong + */ + private <T extends EventListener> void readObject(ObjectInputStream in) + throws ClassNotFoundException, IOException + { + listenerList = NO_LISTENERS; + in.defaultReadObject(); + Object type; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + while ((type = in.readObject()) != null) + { + EventListener l = (EventListener) in.readObject(); + add(((Class<T>) Class.forName((String) type, true, cl)), (T) l); + } + } +} diff --git a/libjava/classpath/javax/swing/event/HyperlinkEvent.java b/libjava/classpath/javax/swing/event/HyperlinkEvent.java new file mode 100644 index 000000000..75092b51a --- /dev/null +++ b/libjava/classpath/javax/swing/event/HyperlinkEvent.java @@ -0,0 +1,162 @@ +/* HyperlinkEvent.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.net.URL; +import java.util.EventObject; + +import javax.swing.text.Element; + +/** + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class HyperlinkEvent extends EventObject +{ + public static final class EventType + { + public static final EventType ENTERED = new EventType("ENTERED"); // TODO + public static final EventType EXITED = new EventType("EXITED"); // TODO + public static final EventType ACTIVATED = new EventType("ACTIVATED"); // TODO + + private String type; + + /** + * Creates a new Event type. + * + * @param type String representing the event type. + */ + private EventType(String type) + { + this.type = type; + } + + /** + * Returns a <code>String</code> of this object. + */ + public String toString() + { + return type; + } + } + + private static final long serialVersionUID = -2054640811732867012L; + + private EventType type; + private URL url; + private String description; + private Element element; + + /** + * Creates a new <code>HyperlinkEvent</code> with the given arguments. + * + * @param source The object this link is associated to. + * @param type The type of event. + * @param url The URL this link pointing too. + */ + public HyperlinkEvent(Object source, EventType type, URL url) + { + this (source, type, url, null, null); + } + + /** + * Creates a new <code>HyperlinkEvent</code> with the given arguments. + * + * @param source The object this link is associated to. + * @param type The type of event. + * @param url The URL this link pointing too. + * @param description The description for this link. + */ + public HyperlinkEvent(Object source, EventType type, URL url, + String description) + { + this (source, type, url, description, null); + } + + /** + * Creates a new <code>HyperlinkEvent</code> with the given arguments. + * + * @param source The object this link is associated to. + * @param type The type of event. + * @param url The URL this link pointing too. + * @param description The description for this link. + * @param element The element in the document representing the anchor. + */ + public HyperlinkEvent(Object source, EventType type, URL url, + String description, Element element) + { + super(source); + this.type = type; + this.url = url; + this.description = description; + this.element = element; + } + + /** + * Returns the element of the document repesenting this anchor. + */ + public Element getSourceElement() + { + return element; + } + + /** + * Returns the URL of this event. + */ + public URL getURL() + { + return url; + } + + /** + * Returns the type of this event. + */ + public EventType getEventType() + { + return type; + } + + /** + * Returns the description of this event. + */ + public String getDescription() + { + return description; + } +} diff --git a/libjava/classpath/javax/swing/event/HyperlinkListener.java b/libjava/classpath/javax/swing/event/HyperlinkListener.java new file mode 100644 index 000000000..0e01ba7ed --- /dev/null +++ b/libjava/classpath/javax/swing/event/HyperlinkListener.java @@ -0,0 +1,57 @@ +/* HyperlinkListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * HyperlinkListener + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface HyperlinkListener extends EventListener { + + /** + * Hyperlink updated + * @param event Hyperlink Event + */ + void hyperlinkUpdate(HyperlinkEvent event); + + +} // HyperlinkListener diff --git a/libjava/classpath/javax/swing/event/InternalFrameAdapter.java b/libjava/classpath/javax/swing/event/InternalFrameAdapter.java new file mode 100644 index 000000000..da893c76d --- /dev/null +++ b/libjava/classpath/javax/swing/event/InternalFrameAdapter.java @@ -0,0 +1,126 @@ +/* InternalFrameAdapter.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +/** + * InternalFrameAdapter. + * + * @author Andrew Selkirk + */ +public abstract class InternalFrameAdapter implements InternalFrameListener +{ + /** + * InternalFrameAdapter constructor. + */ + public InternalFrameAdapter() + { + // Nothing to do here. + } + + /** + * Internal frame activated. + * + * @param event internal frame event + */ + public void internalFrameActivated(InternalFrameEvent event) + { + // Nothing to do here. + } + + /** + * Internal frame closed. + * + * @param event internal frame event + */ + public void internalFrameClosed(InternalFrameEvent event) + { + // Nothing to do here. + } + + /** + * Internal frame closing. + * + * @param event internal frame event + */ + public void internalFrameClosing(InternalFrameEvent event) + { + // Nothing to do here. + } + + /** + * Internal frame deactivated. + * + * @param event internal frame event + */ + public void internalFrameDeactivated(InternalFrameEvent event) + { + // Nothing to do here. + } + + /** + * Internal frame deiconified. + * + * @param event internal frame event + */ + public void internalFrameDeiconified(InternalFrameEvent event) + { + // Nothing to do here. + } + + /** + * Internal frame iconified. + * + * @param event internal frame event + */ + public void internalFrameIconified(InternalFrameEvent event) + { + // Nothing to do here. + } + + /** + * Internal frame opened. + * + * @param event internal frame event + */ + public void internalFrameOpened(InternalFrameEvent event) + { + // Nothing to do here. + } + +} diff --git a/libjava/classpath/javax/swing/event/InternalFrameEvent.java b/libjava/classpath/javax/swing/event/InternalFrameEvent.java new file mode 100644 index 000000000..1d7145d31 --- /dev/null +++ b/libjava/classpath/javax/swing/event/InternalFrameEvent.java @@ -0,0 +1,154 @@ +/* InternalFrameEvent.java -- + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.awt.AWTEvent; + +import javax.swing.JInternalFrame; + +/** + * An event that indicates a change to a {@link JInternalFrame} component. + * + * @author Andrew Selkirk + */ +public class InternalFrameEvent extends AWTEvent +{ + private static final long serialVersionUID = -5204823611874873183L; + + /** + * Internal frame activated event. + */ + public static final int INTERNAL_FRAME_ACTIVATED = 25554; + + /** + * Internal frame closed event. + */ + public static final int INTERNAL_FRAME_CLOSED = 25551; + + /** + * Internal frame closing event. + */ + public static final int INTERNAL_FRAME_CLOSING = 25550; + + /** + * Internal frame deactivated event. + */ + public static final int INTERNAL_FRAME_DEACTIVATED = 25555; + + /** + * Internal frame deiconifed event. + */ + public static final int INTERNAL_FRAME_DEICONIFIED = 25553; + + /** + * Internal frame frame first event. + */ + public static final int INTERNAL_FRAME_FIRST = 25549; + + /** + * Internal frame iconified event. + */ + public static final int INTERNAL_FRAME_ICONIFIED = 25552; + + /** + * Internal frame last event. + */ + public static final int INTERNAL_FRAME_LAST = 25555; + + /** + * Internal frame opened event. + */ + public static final int INTERNAL_FRAME_OPENED = 25549; + + /** + * Creates a new <code>JInternalFrameEvent</code> instance. + * + * @param source the source of this event (<code>null</code> not permitted). + * @param id the event ID of this event (see the constants defined by this + * class). + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public InternalFrameEvent(JInternalFrame source, int id) + { + super(source, id); + } + + /** + * Returns the <code>JInternalFrame</code> component that is the source for + * this event. + * + * @return The source. + * + * @since 1.3 + */ + public JInternalFrame getInternalFrame() + { + return (JInternalFrame) source; + } + + /** + * Returns a string that indicates the event id. This is used by the + * {@link #toString()} method. + * + * @return A string that indicates the event id. + */ + public String paramString() + { + switch (id) { + case INTERNAL_FRAME_ACTIVATED: + return "INTERNAL_FRAME_ACTIVATED"; + case INTERNAL_FRAME_CLOSED: + return "INTERNAL_FRAME_CLOSED"; + case INTERNAL_FRAME_CLOSING: + return "INTERNAL_FRAME_CLOSING"; + case INTERNAL_FRAME_DEACTIVATED: + return "INTERNAL_FRAME_DEACTIVATED"; + case INTERNAL_FRAME_DEICONIFIED: + return "INTERNAL_FRAME_DEICONIFIED"; + case INTERNAL_FRAME_ICONIFIED: + return "INTERNAL_FRAME_ICONIFIED"; + case INTERNAL_FRAME_OPENED: + return "INTERNAL_FRAME_OPENED"; + default: + return "unknown type"; + } + } +} diff --git a/libjava/classpath/javax/swing/event/InternalFrameListener.java b/libjava/classpath/javax/swing/event/InternalFrameListener.java new file mode 100644 index 000000000..36874d216 --- /dev/null +++ b/libjava/classpath/javax/swing/event/InternalFrameListener.java @@ -0,0 +1,92 @@ +/* InternalFrameListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * InternalFrameListener public interface + * @author Andrew Selkirk + */ +public interface InternalFrameListener extends EventListener { + + /** + * Internal frame activated + * @param event Internal Frame Event + */ + void internalFrameActivated(InternalFrameEvent event); + + /** + * Internal frame closed + * @param event Internal Frame Event + */ + void internalFrameClosed(InternalFrameEvent event); + + /** + * Internal frame closing + * @param event Internal Frame Event + */ + void internalFrameClosing(InternalFrameEvent event); + + /** + * Internal frame deactivated + * @param event Internal Frame Event + */ + void internalFrameDeactivated(InternalFrameEvent event); + + /** + * Internal frame deiconified + * @param event Internal Frame Event + */ + void internalFrameDeiconified(InternalFrameEvent event); + + /** + * Internal frame iconified + * @param event Internal Frame Event + */ + void internalFrameIconified(InternalFrameEvent event); + + /** + * Internal frame opened + * @param event Internal Frame Event + */ + void internalFrameOpened(InternalFrameEvent event); + + +} // InternalFrameListener diff --git a/libjava/classpath/javax/swing/event/ListDataEvent.java b/libjava/classpath/javax/swing/event/ListDataEvent.java new file mode 100644 index 000000000..51fa887f8 --- /dev/null +++ b/libjava/classpath/javax/swing/event/ListDataEvent.java @@ -0,0 +1,132 @@ +/* ListDataEvent.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventObject; + +/** + * An event that contains information about a modification to the content of + * a list. + * + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class ListDataEvent extends EventObject +{ + private static final long serialVersionUID = 2510353260071004774L; + + /** An event type indicating that the list content has been modified. */ + public static final int CONTENTS_CHANGED = 0; + + /** An event type indicating that an interval has been added to the list. */ + public static final int INTERVAL_ADDED = 1; + + /** + * An event type indicating that an interval has been removed from the + * list. + */ + public static final int INTERVAL_REMOVED = 2; + + private int type; + private int index0; + private int index1; + + /** + * Creates a <code>ListDataEvent</code> object. + * + * @param source the source of the event (<code>null</code> not permitted). + * @param type the type of the event (should be one of + * {@link #CONTENTS_CHANGED}, {@link #INTERVAL_ADDED} or + * {@link #INTERVAL_REMOVED}, although this is not enforced). + * @param index0 the index for one end of the modified range of list + * elements. + * @param index1 the index for the other end of the modified range of list + * elements. + */ + public ListDataEvent(Object source, int type, int index0, int index1) + { + super(source); + this.type = type; + this.index0 = Math.min(index0, index1); + this.index1 = Math.max(index0, index1); + } + + /** + * Returns the index of the first item in the range of modified list items. + * + * @return The index of the first item in the range of modified list items. + */ + public int getIndex0() + { + return index0; + } + + /** + * Returns the index of the last item in the range of modified list items. + * + * @return The index of the last item in the range of modified list items. + */ + public int getIndex1() + { + return index1; + } + + /** + * Returns a code representing the type of this event, which is usually one + * of {@link #CONTENTS_CHANGED}, {@link #INTERVAL_ADDED} or + * {@link #INTERVAL_REMOVED}. + * + * @return The event type. + */ + public int getType() + { + return type; + } + + /** + * Returns a string representing the state of this event. + * + * @return A string. + */ + public String toString() + { + return getClass().getName() + "[type=" + type + ",index0=" + index0 + + ",index1=" + index1 + "]"; + } +} diff --git a/libjava/classpath/javax/swing/event/ListDataListener.java b/libjava/classpath/javax/swing/event/ListDataListener.java new file mode 100644 index 000000000..4bbe1e5e4 --- /dev/null +++ b/libjava/classpath/javax/swing/event/ListDataListener.java @@ -0,0 +1,82 @@ +/* ListDataListener.java -- + Copyright (C) 2002, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +import javax.swing.ListModel; + +/** + * A <code>ListDataListener</code> can register with a {@link ListModel} and + * receive notification of updates to the model. + * + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface ListDataListener extends EventListener +{ + + /** + * Notifies the listener that the contents of the list have changed + * in some way. This method will be called if the change cannot be + * notified via the {@link #intervalAdded(ListDataEvent)} or the + * {@link #intervalRemoved(ListDataEvent)} methods. + * + * @param event the event. + */ + void contentsChanged(ListDataEvent event); + + /** + * Notifies the listener that one or more items have been added to the + * list. The <code>event</code> argument can supply the indices for the + * range of items added. + * + * @param event the event. + */ + void intervalAdded(ListDataEvent event); + + /** + * Notifies the listener that one or more items have been removed from + * the list. The <code>event</code> argument can supply the indices for + * the range of items removed. + * + * @param event the event. + */ + void intervalRemoved(ListDataEvent event); + +} diff --git a/libjava/classpath/javax/swing/event/ListSelectionEvent.java b/libjava/classpath/javax/swing/event/ListSelectionEvent.java new file mode 100644 index 000000000..97555d17a --- /dev/null +++ b/libjava/classpath/javax/swing/event/ListSelectionEvent.java @@ -0,0 +1,135 @@ +/* ListSelectionEvent.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventObject; + +import javax.swing.ListSelectionModel; + +/** + * An event that indicates a change to a list selection, including the source + * of the change (a {@link ListSelectionModel}) and the range of items in the + * list that have potentially changed their selection status. + * + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class ListSelectionEvent extends EventObject +{ + + /** + * The index of the first list item in the range of items that has + * potentially had its selection status modified. + */ + private int firstIndex = 0; + + /** + * The index of the last list item in the range of items that has + * potentially had its selection status modified. + */ + private int lastIndex = 0; + + /** A flag that indicates that this event is one in a series of events. */ + private boolean isAdjusting = false; + + /** + * Creates a new <code>ListSelectionEvent</code>. + * + * @param source the event source (<code>null</code> not permitted). + * @param firstIndex the first index. + * @param lastIndex the last index. + * @param isAdjusting a flag indicating that this event is one in a series + * of events updating a selection. + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public ListSelectionEvent(Object source, int firstIndex, + int lastIndex, boolean isAdjusting) + { + super(source); + this.firstIndex = firstIndex; + this.lastIndex = lastIndex; + this.isAdjusting = isAdjusting; + } + + /** + * Returns the first index. + * + * @return The first index. + */ + public int getFirstIndex() + { + return firstIndex; + } + + /** + * Returns the last index. + * + * @return The last index. + */ + public int getLastIndex() + { + return lastIndex; + } + + /** + * Returns the flag that indicates that this event is one in a series of + * events updating a selection. + * + * @return A boolean. + */ + public boolean getValueIsAdjusting() + { + return isAdjusting; + } + + /** + * Returns a string representation of the event, typically used for debugging + * purposes. + * + * @return A string representation of the event. + */ + public String toString() + { + return this.getClass().toString() + "[ source=" + source.toString() + + " firstIndex= " + firstIndex + " lastIndex= " + lastIndex + + " isAdjusting= " + isAdjusting + " ]"; + } + +} diff --git a/libjava/classpath/javax/swing/event/ListSelectionListener.java b/libjava/classpath/javax/swing/event/ListSelectionListener.java new file mode 100644 index 000000000..20e40da58 --- /dev/null +++ b/libjava/classpath/javax/swing/event/ListSelectionListener.java @@ -0,0 +1,61 @@ +/* ListSelectionListener.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +import javax.swing.ListSelectionModel; + +/** + * A listener that receives {@link ListSelectionEvent} notifications, + * typically from a {@link ListSelectionModel} when it is modified. + * + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface ListSelectionListener extends EventListener +{ + + /** + * Receives notification of a {@link ListSelectionEvent}. + * + * @param event the event. + */ + void valueChanged(ListSelectionEvent event); + +} diff --git a/libjava/classpath/javax/swing/event/MenuDragMouseEvent.java b/libjava/classpath/javax/swing/event/MenuDragMouseEvent.java new file mode 100644 index 000000000..952d99e39 --- /dev/null +++ b/libjava/classpath/javax/swing/event/MenuDragMouseEvent.java @@ -0,0 +1,104 @@ +/* MenuDragMouseEvent.java -- + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.awt.Component; +import java.awt.event.MouseEvent; + +import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; + +/** + * MenuDragMouseEvent + * @author Andrew Selkirk + */ +public class MenuDragMouseEvent extends MouseEvent +{ + + /** + * path + */ + private MenuElement[] path = null; + + /** + * manager + */ + private MenuSelectionManager manager = null; + + /** + * Constructor MenuDragMouseEvent + * @param source Source + * @param id MouseEvent type + * @param when Time + * @param modifiers Key modifiers + * @param x Horizontal position + * @param y Vertical position + * @param clickCount Click count + * @param popupTrigger Popup trigger? + * @param path Path + * @param manager MenuSelectionManager + */ + public MenuDragMouseEvent(Component source, int id, long when, int modifiers, + int x, int y, int clickCount, boolean popupTrigger, + MenuElement[] path, MenuSelectionManager manager) + { + super(source, id, when, modifiers, x, y, clickCount, popupTrigger); + this.path = path; + this.manager = manager; + } + + /** + * Get path + * @return path + */ + public MenuElement[] getPath() + { + return path; + } + + /** + * Get menu selection manager + * @return manager + */ + public MenuSelectionManager getMenuSelectionManager() + { + return manager; + } + +} diff --git a/libjava/classpath/javax/swing/event/MenuDragMouseListener.java b/libjava/classpath/javax/swing/event/MenuDragMouseListener.java new file mode 100644 index 000000000..d0cd0530f --- /dev/null +++ b/libjava/classpath/javax/swing/event/MenuDragMouseListener.java @@ -0,0 +1,74 @@ +/* MenuDragMouseListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * MenuDragMouseListener public interface + * @author Andrew Selkirk + */ +public interface MenuDragMouseListener extends EventListener { + + /** + * Menu drag mouse dragged + * @param event Menu Drag Mouse Event + */ + void menuDragMouseDragged(MenuDragMouseEvent event); + + /** + * Menu drag mouse entered + * @param event Menu Drag Mouse Event + */ + void menuDragMouseEntered(MenuDragMouseEvent event); + + /** + * Menu drag mouse exited + * @param event Menu Drag Mouse Event + */ + void menuDragMouseExited(MenuDragMouseEvent event); + + /** + * Menu drag mouse released + * @param event Menu Drag Mouse Event + */ + void menuDragMouseReleased(MenuDragMouseEvent event); + + +} // MenuDragMouseListener diff --git a/libjava/classpath/javax/swing/event/MenuEvent.java b/libjava/classpath/javax/swing/event/MenuEvent.java new file mode 100644 index 000000000..6a7e0215f --- /dev/null +++ b/libjava/classpath/javax/swing/event/MenuEvent.java @@ -0,0 +1,59 @@ +/* MenuEvent.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventObject; + +/** + * MenuEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class MenuEvent extends EventObject +{ + + /** + * Constructor MenuEvent + * @param source Source object + */ + public MenuEvent(Object source) + { + super(source); + } + +} diff --git a/libjava/classpath/javax/swing/event/MenuKeyEvent.java b/libjava/classpath/javax/swing/event/MenuKeyEvent.java new file mode 100644 index 000000000..937089ec2 --- /dev/null +++ b/libjava/classpath/javax/swing/event/MenuKeyEvent.java @@ -0,0 +1,102 @@ +/* MenuKeyEvent.java -- + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.awt.Component; +import java.awt.event.KeyEvent; + +import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; + +/** + * MenuKeyEvent + * @author Andrew Selkirk + */ +public class MenuKeyEvent extends KeyEvent +{ + + /** + * path + */ + private MenuElement[] path = null; + + /** + * manager + */ + private MenuSelectionManager manager = null; + + /** + * Constructor MenuKeyEvent + * @param source Source + * @param id KeyEvent ID + * @param when Time + * @param modifiers Modifier keys + * @param keyCode Key code + * @param keyChar Key char + * @param path Path + * @param manager MenuSelectionManager + */ + public MenuKeyEvent(Component source, int id, long when, int modifiers, + int keyCode, char keyChar, MenuElement[] path, + MenuSelectionManager manager) + { + super(source, id, when, modifiers, keyCode, keyChar); + this.path = path; + this.manager = manager; + } + + /** + * getPath + * @return path + */ + public MenuElement[] getPath() + { + return path; + } + + /** + * getMenuSelectionManager + * @return MenuSelectionManager + */ + public MenuSelectionManager getMenuSelectionManager() + { + return manager; + } + +} diff --git a/libjava/classpath/javax/swing/event/MenuKeyListener.java b/libjava/classpath/javax/swing/event/MenuKeyListener.java new file mode 100644 index 000000000..36d6ecdd4 --- /dev/null +++ b/libjava/classpath/javax/swing/event/MenuKeyListener.java @@ -0,0 +1,68 @@ +/* MenuKeyListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * MenuKeyListener public interface + * @author Andrew Selkirk + */ +public interface MenuKeyListener extends EventListener { + + /** + * Menu key pressed + * @param event Menu Key Event + */ + void menuKeyPressed(MenuKeyEvent event); + + /** + * Menu key released + * @param event Menu Key Event + */ + void menuKeyReleased(MenuKeyEvent event); + + /** + * Menu key typed + * @param event Menu Key Event + */ + void menuKeyTyped(MenuKeyEvent event); + + +} // MenuKeyListener diff --git a/libjava/classpath/javax/swing/event/MenuListener.java b/libjava/classpath/javax/swing/event/MenuListener.java new file mode 100644 index 000000000..10a18f215 --- /dev/null +++ b/libjava/classpath/javax/swing/event/MenuListener.java @@ -0,0 +1,68 @@ +/* MenuListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * MenuListener public interface + * @author Andrew Selkirk + */ +public interface MenuListener extends EventListener { + + /** + * Menu canceled + * @param event Menu Event + */ + void menuCanceled(MenuEvent event); + + /** + * Menu deselected + * @param event Menu Event + */ + void menuDeselected(MenuEvent event); + + /** + * Menu selected + * @param event Menu Event + */ + void menuSelected(MenuEvent event); + + +} // MenuListener diff --git a/libjava/classpath/javax/swing/event/MouseInputAdapter.java b/libjava/classpath/javax/swing/event/MouseInputAdapter.java new file mode 100644 index 000000000..2da5543eb --- /dev/null +++ b/libjava/classpath/javax/swing/event/MouseInputAdapter.java @@ -0,0 +1,119 @@ +/* MouseInputAdapter.java -- + Copyright (C) 2002, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.awt.event.MouseEvent; + +/** + * MouseInputAdapter + * @author Andrew Selkirk + */ +public abstract class MouseInputAdapter implements MouseInputListener +{ + /** + * Constructor MouseInputAdapter + */ + public MouseInputAdapter() + { + // Do nothing here. + } + + /** + * Mouse clicked + * @param event Mouse event + */ + public void mouseClicked(MouseEvent event) + { + // Do nothing by default. + } + + /** + * Mouse dragged + * @param event Mouse event + */ + public void mouseDragged(MouseEvent event) + { + // Do nothing by default. + } + + /** + * Mouse entered + * @param event Mouse event + */ + public void mouseEntered(MouseEvent event) + { + // Do nothing by default. + } + + /** + * Mouse exited + * @param event Mouse event + */ + public void mouseExited(MouseEvent event) + { + // Do nothing by default. + } + + /** + * Mouse moved + * @param event Mouse event + */ + public void mouseMoved(MouseEvent event) + { + // Do nothing by default. + } + + /** + * Mouse pressed + * @param event Mouse event + */ + public void mousePressed(MouseEvent event) + { + // Do nothing by default. + } + + /** + * Mouse released + * @param event Mouse event + */ + public void mouseReleased(MouseEvent event) + { + // Do nothing by default. + } +} diff --git a/libjava/classpath/javax/swing/event/MouseInputListener.java b/libjava/classpath/javax/swing/event/MouseInputListener.java new file mode 100644 index 000000000..fc9261533 --- /dev/null +++ b/libjava/classpath/javax/swing/event/MouseInputListener.java @@ -0,0 +1,53 @@ +/* MouseInputListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +/** + * MouseInputListener public interface. + * + * @author Andrew Selkirk + */ +public interface MouseInputListener extends MouseListener, + MouseMotionListener +{ + // This interface only pulls together MouseListener and MouseMotionListener + // without adding any methods on its own. +} diff --git a/libjava/classpath/javax/swing/event/PopupMenuEvent.java b/libjava/classpath/javax/swing/event/PopupMenuEvent.java new file mode 100644 index 000000000..640b900ad --- /dev/null +++ b/libjava/classpath/javax/swing/event/PopupMenuEvent.java @@ -0,0 +1,58 @@ +/* PopupMenuEvent.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventObject; + +/** + * PopupMenuEvent + * @author Andrew Selkirk + */ +public class PopupMenuEvent extends EventObject { + + /** + * Constructor PopupMenuEvent + * @param source Source + */ + public PopupMenuEvent(Object source) { + super(source); + } // PopupMenuEvent() + + +} // PopupMenuEvent diff --git a/libjava/classpath/javax/swing/event/PopupMenuListener.java b/libjava/classpath/javax/swing/event/PopupMenuListener.java new file mode 100644 index 000000000..18d68f406 --- /dev/null +++ b/libjava/classpath/javax/swing/event/PopupMenuListener.java @@ -0,0 +1,68 @@ +/* PopupMenuListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * PopupMenuListener public interface + * @author Andrew Selkirk + */ +public interface PopupMenuListener extends EventListener { + + /** + * Popup Menu Canceled + * @param event Popup Menu Event + */ + void popupMenuCanceled(PopupMenuEvent event); + + /** + * Popup Menu will become invisible + * @param event Popup Menu Event + */ + void popupMenuWillBecomeInvisible(PopupMenuEvent event); + + /** + * Popup Menu will become visible + * @param event Popup Menu Event + */ + void popupMenuWillBecomeVisible(PopupMenuEvent event); + + +} // PopupMenuListener diff --git a/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java new file mode 100644 index 000000000..5228b3d57 --- /dev/null +++ b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java @@ -0,0 +1,70 @@ +/* SwingPropertyChangeSupport.java -- + Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +/** + * Provides a mechanism for registering {@link PropertyChangeListener}s and + * forwarding {@link PropertyChangeEvent}s to those listeners. + * + * As of JDK1.5 this class is no longer in use. Use + * {@link PropertyChangeSupport} instead. + * + * @author Andrew Selkirk + */ +public final class SwingPropertyChangeSupport + extends PropertyChangeSupport +{ + + private static final long serialVersionUID = 7162625831330845068L; + + /** + * Creates a new instance. + * + * @param source the source (<code>null</code> not permitted). + * + * @throws NullPointerException if <code>source</code> is <code>null</code>. + */ + public SwingPropertyChangeSupport(Object source) + { + super(source); + } +} diff --git a/libjava/classpath/javax/swing/event/TableColumnModelEvent.java b/libjava/classpath/javax/swing/event/TableColumnModelEvent.java new file mode 100644 index 000000000..70bd7d050 --- /dev/null +++ b/libjava/classpath/javax/swing/event/TableColumnModelEvent.java @@ -0,0 +1,93 @@ +/* TableColumnModelEvent.java -- + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventObject; + +import javax.swing.table.TableColumnModel; + +/** + * TableColumnModelEvent + * @author Andrew Selkirk + */ +public class TableColumnModelEvent extends EventObject +{ + + /** + * fromIndex + */ + protected int fromIndex = 0; + + /** + * toIndex + */ + protected int toIndex = 0; + + /** + * Constructor TableColumnModelEvent + * @param source Source TableColumnModel + * @param from From index + * @param to To index + */ + public TableColumnModelEvent(TableColumnModel source, int from, int to) + { + super(source); + fromIndex = from; + toIndex = to; + } + + /** + * getFromIndex. + * @return From index + */ + public int getFromIndex() + { + return fromIndex; + } + + /** + * getToIndex. + * @return To index + */ + public int getToIndex() + { + return toIndex; + } + +} diff --git a/libjava/classpath/javax/swing/event/TableColumnModelListener.java b/libjava/classpath/javax/swing/event/TableColumnModelListener.java new file mode 100644 index 000000000..362a4d9cd --- /dev/null +++ b/libjava/classpath/javax/swing/event/TableColumnModelListener.java @@ -0,0 +1,94 @@ +/* TableColumnModelListener.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +import javax.swing.table.TableColumnModel; + +/** + * A <code>TableColumnModelListener</code> can register with a + * {@link TableColumnModel} to receive notification of changes to the model. + * + * @author Andrew Selkirk + */ +public interface TableColumnModelListener + extends EventListener +{ + + /** + * Called by the {@link TableColumnModel} to indicate that a column has been + * added to the model. + * + * @param event information about the column addition. + */ + void columnAdded(TableColumnModelEvent event); + + /** + * Called by the {@link TableColumnModel} to indicate that the model's + * column margin has changed. + * + * @param event the event (identifies the source). + */ + void columnMarginChanged(ChangeEvent event); + + /** + * Called by the {@link TableColumnModel} to indicate that a column has been + * moved. + * + * @param event information about the column move. + */ + void columnMoved(TableColumnModelEvent event); + + /** + * Called by the {@link TableColumnModel} to indicate that a column has been + * removed from the model. + * + * @param event information about the column removal. + */ + void columnRemoved(TableColumnModelEvent event); + + /** + * Called by the {@link TableColumnModel} to indicate that the column + * selection state has changed. + * + * @param event information about the column selection state. + */ + void columnSelectionChanged(ListSelectionEvent event); + +} diff --git a/libjava/classpath/javax/swing/event/TableModelEvent.java b/libjava/classpath/javax/swing/event/TableModelEvent.java new file mode 100644 index 000000000..b75a78a1c --- /dev/null +++ b/libjava/classpath/javax/swing/event/TableModelEvent.java @@ -0,0 +1,220 @@ +/* TableModelEvent.java -- + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventObject; + +import javax.swing.table.TableModel; + +/** + * An event that describes changes to a {@link TableModel}. + * + * @see javax.swing.event.TableModelListener + * + * @author Andrew Selkirk + */ +public class TableModelEvent extends EventObject +{ + private static final long serialVersionUID = -7849342674552212824L; + + /** A column index representing all columns. */ + public static final int ALL_COLUMNS = -1; + + /** + * An event type indicating that one or more rows have been deleted from the + * model. + */ + public static final int DELETE = -1; + + /** A row index representing the header row. */ + public static final int HEADER_ROW = -1; + + /** + * An event type indicating that one or more rows have been inserted into the + * model. + */ + public static final int INSERT = 1; + + /** An event type indicating that data has been updated in the model. */ + public static final int UPDATE = 0; + + /** The column in the table model that the event relates to. */ + protected int column = 0; + + /** The first row in the table model that the event relates to. */ + protected int firstRow = 0; + + /** The last row in the table model that the event relates to. */ + protected int lastRow = 0; + + /** + * The event type (one of {@link #UPDATE}, {@link #INSERT}, {@link #DELETE}). + */ + protected int type = 0; + + /** + * Creates a new <code>TableModelEvent</code> indicating an {@link #UPDATE} + * to the data in all columns and rows. + * + * @param source the source object (<code>null</code> not permitted). + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public TableModelEvent(TableModel source) + { + this(source, 0, Integer.MAX_VALUE, ALL_COLUMNS, UPDATE); + } + + /** + * Creates a new <code>TableModelEvent</code> indicating an {@link #UPDATE} + * to the data in a single row across all columns. + * + * @param source the source object (<code>null</code> not permitted). + * @param row the updated row. + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public TableModelEvent(TableModel source, int row) + { + this(source, row, row, ALL_COLUMNS, UPDATE); + } + + /** + * Creates a new <code>TableModelEvent</code> indicating an {@link #UPDATE} + * to the data in the specified rows across all columns. + * + * @param source the source object (<code>null</code> not permitted). + * @param firstRow the first row of update. + * @param lastRow the last row of update. + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public TableModelEvent(TableModel source, int firstRow, int lastRow) + { + this(source, firstRow, lastRow, ALL_COLUMNS, UPDATE); + } + + /** + * Creates a new <code>TableModelEvent</code> indicating an {@link #UPDATE} + * to the data in the specified rows and column. Use {@link #ALL_COLUMNS} + * for the <code>column</code> argument to indicate all columns. + * + * @param source the source object (<code>null</code> not permitted). + * @param firstRow the first row of update. + * @param lastRow the last row of update. + * @param column the affected column. + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public TableModelEvent(TableModel source, int firstRow, int lastRow, + int column) + { + this(source, firstRow, lastRow, column, UPDATE); + } + + /** + * Creates a new <code>TableModelEvent</code> indicating an operation of + * the specified <code>type</code> on the data in the specified rows and + * column. The event type is usually one of {@link #UPDATE}, {@link #INSERT}, + * and {@link #DELETE}. + * + * @param source the source object (<code>null</code> not permitted). + * @param firstRow the first row of update. + * @param lastRow the last row of update. + * @param column the affected column. + * @param type the type of change. + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public TableModelEvent(TableModel source, int firstRow, int lastRow, + int column, int type) + { + super(source); + this.firstRow = firstRow; + this.lastRow = lastRow; + this.column = column; + this.type = type; + } + + /** + * Returns the affected column of this event. + * + * @return The column index. + */ + public int getColumn() + { + return column; + } + + /** + * Returns the first affected row of this event. + * + * @return The row index. + */ + public int getFirstRow() + { + return firstRow; + } + + /** + * Returns the last affected row of this event. + * + * @return The row index. + */ + public int getLastRow() + { + return lastRow; + } + + /** + * Returns the type of change indicated by this event (usually one of + * {@link #UPDATE}, {@link #INSERT}, {@link #DELETE}). + * + * @return The type. + */ + public int getType() + { + return type; + } +} diff --git a/libjava/classpath/javax/swing/event/TableModelListener.java b/libjava/classpath/javax/swing/event/TableModelListener.java new file mode 100644 index 000000000..612712f85 --- /dev/null +++ b/libjava/classpath/javax/swing/event/TableModelListener.java @@ -0,0 +1,60 @@ +/* TableModelListener.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +/** + * A <code>TableModelListener</code> can register with a + * {@link javax.swing.table.TableModel} and receive notification of updates to + * the model. + * + * @author Andrew Selkirk + */ +public interface TableModelListener extends EventListener +{ + + /** + * Called to notify the listener that the + * {@link javax.swing.table.TableModel} has been updated. + * + * @param event contains details of the update. + */ + void tableChanged(TableModelEvent event); + +} diff --git a/libjava/classpath/javax/swing/event/TreeExpansionEvent.java b/libjava/classpath/javax/swing/event/TreeExpansionEvent.java new file mode 100644 index 000000000..99e166677 --- /dev/null +++ b/libjava/classpath/javax/swing/event/TreeExpansionEvent.java @@ -0,0 +1,77 @@ +/* TreeExpansionEvent.java -- + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventObject; + +import javax.swing.tree.TreePath; + +/** + * TreeExpansionEvent + * @author Andrew Selkirk + */ +public class TreeExpansionEvent extends EventObject +{ + + /** + * path + */ + protected TreePath path = null; + + /** + * Constructor TreeExpansionEvent + * @param source Source object + * @param path Path + */ + public TreeExpansionEvent(Object source, TreePath path) + { + super(source); + this.path = path; + } + + /** + * getPath + * @return Tree path + */ + public TreePath getPath() + { + return path; + } + +} diff --git a/libjava/classpath/javax/swing/event/TreeExpansionListener.java b/libjava/classpath/javax/swing/event/TreeExpansionListener.java new file mode 100644 index 000000000..3461f2ce4 --- /dev/null +++ b/libjava/classpath/javax/swing/event/TreeExpansionListener.java @@ -0,0 +1,62 @@ +/* TreeExpansionListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +/** + * TreeExpansionListener public interface + * @author Andrew Selkirk + */ +public interface TreeExpansionListener extends EventListener +{ + + /** + * Tree collapsed + * @param event Tree Expansion Event + */ + void treeCollapsed(TreeExpansionEvent event); + + /** + * Tree expanded + * @param event Tree Expansion Event + */ + void treeExpanded(TreeExpansionEvent event); + + +} diff --git a/libjava/classpath/javax/swing/event/TreeModelEvent.java b/libjava/classpath/javax/swing/event/TreeModelEvent.java new file mode 100644 index 000000000..490126f4d --- /dev/null +++ b/libjava/classpath/javax/swing/event/TreeModelEvent.java @@ -0,0 +1,168 @@ +/* TreeModelEvent.java -- + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventObject; + +import javax.swing.tree.TreePath; + +/** + * TreeModelEvent + * @author Andrew Selkirk + */ +public class TreeModelEvent extends EventObject +{ + + /** + * childIndices + */ + protected int[] childIndices = null; + + /** + * children + */ + protected Object[] children = null; + + /** + * path + */ + protected TreePath path = null; + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path + */ + public TreeModelEvent(Object source, Object[] path) + { + super(source); + this.path = new TreePath(path); + } + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path path + * @param childIndices Child indices + * @param children Children + */ + public TreeModelEvent(Object source, Object[] path, + int[] childIndices, Object[] children) + { + super(source); + this.path = new TreePath(path); + this.childIndices = childIndices; + this.children = children; + } + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path Path + */ + public TreeModelEvent(Object source, TreePath path) + { + super(source); + this.path = path; + } + + /** + * Constructor TreeModelEvent + * @param source Source object + * @param path Path + * @param childIndices Child indices + * @param children Children + */ + public TreeModelEvent(Object source, TreePath path, + int[] childIndices, Object[] children) + { + super(source); + this.path = path; + this.childIndices = childIndices; + this.children = children; + } + + /** + * getChildIndices + * @return child indices + */ + public int[] getChildIndices() + { + return childIndices; + } + + /** + * getChildren + * @return children + */ + public Object[] getChildren() + { + return children; + } + + /** + * getPath + * @return path + */ + public Object[] getPath() + { + return path.getPath(); + } + + /** + * getTreePath + * @return TreePath + */ + public TreePath getTreePath() + { + return path; + } + + /** + * String representation + * @return String representation + */ + public String toString() + { + return getClass() + " [Source: " + getSource() + ", TreePath: " + + getTreePath() + ", Child Indicies: " + getChildIndices() + + ", Children: " + getChildren() + ", Path: " + getPath() +"]"; + } + +} diff --git a/libjava/classpath/javax/swing/event/TreeModelListener.java b/libjava/classpath/javax/swing/event/TreeModelListener.java new file mode 100644 index 000000000..780410588 --- /dev/null +++ b/libjava/classpath/javax/swing/event/TreeModelListener.java @@ -0,0 +1,74 @@ +/* TreeModelListener.java -- + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +// Imports +import java.util.EventListener; + +/** + * TreeModelListener public interface + * @author Andrew Selkirk + */ +public interface TreeModelListener extends EventListener { + + /** + * Tree nodes changed + * @param event Tree Model Event + */ + void treeNodesChanged(TreeModelEvent event); + + /** + * Tree nodes inserted + * @param event Tree Model Event + */ + void treeNodesInserted(TreeModelEvent event); + + /** + * Tree nodes removed + * @param event Tree Model Event + */ + void treeNodesRemoved(TreeModelEvent event); + + /** + * Tree structured changed + * @param event Tree Model Event + */ + void treeStructureChanged(TreeModelEvent event); + + +} // TreeModelListener diff --git a/libjava/classpath/javax/swing/event/TreeSelectionEvent.java b/libjava/classpath/javax/swing/event/TreeSelectionEvent.java new file mode 100644 index 000000000..830170d9f --- /dev/null +++ b/libjava/classpath/javax/swing/event/TreeSelectionEvent.java @@ -0,0 +1,257 @@ +/* TreeSelectionEvent.java -- + Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventObject; + +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +/** + * An event that carries information about a change to a + * {@link TreeSelectionModel}. + * + * @see TreeSelectionListener + * + * @author Andrew Selkirk + */ +public class TreeSelectionEvent extends EventObject +{ + + /** + * The paths that have been added or removed from the selection. + */ + protected TreePath[] paths; + + /** + * Flags indicating if the paths were added (<code>true</code>) or removed + * (<code>false</code>) from the selection. + */ + protected boolean[] areNew; + + /** + * The old lead selection path (may be <code>null</code>). + */ + protected TreePath oldLeadSelectionPath; + + /** + * The new lead selection path (may be <code>null</code>). + */ + protected TreePath newLeadSelectionPath; + + /** + * Creates a new <code>TreeSelectionEvent</code>. + * + * @param source the source (usually a {@link TreeSelectionModel}, + * <code>null</code> not permitted). + * @param paths an array of the paths that have been added to or removed + * from the selection. + * @param areNew a flag for each path where <code>true</code> indicates the + * corresponding path has been added to the selection and + * <code>false</code> indicates the path has been removed. + * @param oldLeadSelectionPath the old lead selection path (<code>null</code> + * permitted). + * @param newLeadSelectionPath the new lead selection path (<code>null</code> + * permitted). + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public TreeSelectionEvent(Object source, TreePath[] paths, + boolean[] areNew, TreePath oldLeadSelectionPath, + TreePath newLeadSelectionPath) + { + super(source); + this.paths = paths; + this.areNew = areNew; + this.oldLeadSelectionPath = oldLeadSelectionPath; + this.newLeadSelectionPath = newLeadSelectionPath; + } + + /** + * Creates a new <code>TreeSelectionEvent</code>. + * + * @param source the event source (usually a {@link TreeSelectionModel}, + * <code>null</code> not permitted). + * @param path the path. + * @param isNew <code>true</code> indicates that <code>path</code> has been + * added to the selection, and <code>false</code> indicates that it has + * been removed. + * @param oldLeadSelectionPath the old lead selection path (<code>null</code> + * permitted). + * @param newLeadSelectionPath the new lead selection path (<code>null</code> + * permitted). + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public TreeSelectionEvent(Object source, TreePath path, + boolean isNew, TreePath oldLeadSelectionPath, + TreePath newLeadSelectionPath) + { + super(source); + this.paths = new TreePath[]{path}; + this.areNew = new boolean[]{isNew}; + this.oldLeadSelectionPath = oldLeadSelectionPath; + this.newLeadSelectionPath = newLeadSelectionPath; + } + + /** + * Returns the first path element. + * + * @return The first path element. + * + * @see #getPaths() + */ + public TreePath getPath() + { + return paths[0]; + } + + /** + * Returns an array of the paths that changed in the selection. + * + * @return The paths that changed in the selection. + * + * @see #isAddedPath(TreePath) + */ + public TreePath[] getPaths() + { + return (TreePath[]) paths.clone(); + } + + /** + * Returns <code>true</code> if the path returned by {@link #getPath()} has + * been added to the selection, and <code>false</code> if it has been + * removed. + * + * @return A boolean. + * + * @see #isAddedPath(int) + */ + public boolean isAddedPath() + { + return areNew[0]; + } + + /** + * Returns <code>true</code> if <code>path</code> has been added to the + * selection, and <code>false</code> if the path has been removed from the + * selection. + * + * @param path the path to check. + * + * @return A flag indicating whether the path has been added to, or removed + * from, the selection. + * + * @throw IllegalArgumentException if <code>path</code> is not one of the + * paths in {@link #getPaths()}. + * + * @see #isAddedPath(int) + */ + public boolean isAddedPath(TreePath path) + { + for (int i = paths.length - 1; i >= 0; i--) + if (paths[i].equals(path)) + return areNew[i]; + + throw new IllegalArgumentException("Unknown 'path' argument."); + } + + /** + * Returns <code>true</code> if the path at the specified index has been + * added to the selection, and <code>false</code> if the path has been + * removed from the selection. + * + * @param index the path index. + * + * @return A flag indicating whether the path has been added to, or removed + * from, the selection. + * + * @since 1.3 + * + * @see #isAddedPath(TreePath) + */ + public boolean isAddedPath(int index) + { + return areNew[index]; + } + + /** + * Returns the old lead selection path. + * + * @return The old lead selection path (possibly <code>null</code>). + * + * @see #getNewLeadSelectionPath() + */ + public TreePath getOldLeadSelectionPath() + { + return oldLeadSelectionPath; + } + + /** + * Returns the new lead selection path. + * + * @return The new lead selection path (possibly <code>null</code>). + * + * @see #getOldLeadSelectionPath() + */ + public TreePath getNewLeadSelectionPath() + { + return newLeadSelectionPath; + } + + /** + * Creates a shallow copy of this <code>TreeSelectionEvent</code>, replacing + * the source with <code>source</code>. + * + * @param source the new event source (<code>null</code> not permitted). + * + * @return A cloned event with another event source. + * + * @throws IllegalArgumentException if <code>source</code> is + * <code>null</code>. + */ + public Object cloneWithSource(Object source) + { + return new TreeSelectionEvent (source, paths, areNew, oldLeadSelectionPath, + newLeadSelectionPath); + } + +} diff --git a/libjava/classpath/javax/swing/event/TreeSelectionListener.java b/libjava/classpath/javax/swing/event/TreeSelectionListener.java new file mode 100644 index 000000000..8f8711d3a --- /dev/null +++ b/libjava/classpath/javax/swing/event/TreeSelectionListener.java @@ -0,0 +1,60 @@ +/* TreeSelectionListener.java -- + Copyright (C) 2002, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + +import javax.swing.tree.TreeSelectionModel; + +/** + * A listener that receives {@link TreeSelectionEvent} notifications from a + * source (such as a {@link TreeSelectionModel}). + * + * @author Andrew Selkirk + */ +public interface TreeSelectionListener extends EventListener +{ + + /** + * Receives notification of a change to a tree selection model. + * + * @param event information about the event. + */ + void valueChanged(TreeSelectionEvent event); + +} diff --git a/libjava/classpath/javax/swing/event/TreeWillExpandListener.java b/libjava/classpath/javax/swing/event/TreeWillExpandListener.java new file mode 100644 index 000000000..7bdcbe48d --- /dev/null +++ b/libjava/classpath/javax/swing/event/TreeWillExpandListener.java @@ -0,0 +1,65 @@ +/* TreeWillExpandListener.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventListener; + +import javax.swing.tree.ExpandVetoException; + +/** + * @author Andrew Selkirk + */ +public interface TreeWillExpandListener extends EventListener +{ + /** + * Invoked whenever a node in the tree is about to be collapsed. + * + * @param event The tree expansion Event + */ + void treeWillCollapse(TreeExpansionEvent event) + throws ExpandVetoException; + + /** + * Invoked whenever a node in the tree is about to be expanded. + * + * @param event The tree expansion Event + */ + void treeWillExpand(TreeExpansionEvent event) + throws ExpandVetoException; +} diff --git a/libjava/classpath/javax/swing/event/UndoableEditEvent.java b/libjava/classpath/javax/swing/event/UndoableEditEvent.java new file mode 100644 index 000000000..b889bb656 --- /dev/null +++ b/libjava/classpath/javax/swing/event/UndoableEditEvent.java @@ -0,0 +1,80 @@ +/* UndoableEditEvent.java -- + Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.event; + +import java.util.EventObject; + +import javax.swing.undo.UndoableEdit; + +/** + * UndoableEditEvent + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public class UndoableEditEvent extends EventObject +{ + + private static final long serialVersionUID = 4418044561759134484L; + + /** + * edit + */ + private UndoableEdit edit; + + /** + * Constructor UndoableEditEvent + * @param source TODO + * @param edit TODO + */ + public UndoableEditEvent(Object source, UndoableEdit edit) + { + super(source); + this.edit = edit; + } + + /** + * getEdit + * @return UndoableEdit + */ + public UndoableEdit getEdit() + { + return edit; + } + +} diff --git a/libjava/classpath/javax/swing/event/UndoableEditListener.java b/libjava/classpath/javax/swing/event/UndoableEditListener.java new file mode 100644 index 000000000..13eecf51a --- /dev/null +++ b/libjava/classpath/javax/swing/event/UndoableEditListener.java @@ -0,0 +1,56 @@ +/* UndoableEditListener.java -- + Copyright (C) 2002, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.swing.event; + +import java.util.EventListener; + + +/** + * UndoableEditListener public interface + * @author Andrew Selkirk + * @author Ronald Veldema + */ +public interface UndoableEditListener extends EventListener +{ + /** + * Undoable edit has happened + * + * @param event Undoable Edit Event + */ + void undoableEditHappened(UndoableEditEvent event); +} diff --git a/libjava/classpath/javax/swing/event/package.html b/libjava/classpath/javax/swing/event/package.html new file mode 100644 index 000000000..faef7e15a --- /dev/null +++ b/libjava/classpath/javax/swing/event/package.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.swing.event package. + Copyright (C) 2002, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.swing.event</title></head> + +<body> +<p>Provides events and listeners used by components in the +<code>javax.swing</code> package.</p> + +</body> +</html> |