1 /*
   2  * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.eawt;
  27 
  28 import java.util.EventListener;
  29 
  30 /**
  31  * ApplicationEvents are deprecated. Use individual AppEvent listeners or handlers instead.
  32  *
  33  * @see Application#addAppEventListener(AppEventListener)
  34  *
  35  * @see AboutHandler
  36  * @see PreferencesHandler
  37  * @see OpenURIHandler
  38  * @see OpenFilesHandler
  39  * @see PrintFilesHandler
  40  * @see QuitHandler
  41  *
  42  * @see AppReOpenedListener
  43  * @see AppForegroundListener
  44  * @see AppHiddenListener
  45  * @see UserSessionListener
  46  * @see ScreenSleepListener
  47  * @see SystemSleepListener
  48  *
  49  * @since 1.4
  50  * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReOpenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
  51  */
  52 @SuppressWarnings("deprecation")
  53 @Deprecated
  54 public interface ApplicationListener extends EventListener {
  55     /**
  56      * Called when the user selects the About item in the application menu. If <code>event</code> is not handled by
  57      * setting <code>isHandled(true)</code>, a default About window consisting of the application's name and icon is
  58      * displayed. To display a custom About window, designate the <code>event</code> as being handled and display the
  59      * appropriate About window.
  60      *
  61      * @param event an ApplicationEvent initiated by the user choosing About in the application menu
  62      * @deprecated use {@link AboutHandler}
  63      */
  64     @Deprecated
  65     public void handleAbout(ApplicationEvent event);
  66 
  67     /**
  68      * Called when the application receives an Open Application event from the Finder or another application. Usually
  69      * this will come from the Finder when a user double-clicks your application icon. If there is any special code
  70      * that you want to run when you user launches your application from the Finder or by sending an Open Application
  71      * event from another application, include that code as part of this handler. The Open Application event is sent
  72      * after AWT has been loaded.
  73      *
  74      * @param event the Open Application event
  75      * @deprecated no replacement
  76      */
  77     @Deprecated
  78     public void handleOpenApplication(ApplicationEvent event);
  79 
  80     /**
  81      * Called when the application receives an Open Document event from the Finder or another application. This event
  82      * is generated when a user double-clicks a document in the Finder. If the document is registered as belonging
  83      * to your application, this event is sent to your application. Documents are bound to a particular application based
  84      * primarily on their suffix. In the Finder, a user selects a document and then from the File Menu chooses Get Info.
  85      * The Info window allows users to bind a document to a particular application.
  86      *
  87      * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types
  88      * or CFBundleDocumentTypes.
  89      *
  90      * The ApplicationEvent sent to this handler holds a reference to the file being opened.
  91      *
  92      * @param event an Open Document event with reference to the file to be opened
  93      * @deprecated use {@link OpenFilesHandler}
  94      */
  95     @Deprecated
  96     public void handleOpenFile(ApplicationEvent event);
  97 
  98     /**
  99      * Called when the Preference item in the application menu is selected. Native Mac OS X applications make their
 100      * Preferences window available through the application menu. Java applications are automatically given an application
 101      * menu in Mac OS X. By default, the Preferences item is disabled in that menu. If you are deploying an application
 102      * on Mac OS X, you should enable the preferences item with <code>setEnabledPreferencesMenu(true)</code> in the
 103      * Application object and then display your Preferences window in this handler.
 104      *
 105      * @param event triggered when the user selects Preferences from the application menu
 106      * @deprecated use {@link PreferencesHandler}
 107      */
 108     @Deprecated
 109     public void handlePreferences(ApplicationEvent event);
 110 
 111     /**
 112      * Called when the application is sent a request to print a particular file or files. You can allow other applications to
 113      * print files with your application by implementing this handler. If another application sends a Print Event along
 114      * with the name of a file that your application knows how to process, you can use this handler to determine what to
 115      * do with that request. You might open your entire application, or just invoke your printing classes.
 116      *
 117      * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types
 118      * or CFBundleDocumentTypes.
 119      *
 120      * The ApplicationEvent sent to this handler holds a reference to the file being opened.
 121      *
 122      * @param event a Print Document event with a reference to the file(s) to be printed
 123      * @deprecated use {@link PrintFilesHandler}
 124      */
 125     @Deprecated
 126     public void handlePrintFile(ApplicationEvent event);
 127 
 128     /**
 129      * Called when the application is sent the Quit event. This event is generated when the user selects Quit from the
 130      * application menu, when the user types Command-Q, or when the user control clicks on your application icon in the
 131      * Dock and chooses Quit. You can either accept or reject the request to quit. You might want to reject the request
 132      * to quit if the user has unsaved work. Reject the request, move into your code to save changes, then quit your
 133      * application. To accept the request to quit, and terminate the application, set <code>isHandled(true)</code> for the
 134      * <code>event</code>. To reject the quit, set <code>isHandled(false)</code>.
 135      *
 136      * @param event a Quit Application event
 137      * @deprecated use {@link QuitHandler} and {@link MacQuitResponse}
 138      */
 139     @Deprecated
 140     public void handleQuit(ApplicationEvent event);
 141 
 142     /**
 143      * Called when the application receives a Reopen Application event from the Finder or another application. Usually
 144      * this will come when a user clicks on your application icon in the Dock. If there is any special code
 145      * that needs to run when your user clicks on your application icon in the Dock or when a Reopen Application
 146      * event is sent from another application, include that code as part of this handler.
 147      *
 148      * @param event the Reopen Application event
 149      * @deprecated use {@link AppReOpenedListener}
 150      */
 151     @Deprecated
 152     public void handleReOpenApplication(ApplicationEvent event);
 153 }