001 package com.sptci.echo2;
002
003 import nextapp.echo2.app.ApplicationInstance;
004 import nextapp.echo2.app.event.ActionEvent;
005 import nextapp.echo2.app.event.ActionListener;
006
007 import nextapp.echo2.webcontainer.command.BrowserOpenWindowCommand;
008
009 /**
010 * An action listener to open {@link #url} in a new browser window.
011 *
012 * <p>Copyright 2006 Sans Pareil Technologies, Inc.</p>
013 * @author Rakesh Vidyadharan 2006-12-27
014 * @version $Id: UrlListener.java 2808 2006-12-28 04:16:13Z rakesh $
015 */
016 public class UrlListener implements ActionListener
017 {
018 /**
019 * The URL to use to open the browser window.
020 */
021 private final String url;
022
023 /**
024 * Create a new instance of the listener for the specified
025 * {@link #url}.
026 *
027 * @param url The {@link #url} to use.
028 */
029 public UrlListener( String url )
030 {
031 this.url = url;
032 }
033
034 /**
035 * The action listener implementation. Open a new browser window
036 * and load {@link #url} in it.
037 */
038 public void actionPerformed( ActionEvent event )
039 {
040 String features = "scrollbars=yes,toolbar=yes,location=yes";
041 BrowserOpenWindowCommand command =
042 new BrowserOpenWindowCommand( url, null, features );
043 ApplicationInstance.getActive().enqueueCommand( command );
044 }
045 }