net.talvi.puffinplot
Class AppleListener

java.lang.Object
  extended by com.apple.eawt.ApplicationAdapter
      extended by net.talvi.puffinplot.AppleListener
All Implemented Interfaces:
com.apple.eawt.ApplicationListener, java.util.EventListener

public class AppleListener
extends com.apple.eawt.ApplicationAdapter

AppleListener handles the user actions About, Open, Preferences, and Quit on Mac OS X systems, passing them on to the appropriate methods of a PuffinApp instance specified on initialization.


Method Summary
 void handleAbout(com.apple.eawt.ApplicationEvent event)
          Handles an Apple About action by calling PuffinApp.about()
 void handleOpenFile(com.apple.eawt.ApplicationEvent event)
          Handles an Apple Open File action by calling PuffinApp.openFiles()
 void handlePreferences(com.apple.eawt.ApplicationEvent event)
          Handles an Apple Preferences action by calling PuffinApp.preferences()
 void handleQuit(com.apple.eawt.ApplicationEvent event)
          Handles an Apple Quit action by calling PuffinApp.quit()
static void initialize(PuffinApp puffinApp)
          Instantiates a new AppleListener, which will send events to the supplied PuffinApp instance.
 
Methods inherited from class com.apple.eawt.ApplicationAdapter
handleOpenApplication, handlePrintFile, handleReOpenApplication
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialize

public static void initialize(PuffinApp puffinApp)
Instantiates a new AppleListener, which will send events to the supplied PuffinApp instance. When the user initiates an About, Open, Preferences, or Quit action, the AppleListener will call the corresponding method of the PuffinApp.

Parameters:
puffinApp - the PuffinApp instance to control using Apple events

handleAbout

public void handleAbout(com.apple.eawt.ApplicationEvent event)
Handles an Apple About action by calling PuffinApp.about()

Specified by:
handleAbout in interface com.apple.eawt.ApplicationListener
Overrides:
handleAbout in class com.apple.eawt.ApplicationAdapter
Parameters:
event - the event corresponding to the About action
See Also:
PuffinApp.about()

handleOpenFile

public void handleOpenFile(com.apple.eawt.ApplicationEvent event)
Handles an Apple Open File action by calling PuffinApp.openFiles()

Specified by:
handleOpenFile in interface com.apple.eawt.ApplicationListener
Overrides:
handleOpenFile in class com.apple.eawt.ApplicationAdapter
Parameters:
event - the event corresponding to the OpenFile action
See Also:
PuffinApp.openFiles(List files)

handlePreferences

public void handlePreferences(com.apple.eawt.ApplicationEvent event)
Handles an Apple Preferences action by calling PuffinApp.preferences()

Specified by:
handlePreferences in interface com.apple.eawt.ApplicationListener
Overrides:
handlePreferences in class com.apple.eawt.ApplicationAdapter
Parameters:
event - the event corresponding to the Preferences action
See Also:
PuffinApp.showPreferences()

handleQuit

public void handleQuit(com.apple.eawt.ApplicationEvent event)
Handles an Apple Quit action by calling PuffinApp.quit()

Specified by:
handleQuit in interface com.apple.eawt.ApplicationListener
Overrides:
handleQuit in class com.apple.eawt.ApplicationAdapter
Parameters:
event - the event corresponding to the Quit action
See Also:
PuffinApp.quit()