4632N/A/*
4632N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
4632N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4632N/A *
4632N/A * This code is free software; you can redistribute it and/or modify it
4632N/A * under the terms of the GNU General Public License version 2 only, as
4632N/A * published by the Free Software Foundation. Oracle designates this
4632N/A * particular file as subject to the "Classpath" exception as provided
4632N/A * by Oracle in the LICENSE file that accompanied this code.
4632N/A *
4632N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4632N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4632N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4632N/A * version 2 for more details (a copy is included in the LICENSE file that
4632N/A * accompanied this code).
4632N/A *
4632N/A * You should have received a copy of the GNU General Public License version
4632N/A * 2 along with this work; if not, write to the Free Software Foundation,
4632N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4632N/A *
4632N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4632N/A * or visit www.oracle.com if you need additional information or have any
4632N/A * questions.
4632N/A */
4632N/A
4632N/Apackage com.apple.eawt;
4632N/A
4632N/Aimport java.io.File;
4632N/Aimport java.net.URI;
4632N/Aimport java.util.*;
4632N/Aimport java.awt.Window;
4632N/A
4632N/A/**
4632N/A * AppEvents are sent to listeners and handlers installed on the {@link Application}.
4632N/A *
4632N/A * @since Java for Mac OS X 10.6 Update 3
4632N/A * @since Java for Mac OS X 10.5 Update 8
4632N/A */
4632N/Apublic abstract class AppEvent extends EventObject {
4632N/A AppEvent() {
4632N/A super(Application.getApplication());
4632N/A }
4632N/A
4632N/A /**
4632N/A * Contains a list of files.
4632N/A */
4632N/A public abstract static class FilesEvent extends AppEvent {
4632N/A final List<File> files;
4632N/A
4632N/A FilesEvent(final List<File> files) {
4632N/A this.files = files;
4632N/A }
4632N/A
4632N/A /**
4632N/A * @return the list of files
4632N/A */
4632N/A public List<File> getFiles() {
4632N/A return files;
4632N/A }
4632N/A }
4632N/A
4632N/A /**
4632N/A * Event sent when the app is asked to open a list of files.
4632N/A *
4632N/A * @see OpenFilesHandler#openFiles(OpenFilesEvent)
4632N/A */
4632N/A public static class OpenFilesEvent extends FilesEvent {
4632N/A final String searchTerm;
4632N/A
4632N/A OpenFilesEvent(final List<File> files, final String searchTerm) {
4632N/A super(files);
4632N/A this.searchTerm = searchTerm;
4632N/A }
4632N/A
4632N/A /**
4632N/A * If the files were opened using the Spotlight search menu or a Finder search window, this method obtains the search term used to find the files.
4632N/A * This is useful for highlighting the search term in the documents when they are opened.
4632N/A * @return the search term used to find the files
4632N/A */
4632N/A public String getSearchTerm() {
4632N/A return searchTerm;
4632N/A }
4632N/A }
4632N/A
4632N/A /**
4632N/A * Event sent when the app is asked to print a list of files.
4632N/A *
4632N/A * @see PrintFilesHandler#printFiles(PrintFilesEvent)
4632N/A */
4632N/A public static class PrintFilesEvent extends FilesEvent {
4632N/A PrintFilesEvent(final List<File> files) {
4632N/A super(files);
4632N/A }
4632N/A }
4632N/A
4632N/A /**
4632N/A * Event sent when the app is asked to open a URI.
4632N/A *
4632N/A * @see OpenURIHandler#openURI(OpenURIEvent)
4632N/A */
4632N/A public static class OpenURIEvent extends AppEvent {
4632N/A final URI uri;
4632N/A
4632N/A OpenURIEvent(final URI uri) {
4632N/A this.uri = uri;
4632N/A }
4632N/A
4632N/A /**
4632N/A * @return the URI the app was asked to open
4632N/A */
4632N/A public URI getURI() {
4632N/A return uri;
4632N/A }
4632N/A }
4632N/A
4632N/A /**
4632N/A * Event sent when the application is asked to open it's about window.
4632N/A *
4632N/A * @see AboutHandler#handleAbout()
4632N/A */
4632N/A public static class AboutEvent extends AppEvent { AboutEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the application is asked to open it's preferences window.
4632N/A *
4632N/A * @see PreferencesHandler#handlePreferences()
4632N/A */
4632N/A public static class PreferencesEvent extends AppEvent { PreferencesEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the application is asked to quit.
4632N/A *
4632N/A * @see QuitHandler#handleQuitRequestWith(QuitEvent, QuitResponse)
4632N/A */
4632N/A public static class QuitEvent extends AppEvent { QuitEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the application is asked to re-open itself.
4632N/A *
4632N/A * @see AppReOpenedListener#appReOpened(AppReOpenedEvent)
4632N/A */
4632N/A public static class AppReOpenedEvent extends AppEvent { AppReOpenedEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the application has become the foreground app, and when it has resigned being the foreground app.
4632N/A *
4632N/A * @see AppForegroundListener#appRaisedToForeground(AppForegroundEvent)
4632N/A * @see AppForegroundListener#appMovedToBackground(AppForegroundEvent)
4632N/A */
4632N/A public static class AppForegroundEvent extends AppEvent { AppForegroundEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the application has been hidden or shown.
4632N/A *
4632N/A * @see AppHiddenListener#appHidden(AppHiddenEvent)
4632N/A * @see AppHiddenListener#appUnhidden(AppHiddenEvent)
4632N/A */
4632N/A public static class AppHiddenEvent extends AppEvent { AppHiddenEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the user session has been changed via Fast User Switching.
4632N/A *
4632N/A * @see UserSessionListener#userSessionActivated(UserSessionEvent)
4632N/A * @see UserSessionListener#userSessionDeactivated(UserSessionEvent)
4632N/A */
4632N/A public static class UserSessionEvent extends AppEvent { UserSessionEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the displays attached to the system enter and exit power save sleep.
4632N/A *
4632N/A * @see ScreenSleepListener#screenAboutToSleep(ScreenSleepEvent)
4632N/A * @see ScreenSleepListener#screenAwoke(ScreenSleepEvent)
4632N/A */
4632N/A public static class ScreenSleepEvent extends AppEvent { ScreenSleepEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when the system enters and exits power save sleep.
4632N/A *
4632N/A * @see SystemSleepListener#systemAboutToSleep(SystemSleepEvent)
4632N/A * @see SystemSleepListener#systemAwoke(SystemSleepEvent)
4632N/A */
4632N/A public static class SystemSleepEvent extends AppEvent { SystemSleepEvent() { } }
4632N/A
4632N/A /**
4632N/A * Event sent when a window is entering/exiting or has entered/exited full screen state.
4632N/A *
4632N/A * @see FullScreenUtilities
4632N/A *
4632N/A * @since Java for Mac OS X 10.7 Update 1
4632N/A */
4632N/A public static class FullScreenEvent extends AppEvent {
4632N/A final Window window;
4632N/A
4632N/A FullScreenEvent(final Window window) {
4632N/A this.window = window;
4632N/A }
4632N/A
4632N/A /**
4632N/A * @return window transitioning between full screen states
4632N/A */
4632N/A public Window getWindow() {
4632N/A return window;
4632N/A }
4632N/A }
4632N/A}