jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java
changeset 47213 57173ad5c534
parent 47212 000f4e4ddd39
parent 47211 75e8600f1136
child 47214 22850b3a5524
equal deleted inserted replaced
47212:000f4e4ddd39 47213:57173ad5c534
     1 /*
       
     2  * Copyright (c) 2011, 2017, 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.awt.desktop.AboutHandler;
       
    29 import java.awt.desktop.AppForegroundListener;
       
    30 import java.awt.desktop.AppHiddenListener;
       
    31 import java.awt.desktop.AppReopenedListener;
       
    32 import java.awt.desktop.OpenFilesHandler;
       
    33 import java.awt.desktop.OpenURIHandler;
       
    34 import java.awt.desktop.PreferencesHandler;
       
    35 import java.awt.desktop.PrintFilesHandler;
       
    36 import java.awt.desktop.QuitHandler;
       
    37 import java.awt.desktop.ScreenSleepListener;
       
    38 import java.awt.desktop.SystemEventListener;
       
    39 import java.awt.desktop.SystemSleepListener;
       
    40 import java.awt.desktop.UserSessionListener;
       
    41 import java.util.EventListener;
       
    42 
       
    43 /**
       
    44  * ApplicationEvents are deprecated. Use individual AppEvent listeners or handlers instead.
       
    45  *
       
    46  * @see Application#addAppEventListener(SystemEventListener)
       
    47  *
       
    48  * @see AboutHandler
       
    49  * @see PreferencesHandler
       
    50  * @see OpenURIHandler
       
    51  * @see OpenFilesHandler
       
    52  * @see PrintFilesHandler
       
    53  * @see QuitHandler
       
    54  *
       
    55  * @see AppReopenedListener
       
    56  * @see AppForegroundListener
       
    57  * @see AppHiddenListener
       
    58  * @see UserSessionListener
       
    59  * @see ScreenSleepListener
       
    60  * @see SystemSleepListener
       
    61  *
       
    62  * @since 1.4
       
    63  * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
       
    64  */
       
    65 @SuppressWarnings("deprecation")
       
    66 @Deprecated
       
    67 public interface ApplicationListener extends EventListener {
       
    68     /**
       
    69      * Called when the user selects the About item in the application menu. If {@code event} is not handled by
       
    70      * setting {@code isHandled(true)}, a default About window consisting of the application's name and icon is
       
    71      * displayed. To display a custom About window, designate the {@code event} as being handled and display the
       
    72      * appropriate About window.
       
    73      *
       
    74      * @param event an ApplicationEvent initiated by the user choosing About in the application menu
       
    75      * @deprecated use {@link AboutHandler}
       
    76      */
       
    77     @Deprecated
       
    78     public void handleAbout(ApplicationEvent event);
       
    79 
       
    80     /**
       
    81      * Called when the application receives an Open Application event from the Finder or another application. Usually
       
    82      * this will come from the Finder when a user double-clicks your application icon. If there is any special code
       
    83      * that you want to run when you user launches your application from the Finder or by sending an Open Application
       
    84      * event from another application, include that code as part of this handler. The Open Application event is sent
       
    85      * after AWT has been loaded.
       
    86      *
       
    87      * @param event the Open Application event
       
    88      * @deprecated no replacement
       
    89      */
       
    90     @Deprecated
       
    91     public void handleOpenApplication(ApplicationEvent event);
       
    92 
       
    93     /**
       
    94      * Called when the application receives an Open Document event from the Finder or another application. This event
       
    95      * is generated when a user double-clicks a document in the Finder. If the document is registered as belonging
       
    96      * to your application, this event is sent to your application. Documents are bound to a particular application based
       
    97      * primarily on their suffix. In the Finder, a user selects a document and then from the File Menu chooses Get Info.
       
    98      * The Info window allows users to bind a document to a particular application.
       
    99      *
       
   100      * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types
       
   101      * or CFBundleDocumentTypes.
       
   102      *
       
   103      * The ApplicationEvent sent to this handler holds a reference to the file being opened.
       
   104      *
       
   105      * @param event an Open Document event with reference to the file to be opened
       
   106      * @deprecated use {@link OpenFilesHandler}
       
   107      */
       
   108     @Deprecated
       
   109     public void handleOpenFile(ApplicationEvent event);
       
   110 
       
   111     /**
       
   112      * Called when the Preference item in the application menu is selected. Native Mac OS X applications make their
       
   113      * Preferences window available through the application menu. Java applications are automatically given an application
       
   114      * menu in Mac OS X. By default, the Preferences item is disabled in that menu. If you are deploying an application
       
   115      * on Mac OS X, you should enable the preferences item with {@code setEnabledPreferencesMenu(true)} in the
       
   116      * Application object and then display your Preferences window in this handler.
       
   117      *
       
   118      * @param event triggered when the user selects Preferences from the application menu
       
   119      * @deprecated use {@link PreferencesHandler}
       
   120      */
       
   121     @Deprecated
       
   122     public void handlePreferences(ApplicationEvent event);
       
   123 
       
   124     /**
       
   125      * Called when the application is sent a request to print a particular file or files. You can allow other applications to
       
   126      * print files with your application by implementing this handler. If another application sends a Print Event along
       
   127      * with the name of a file that your application knows how to process, you can use this handler to determine what to
       
   128      * do with that request. You might open your entire application, or just invoke your printing classes.
       
   129      *
       
   130      * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types
       
   131      * or CFBundleDocumentTypes.
       
   132      *
       
   133      * The ApplicationEvent sent to this handler holds a reference to the file being opened.
       
   134      *
       
   135      * @param event a Print Document event with a reference to the file(s) to be printed
       
   136      * @deprecated use {@link PrintFilesHandler}
       
   137      */
       
   138     @Deprecated
       
   139     public void handlePrintFile(ApplicationEvent event);
       
   140 
       
   141     /**
       
   142      * Called when the application is sent the Quit event. This event is generated when the user selects Quit from the
       
   143      * application menu, when the user types Command-Q, or when the user control clicks on your application icon in the
       
   144      * Dock and chooses Quit. You can either accept or reject the request to quit. You might want to reject the request
       
   145      * to quit if the user has unsaved work. Reject the request, move into your code to save changes, then quit your
       
   146      * application. To accept the request to quit, and terminate the application, set {@code isHandled(true)} for the
       
   147      * {@code event}. To reject the quit, set {@code isHandled(false)}.
       
   148      *
       
   149      * @param event a Quit Application event
       
   150      * @deprecated use {@link QuitHandler} and {@link MacQuitResponse}
       
   151      */
       
   152     @Deprecated
       
   153     public void handleQuit(ApplicationEvent event);
       
   154 
       
   155     /**
       
   156      * Called when the application receives a Reopen Application event from the Finder or another application. Usually
       
   157      * this will come when a user clicks on your application icon in the Dock. If there is any special code
       
   158      * that needs to run when your user clicks on your application icon in the Dock or when a Reopen Application
       
   159      * event is sent from another application, include that code as part of this handler.
       
   160      *
       
   161      * @param event the Reopen Application event
       
   162      * @deprecated use {@link AppReopenedListener}
       
   163      */
       
   164     @Deprecated
       
   165     public void handleReOpenApplication(ApplicationEvent event);
       
   166 }