fr.tireme.shared
Class GuiThread

java.lang.Object
  extended by java.lang.Thread
      extended by fr.tireme.shared.GuiThread
All Implemented Interfaces:
java.lang.Runnable

public abstract class GuiThread
extends java.lang.Thread

Class managing all threaded User Interface where there is a need to send interactive messages to a log area and, if needed to update a progress bar.

The calls is abstract and is extended in order to rpvide the _run mlethod, responsible to run all user actions.

Since:
9 septembre 2002 *@version 1.0, Copyright (c) 2002, 2003, 2004
Author:
Pierre Attar

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 boolean debug
          debug mode ?
 java.lang.String message
          Interact with the user interrface : the current message that will be output.
 Messages mMess
          Message handler
 int pbCount
          Interact with the user interface : percentage for the progress bar.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GuiThread()
           
 
Method Summary
abstract  java.lang.String _run()
          This is implemented by extending classes.
 java.io.File initializeVariables(boolean debug, Messages mess, java.lang.Runnable ml, boolean withProgressbar)
          Initialize all needed objects of the abstract class
 void run()
          Main processing method for the called as soon a something is launched and that need to output messages in the log area window.
 void writeMessage(java.lang.String mess)
          Write a message in the text Area.
 void writeMessage(java.lang.String mess, boolean retBefore)
          Description of the rite a message but in plus, output a return before
 void writeMessage(java.lang.String log, java.lang.String mess)
           
 void writeMessageAndProgress(java.lang.String mess, int progress)
          Write a message in the text Area and increment the progress bar
 void writeMessageAndProgress(java.lang.String log, java.lang.String mess, int progress)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mMess

public Messages mMess
Message handler


debug

public boolean debug
debug mode ?


message

public java.lang.String message
Interact with the user interrface : the current message that will be output. Needs to remain public because used in other threaded classes.


pbCount

public int pbCount
Interact with the user interface : percentage for the progress bar. Needs to remain public because used in other threaded classes.

Constructor Detail

GuiThread

public GuiThread()
Method Detail

initializeVariables

public java.io.File initializeVariables(boolean debug,
                                        Messages mess,
                                        java.lang.Runnable ml,
                                        boolean withProgressbar)
                                 throws java.lang.Exception
Initialize all needed objects of the abstract class

Parameters:
debug - Are we in a debug mode
mess - MutoMessage message handler
ml - the modifier used to log information in the text log area
withProgressbar - do we have a progress bar in the user interface ?
Returns:
The file where will be logged all messages
Throws:
java.lang.Exception - mainly, all IO Exceptions linked to the log file creation

run

public void run()
Main processing method for the called as soon a something is launched and that need to output messages in the log area window. As an abstract method, manages all init andend massages. Call beneath the _run method provided by extending classes

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

writeMessage

public void writeMessage(java.lang.String mess)
Write a message in the text Area. This method also write the message onto a logfile if debug mode is active.

Parameters:
mess - String defining the message to write

writeMessage

public void writeMessage(java.lang.String mess,
                         boolean retBefore)
Description of the rite a message but in plus, output a return before

Parameters:
mess - String defining the message to write
retBefore - Indicate that a break needs to be generated before the message

writeMessageAndProgress

public void writeMessageAndProgress(java.lang.String mess,
                                    int progress)
Write a message in the text Area and increment the progress bar

Parameters:
mess - String defining the message to write
progress - Integer value from 0 to 100 that will be understood as a percentage of the total progress bar width.

writeMessageAndProgress

public void writeMessageAndProgress(java.lang.String log,
                                    java.lang.String mess,
                                    int progress)

writeMessage

public void writeMessage(java.lang.String log,
                         java.lang.String mess)

_run

public abstract java.lang.String _run()
This is implemented by extending classes. Mainly, responsible for managing the running of the action performed. The program threaded.

Returns:
A completion message that will be output.