FileDocCategorySizeDatePackage
MMHelperImpl.javaAPI DocphoneME MR2 API (J2ME)3934Wed May 02 18:00:16 BST 2007javax.microedition.lcdui

MMHelperImpl

public final class MMHelperImpl extends com.sun.mmedia.MMHelper
This is a helper class to communicate between the LCDUI canvas and the MMAPI video players.

Fields Summary
private static MMHelperImpl
instance
Constructors Summary
public MMHelperImpl()
Single use constructor. Cannot be instantiated twice. The instance object is held by Canvas as well as MIDPVideoPainter implementation.

    
                            
      
        if (instance != null) {
            throw new RuntimeException("Cannot instantiate MMHelperImpl twice");
        }
        MMHelper.setMMHelper(this);
        instance = this;
    
Methods Summary
static javax.microedition.lcdui.MMHelperImplgetInstance()
Returns the only instance of this class.

return
the instance of this class

        return instance;
    
public DisplaygetItemDisplay(Item item)
Get Display being used for Item painting. Platform-dependent.

        Display display = null;

        if (item.owner == null)
            return null;

        return item.owner.getLF().lGetCurrentDisplay();
    
synchronized voidhideVideo(java.lang.Object video)
Notify video renderers that canvas becomes invisible.

param
video The video painter which is hidden.

        MIDPVideoPainter vp = (MIDPVideoPainter)video;
        vp.hideVideo();
    
synchronized voidpaintVideo(java.lang.Object video, Graphics g)
Informs the player to draw into Graphics g

param
video The video player which should be repainted.
param
g The graphics object to pass to the video player.

        MIDPVideoPainter vp = (MIDPVideoPainter)video;
        vp.paintVideo(g);
    
public voidregisterPlayer(Canvas c, com.sun.mmedia.MIDPVideoPainter vp)
Registers a video control (which implements MIDPVideoPainter) with the corresponding Canvas where the video is to show up.

        ((CanvasLFImpl)c.canvasLF).addEmbeddedVideo(vp);
    
synchronized voidshowVideo(java.lang.Object video)
Notify video renderers that canvas becomes visible.

param
video The video painter which is shown.

        MIDPVideoPainter vp = (MIDPVideoPainter)video;
        vp.showVideo();
    
public synchronized voidunregisterPlayer(Canvas c, com.sun.mmedia.MIDPVideoPainter vp)
Unregisters a video control so that it doesn't get paint callbacks anymore after the player is closed. This also reduces load on the Canvas repaint mechanism.

        ((CanvasLFImpl)c.canvasLF).removeEmbeddedVideo(vp);