package mit.awt.event ;

public class ActionAdapter
extends mit.event.Adapter
implements	java.awt.event.ActionListener
	,	mit.awt.event.ActionRaiser
{
	private mit.event.RaiserAdapter raiserAdapter = null ;
	public mit.event.RaiserAdapter getRaiserAdapter() { return this.raiserAdapter ; }
	public void setRaiserAdapter( mit.event.RaiserAdapter raiserAdapter ) { this.raiserAdapter = raiserAdapter ; }

	private java.awt.event.ActionEvent actionEvent = null ;
	public java.awt.event.ActionEvent getActionEvent() { return this.actionEvent ; }
	public void setActionEvent( java.awt.event.ActionEvent actionEvent ) { this.actionEvent = actionEvent ; }

	public ActionAdapter( Object owner )
	{
		super( owner ) ;
		setRaiserAdapter( new mit.event.RaiserAdapter( owner ) ) ;
		if( owner instanceof java.awt.MenuItem )
		{
			( ( java.awt.MenuItem ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof java.awt.List )
		{
			( ( java.awt.List ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof java.awt.TextField )
		{
			( ( java.awt.TextField ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof java.awt.Button )
		{
			( ( java.awt.Button ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.AbstractButton )
		{
			( ( javax.swing.AbstractButton ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.JTextField )
		{
			( ( javax.swing.JTextField ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.ButtonModel )
		{
			( ( javax.swing.ButtonModel ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.JComboBox )
		{
			( ( javax.swing.JComboBox ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.Timer )
		{
			( ( javax.swing.Timer ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.DefaultButtonModel )
		{
			( ( javax.swing.DefaultButtonModel ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.ComboBoxEditor )
		{
			( ( javax.swing.ComboBoxEditor ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.JFileChooser )
		{
			( ( javax.swing.JFileChooser ) owner ).addActionListener( this ) ;
		}
		else if( owner instanceof javax.swing.plaf.basic.BasicComboBoxEditor )
		{
			( ( javax.swing.plaf.basic.BasicComboBoxEditor ) owner ).addActionListener( this ) ;
		}
	}

	public void actionPerformed( java.awt.event.ActionEvent e ) { setEvent( e ) ; }
	public void actionLost( java.awt.event.ActionEvent e ) { setEvent( e ) ; }

	private void setEvent( java.awt.event.ActionEvent e )
	{
		try
		{
			if( e.getSource().equals( getRaiserAdapter().getOwner() ) )
			{
				setActionEvent( e ) ;
				new mit.awt.event.ActionEvent( this ).raise() ;
			}
		}
		catch( Exception ex )
		{
			ex.printStackTrace() ;
		}
	}

}