aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/event
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing/event')
-rw-r--r--libjava/classpath/javax/swing/event/ChangeEvent.java33
-rw-r--r--libjava/classpath/javax/swing/event/ChangeListener.java32
-rw-r--r--libjava/classpath/javax/swing/event/InternalFrameEvent.java67
-rw-r--r--libjava/classpath/javax/swing/event/TableColumnModelListener.java88
-rw-r--r--libjava/classpath/javax/swing/event/TreeSelectionEvent.java143
-rw-r--r--libjava/classpath/javax/swing/event/TreeSelectionListener.java26
6 files changed, 266 insertions, 123 deletions
diff --git a/libjava/classpath/javax/swing/event/ChangeEvent.java b/libjava/classpath/javax/swing/event/ChangeEvent.java
index f75c15a..8854282 100644
--- a/libjava/classpath/javax/swing/event/ChangeEvent.java
+++ b/libjava/classpath/javax/swing/event/ChangeEvent.java
@@ -1,5 +1,5 @@
/* ChangeEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,23 +37,30 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventObject;
/**
- * ChangeEvent
+ * 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 {
+public class ChangeEvent
+ extends EventObject
+{
- /**
- * ChangeEvent constructor
- * @param source Source object
- */
- public ChangeEvent(Object source) {
- super(source);
- } // ChangeEvent()
+ /**
+ * 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);
+ }
-
-} // ChangeEvent
+}
diff --git a/libjava/classpath/javax/swing/event/ChangeListener.java b/libjava/classpath/javax/swing/event/ChangeListener.java
index 1e58b1d..7580970 100644
--- a/libjava/classpath/javax/swing/event/ChangeListener.java
+++ b/libjava/classpath/javax/swing/event/ChangeListener.java
@@ -1,5 +1,5 @@
/* ChangeListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,21 +37,27 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventListener;
/**
- * ChangeListener interface
+ * 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 {
-
- /**
- * State changed
- * @param event Change Event
- */
- void stateChanged(ChangeEvent event);
-
-
-} // ChangeListener
+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/InternalFrameEvent.java b/libjava/classpath/javax/swing/event/InternalFrameEvent.java
index badfa80..4e289bf 100644
--- a/libjava/classpath/javax/swing/event/InternalFrameEvent.java
+++ b/libjava/classpath/javax/swing/event/InternalFrameEvent.java
@@ -1,5 +1,5 @@
/* InternalFrameEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,6 +43,8 @@ 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
@@ -50,55 +52,59 @@ public class InternalFrameEvent extends AWTEvent
private static final long serialVersionUID = -5204823611874873183L;
/**
- * Internal frame activated event
+ * Internal frame activated event.
*/
public static final int INTERNAL_FRAME_ACTIVATED = 25554;
/**
- * Internal frame closed event
+ * Internal frame closed event.
*/
public static final int INTERNAL_FRAME_CLOSED = 25551;
/**
- * Internal frame closing event
+ * Internal frame closing event.
*/
public static final int INTERNAL_FRAME_CLOSING = 25550;
/**
- * Internal frame deactivated event
+ * Internal frame deactivated event.
*/
public static final int INTERNAL_FRAME_DEACTIVATED = 25555;
/**
- * Internal frame deiconifed event
+ * Internal frame deiconifed event.
*/
public static final int INTERNAL_FRAME_DEICONIFIED = 25553;
/**
- * Internal frame frame first event
+ * Internal frame frame first event.
*/
public static final int INTERNAL_FRAME_FIRST = 25549;
/**
- * Internal frame iconified event
+ * Internal frame iconified event.
*/
public static final int INTERNAL_FRAME_ICONIFIED = 25552;
/**
- * Internal frame last event
+ * Internal frame last event.
*/
public static final int INTERNAL_FRAME_LAST = 25555;
/**
- * Internal frame opened event
+ * Internal frame opened event.
*/
public static final int INTERNAL_FRAME_OPENED = 25549;
/**
- * Creates a <code>JInternalFrameEvent</code> object.
+ * Creates a new <code>JInternalFrameEvent</code> instance.
*
- * @param source The source of this event.
- * @param id Then event ID of this event.
+ * @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)
{
@@ -106,10 +112,43 @@ public class InternalFrameEvent extends AWTEvent
}
/**
- * Returns the <code>JInternalFrame</code> object stored in this event.
+ * 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/TableColumnModelListener.java b/libjava/classpath/javax/swing/event/TableColumnModelListener.java
index 90e1b29..522e0a8 100644
--- a/libjava/classpath/javax/swing/event/TableColumnModelListener.java
+++ b/libjava/classpath/javax/swing/event/TableColumnModelListener.java
@@ -1,5 +1,5 @@
/* TableColumnModelListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,44 +37,58 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventListener;
+import javax.swing.table.TableColumnModel;
+
/**
- * TableColumnModelListener public interface
+ * 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 {
-
- /**
- * Column added
- * @param event Table Column Model Event
- */
- void columnAdded(TableColumnModelEvent event);
-
- /**
- * Column margin changed
- * @param event Change Event
- */
- void columnMarginChanged(ChangeEvent event);
-
- /**
- * Column moved
- * @param event Table Column Model Event
- */
- void columnMoved(TableColumnModelEvent event);
-
- /**
- * Column removed
- * @param event Table Column Model Event
- */
- void columnRemoved(TableColumnModelEvent event);
-
- /**
- * Column selection changed
- * @param event List Selection Event
- */
- void columnSelectionChanged(ListSelectionEvent event);
-
-
-} // TableColumnModelListener
+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/TreeSelectionEvent.java b/libjava/classpath/javax/swing/event/TreeSelectionEvent.java
index 1930677..532a1db 100644
--- a/libjava/classpath/javax/swing/event/TreeSelectionEvent.java
+++ b/libjava/classpath/javax/swing/event/TreeSelectionEvent.java
@@ -41,41 +41,57 @@ package javax.swing.event;
import java.util.EventObject;
import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
/**
- * TreeSelectionEvent
+ * An event that carries information about a change to a
+ * {@link TreeSelectionModel}.
+ *
+ * @see TreeSelectionListener
+ *
* @author Andrew Selkirk
- * @version 1.0
*/
-public class TreeSelectionEvent extends EventObject {
+public class TreeSelectionEvent extends EventObject
+{
/**
- * paths
+ * The paths that have been added or removed from the selection.
*/
protected TreePath[] paths;
/**
- * areNew
+ * Flags indicating if the paths were added (<code>true</code>) or removed
+ * (<code>false</code>) from the selection.
*/
protected boolean[] areNew;
/**
- * oldLeadSelectionPath
+ * The old lead selection path (may be <code>null</code>).
*/
protected TreePath oldLeadSelectionPath;
/**
- * newLeadSelectionPath
+ * The new lead selection path (may be <code>null</code>).
*/
protected TreePath newLeadSelectionPath;
/**
- * Constructor TreeSelectionEvent
- * @param source TODO
- * @param paths TODO
- * @param areNew TODO
- * @param oldLeadSelectionPath TODO
- * @param newLeadSelectionPath TODO
+ * 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,
@@ -89,12 +105,21 @@ public class TreeSelectionEvent extends EventObject {
}
/**
- * Constructor TreeSelectionEvent
- * @param source TODO
- * @param path TODO
- * @param isNew TODO
- * @param oldLeadSelectionPath TODO
- * @param newLeadSelectionPath TODO
+ * 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,
@@ -108,7 +133,11 @@ public class TreeSelectionEvent extends EventObject {
}
/**
- * @return the first path element
+ * Returns the first path element.
+ *
+ * @return The first path element.
+ *
+ * @see #getPaths()
*/
public TreePath getPath()
{
@@ -116,8 +145,11 @@ public class TreeSelectionEvent extends EventObject {
}
/**
+ * Returns an array of the paths that changed in the selection.
+ *
+ * @return The paths that changed in the selection.
*
- * @return the paths with selection changed
+ * @see #isAddedPath(TreePath)
*/
public TreePath[] getPaths()
{
@@ -125,7 +157,13 @@ public class TreeSelectionEvent extends EventObject {
}
/**
- * @return true if the first path is added to the selection, false otherwise
+ * 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()
{
@@ -133,21 +171,42 @@ public class TreeSelectionEvent extends EventObject {
}
/**
- * @param path the path to check
- * @return true if the path is added to the selection, false otherwise
+ * 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];
+ return areNew[i];
- return false;
+ throw new IllegalArgumentException("Unknown 'path' argument.");
}
/**
- * @param index the index'th path
- * @return true if the path is added to the selection, false otherwise
+ * 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)
{
@@ -155,7 +214,11 @@ public class TreeSelectionEvent extends EventObject {
}
/**
- * @return the previous lead selection path
+ * Returns the old lead selection path.
+ *
+ * @return The old lead selection path (possibly <code>null</code>).
+ *
+ * @see #getNewLeadSelectionPath()
*/
public TreePath getOldLeadSelectionPath()
{
@@ -163,7 +226,11 @@ public class TreeSelectionEvent extends EventObject {
}
/**
- * @return the current lead selection path
+ * Returns the new lead selection path.
+ *
+ * @return The new lead selection path (possibly <code>null</code>).
+ *
+ * @see #getOldLeadSelectionPath()
*/
public TreePath getNewLeadSelectionPath()
{
@@ -171,14 +238,20 @@ public class TreeSelectionEvent extends EventObject {
}
/**
- * @param source the new event source
- * @return a cloned event with another event source
+ * 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);
+ 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
index b844a6e..2171e39 100644
--- a/libjava/classpath/javax/swing/event/TreeSelectionListener.java
+++ b/libjava/classpath/javax/swing/event/TreeSelectionListener.java
@@ -1,5 +1,5 @@
/* TreeSelectionListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,20 +37,24 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventListener;
+import javax.swing.tree.TreeSelectionModel;
+
/**
- * TreeSelectionListener public interface
+ * A listener that receives {@link TreeSelectionEvent} notifications from a
+ * source (such as a {@link TreeSelectionModel}).
+ *
* @author Andrew Selkirk
*/
-public interface TreeSelectionListener extends EventListener {
-
- /**
- * Value changed
- * @param event Tree Selection Event
- */
- void valueChanged(TreeSelectionEvent event);
+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);
-} // TreeSelectionListener
+}