com.jogamp.newt.impl
Class DisplayImpl

java.lang.Object
  extended by com.jogamp.newt.Display
      extended by com.jogamp.newt.impl.DisplayImpl
Direct Known Subclasses:
AWTDisplay, Display, Display, KDDisplay, MacDisplay, WindowsDisplay, X11Display

public abstract class DisplayImpl
extends Display


Field Summary
protected  AbstractGraphicsDevice aDevice
           
static boolean DEBUG_TEST_EDT_MAINTHREAD
           
protected  boolean destroyWhenUnused
           
protected  EDTUtil edtUtil
           
protected  String fqname
           
protected  int hashCode
           
protected  int id
           
protected  String name
           
static String nilString
           
protected  int refCount
           
protected  String type
           
 
Fields inherited from class com.jogamp.newt.Display
DEBUG, displayList, displaysActive
 
Constructor Summary
DisplayImpl()
           
 
Method Summary
 int addReference()
          The 1st call will initiate native creation, since we follow the lazy creation pattern.
protected abstract  void closeNativeImpl()
           
static Display create(String type, String name, long handle, boolean reuse)
          Make sure to reuse a Display with the same name
protected  void createEDTUtil()
           
 void createNative()
          Manual trigger the native creation, if it is not done yet.
This is useful to be able to request the AbstractGraphicsDevice, via Display.getGraphicsDevice().
Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized.
protected abstract  void createNativeImpl()
           
 void destroy()
          Manually trigger the destruction, incl.
 void dispatchMessages()
           
protected abstract  void dispatchMessagesNative()
           
 void enqueueEvent(boolean wait, NEWTEvent e)
           
 EDTUtil getEDTUtil()
           
 String getFQName()
           
 AbstractGraphicsDevice getGraphicsDevice()
           
 long getHandle()
           
 int getId()
           
 String getName()
           
 int getReferenceCount()
           
 String getType()
           
 int hashCode()
          return precomputed hashCode from FQN Display.getFQName()
 boolean isEDTRunning()
           
 boolean isNativeValid()
           
 int removeReference()
          The last call may destroy this instance, if #getDestroyWhenUnused() returns true.
 void runOnEDTIfAvail(boolean wait, Runnable task)
           
protected  boolean shallRunOnEDT()
           
 String toString()
           
 String validateDisplayName(String name, long handle)
           
 boolean validateEDT()
          Validate EDT running state.
Stop the running EDT in case this display is destroyed already.
 
Methods inherited from class com.jogamp.newt.Display
dumpDisplayList, equals, getActiveDisplayNumber, getAllDisplays, getFirstDisplayOf, getLastDisplayOf, getThreadName, hashCodeNullSafe, toHexString, toHexString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_TEST_EDT_MAINTHREAD

public static final boolean DEBUG_TEST_EDT_MAINTHREAD

nilString

public static final String nilString
See Also:
Constant Field Values

edtUtil

protected EDTUtil edtUtil

id

protected int id

name

protected String name

type

protected String type

fqname

protected String fqname

hashCode

protected int hashCode

refCount

protected int refCount

destroyWhenUnused

protected boolean destroyWhenUnused

aDevice

protected AbstractGraphicsDevice aDevice
Constructor Detail

DisplayImpl

public DisplayImpl()
Method Detail

create

public static Display create(String type,
                             String name,
                             long handle,
                             boolean reuse)
Make sure to reuse a Display with the same name


hashCode

public int hashCode()
Description copied from class: Display
return precomputed hashCode from FQN Display.getFQName()

Specified by:
hashCode in class Display

createNative

public final void createNative()
                        throws NativeWindowException
Description copied from class: Display
Manual trigger the native creation, if it is not done yet.
This is useful to be able to request the AbstractGraphicsDevice, via Display.getGraphicsDevice().
Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized.

This method is usually invoke by Display.addReference()

Specified by:
createNative in class Display
Throws:
NativeWindowException - if the native creation failed.

shallRunOnEDT

protected boolean shallRunOnEDT()

createEDTUtil

protected void createEDTUtil()

getEDTUtil

public final EDTUtil getEDTUtil()
Specified by:
getEDTUtil in class Display

runOnEDTIfAvail

public void runOnEDTIfAvail(boolean wait,
                            Runnable task)

validateEDT

public boolean validateEDT()
Description copied from class: Display
Validate EDT running state.
Stop the running EDT in case this display is destroyed already.

Specified by:
validateEDT in class Display
Returns:
true if EDT has been stopped (destroyed but running), otherwise false.

destroy

public final void destroy()
Description copied from class: Display
Manually trigger the destruction, incl. native destruction.

This method is usually invoke by Display.removeReference()

Specified by:
destroy in class Display

addReference

public final int addReference()
Description copied from class: Display
The 1st call will initiate native creation, since we follow the lazy creation pattern.

Specified by:
addReference in class Display
Returns:
number of references after adding one
See Also:
Display.removeReference()

removeReference

public final int removeReference()
Description copied from class: Display
The last call may destroy this instance, if #getDestroyWhenUnused() returns true.

Specified by:
removeReference in class Display
Returns:
number of references after removing one
See Also:
Display.addReference(), #getDestroyWhenUnused(), #setDestroyWhenUnused(boolean)

getReferenceCount

public final int getReferenceCount()
Specified by:
getReferenceCount in class Display
Returns:
number of references by Screen

createNativeImpl

protected abstract void createNativeImpl()

closeNativeImpl

protected abstract void closeNativeImpl()

getId

public final int getId()
Specified by:
getId in class Display
Returns:
this display internal serial id

getType

public final String getType()
Specified by:
getType in class Display
Returns:
the native display type, ie NativeWindowFactory.getNativeWindowType(boolean)

getName

public final String getName()
Specified by:
getName in class Display
Returns:
this display instance name as defined at creation time

getFQName

public final String getFQName()
Specified by:
getFQName in class Display
Returns:
the fully qualified Display name, which is a key of Display.getType() + Display.getName() + Display.getId()

validateDisplayName

public String validateDisplayName(String name,
                                  long handle)

getHandle

public final long getHandle()
Specified by:
getHandle in class Display

getGraphicsDevice

public final AbstractGraphicsDevice getGraphicsDevice()
Specified by:
getGraphicsDevice in class Display

isNativeValid

public final boolean isNativeValid()
Specified by:
isNativeValid in class Display
Returns:
true if the native display handle is valid and ready to operate, otherwise false.
See Also:
Display.destroy()

isEDTRunning

public boolean isEDTRunning()
Specified by:
isEDTRunning in class Display

toString

public String toString()
Overrides:
toString in class Object

dispatchMessagesNative

protected abstract void dispatchMessagesNative()

dispatchMessages

public void dispatchMessages()
Specified by:
dispatchMessages in class Display

enqueueEvent

public void enqueueEvent(boolean wait,
                         NEWTEvent e)


Copyright 2010 JogAmp Community.