Note: This is an HTML facsimile of the actual Java code. To see the code itself in its most current version, you can look at HwBasicUserPlugIn.java in the directory \Hyperwire\Classes\kinetix\hyperc1\runtime\.

package kinetix.hyperc1.runtime;

/********************************************************************************\
**                                                                              **
**  (C) Copyright 1997 by Autodesk, Inc.                                        **
**                                                                              **
**  This program is copyrighted by Autodesk, Inc. and is licensed to you under  **
**  the following conditions.  You may not distribute or publish the source     **
**  code of this program in any form.  You may incorporate this code in object  **
**  form in derivative works provided such derivative works are (i.) are de-    **
**  signed and intended to work solely with Autodesk, Inc. products, and (ii.)  **
**  contain Autodesk's copyright notice "(C) Copyright 1997 by Autodesk, Inc."  **
**                                                                              **
**  AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.  AUTODESK SPE-  **
**  CIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR  **
**  A PARTICULAR USE.  AUTODESK, INC.  DOES NOT WARRANT THAT THE OPERATION OF   **
**  THE PROGRAM WILL BE UNINTERRUPTED OR ERROR FREE.                            **
**                                                                              **
\********************************************************************************/

import java.applet.Applet;
import java.awt.Event;

/******************************************************************************\
**                                                                            **
**  Class: HwBasicUserPlugIn                                                  **
**  Purpose:                                                                  **
**  Base class for user added plugins.                                        **
**                                                                            **
\******************************************************************************/

