< prev index next >

src/share/classes/sun/awt/AWTAccessor.java

Print this page




  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 sun.awt;
  27 
  28 import sun.misc.Unsafe;
  29 
  30 import javax.accessibility.AccessibleContext;
  31 import java.awt.*;
  32 import java.awt.KeyboardFocusManager;
  33 import java.awt.DefaultKeyboardFocusManager;
  34 import java.awt.event.InputEvent;
  35 import java.awt.event.InvocationEvent;
  36 import java.awt.event.KeyEvent;

  37 import java.awt.geom.Point2D;
  38 import java.awt.peer.ComponentPeer;
  39 import java.awt.peer.MenuComponentPeer;
  40 
  41 import java.lang.reflect.InvocationTargetException;
  42 import java.security.AccessControlContext;
  43 
  44 import java.io.File;
  45 import java.util.ResourceBundle;
  46 import java.util.Vector;
  47 
  48 /**
  49  * The AWTAccessor utility class.
  50  * The main purpose of this class is to enable accessing
  51  * private and package-private fields of classes from
  52  * different classes/packages. See sun.misc.SharedSecretes
  53  * for another example.
  54  */
  55 public final class AWTAccessor {
  56 


 368         AccessControlContext getAccessControlContext(AWTEvent ev);
 369 
 370         /**
 371          * Returns binary data associated with this event;
 372          */
 373         byte[] getBData(AWTEvent ev);
 374 
 375         /**
 376          * Associates binary data with this event;
 377          */
 378         void setBData(AWTEvent ev, byte[] bdata);
 379     }
 380 
 381     public interface InputEventAccessor {
 382         /*
 383          * Accessor for InputEvent.getButtonDownMasks()
 384          */
 385         int[] getButtonDownMasks();
 386     }
 387 















 388     /*
 389      * An accessor for the java.awt.Frame class.
 390      */
 391     public interface FrameAccessor {
 392         /*
 393          * Sets the state of this frame.
 394          */
 395         void setExtendedState(Frame frame, int state);
 396         /*
 397          * Gets the state of this frame.
 398          */
 399        int getExtendedState(Frame frame);
 400         /*
 401          * Gets the maximized bounds of this frame.
 402          */
 403        Rectangle getMaximizedBounds(Frame frame);
 404     }
 405 
 406     /**
 407      * An interface of accessor for the java.awt.KeyboardFocusManager class.


 753         void updateSystemColors();
 754     }
 755 
 756     /*
 757      * An accessor object for the AccessibleContext class
 758      */
 759     public interface AccessibleContextAccessor {
 760         void setAppContext(AccessibleContext accessibleContext, AppContext appContext);
 761         AppContext getAppContext(AccessibleContext accessibleContext);
 762     }
 763 
 764     /*
 765      * Accessor instances are initialized in the static initializers of
 766      * corresponding AWT classes by using setters defined below.
 767      */
 768     private static ComponentAccessor componentAccessor;
 769     private static ContainerAccessor containerAccessor;
 770     private static WindowAccessor windowAccessor;
 771     private static AWTEventAccessor awtEventAccessor;
 772     private static InputEventAccessor inputEventAccessor;

 773     private static FrameAccessor frameAccessor;
 774     private static KeyboardFocusManagerAccessor kfmAccessor;
 775     private static MenuComponentAccessor menuComponentAccessor;
 776     private static EventQueueAccessor eventQueueAccessor;
 777     private static PopupMenuAccessor popupMenuAccessor;
 778     private static FileDialogAccessor fileDialogAccessor;
 779     private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
 780     private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;
 781     private static CursorAccessor cursorAccessor;
 782     private static MenuBarAccessor menuBarAccessor;
 783     private static MenuItemAccessor menuItemAccessor;
 784     private static MenuAccessor menuAccessor;
 785     private static KeyEventAccessor keyEventAccessor;
 786     private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;
 787     private static SystemTrayAccessor systemTrayAccessor;
 788     private static TrayIconAccessor trayIconAccessor;
 789     private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
 790     private static SequencedEventAccessor sequencedEventAccessor;
 791     private static ToolkitAccessor toolkitAccessor;
 792     private static InvocationEventAccessor invocationEventAccessor;


 864     }
 865 
 866     /*
 867      * Set an accessor object for the java.awt.event.InputEvent class.
 868      */
 869     public static void setInputEventAccessor(InputEventAccessor iea) {
 870         inputEventAccessor = iea;
 871     }
 872 
 873     /*
 874      * Retrieve the accessor object for the java.awt.event.InputEvent class.
 875      */
 876     public static InputEventAccessor getInputEventAccessor() {
 877         if (inputEventAccessor == null) {
 878             unsafe.ensureClassInitialized(InputEvent.class);
 879         }
 880         return inputEventAccessor;
 881     }
 882 
 883     /*

















 884      * Set an accessor object for the java.awt.Frame class.
 885      */
 886     public static void setFrameAccessor(FrameAccessor fa) {
 887         frameAccessor = fa;
 888     }
 889 
 890     /*
 891      * Retrieve the accessor object for the java.awt.Frame class.
 892      */
 893     public static FrameAccessor getFrameAccessor() {
 894         if (frameAccessor == null) {
 895             unsafe.ensureClassInitialized(Frame.class);
 896         }
 897         return frameAccessor;
 898     }
 899 
 900     /*
 901      * Set an accessor object for the java.awt.KeyboardFocusManager class.
 902      */
 903     public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {




  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 sun.awt;
  27 
  28 import sun.misc.Unsafe;
  29 
  30 import javax.accessibility.AccessibleContext;
  31 import java.awt.*;
  32 import java.awt.KeyboardFocusManager;
  33 import java.awt.DefaultKeyboardFocusManager;
  34 import java.awt.event.InputEvent;
  35 import java.awt.event.InvocationEvent;
  36 import java.awt.event.KeyEvent;
  37 import java.awt.event.MouseEvent;
  38 import java.awt.geom.Point2D;
  39 import java.awt.peer.ComponentPeer;
  40 import java.awt.peer.MenuComponentPeer;
  41 
  42 import java.lang.reflect.InvocationTargetException;
  43 import java.security.AccessControlContext;
  44 
  45 import java.io.File;
  46 import java.util.ResourceBundle;
  47 import java.util.Vector;
  48 
  49 /**
  50  * The AWTAccessor utility class.
  51  * The main purpose of this class is to enable accessing
  52  * private and package-private fields of classes from
  53  * different classes/packages. See sun.misc.SharedSecretes
  54  * for another example.
  55  */
  56 public final class AWTAccessor {
  57 


 369         AccessControlContext getAccessControlContext(AWTEvent ev);
 370 
 371         /**
 372          * Returns binary data associated with this event;
 373          */
 374         byte[] getBData(AWTEvent ev);
 375 
 376         /**
 377          * Associates binary data with this event;
 378          */
 379         void setBData(AWTEvent ev, byte[] bdata);
 380     }
 381 
 382     public interface InputEventAccessor {
 383         /*
 384          * Accessor for InputEvent.getButtonDownMasks()
 385          */
 386         int[] getButtonDownMasks();
 387     }
 388 
 389     /**
 390      * An accessor for the MouseEvent class.
 391      */
 392     public interface MouseEventAccessor {
 393         /**
 394          * Indicates whether the event is a result of a touch event.
 395          */
 396         boolean isCausedByTouchEvent(MouseEvent ev);
 397 
 398         /**
 399          * Sets whether the event is a result of a touch event.
 400          */
 401         void setCausedByTouchEvent(MouseEvent ev, boolean causedByTouchEvent);
 402     }
 403 
 404     /*
 405      * An accessor for the java.awt.Frame class.
 406      */
 407     public interface FrameAccessor {
 408         /*
 409          * Sets the state of this frame.
 410          */
 411         void setExtendedState(Frame frame, int state);
 412         /*
 413          * Gets the state of this frame.
 414          */
 415        int getExtendedState(Frame frame);
 416         /*
 417          * Gets the maximized bounds of this frame.
 418          */
 419        Rectangle getMaximizedBounds(Frame frame);
 420     }
 421 
 422     /**
 423      * An interface of accessor for the java.awt.KeyboardFocusManager class.


 769         void updateSystemColors();
 770     }
 771 
 772     /*
 773      * An accessor object for the AccessibleContext class
 774      */
 775     public interface AccessibleContextAccessor {
 776         void setAppContext(AccessibleContext accessibleContext, AppContext appContext);
 777         AppContext getAppContext(AccessibleContext accessibleContext);
 778     }
 779 
 780     /*
 781      * Accessor instances are initialized in the static initializers of
 782      * corresponding AWT classes by using setters defined below.
 783      */
 784     private static ComponentAccessor componentAccessor;
 785     private static ContainerAccessor containerAccessor;
 786     private static WindowAccessor windowAccessor;
 787     private static AWTEventAccessor awtEventAccessor;
 788     private static InputEventAccessor inputEventAccessor;
 789     private static MouseEventAccessor mouseEventAccessor;
 790     private static FrameAccessor frameAccessor;
 791     private static KeyboardFocusManagerAccessor kfmAccessor;
 792     private static MenuComponentAccessor menuComponentAccessor;
 793     private static EventQueueAccessor eventQueueAccessor;
 794     private static PopupMenuAccessor popupMenuAccessor;
 795     private static FileDialogAccessor fileDialogAccessor;
 796     private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
 797     private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;
 798     private static CursorAccessor cursorAccessor;
 799     private static MenuBarAccessor menuBarAccessor;
 800     private static MenuItemAccessor menuItemAccessor;
 801     private static MenuAccessor menuAccessor;
 802     private static KeyEventAccessor keyEventAccessor;
 803     private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;
 804     private static SystemTrayAccessor systemTrayAccessor;
 805     private static TrayIconAccessor trayIconAccessor;
 806     private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
 807     private static SequencedEventAccessor sequencedEventAccessor;
 808     private static ToolkitAccessor toolkitAccessor;
 809     private static InvocationEventAccessor invocationEventAccessor;


 881     }
 882 
 883     /*
 884      * Set an accessor object for the java.awt.event.InputEvent class.
 885      */
 886     public static void setInputEventAccessor(InputEventAccessor iea) {
 887         inputEventAccessor = iea;
 888     }
 889 
 890     /*
 891      * Retrieve the accessor object for the java.awt.event.InputEvent class.
 892      */
 893     public static InputEventAccessor getInputEventAccessor() {
 894         if (inputEventAccessor == null) {
 895             unsafe.ensureClassInitialized(InputEvent.class);
 896         }
 897         return inputEventAccessor;
 898     }
 899 
 900     /*
 901      * Set an accessor object for the java.awt.event.MouseEvent class.
 902      */
 903     public static void setMouseEventAccessor(MouseEventAccessor mea) {
 904         mouseEventAccessor = mea;
 905     }
 906 
 907     /*
 908      * Retrieve the accessor object for the java.awt.event.MouseEvent class.
 909      */
 910     public static MouseEventAccessor getMouseEventAccessor() {
 911         if (mouseEventAccessor == null) {
 912             unsafe.ensureClassInitialized(MouseEvent.class);
 913         }
 914         return mouseEventAccessor;
 915     }
 916 
 917     /*
 918      * Set an accessor object for the java.awt.Frame class.
 919      */
 920     public static void setFrameAccessor(FrameAccessor fa) {
 921         frameAccessor = fa;
 922     }
 923 
 924     /*
 925      * Retrieve the accessor object for the java.awt.Frame class.
 926      */
 927     public static FrameAccessor getFrameAccessor() {
 928         if (frameAccessor == null) {
 929             unsafe.ensureClassInitialized(Frame.class);
 930         }
 931         return frameAccessor;
 932     }
 933 
 934     /*
 935      * Set an accessor object for the java.awt.KeyboardFocusManager class.
 936      */
 937     public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {


< prev index next >