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
This commit is contained in:
Michael Koch 2004-01-23 12:42:10 +00:00 committed by Michael Koch
parent 5d7b2198ba
commit 3ac55a5a69
5 changed files with 235 additions and 140 deletions

View File

@ -1,3 +1,28 @@
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

View File

@ -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()
/**
* 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 TODO
*/
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
changeSupport.addPropertyChangeListener(listener);
} // addPropertyChangeListener()
/**
* addPropertyChangeListener
*
* @param listener the listener to add
*/
public void addPropertyChangeListener(PropertyChangeListener listener)
{
changeSupport.addPropertyChangeListener(listener);
}
/**
* removePropertyChangeListener
* @param listener TODO
*/
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
changeSupport.removePropertyChangeListener(listener);
} // removePropertyChangeListener()
/**
* 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();
}
}

View File

@ -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
@ -118,41 +104,67 @@ public abstract class AbstractCellEditor
// TODO
} // 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

View File

@ -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);
}
}

View File

@ -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
@ -579,38 +592,6 @@ public class JComboBox extends JComponent
return false; // TODO
} // 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()
/**
* 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);
}
} // JComboBox
/**
* @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);
}
}