javax.media.nativewindow
Class NativeWindowFactory

java.lang.Object
  extended by javax.media.nativewindow.NativeWindowFactory

public abstract class NativeWindowFactory
extends Object

Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the NativeWindow interface, which provides a platform-independent mechanism of accessing the information required to perform operations like hardware-accelerated rendering using the OpenGL API.


Field Summary
static String AWTComponentClassName
           
static String GDIClassName
           
static String JAWTUtilClassName
           
static String TYPE_ANDROID
          Android/EGL type, as retrieved with getNativeWindowType(boolean)
static String TYPE_AWT
          Generic AWT type, as retrieved with getNativeWindowType(boolean)
static String TYPE_DEFAULT
          Generic DEFAULT type, where platform implementation don't care, as retrieved with getNativeWindowType(boolean)
static String TYPE_EGL
          OpenKODE/EGL type, as retrieved with getNativeWindowType(boolean)
static String TYPE_MACOSX
          Mac OS X type, as retrieved with getNativeWindowType(boolean)
static String TYPE_WINDOWS
          Microsoft Windows type, as retrieved with getNativeWindowType(boolean)
static String TYPE_X11
          X11 type, as retrieved with getNativeWindowType(boolean)
static String X11JAWTToolkitLockClassName
           
static String X11ToolkitLockClassName
           
static String X11UtilClassName
           
 
Method Summary
static ToolkitLock createDefaultToolkitLock(String type, long deviceHandle)
          Creates the default ToolkitLock for type and deviceHandle.
static NativeWindowFactory getDefaultFactory()
          Gets the default NativeWindowFactory.
static ToolkitLock getDefaultToolkitLock()
          Provides the system default ToolkitLock, a singleton instance.
static ToolkitLock getDefaultToolkitLock(String type)
          Provides the default ToolkitLock for type, a singleton instance.
static NativeWindowFactory getFactory(Class windowClass)
          Returns the appropriate NativeWindowFactory to handle window objects of the given type.
static NativeWindow getNativeWindow(Object winObj, AbstractGraphicsConfiguration config)
          Converts the given window object and it's AbstractGraphicsConfiguration into a NativeWindow which can be operated upon by a custom toolkit, e.g.
static String getNativeWindowType(boolean useCustom)
           
static ToolkitLock getNullToolkitLock()
           
static void initSingleton(boolean firstUIActionOnProcess)
          Static one time initialization of this factory.
This initialization method must be called once by the program or utilizing modules!
static boolean isAWTAvailable()
           
static boolean isFirstUIActionOnProcess()
           
static boolean requiresToolkitLock()
           
static void setDefaultFactory(NativeWindowFactory factory)
          Sets the default NativeWindowFactory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_EGL

public static final String TYPE_EGL
OpenKODE/EGL type, as retrieved with getNativeWindowType(boolean)

See Also:
Constant Field Values

TYPE_WINDOWS

public static final String TYPE_WINDOWS
Microsoft Windows type, as retrieved with getNativeWindowType(boolean)

See Also:
Constant Field Values

TYPE_X11

public static final String TYPE_X11
X11 type, as retrieved with getNativeWindowType(boolean)

See Also:
Constant Field Values

TYPE_ANDROID

public static final String TYPE_ANDROID
Android/EGL type, as retrieved with getNativeWindowType(boolean)

See Also:
Constant Field Values

TYPE_MACOSX

public static final String TYPE_MACOSX
Mac OS X type, as retrieved with getNativeWindowType(boolean)

See Also:
Constant Field Values

TYPE_AWT

public static final String TYPE_AWT
Generic AWT type, as retrieved with getNativeWindowType(boolean)

See Also:
Constant Field Values

TYPE_DEFAULT

public static final String TYPE_DEFAULT
Generic DEFAULT type, where platform implementation don't care, as retrieved with getNativeWindowType(boolean)

See Also:
Constant Field Values

AWTComponentClassName

public static final String AWTComponentClassName
See Also:
Constant Field Values

JAWTUtilClassName

public static final String JAWTUtilClassName
See Also:
Constant Field Values

X11UtilClassName

public static final String X11UtilClassName
See Also:
Constant Field Values

GDIClassName

public static final String GDIClassName
See Also:
Constant Field Values

X11JAWTToolkitLockClassName

public static final String X11JAWTToolkitLockClassName
See Also:
Constant Field Values

X11ToolkitLockClassName

public static final String X11ToolkitLockClassName
See Also:
Constant Field Values
Method Detail

initSingleton

public static void initSingleton(boolean firstUIActionOnProcess)
Static one time initialization of this factory.
This initialization method must be called once by the program or utilizing modules!

The parameter firstUIActionOnProcess has an impact on concurrent locking:

Parameters:
firstUIActionOnProcess - Should be true if called before the first UI action of the running program, otherwise false.

isFirstUIActionOnProcess

public static boolean isFirstUIActionOnProcess()
Returns:
true if initialized with initSingleton(firstUIActionOnProcess==true), otherwise false.

requiresToolkitLock

public static boolean requiresToolkitLock()
Returns:
true if the underlying toolkit requires locking, otherwise false.

isAWTAvailable

public static boolean isAWTAvailable()
Returns:
true if not headless, AWT Component and NativeWindow's AWT part available

getNativeWindowType

public static String getNativeWindowType(boolean useCustom)
Parameters:
useCustom - if false return the native value, if true return a custom value if set, otherwise fallback to the native value.
Returns:
a define native window type, like TYPE_X11, ..

setDefaultFactory

public static void setDefaultFactory(NativeWindowFactory factory)
Sets the default NativeWindowFactory.


getDefaultFactory

public static NativeWindowFactory getDefaultFactory()
Gets the default NativeWindowFactory.


getDefaultToolkitLock

public static ToolkitLock getDefaultToolkitLock()
Provides the system default ToolkitLock, a singleton instance.

See Also:
getDefaultToolkitLock(java.lang.String)

getDefaultToolkitLock

public static ToolkitLock getDefaultToolkitLock(String type)
Provides the default ToolkitLock for type, a singleton instance.


getNullToolkitLock

public static ToolkitLock getNullToolkitLock()

createDefaultToolkitLock

public static ToolkitLock createDefaultToolkitLock(String type,
                                                   long deviceHandle)
Creates the default ToolkitLock for type and deviceHandle.


getFactory

public static NativeWindowFactory getFactory(Class windowClass)
                                      throws IllegalArgumentException
Returns the appropriate NativeWindowFactory to handle window objects of the given type. The windowClass might be NativeWindow, in which case the client has already assumed the responsibility of creating a compatible NativeWindow implementation, or it might be that of a toolkit class like Component.

Throws:
IllegalArgumentException

getNativeWindow

public static NativeWindow getNativeWindow(Object winObj,
                                           AbstractGraphicsConfiguration config)
                                    throws IllegalArgumentException,
                                           NativeWindowException
Converts the given window object and it's AbstractGraphicsConfiguration into a NativeWindow which can be operated upon by a custom toolkit, e.g. javax.media.opengl.GLDrawableFactory.
The object may be a component for a particular window toolkit, such as an AWT Canvas. It may also be a NativeWindow object itself.
You shall utilize GraphicsConfigurationFactory to construct a proper AbstractGraphicsConfiguration.
The particular implementation of the NativeWindowFactory is responsible for handling objects from a particular window toolkit. The built-in NativeWindowFactory handles NativeWindow instances as well as AWT Components.

Throws:
IllegalArgumentException - if the given window object could not be handled by any of the registered NativeWindowFactory instances
NativeWindowException
See Also:
javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)


Copyright 2010 JogAmp Community.