aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2004-01-23 12:42:10 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2004-01-23 12:42:10 +0000
commit3ac55a5a69f6a4f2f1acac66a36676c63c428db8 (patch)
treed45ab18ff6f571ac20c614d6c7c6c53cebbdc077 /libjava
parent5d7b2198ba194fba04e4b82dc1d223f07bc83da6 (diff)
downloadgcc-3ac55a5a69f6a4f2f1acac66a36676c63c428db8.zip
gcc-3ac55a5a69f6a4f2f1acac66a36676c63c428db8.tar.gz
gcc-3ac55a5a69f6a4f2f1acac66a36676c63c428db8.tar.bz2
AbstractAction.java: Reformated.
2004-01-23 Michael Koch <konqueror@gmx.de> * javax/swing/AbstractAction.java: Reformated. (getPropertyChangeListeners): New method. * javax/swing/AbstractCellEditor.java: Reformated. (getCellEditorListeners): New method. * javax/swing/DefaultListSelectionModel.java (listenerList): New field. (listeners): Removed. (get_listeners): Removed. (addListSelectionListener): Rewritten. (removeListSelectionListener): Rewritten. (getListSelectionListeners): New method. (getListeners): New method. * javax/swing/JComboBox.java: Imports reworked. (addActionListener): Implemented. (removeActionListener): Implemented. (addItemListener): Implemented. (removeItemListener): Implemented. (addPopupMenuListener): Implemented. (removePopupMenuListener): Implemented. (getActionListeners): New method. (getItemListeners): New method. (getPopupMenuListeners): New method. From-SVN: r76413
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog25
-rw-r--r--libjava/javax/swing/AbstractAction.java84
-rw-r--r--libjava/javax/swing/AbstractCellEditor.java100
-rw-r--r--libjava/javax/swing/DefaultListSelectionModel.java40
-rw-r--r--libjava/javax/swing/JComboBox.java134
5 files changed, 239 insertions, 144 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 6ed347a..1ebfd30 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,30 @@
2004-01-23 Michael Koch <konqueror@gmx.de>
+ * javax/swing/AbstractAction.java: Reformated.
+ (getPropertyChangeListeners): New method.
+ * javax/swing/AbstractCellEditor.java: Reformated.
+ (getCellEditorListeners): New method.
+ * javax/swing/DefaultListSelectionModel.java
+ (listenerList): New field.
+ (listeners): Removed.
+ (get_listeners): Removed.
+ (addListSelectionListener): Rewritten.
+ (removeListSelectionListener): Rewritten.
+ (getListSelectionListeners): New method.
+ (getListeners): New method.
+ * javax/swing/JComboBox.java: Imports reworked.
+ (addActionListener): Implemented.
+ (removeActionListener): Implemented.
+ (addItemListener): Implemented.
+ (removeItemListener): Implemented.
+ (addPopupMenuListener): Implemented.
+ (removePopupMenuListener): Implemented.
+ (getActionListeners): New method.
+ (getItemListeners): New method.
+ (getPopupMenuListeners): New method.
+
+2004-01-23 Michael Koch <konqueror@gmx.de>
+
* gnu/java/net/protocol/http/Connection.java
(connect): Don't initialize bufferedOutputStream if not needed.
(sendRequest): Set property for content length if content is present.
diff --git a/libjava/javax/swing/AbstractAction.java b/libjava/javax/swing/AbstractAction.java
index 4141dd3..e616bad 100644
--- a/libjava/javax/swing/AbstractAction.java
+++ b/libjava/javax/swing/AbstractAction.java
@@ -56,10 +56,6 @@ public abstract class AbstractAction
{
static final long serialVersionUID = -6803159439231523484L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
/**
* enabled
*/
@@ -76,11 +72,6 @@ public abstract class AbstractAction
*/
private transient HashMap store = new HashMap();
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor AbstractAction
*/
@@ -106,11 +97,6 @@ public abstract class AbstractAction
putValue(SMALL_ICON, icon);
} // AbstractAction()
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
/**
* readObject
* @param stream TODO
@@ -183,30 +169,48 @@ public abstract class AbstractAction
return store.keySet().toArray();
} // getKeys()
- /**
- * firePropertyChange
- * @param propertyName TODO
- * @param oldValue TODO
- * @param newValue TODO
- */
- protected void firePropertyChange(String propertyName,
- Object oldValue, Object newValue) {
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
- } // firePropertyChange()
-
- /**
- * addPropertyChangeListener
- * @param listener TODO
- */
- public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- changeSupport.addPropertyChangeListener(listener);
- } // addPropertyChangeListener()
-
- /**
- * removePropertyChangeListener
- * @param listener TODO
- */
- public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
- changeSupport.removePropertyChangeListener(listener);
- } // removePropertyChangeListener()
+ /**
+ * firePropertyChange
+ *
+ * @param propertyName TODO
+ * @param oldValue TODO
+ * @param newValue TODO
+ */
+ protected void firePropertyChange(String propertyName, Object oldValue,
+ Object newValue)
+ {
+ changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ /**
+ * addPropertyChangeListener
+ *
+ * @param listener the listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * removePropertyChangeListener
+ *
+ * @param listener the listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns all registered listeners.
+ *
+ * @return array of listeners.
+ *
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ return changeSupport.getPropertyChangeListeners();
+ }
}
diff --git a/libjava/javax/swing/AbstractCellEditor.java b/libjava/javax/swing/AbstractCellEditor.java
index 026ab30..b2a4f4c 100644
--- a/libjava/javax/swing/AbstractCellEditor.java
+++ b/libjava/javax/swing/AbstractCellEditor.java
@@ -54,10 +54,6 @@ public abstract class AbstractCellEditor
{
static final long serialVersionUID = -1048006551406220959L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
/**
* listenerList
*/
@@ -68,11 +64,6 @@ public abstract class AbstractCellEditor
*/
protected transient ChangeEvent changeEvent;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor AbstractCellEditor
*/
@@ -80,11 +71,6 @@ public abstract class AbstractCellEditor
// TODO
} // AbstractCellEditor()
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
/**
* isCellEditable
* @param event TODO
@@ -119,40 +105,66 @@ public abstract class AbstractCellEditor
} // cancelCellEditing()
/**
- * addCellEditorListener
- * @param listener TODO
- */
- public void addCellEditorListener(CellEditorListener listener) {
- // TODO
- } // addCellEditorListener()
-
- /**
- * removeCellEditorListener
- * @param listener TODO
- */
- public void removeCellEditorListener(CellEditorListener listener) {
- // TODO
- } // removeCellEditorListener()
-
- /**
- * fireEditingStopped
- */
- protected void fireEditingStopped() {
- // TODO
- } // fireEditingStopped()
-
- /**
- * fireEditingCanceled
- */
- protected void fireEditingCanceled() {
- // TODO
- } // fireEditingCanceled()
-
- /**
* getCellEditorValue
* @returns Object
*/
public abstract Object getCellEditorValue();
+ /**
+ * addCellEditorListener
+ *
+ * @param listener The listener to add
+ */
+ public void addCellEditorListener (CellEditorListener listener)
+ {
+ listenerList.add (CellEditorListener.class, listener);
+ }
+
+ /**
+ * removeCellEditorListener
+ *
+ * @param listener The listener to remove
+ */
+ public void removeCellEditorListener (CellEditorListener listener)
+ {
+ listenerList.remove (CellEditorListener.class, listener);
+ }
+
+ /**
+ * getCellEditorListeners
+ *
+ * @since 1.4
+ */
+ public CellEditorListener[] getCellEditorListeners()
+ {
+ return (CellEditorListener[]) listenerList.getListeners (CellEditorListener.class);
+ }
+
+ /**
+ * fireEditingStopped
+ */
+ protected void fireEditingStopped()
+ {
+ CellEditorListener[] listeners = getCellEditorListeners();
+
+ for (int index = 0; index < listeners.length; index++)
+ {
+ listeners [index].editingStopped (changeEvent);
+ }
+ }
+
+ /**
+ * fireEditingCanceled
+ */
+ protected void fireEditingCanceled()
+ {
+ CellEditorListener[] listeners = getCellEditorListeners();
+
+ for (int index = 0; index < listeners.length; index++)
+ {
+ listeners [index].editingCanceled (changeEvent);
+ }
+ }
+
} // AbstractCellEditor
diff --git a/libjava/javax/swing/DefaultListSelectionModel.java b/libjava/javax/swing/DefaultListSelectionModel.java
index 2da790d..7ad66b0 100644
--- a/libjava/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/javax/swing/DefaultListSelectionModel.java
@@ -42,34 +42,20 @@ import java.io.Serializable;
import java.util.EventListener;
import java.util.Vector;
import javax.swing.event.EventListenerList;
+import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
public class DefaultListSelectionModel implements Cloneable, ListSelectionModel, Serializable
{
+ private EventListenerList listenerList = new EventListenerList();
+
int mode = SINGLE_SELECTION;
Vector sel = new Vector();
- Vector listeners;
-
- Vector get_listeners()
- {
- if (listeners == null)
- listeners = new Vector();
- return listeners;
- }
-
-
- public void addListSelectionListener(ListSelectionListener listener)
{
- get_listeners().addElement(listener);
}
- public void removeListSelectionListener(ListSelectionListener listener)
- {
- get_listeners().removeElement(listener);
- }
-
class Range
{
int i0, i1;
@@ -182,4 +168,24 @@ public class DefaultListSelectionModel implements Cloneable, ListSelectionModel,
sel.addElement(new Range(index0, index1));
}
+
+ public void addListSelectionListener(ListSelectionListener listener)
+ {
+ listenerList.add (ListSelectionListener.class, listener);
+ }
+
+ public void removeListSelectionListener(ListSelectionListener listener)
+ {
+ listenerList.remove (ListSelectionListener.class, listener);
+ }
+
+ public ListSelectionListener[] getListSelectionListeners()
+ {
+ return (ListSelectionListener[]) getListeners (ListSelectionListener.class);
+ }
+
+ public EventListener[] getListeners (Class listenerType)
+ {
+ return listenerList.getListeners (listenerType);
+ }
}
diff --git a/libjava/javax/swing/JComboBox.java b/libjava/javax/swing/JComboBox.java
index 6da2b2e..b019293 100644
--- a/libjava/javax/swing/JComboBox.java
+++ b/libjava/javax/swing/JComboBox.java
@@ -38,14 +38,27 @@ exception statement from your version. */
package javax.swing;
-import java.awt.*;
-import java.awt.event.*;
-import java.beans.*;
-import java.io.*;
-import java.util.*;
-import javax.accessibility.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
+import java.awt.ItemSelectable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.Vector;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.plaf.ComboBoxUI;
/**
* JComboBox
@@ -580,38 +593,6 @@ public class JComboBox extends JComponent
} // isPopupVisible()
/**
- * addItemListener
- * @param value0 TODO
- */
- public void addItemListener(ItemListener value0) {
- // TODO
- } // addItemListener()
-
- /**
- * removeItemListener
- * @param value0 TODO
- */
- public void removeItemListener(ItemListener value0) {
- // TODO
- } // removeItemListener()
-
- /**
- * addActionListener
- * @param value0 TODO
- */
- public void addActionListener(ActionListener value0) {
- // TODO
- } // addActionListener()
-
- /**
- * removeActionListener
- * @param value0 TODO
- */
- public void removeActionListener(ActionListener value0) {
- // TODO
- } // removeActionListener()
-
- /**
* setActionCommand
* @param value0 TODO
*/
@@ -834,6 +815,73 @@ public class JComboBox extends JComponent
} // if
return accessibleContext;
} // getAccessibleContext()
-
-
-} // JComboBox
+ /**
+ * addActionListener
+ * @param listener TODO
+ */
+ public void addActionListener (ActionListener listener)
+ {
+ listenerList.add (ActionListener.class, listener);
+ }
+
+ /**
+ * removeActionListener
+ * @param listener TODO
+ */
+ public void removeActionListener (ActionListener listener)
+ {
+ listenerList.remove (ActionListener.class, listener);
+ }
+
+ /**
+ * @since 1.4
+ */
+ public ActionListener[] getActionListeners()
+ {
+ return (ActionListener[]) getListeners (ActionListener.class);
+ }
+
+ /**
+ * addItemListener
+ * @param listener TODO
+ */
+ public void addItemListener(ItemListener listener)
+ {
+ listenerList.add (ItemListener.class, listener);
+ }
+
+ /**
+ * removeItemListener
+ * @param listener TODO
+ */
+ public void removeItemListener(ItemListener listener)
+ {
+ listenerList.remove (ItemListener.class, listener);
+ }
+
+ /**
+ * @since 1.4
+ */
+ public ItemListener[] getItemListeners()
+ {
+ return (ItemListener[]) getListeners (ItemListener.class);
+ }
+
+ public void addPopupMenuListener (PopupMenuListener listener)
+ {
+ listenerList.add (PopupMenuListener.class, listener);
+ }
+
+ public void removePopupMenuListener (PopupMenuListener listener)
+ {
+ listenerList.remove (PopupMenuListener.class, listener);
+ }
+
+ /**
+ * @since 1.4
+ */
+ public PopupMenuListener[] getPopupMenuListeners()
+ {
+ return (PopupMenuListener[]) getListeners (PopupMenuListener.class);
+ }
+}