public class HwBasicUserPlugIn extends HwBasicPlugIn
	{
	/** piEventAppletInit **
	 * Called by the system when the applet
	 * containing the plug-in is initialized (sent
	 * init() message).
	 */
	public void piEventAppletInit(Applet theApplet) 
			throws HwException
		{}

	/** piEventAppletDestroy **
	 * Called by the system when the applet
	 * is about to be destroyed. The plug-in should release
	 * any resources which need to be released
     * Do not depend on this method always being called,
     * especially if the title is being run as an applet.
     * When Applet viewers and browsers terminate,
     * applets often receive little warning.
     *
     * piEventAppletDestroy() will always be called before
     * piTerminate().  However, the applet may be killed before,
     * during, or after piEventAppletDestroy() is called, or
     * before, during, or after piTerminate() is called.
     *
     * See also piTerminate().
	 */
	public void piEventAppletDestroy(Applet theApplet) 
			throws HwException
		{}

	/** piEventAppletStart **
	 * Called by the system when the applet
	 * containing the plug-in is becomes visible.
	 */
	public void piEventAppletStart(Applet theApplet) 
			throws HwException
		{}

	/** piEventAppletStop **
	 * Called by the system when the applet
	 * containing the plug-in is no longer visible.
	 */
	public void piEventAppletStop(Applet theApplet) 
			throws HwException
		{}

	/** piGetRunService **
	 * Called by the plug-in to get access to the system
	 * services. The plug-in should return the run service
	 * received in the piInit( method
	 */
	public BasicRunService piGetRunService()
		{
		return super.piGetRunService();
		}

	/**	piInit **
	 * Called by the system just after the plug-in is created
	 * The implementation should:
	 * (1) Save the run service in an instance variable
	 * (2) Create the necessary data structures to save the static
	 * authored properties unique to the plug-in and the 
	 * corresponding dynamic copy of the properties for run-time
	 * (3) piInit(ialize the static properties of the plug-in
	 * from the piInit(ialProperties parameter
	 */
	public void piInit(BasicRunService aRunService)
		 	throws HwException
		{
		super.piInit(aRunService);
		}

	/** piTerminate **
	 * Called by the system when the title is terminating.
	 * The plug-in should release
	 * any resources which need to be released.
     * Do not depend on this method always being called,
     * especially if the title is being run as an applet.
     * When Applet viewers and browsers terminate,
     * applets often receive little warning.
     *
     * piEventAppletDestroy() will always be called before
     * piTerminate().  However, the applet may be killed before,
     * during, or after piEventAppletDestroy() is called, or
     * before, during, or after piTerminate() is called.
     *
     * Note: This method was implemented to circumvent a problem
     * with piEventAppletDestroy().  piEventAppletDestroy()
     * may be called without the applet truly being destroyed.
     * The menu item Applet->Restart in Sun's Appletviewer will
     * send a stop() and destroy(), and then send an init() and
     * start() to the same applet.  piTerminate() will only be
     * called when the applet is actually terminating.
     *
     * See also piEventAppletDestroy().
	 */
	/*** piTerminate ***/
	public void piTerminate(Applet theApplet) 
		throws HwException
    {}

	/** piIsContainer **
	 * Return true if the plug-in is a container, false otherwise
	 */
	public boolean piIsContainer()
		{
		return false;
		}

	/** piIsVisual **
	 * Return true if the plug-in is visual, falst otherwise
	 */
	public boolean piIsVisual()
		{
		return false;
		}

	/** piEventParentMovedBy **
	* Called by the system when the immediate parent of the 
	* plug-in has been moved. The plug-in should update its 
	* appearance and internal state accordingly. This method is
	* called before the bounding rectangle of the plug-in has
	* been translated by the system. It is primarily for plug-ins
	* which do not rely on piDraw to draw themselves
	*/
	public void piEventParentMovedBy(VisualRunPlugIn aParent, int xOffset, int yOffset)
			throws HwException
		{}

	/** piRestoreInitialRunState **
	 * Called by the system when it is necessary to re-piInit(ialize
	 * transient run-time properties unique to the plug-in which
	 * are not also stored as static authored properties
	 */
	public void piRestoreInitialRunState()
			throws HwException
		{}

	/** piEventRefreshDaemonTick **
	 * Now is the when we dance.  Called by the system when a
	 * refresh daemon tick occurs.
	 * timeNow is the tick time, in milliseconds.
	 */
	public void piEventRefreshDaemonTick(long timeNow, RefreshDaemon worldMover) 
			throws HwException
		{}

	/** piPerformUserPort **
	 * Called by the system when a user-added port on this module is
	 * triggered.  The first argument is the name of the triggered port
	 */
	public HwObject piPerformUserPort(String portName, HwObject args[]) 
		throws HwException
		{
		return HwLObject.from(null);
		}

	/** piEventKeyDown **
	 * Called by the system when a key down event occurs.
	 * Returning true will consume the key down event.
	 */
	public boolean piEventKeyDown(Event evt, int key)
			throws HwException
		{
		return false;
		}
		
	/** piEventKeyUp **
	 * Called by the system when a key up event occurs.
	 * Returning true will consume the key up event.
	 */
	public boolean piEventKeyUp(Event evt, int key)
			throws HwException
		{
		return false;
		}

    /** piPrepareMedia **
	* Called by the system in preparation for asking the plug-in to draw in
	* the case where the system wishes to defer all drawing until all 
	* necessary images are loaded and ready to draw.
	* The implementation should call piGetRunService().siGetApplet().getImage(...)
	* to initiate the asynchronous load of any images required to draw itself.
	* If the images do not need to be scaled, the implementation should call
	* theTracker.addImage(theImage, priority). If the image needs to be scaled,
	* the implementation should call theTracker.addImage(theImage, priority,
	* width, height)
	*/
	public void piPrepareMedia(HwMediaTracker theTracker, int priority)
		{
        piPrepareImage(theTracker, priority);
        }

	/** piPrepareImage **
    * retained for backward compatibility.
    */
	public void piPrepareImage(HwMediaTracker theTracker, int priority)
		{}

    /** piSetRadioState **
    * Called when a module in the same container calls siSetRadioNodule().
    * If the parameter is true, this plug-in is the one that made the call
    * to siSetRadioNodule().  All other plug-ins in the same container
    * will receive a parameter of false.  What the plug-ins choose to do
    * with this information is completely up to them.
    * Generally, plug-ins use it to maintain an "active radio state".  When
    * one of the plug-ins wants to become active it calls siSetRadioNodule().
    * It should not become active until it receives a call to piSetRadioState(true),
    * since another module might call siSetRadioNodule() at the same time.
    * The other plug-ins will receive a call to piSetRadioState(false), and
    * should become inactive.  This ensures that only one module is active
    * at a time, similar to radio buttons on a dialog.
	*/
    public boolean piSetRadioState(boolean state) 
		throws HwException
        {
        return false;
        }

	/** piMouseDown **
	* Called by the system when the user has depressed the mouse
	* within the plug-in's clickable extent. This extent may exclude
	* transparent areas and may include selection highlights.
	* The plug-in should update its appearance and internal state 
	* accordingly. Wire messages initiated by the event will be sent 
	* automatically by the system. The implementation should return
	* true if it wishes to terminate the broadcast of the event
	* through the module hierarchy, and false, if the event should be
	* broadcast to other modules as well.
	*/
	public boolean piMouseDown(Event evt, int x, int y)
			throws HwException
		{
		return true;
		}

	/** piMouseMove **
	* Called by the system when the user has moved the mouse with
	* the mouse up within the plug-in bounding rectangle. The plug-in 
	* should update its appearance and internal state accordingly. Wire
	* messages initiated by the event will be sent automatically
	* by the system. The implementation should return
	* true if it wishes to terminate the broadcast of the event
	* through the module hierarchy, and false, if the event should be
	* broadcast to other modules as well.
	*/
	public boolean piMouseMove(Event evt, int x, int y)
			throws HwException
		{
		return true;
		}

	/** piMouseDrag **
	* Called by the system when the user has moved the mouse with
	* the mouse down within the plug-in bounding rectangle. The plug-in 
	* should update its appearance and internal state accordingly. Wire
	* messages initiated by the event will be sent automatically
	* by the system. The implementation should return
	* true if it wishes to terminate the broadcast of the event
	* through the module hierarchy, and false, if the event should be
	* broadcast to other modules as well. This event will only be sent if
	* the module is not moveable. If the module is moveable, the drag will
	* result in the visual representation of the module being dragged in
	* the display.
	*/
	public boolean piMouseDrag(Event evt, int x, int y)
			throws HwException
		{
		return true;
		}

	/** piMouseUp **
	* Called by the system when the user has let up the mouse
	* within the plug-in's clickable extent. This extent may exclude
	* transparent areas and may include selection highlights.
	* The plug-in should update its appearance and internal state 
	* accordingly. Wire messages initiated by the event will be sent 
	* automatically by the system. The implementation should return
	* true if it wishes to terminate the broadcast of the event
	* through the module hierarchy, and false, if the event should be
	* broadcast to other modules as well.
	*/
	public boolean piMouseUp(Event evt, int x, int y)
			throws HwException
		{
		return true;
		}
	}