FileDocCategorySizeDatePackage
DisplayManagerFactory.javaAPI DocJ2ME MIDP 2.02485Thu Nov 07 12:02:22 GMT 2002com.sun.midp.lcdui

DisplayManagerFactory

public class DisplayManagerFactory extends Object
This class works around the fact that public classes can not be added to a javax package by an implementaion.

Fields Summary
private static DisplayManager
managerImpl
The real implementation of the display manager.
private static com.sun.midp.security.SecurityToken
displayClassSecurityToken
This class has a different security domain than the MIDlet suite
Constructors Summary
Methods Summary
public static voidSetDisplayManagerImpl(DisplayManager dm)
Set the implemetation of the display manager, if one is not already set.

This implementaion class will be in the as the Display class for security. But needs placed here to be visible to com.sun.midp classes.

param
dm reference to the system display manager

        if (managerImpl != null) {
            return;
        }

        managerImpl = dm;
	managerImpl.initSecurityToken(displayClassSecurityToken);
    
public static DisplayManagergetDisplayManager()
Return a reference to the singleton display manager object.

return
display manager reference.

        if (managerImpl != null) {
            return managerImpl;
        }

        /**
         * The display manager implementation is a private class of Display
         * and is create in the class init of Display, we need to call a
         * static method of display to get the class init to run, because
         * some classes need to get the display manager to create a display
         */
        try {
            // this will yield a null pointer exception on purpose
            Display.getDisplay(null);
        } catch (NullPointerException npe) {
            // this is normal for this case, do nothing
        }

        return managerImpl;
    
public static voidinitSecurityToken(com.sun.midp.security.SecurityToken token)
Initializes the security token for this class, so it can perform actions that a normal MIDlet Suite cannot.

param
token security token for this class.

	if (displayClassSecurityToken != null) {
	    return;
	}
	
	displayClassSecurityToken = token;