home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 13 / boot-disc-1997-09.iso / HyprWire / DATA.Z / HwBasicUserPlugIn.java < prev    next >
Text File  |  1997-01-24  |  11KB  |  282 lines

  1. package kinetix.hyperc1.runtime;
  2.  
  3. /********************************************************************************\
  4. **                                                                              **
  5. **  (C) Copyright 1997 by Autodesk, Inc.                                        **
  6. **                                                                              **
  7. **  This program is copyrighted by Autodesk, Inc. and is licensed to you under  **
  8. **  the following conditions.  You may not distribute or publish the source     **
  9. **  code of this program in any form.  You may incorporate this code in object  **
  10. **  form in derivative works provided such derivative works are (i.) are de-    **
  11. **  signed and intended to work solely with Autodesk, Inc. products, and (ii.)  **
  12. **  contain Autodesk's copyright notice "(C) Copyright 1997 by Autodesk, Inc."  **
  13. **                                                                              **
  14. **  AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  AUTODESK SPE-  **
  15. **  CIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR  **
  16. **  A PARTICULAR USE.  AUTODESK, INC.  DOES NOT WARRANT THAT THE OPERATION OF   **
  17. **  THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE.                            **
  18. **                                                                              **
  19. \********************************************************************************/
  20.  
  21. import java.applet.Applet;
  22. import java.awt.Event;
  23.  
  24. /******************************************************************************\
  25. **                                                                            **
  26. **  Class: HwBasicUserPlugIn                                                  **
  27. **  Purpose:                                                                  **
  28. **  Base class for user added plugins.                                        **
  29. **                                                                            **
  30. \******************************************************************************/
  31.  
  32. public class HwBasicUserPlugIn extends HwBasicPlugIn
  33.     {
  34.     /** piEventAppletInit **
  35.      * Called by the system when the applet
  36.      * containing the plug-in is initialized (sent
  37.      * init() message).
  38.      */
  39.     public void piEventAppletInit(Applet theApplet) 
  40.             throws HwException
  41.         {}
  42.  
  43.     /** piEventAppletDestroy **
  44.      * Called by the system when the applet
  45.      * is about to be destroyed. The plug-in should release
  46.      * any resources which need to be released
  47.      */
  48.     public void piEventAppletDestroy(Applet theApplet) 
  49.             throws HwException
  50.         {}
  51.  
  52.     /** piEventAppletStart **
  53.      * Called by the system when the applet
  54.      * containing the plug-in is becomes visible.
  55.      */
  56.     public void piEventAppletStart(Applet theApplet) 
  57.             throws HwException
  58.         {}
  59.  
  60.     /** piEventAppletStop **
  61.      * Called by the system when the applet
  62.      * containing the plug-in is no longer visible.
  63.      */
  64.     public void piEventAppletStop(Applet theApplet) 
  65.             throws HwException
  66.         {}
  67.  
  68.     /** piGetRunService **
  69.      * Called by the plug-in to get access to the system
  70.      * services. The plug-in should return the run service
  71.      * received in the piInit( method
  72.      */
  73.     public BasicRunService piGetRunService()
  74.         {
  75.         return super.piGetRunService();
  76.         }
  77.  
  78.     /**    piInit **
  79.      * Called by the system just after the plug-in is created
  80.      * The implementation should:
  81.      * (1) Save the run service in an instance variable
  82.      * (2) Create the necessary data structures to save the static
  83.      * authored properties unique to the plug-in and the 
  84.      * corresponding dynamic copy of the properties for run-time
  85.      * (3) piInit(ialize the static properties of the plug-in
  86.      * from the piInit(ialProperties parameter
  87.      */
  88.     public void piInit(BasicRunService aRunService)
  89.              throws HwException
  90.         {
  91.         super.piInit(aRunService);
  92.         }
  93.  
  94.     /** piIsContainer **
  95.      * Return true if the plug-in is a container, false otherwise
  96.      */
  97.     public boolean piIsContainer()
  98.         {
  99.         return false;
  100.         }
  101.  
  102.     /** piIsVisual **
  103.      * Return true if the plug-in is visual, falst otherwise
  104.      */
  105.     public boolean piIsVisual()
  106.         {
  107.         return false;
  108.         }
  109.  
  110.     /** piEventParentMovedBy **
  111.     * Called by the system when the immediate parent of the 
  112.     * plug-in has been moved. The plug-in should update its 
  113.     * appearance and internal state accordingly. This method is
  114.     * called before the bounding rectangle of the plug-in has
  115.     * been translated by the system. It is primarily for plug-ins
  116.     * which do not rely on piDraw to draw themselves
  117.     */
  118.     public void piEventParentMovedBy(VisualRunPlugIn aParent, int xOffset, int yOffset)
  119.             throws HwException
  120.         {}
  121.  
  122.     /** piRestoreInitialRunState **
  123.      * Called by the system when it is necessary to re-piInit(ialize
  124.      * transient run-time properties unique to the plug-in which
  125.      * are not also stored as static authored properties
  126.      */
  127.     public void piRestoreInitialRunState()
  128.             throws HwException
  129.         {}
  130.  
  131.     /** piEventRefreshDaemonTick **
  132.      * Now is the when we dance.  Called by the system when a
  133.      * refresh daemon tick occurs.
  134.      * timeNow is the tick time, in milliseconds.
  135.      */
  136.     public void piEventRefreshDaemonTick(long timeNow, RefreshDaemon worldMover) 
  137.             throws HwException
  138.         {}
  139.  
  140.     /** piPerformUserPort **
  141.      * Called by the system when a user-added port on this module is
  142.      * triggered.  The first argument is the name of the triggered port
  143.      */
  144.     public HwObject piPerformUserPort(String portName, HwObject args[]) 
  145.         throws HwException
  146.         {
  147.         return HwLObject.from(null);
  148.         }
  149.  
  150.     /** piEventKeyDown **
  151.      * Called by the system when a key down event occurs.
  152.      * Returning true will consume the key down event.
  153.      */
  154.     public boolean piEventKeyDown(Event evt, int key)
  155.             throws HwException
  156.         {
  157.         return false;
  158.         }
  159.         
  160.     /** piEventKeyUp **
  161.      * Called by the system when a key up event occurs.
  162.      * Returning true will consume the key up event.
  163.      */
  164.     public boolean piEventKeyUp(Event evt, int key)
  165.             throws HwException
  166.         {
  167.         return false;
  168.         }
  169.  
  170.     /** piPrepareMedia **
  171.     * Called by the system in preparation for asking the plug-in to draw in
  172.     * the case where the system wishes to defer all drawing until all 
  173.     * necessary images are loaded and ready to draw.
  174.     * The implementation should call piGetRunService().siGetApplet().getImage(...)
  175.     * to initiate the asynchronous load of any images required to draw itself.
  176.     * If the images do not need to be scaled, the implementation should call
  177.     * theTracker.addImage(theImage, priority). If the image needs to be scaled,
  178.     * the implementation should call theTracker.addImage(theImage, priority,
  179.     * width, height)
  180.     */
  181.     public void piPrepareMedia(HwMediaTracker theTracker, int priority)
  182.         {
  183.         piPrepareImage(theTracker, priority);
  184.         }
  185.  
  186.     /** piPrepareImage **
  187.     * retained for backward compatibility.
  188.     */
  189.     public void piPrepareImage(HwMediaTracker theTracker, int priority)
  190.         {}
  191.  
  192.     /** piSetRadioState **
  193.     * Called when a module in the same container calls siSetRadioNodule().
  194.     * If the parameter is true, this plug-in is the one that made the call
  195.     * to siSetRadioNodule().  All other plug-ins in the same container
  196.     * will receive a parameter of false.  What the plug-ins choose to do
  197.     * with this information is completely up to them.
  198.     * Generally, plug-ins use it to maintain an "active radio state".  When
  199.     * one of the plug-ins wants to become active it calls siSetRadioNodule().
  200.     * It should not become active until it receives a call to piSetRadioState(true),
  201.     * since another module might call siSetRadioNodule() at the same time.
  202.     * The other plug-ins will receive a call to piSetRadioState(false), and
  203.     * should become inactive.  This ensures that only one module is active
  204.     * at a time, similar to radio buttons on a dialog.
  205.     */
  206.     public boolean piSetRadioState(boolean state) 
  207.         throws HwException
  208.         {
  209.         return false;
  210.         }
  211.  
  212.     /** piMouseDown **
  213.     * Called by the system when the user has depressed the mouse
  214.     * within the plug-in's clickable extent. This extent may exclude
  215.     * transparent areas and may include selection highlights.
  216.     * The plug-in should update its appearance and internal state 
  217.     * accordingly. Wire messages initiated by the event will be sent 
  218.     * automatically by the system. The implementation should return
  219.     * true if it wishes to terminate the broadcast of the event
  220.     * through the module hierarchy, and false, if the event should be
  221.     * broadcast to other modules as well.
  222.     */
  223.     public boolean piMouseDown(Event evt, int x, int y)
  224.             throws HwException
  225.         {
  226.         return true;
  227.         }
  228.  
  229.     /** piMouseMove **
  230.     * Called by the system when the user has moved the mouse with
  231.     * the mouse up within the plug-in bounding rectangle. The plug-in 
  232.     * should update its appearance and internal state accordingly. Wire
  233.     * messages initiated by the event will be sent automatically
  234.     * by the system. The implementation should return
  235.     * true if it wishes to terminate the broadcast of the event
  236.     * through the module hierarchy, and false, if the event should be
  237.     * broadcast to other modules as well.
  238.     */
  239.     public boolean piMouseMove(Event evt, int x, int y)
  240.             throws HwException
  241.         {
  242.         return true;
  243.         }
  244.  
  245.     /** piMouseDrag **
  246.     * Called by the system when the user has moved the mouse with
  247.     * the mouse down within the plug-in bounding rectangle. The plug-in 
  248.     * should update its appearance and internal state accordingly. Wire
  249.     * messages initiated by the event will be sent automatically
  250.     * by the system. The implementation should return
  251.     * true if it wishes to terminate the broadcast of the event
  252.     * through the module hierarchy, and false, if the event should be
  253.     * broadcast to other modules as well. This event will only be sent if
  254.     * the module is not moveable. If the module is moveable, the drag will
  255.     * result in the visual representation of the module being dragged in
  256.     * the display.
  257.     */
  258.     public boolean piMouseDrag(Event evt, int x, int y)
  259.             throws HwException
  260.         {
  261.         return true;
  262.         }
  263.  
  264.     /** piMouseUp **
  265.     * Called by the system when the user has let up the mouse
  266.     * within the plug-in's clickable extent. This extent may exclude
  267.     * transparent areas and may include selection highlights.
  268.     * The plug-in should update its appearance and internal state 
  269.     * accordingly. Wire messages initiated by the event will be sent 
  270.     * automatically by the system. The implementation should return
  271.     * true if it wishes to terminate the broadcast of the event
  272.     * through the module hierarchy, and false, if the event should be
  273.     * broadcast to other modules as well.
  274.     */
  275.     public boolean piMouseUp(Event evt, int x, int y)
  276.             throws HwException
  277.         {
  278.         return true;
  279.         }
  280.     }
  281.     
  282.