Documentation of 'org.jhotdraw.app.osx.OSXAdapter' Java class
OSXAdapter
org.jhotdraw.app.osx

Class OSXAdapter

  • All Implemented Interfaces:
    java.lang.reflect.InvocationHandler


    public class OSXAdapter
    extends java.lang.Object
    implements java.lang.reflect.InvocationHandler
    OSXAdapter uses a Proxy object to dynamically implement the com.apple.eawt.ApplicationListener interface and register it with the com.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
      boolean callTarget(java.lang.Object appleEvent)
      Override this method to perform any operations on the event that comes with the various callbacks.
      java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
      InvocationHandler implementation.
      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.
      static void setHandler(OSXAdapter adapter)
      setHandler creates a Proxy object from the passed OSXAdapter and adds it as an ApplicationListener.
      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.
      static void setOpenFileHandler(java.awt.event.ActionListener fileHandler)
      Pass this method an ActionListener equipped to handle document events from the Finder.
      static void setPreferencesHandler(java.awt.event.ActionListener prefsHandler)
      Pass this method an ActionListener equipped to display application options.
      static void setPrintFileHandler(java.awt.event.ActionListener fileHandler)
      Pass this method an ActionListener equipped to handle document events from the Finder.
      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.
      static void setReOpenApplicationHandler(java.awt.event.ActionListener reopenHandler)
      Called when the application receives a Reopen Application event from the Finder or another application.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 an ActionListener equipped 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 an ActionListener equipped 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 an ActionListener equipped 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)
        setHandler creates a Proxy object from the passed OSXAdapter and adds it as an ApplicationListener.
      • callTarget

        public boolean callTarget(java.lang.Object appleEvent)
                           throws java.lang.reflect.InvocationTargetException,
                                  java.lang.IllegalAccessException
        Override 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.InvocationTargetException
        java.lang.IllegalAccessException
      • invoke

        public java.lang.Object invoke(java.lang.Object proxy,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable
        InvocationHandler implementation. This is the entry point for our proxy object; it is called every time an ApplicationListener method is invoked.
        Specified by:
        invoke in interface java.lang.reflect.InvocationHandler
        Throws:
        java.lang.Throwable

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.