Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gui4j.core.impl
Class Gui4jImpl  view Gui4jImpl download Gui4jImpl.java

java.lang.Object
  extended byorg.gui4j.core.impl.Gui4jImpl
All Implemented Interfaces:
org.gui4j.Gui4j, org.gui4j.core.Gui4jInternal, java.io.Serializable

final class Gui4jImpl
extends java.lang.Object
implements java.io.Serializable, org.gui4j.core.Gui4jInternal

This is the base initialization class of Gui4j. An instance of Gui4j holds all other necessary instances to deal with graphical user interfaces with gui4j. Note that it is possible to use different instances of Gui4j, but each instance has its own workspace and they are completely independant; and each instance maintains its own cache for reflection calls and worker threads.


Field Summary
private  org.gui4j.event.SimpleEvent eViewCollection
           
private  org.gui4j.exception.Gui4jErrorHandler mErrorHandler
           
private  org.gui4j.core.Gui4jComponentContainerManager mGui4jComponentContainerManager
           
private  org.gui4j.core.Gui4jComponentManager mGui4jComponentManager
           
private  org.gui4j.core.Gui4jReflectionManager mGui4jReflectionManager
           
private  org.gui4j.core.Gui4jThreadManager mGui4jThreadManager
           
private  org.apache.commons.logging.Log mLogger
           
private  boolean mLogInvoke
           
private  boolean mTraceWorkerInvocation
           
private  boolean mValidateXML
           
private  java.util.Set windowCollector
           
 
Constructor Summary
Gui4jImpl(boolean validateXML, boolean logInvoke, int numberOfWorkerThreads, java.net.URL configURL)
           
 
Method Summary
 void addToWindowCollector(org.gui4j.core.interfaces.Gui4jWindowInternal window)
           
private  void configure(java.net.URL configurationSource)
           
 org.gui4j.core.Gui4jCallFactory createCallFactory()
           
 org.gui4j.Gui4jDialog createDialog(org.gui4j.Gui4jWindow owner, java.lang.String viewResourceName, org.gui4j.Gui4jController gui4jController, java.lang.String title, boolean readOnlyMode)
           
 org.gui4j.Gui4jValidator createValidator()
          Creates an instance of Gui4jValidator to validate xml files
 org.gui4j.Gui4jView createView(java.lang.String viewResourceName, org.gui4j.Gui4jController gui4jController, java.lang.String title, boolean readOnlyMode)
           
 org.gui4j.core.Gui4jComponentContainerManager getGui4jComponentContainerManager()
           
 org.gui4j.core.Gui4jComponentManager getGui4jComponentManager()
           
 org.gui4j.core.Gui4jReflectionManager getGui4jReflectionManager()
           
 org.gui4j.core.Gui4jThreadManager getGui4jThreadManager()
           
 java.util.Set getViewCollector()
          Returns the viewCollector.
 void handleException(org.gui4j.Gui4jCallBase gui4jCallBase, java.lang.Throwable t, java.lang.Object context)
          Is called for all exceptions occuring during execution of methods.
 void handleSuccess(org.gui4j.Gui4jCallBase gui4jCallBase, java.lang.Object context)
          Is called after the setter of an edit field returns without raising an exception.
private  void internalError(java.lang.Throwable t)
           
 boolean logInvoke()
           
private  void readObject(java.io.ObjectInputStream in)
           
 void readResourceFile(java.lang.Class controllerClass, java.lang.String resourceName)
          Loads the specified resource file in the cache.
 void removeFromWindowCollector(org.gui4j.core.interfaces.Gui4jWindowInternal window)
           
 void setErrorHandler(org.gui4j.exception.Gui4jErrorHandler errorHandler)
          Sets the errorHandler.
 void setTraceWorkerInvocation(boolean b)
          Defines if the call stack of invokers of WorkerThreads should always be saved so that it can be printed together with the thread's own stack trace in case of an internal error.
