001 package com.sptci.rwt.webui;
002
003 import nextapp.echo2.app.event.ActionEvent;
004
005 import com.sptci.echo2.Listener;
006
007 /**
008 * Action listener for executing a saved SQL statement (which may be a
009 * batch of statements) using {@link BatchQueryExecutorView}.
010 *
011 * <p>© Copyright 2007 <a href='http://sptci.com/' target='_new'>Sans Pareil Technologies, Inc.</a></p>
012 * @author Rakesh Vidyadharan 2007-10-13
013 * @version $Id: SavedQueryExecutorListener.java 4123 2008-05-25 21:49:01Z rakesh $
014 */
015 public class SavedQueryExecutorListener extends ExecutorListener
016 {
017 /** The query that is to be executed. */
018 private final String statement;
019
020 /**
021 * Create a new instance of the listener using the specified query and
022 * controller.
023 *
024 * @param statement The statement that is to be executed.
025 * @param controller The controller to use to interact with the
026 * application.
027 */
028 public SavedQueryExecutorListener( final String statement,
029 final MainController controller )
030 {
031 super( controller );
032 this.statement = statement;
033 }
034
035 /**
036 * The action listener implementation. Executes the query and exports
037 * the results.
038 *
039 * @param event The event that triggers the export process.
040 */
041 public void actionPerformed( ActionEvent event )
042 {
043 if ( checkConnection() )
044 {
045 final BatchQueryExecutorView view =
046 new BatchQueryExecutorView( controller, statement );
047 controller.addPane( view );
048 }
049 }
050 }