home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / afc11 / JNotepad / src / AppCommandFeature.java < prev    next >
Encoding:
Java Source  |  2000-05-04  |  1.9 KB  |  66 lines

  1. //
  2. // (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  3. //
  4.  
  5. /**
  6. *    Static abstract wrapper class for the CommandFeature interfaces.
  7. *    This class holds a static IComponentFeature and a static ICommandFeedback
  8. *    and static methods to obtain either one of these. This allows any class
  9. *    to get to one application-wide version of these interfaces. We avoid
  10. *    having to pass the objects down and across class hierarchies. Since we
  11. *    want only one central place to handle commands, having one static copy
  12. *    that all classes can get to leads to simplicity and ease of use.
  13. *    Subclass this to use your own classes that follow these interfaces.
  14. *
  15. *    @version    1.0, 8/18/97
  16. *    @see        IComponentFeature
  17. *    @see        ICommandFeedback
  18. */
  19.  
  20. public abstract class AppCommandFeature 
  21. {
  22.     /**
  23.     *    The application-wide IComponentFeature object
  24.     */
  25.     private static IComponentFeature compFeature;    
  26.     
  27.     /**
  28.     *    The application-wide ICommandFeedback object
  29.     */
  30.     private static ICommandFeedback commandFeedback;
  31.     
  32.     /**
  33.     *    Protected init method. Called by subclasses to set the IComponentFeature
  34.     *    and the ICommandFeedback interfaces.
  35.     *
  36.     *    @param    compfeature    The IComponentFeature object to set as the application-wide one.
  37.     *    @param    commandfeedback The ICommandFeedback object to set as the application-wide one.
  38.     */
  39.     protected static void init(IComponentFeature compfeature, ICommandFeedback commandfeedback)
  40.     {
  41.         compFeature = compfeature;
  42.         commandFeedback = commandfeedback;            
  43.     }
  44.     
  45.     /**
  46.     *    Retrieves the application-wide IComponentFeature. This is a static method,
  47.     *    so there is no need to create a local object.
  48.     */
  49.     public static IComponentFeature getCompFeature()
  50.     {
  51.         return compFeature;
  52.     }
  53.     
  54.     /**
  55.     *    Retrieves the application-wide ICommandFeedback. This is a static method,
  56.     *    so there is no need to create a local object.
  57.     */
  58.     public static ICommandFeedback getCommandFeedback()
  59.     {
  60.         return commandFeedback;
  61.     }
  62. }
  63.  
  64.  
  65.  
  66.