org.jhotdraw.app.osx
Class OSXAdapter
- java.lang.Object
-
- org.jhotdraw.app.osx.OSXAdapter
-
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
public class OSXAdapter extends java.lang.Object implements java.lang.reflect.InvocationHandlerOSXAdapteruses a Proxy object to dynamically implement thecom.apple.eawt.ApplicationListenerinterface and register it with thecom.apple.eawt.Application object. This allows the complete project to be both built and run on any platform without any stubs or placeholders. Useful for developers looking to implement Mac OS X features while supporting multiple platforms with minimal impact.This class has been derived from OSXAdapter 2.0 © Apple Inc., All Rights Rserved.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancallTarget(java.lang.Object appleEvent)Override this method to perform any operations on the event that comes with the various callbacks.java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)InvocationHandler implementation.static voidsetAboutHandler(java.awt.event.ActionListener aboutHandler)The action listener will be called when the user selects the About item in the application menu.static voidsetHandler(OSXAdapter adapter)setHandlercreates a Proxy object from the passedOSXAdapterand adds it as anApplicationListener.static voidsetOpenApplicationHandler(java.awt.event.ActionListener openHandler)The action listener will be called when the application receives an Open Application event from the Finder or another application.static voidsetOpenFileHandler(java.awt.event.ActionListener fileHandler)Pass this method anActionListenerequipped to handle document events from the Finder.static voidsetPreferencesHandler(java.awt.event.ActionListener prefsHandler)Pass this method anActionListenerequipped to display application options.static voidsetPrintFileHandler(java.awt.event.ActionListener fileHandler)Pass this method anActionListenerequipped to handle document events from the Finder.static voidsetQuitHandler(java.awt.event.ActionListener aboutHandler)The action listener will be called when the Quit menu item is selected from the application menu.static voidsetReOpenApplicationHandler(java.awt.event.ActionListener reopenHandler)Called when the application receives a Reopen Application event from the Finder or another application.
-
-
-
Method Detail
-
setOpenApplicationHandler
public static void setOpenApplicationHandler(java.awt.event.ActionListener openHandler)
The action listener will be called when the application receives an Open Application event from the Finder or another application. Usually this will come from the Finder when a user double-clicks your application icon. If there is any special code that you want to run when you user launches your application from the Finder or by sending an Open Application event from another application, include that code as part of this handler. The Open Application event is sent after AWT has been loaded.
-
setReOpenApplicationHandler
public static void setReOpenApplicationHandler(java.awt.event.ActionListener reopenHandler)
Called when the application receives a Reopen Application event from the Finder or another application. Usually this will come when a user clicks on your application icon in the Dock. If there is any special code that needs to run when your user clicks on your application icon in the Dock or when a Reopen Application event is sent from another application, include that code as part of this handler.
-
setQuitHandler
public static void setQuitHandler(java.awt.event.ActionListener aboutHandler)
The action listener will be called when the Quit menu item is selected from the application menu.
-
setAboutHandler
public static void setAboutHandler(java.awt.event.ActionListener aboutHandler)
The action listener will be called when the user selects the About item in the application menu.
-
setPreferencesHandler
public static void setPreferencesHandler(java.awt.event.ActionListener prefsHandler)
Pass this method anActionListenerequipped to display application options. They will be called when the Preferences menu item is selected from the application menu.
-
setOpenFileHandler
public static void setOpenFileHandler(java.awt.event.ActionListener fileHandler)
Pass this method anActionListenerequipped to handle document events from the Finder. Documents are registered with the Finder via the CFBundleDocumentTypes dictionary in the application bundle's Info.plist.The filename is passed as the
actionCommand.
-
setPrintFileHandler
public static void setPrintFileHandler(java.awt.event.ActionListener fileHandler)
Pass this method anActionListenerequipped to handle document events from the Finder. Documents are registered with the Finder via the CFBundleDocumentTypes dictionary in the application bundle's Info.plist.The filename is passed as the
actionCommand.
-
setHandler
public static void setHandler(OSXAdapter adapter)
setHandlercreates a Proxy object from the passedOSXAdapterand adds it as anApplicationListener.
-
callTarget
public boolean callTarget(java.lang.Object appleEvent) throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessExceptionOverride this method to perform any operations on the event that comes with the various callbacks. See setOpenFileHandler above for an example.- Throws:
java.lang.reflect.InvocationTargetExceptionjava.lang.IllegalAccessException
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.ThrowableInvocationHandler implementation. This is the entry point for our proxy object; it is called every time an ApplicationListener method is invoked.- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
-
DataMelt 3.0 © DataMelt by jWork.ORG