com.mamarce.mhp.mf.xlet
Class MXLet

java.lang.Object
  extended by com.mamarce.mhp.mf.xlet.MXLet
All Implemented Interfaces:
javax.tv.xlet.Xlet
Direct Known Subclasses:
Example01, SlideShowXlet

public class MXLet
extends java.lang.Object
implements javax.tv.xlet.Xlet

The starting point for every mhp application.

Version:
1.0
Author:
Marco Frattallone

Constructor Summary
MXLet()
          In order to support interoperability between Xlets and application managers, all Xlet classes must provide a public no-argument constructor.
 
Method Summary
 void addToScene(java.awt.Component component)
          This method adds a new Component to the scene.
 void addToScene(java.awt.Component component, int index)
          This methos adds a new Component to the scene at the position specified by index.
 void destroyXlet(boolean unconditional)
          Signals the Xlet to terminate and enter the Destroyed state.
 MListener getActiveListener()
          Returs the current active listener.
 MListener getOldListener()
          Returns the previous active listener.
 javax.tv.xlet.XletContext getXletContext()
          Returns XletContext for an xlet.
 void initXlet(javax.tv.xlet.XletContext ctx)
          Signals the Xlet to initialize itself and enter the Paused state.
 void notifyDestroied()
          This method signals the Xlet Mananager that has entered into the Destroyed state.
 void pauseXlet()
          Signals the Xlet to stop providing service and enter the Paused state.
 void setActiveListener(MListener listener)
          Sets the the active listner.
static void setExitContainerEnabled(boolean enabled)
          Enable/Disable an ExitContainer call to handle the pressure of the EXIT button.
 void startXlet()
          Signals the Xlet to start providing service and enter the Active state.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MXLet

public MXLet()
In order to support interoperability between Xlets and application managers, all Xlet classes must provide a public no-argument constructor.

Method Detail

destroyXlet

public void destroyXlet(boolean unconditional)
                 throws javax.tv.xlet.XletStateChangeException
Signals the Xlet to terminate and enter the Destroyed state. In the destroyed state the Xlet must release all resources and save any persistent state. This method may be called from the Loaded, Paused or Active states. Xlets should perform any operations required before being terminated, such as releasing resources or saving preferences or state.

NOTE: The Xlet can request that it not enter the Destroyed state by throwing an XletStateChangeException. This is only a valid response if the unconditional flag is set to false. If it is true the Xlet is assumed to be in the Destroyed state regardless of how this method terminates. If it is not an unconditional request, the Xlet can signify that it wishes to stay in its current state by throwing the Exception. This request may be honored and the destroyXlet() method called again at a later time.

Specified by:
destroyXlet in interface javax.tv.xlet.Xlet
Parameters:
unconditional - If unconditional is true when this method is called, requests by the Xlet to not enter the destroyed state will be ignored.
Throws:
javax.tv.xlet.XletStateChangeException - is thrown if the Xlet wishes to continue to execute (Not enter the Destroyed state). This exception is ignored if unconditional is equal to true.

initXlet

public void initXlet(javax.tv.xlet.XletContext ctx)
              throws javax.tv.xlet.XletStateChangeException
Signals the Xlet to initialize itself and enter the Paused state. The Xlet shall initialize itself in preparation for providing service. It should not hold shared resources but should be prepared to provide service in a reasonable amount of time.

An XletContext is used by the Xlet to access properties associated with its runtime environment. After this method returns successfully, the Xlet is in the Paused state and should be quiescent.

Note:his method shall only be called once.

Specified by:
initXlet in interface javax.tv.xlet.Xlet
Parameters:
ctx - the XletContext of the Xlet.
Throws:
javax.tv.xlet.XletStateChangeException - If the Xlet cannot be initialized.
See Also:
Xlet.initXlet(javax.tv.xlet.XletContext)

pauseXlet

public void pauseXlet()
Signals the Xlet to stop providing service and enter the Paused state. In the Paused state the Xlet must stop providing service, and might release all shared resources and become quiescent. This method will only be called called when the Xlet is in the Active state.

Specified by:
pauseXlet in interface javax.tv.xlet.Xlet

startXlet

public void startXlet()
               throws javax.tv.xlet.XletStateChangeException
Signals the Xlet to start providing service and enter the Active state. In the Active state the Xlet may hold shared resources. The method will only be called when the Xlet is in the paused state.

Specified by:
startXlet in interface javax.tv.xlet.Xlet
Throws:
javax.tv.xlet.XletStateChangeException - is thrown if the Xlet cannot start providing service.
See Also:
Xlet.startXlet()

addToScene

public final void addToScene(java.awt.Component component)
This method adds a new Component to the scene.

Parameters:
component - the Component object to add to the scene.
See Also:
Component

addToScene

public final void addToScene(java.awt.Component component,
                             int index)
This methos adds a new Component to the scene at the position specified by index.

Parameters:
component - the Component object to add to the scene
index - indicates the position to place the component parameter

notifyDestroied

public final void notifyDestroied()
This method signals the Xlet Mananager that has entered into the Destroyed state. Signals the Xlet Manager to destroy this Xlet.


getXletContext

public final javax.tv.xlet.XletContext getXletContext()
Returns XletContext for an xlet.

Returns:
context for an xlet.

setActiveListener

public final void setActiveListener(MListener listener)
Sets the the active listner. An active Listenrs is the one who recives KeyEvent.

Parameters:
listener - this listener will recieve KeyEvent.

getActiveListener

public final MListener getActiveListener()
Returs the current active listener.

Returns:
current active controller.

getOldListener

public final MListener getOldListener()
Returns the previous active listener. Is usefull for navigation purposes.

Returns:
previous active listener

setExitContainerEnabled

public static final void setExitContainerEnabled(boolean enabled)
Enable/Disable an ExitContainer call to handle the pressure of the EXIT button. By default it is set to true.

Parameters:
enabled - enable disable exitContainer