/*
 * CancelButtonActionCallback
 * キャンセルボタン関係のコールバック
 */
package org.logical_paradox.rss.test.dsync;

import java.awt.event.ActionEvent;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class CancelButtonActionCallback extends ButtonActionCallback {
	private static final Log log = LogFactory.getLog(CancelButtonActionCallback.class);
	public CancelButtonActionCallback( DelayedSyncTestGUI gui ) {
		super( gui );
	}

	public void actionPerformed( ActionEvent event ) {
		Object[] targets = parent.commandQueueList.getSelectedValues();

		if( event.getSource() == parent.cancelBtn && targets != null || targets.length > 0 ) {
			removeObjectsFromTransList( targets );
		}
	}
	protected void removeObjectsFromTransList( Object[] obj ) {
		for( int i = 0; i < obj.length; i++ ) {
			log.info( obj[i].toString() + "を送信リストから削除しました" );
			parent.commandQueue.remove( obj[i] );
		}
		parent.commandQueueList.setListData( parent.commandQueue );
	}
}


// end of CancelButtonActionCallback.java