This feature is recommended only for debugging purposes since the negative performance impact of creating a call stack (i.e.
 boolean traceMode()
           
 boolean traceWorkerInvocation()
           
private  java.lang.Throwable unpack(java.lang.Throwable t)
           
 boolean validateXML()
           
 void writeDTD(java.io.File outputFile)
          Writes the DTD to the specified file
private  void writeObject(java.io.ObjectOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mLogger

private org.apache.commons.logging.Log mLogger

mGui4jComponentManager

private final org.gui4j.core.Gui4jComponentManager mGui4jComponentManager

mGui4jComponentContainerManager

private final org.gui4j.core.Gui4jComponentContainerManager mGui4jComponentContainerManager

mGui4jReflectionManager

private final org.gui4j.core.Gui4jReflectionManager mGui4jReflectionManager

mGui4jThreadManager

private final org.gui4j.core.Gui4jThreadManager mGui4jThreadManager

eViewCollection

private final org.gui4j.event.SimpleEvent eViewCollection

mValidateXML

private boolean mValidateXML

mLogInvoke

private boolean mLogInvoke

mTraceWorkerInvocation

private boolean mTraceWorkerInvocation

mErrorHandler

private org.gui4j.exception.Gui4jErrorHandler mErrorHandler

windowCollector

private java.util.Set windowCollector
Constructor Detail

Gui4jImpl

public Gui4jImpl(boolean validateXML,
                 boolean logInvoke,
                 int numberOfWorkerThreads,
                 java.net.URL configURL)
Method Detail

getGui4jComponentManager

public org.gui4j.core.Gui4jComponentManager getGui4jComponentManager()
Specified by:
getGui4jComponentManager in interface org.gui4j.core.Gui4jInternal

getGui4jComponentContainerManager

public org.gui4j.core.Gui4jComponentContainerManager getGui4jComponentContainerManager()
Specified by:
getGui4jComponentContainerManager in interface org.gui4j.core.Gui4jInternal

getGui4jReflectionManager

public org.gui4j.core.Gui4jReflectionManager getGui4jReflectionManager()
Specified by:
getGui4jReflectionManager in interface org.gui4j.core.Gui4jInternal

getGui4jThreadManager

public org.gui4j.core.Gui4jThreadManager getGui4jThreadManager()
Specified by:
getGui4jThreadManager in interface org.gui4j.core.Gui4jInternal

configure

private void configure(java.net.URL configurationSource)

handleSuccess

public void handleSuccess(org.gui4j.Gui4jCallBase gui4jCallBase,
                          java.lang.Object context)
Is called after the setter of an edit field returns without raising an exception. If the given Controller (Gui4jCallBase) implements a suitable method, that method is called, otherwise, nothing happens.

Specified by:
handleSuccess in interface org.gui4j.Gui4j

unpack

private java.lang.Throwable unpack(java.lang.Throwable t)

handleException

public void handleException(org.gui4j.Gui4jCallBase gui4jCallBase,
                            java.lang.Throwable t,
                            java.lang.Object context)
Is called for all exceptions occuring during execution of methods. If the given Controller (Gui4jCallBase) defines a suitable error handler, that error handler is called. Otherwise an internal error is raisen.

Specified by:
handleException in interface org.gui4j.Gui4j

internalError

private void internalError(java.lang.Throwable t)

readResourceFile

public void readResourceFile(java.lang.Class controllerClass,
                             java.lang.String resourceName)
Loads the specified resource file in the cache. The method can be used to ensure that some XML resource files are loaded before serializing the current state.

Specified by:
readResourceFile in interface org.gui4j.core.Gui4jInternal

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException

validateXML

public boolean validateXML()
Specified by:
validateXML in interface org.gui4j.core.Gui4jInternal

logInvoke

public boolean logInvoke()
Specified by:
logInvoke in interface org.gui4j.core.Gui4jInternal

traceWorkerInvocation

public boolean traceWorkerInvocation()
Specified by:
traceWorkerInvocation in interface org.gui4j.core.Gui4jInternal

setTraceWorkerInvocation

public void setTraceWorkerInvocation(boolean b)
Defines if the call stack of invokers of WorkerThreads should always be saved so that it can be printed together with the thread's own stack trace in case of an internal error.
This feature is recommended only for debugging purposes since the negative performance impact of creating a call stack (i.e. instance of Throwable) for each invocation of a WorkerThread has not been measured.

Specified by:
setTraceWorkerInvocation in interface org.gui4j.Gui4j

traceMode

public boolean traceMode()
Specified by:
traceMode in interface org.gui4j.core.Gui4jInternal

setErrorHandler

public void setErrorHandler(org.gui4j.exception.Gui4jErrorHandler errorHandler)
Sets the errorHandler.

Specified by:
setErrorHandler in interface org.gui4j.Gui4j

getViewCollector

public java.util.Set getViewCollector()
Returns the viewCollector.

Specified by:
getViewCollector in interface org.gui4j.Gui4j

addToWindowCollector

public void addToWindowCollector(org.gui4j.core.interfaces.Gui4jWindowInternal window)
Specified by:
addToWindowCollector in interface org.gui4j.core.Gui4jInternal

removeFromWindowCollector

public void removeFromWindowCollector(org.gui4j.core.interfaces.Gui4jWindowInternal window)
Specified by:
removeFromWindowCollector in interface org.gui4j.core.Gui4jInternal

createView

public org.gui4j.Gui4jView createView(java.lang.String viewResourceName,
                                      org.gui4j.Gui4jController gui4jController,
                                      java.lang.String title,
                                      boolean readOnlyMode)
Specified by:
createView in interface org.gui4j.Gui4j

createDialog

public org.gui4j.Gui4jDialog createDialog(org.gui4j.Gui4jWindow owner,
                                          java.lang.String viewResourceName,
                                          org.gui4j.Gui4jController gui4jController,
                                          java.lang.String title,
                                          boolean readOnlyMode)
Specified by:
createDialog in interface org.gui4j.Gui4j

createCallFactory

public org.gui4j.core.Gui4jCallFactory createCallFactory()
Specified by:
createCallFactory in interface org.gui4j.core.Gui4jInternal

writeDTD

public void writeDTD(java.io.File outputFile)
              throws org.gui4j.exception.Gui4jException
Description copied from interface: org.gui4j.Gui4j
Writes the DTD to the specified file

Specified by:
writeDTD in interface org.gui4j.Gui4j

createValidator

public org.gui4j.Gui4jValidator createValidator()
Description copied from interface: org.gui4j.Gui4j
Creates an instance of Gui4jValidator to validate xml files

Specified by:
createValidator in interface org.gui4j.Gui4j