wxtutils
Class reporter

java.lang.Object
  extended bywxtutils.reporter

public class reporter
extends java.lang.Object

Reporter is used as a stack. Messages are pushed and popped This facilitates a strategy that prepares for detailed reporting and removing of details if everything goes ok Reporter also holds general utilities: getMergedStrings which operates as sentences with 1 or 2 insertion points %1 and %2 respectively. Strings are fetched from resources if necessary. No string constants are administrated outside this class.


Constructor Summary
reporter()
          Creates a new instance of reporter
 
Method Summary
 void clearLogFile()
          Clear the currently selected logfile
 void clearMessages()
          Clear all message
static void displaySystemProps()
          Nice to have during debugging
static java.lang.String getBundleString(java.lang.String S)
          Gets a string from a resource bundle: wxtgui/guiStrings
static java.lang.String getBundleString(java.lang.String S, java.lang.String t1)
          Gets a string from a resource bundle: wxtgui/guiStrings combined with a parameter at %1
static java.lang.String getBundleString(java.lang.String S, java.lang.String t1, java.lang.String t2)
          Gets a string from a resource bundle: wxtgui/guiStrings combined with a parameter at %1 and one at %2
 long getLogFileMaxlength()
          Get the max length of the logfile
 java.net.URI getLogFileUri()
          Get the logfilepath
 java.lang.String getReport(java.lang.String scriptpath)
          Retrieves the total report as the stack is at the moment Adds this report to the actual file-log, if turned on
 int getStackSize()
          Get stacksize
 void markStack()
          Sets the popmark
 java.lang.String popMessage()
          Removes the top of the stack.
 void pushMessage(java.lang.String m)
          Push a message from resourcebundle to the stack
 void pushMessage(java.lang.String m, java.lang.String t1)
          Push message from resourcebundle and compose with 1 insertion
 void pushMessage(java.lang.String m, java.lang.String t1, java.lang.String t2)
          Push message from resourcebundle and compose with 2 insertions
 void pushSimpleMessage(java.lang.String m)
          Push a simple, non constructed message to the stack
static void setLocale(java.lang.String lang)
          set locale
 void setLogFileMaxlength(long m)
          Set the max length of the logfile
 void setLogFileURI(java.net.URI theUri)
          Set the logfilepath
 void writeLogFile(java.lang.String text, java.lang.String scriptpath)
          Append a new report to the currently selected logfile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

reporter

public reporter()
Creates a new instance of reporter

Method Detail

setLocale

public static void setLocale(java.lang.String lang)
set locale

Parameters:
lang - String defining the locale

getLogFileUri

public java.net.URI getLogFileUri()
Get the logfilepath

Returns:
the path of the logfile

setLogFileURI

public void setLogFileURI(java.net.URI theUri)
Set the logfilepath

Parameters:
theUri - the new URI for the logfile

getLogFileMaxlength

public long getLogFileMaxlength()
Get the max length of the logfile

Returns:
max length of the logfile

setLogFileMaxlength

public void setLogFileMaxlength(long m)
Set the max length of the logfile

Parameters:
m - the new max length of the logfile

markStack

public void markStack()
Sets the popmark


getStackSize

public int getStackSize()
Get stacksize

Returns:
the size of the stack

clearMessages

public void clearMessages()
Clear all message


pushSimpleMessage

public void pushSimpleMessage(java.lang.String m)
Push a simple, non constructed message to the stack

Parameters:
m - The message

pushMessage

public void pushMessage(java.lang.String m)
Push a message from resourcebundle to the stack

Parameters:
m - The string used as key in the resourcebundle. If m is no key, m is pushed

pushMessage

public void pushMessage(java.lang.String m,
                        java.lang.String t1)
Push message from resourcebundle and compose with 1 insertion

Parameters:
m - The string used as key. If m is no key, m is pushed
t1 - The string used as %1 parameter

pushMessage

public void pushMessage(java.lang.String m,
                        java.lang.String t1,
                        java.lang.String t2)
Push message from resourcebundle and compose with 2 insertions

Parameters:
m - The string used as key. If m is no key, m is pushed
t1 - The string used as %1 parameter
t2 - The second string, used as %2 parameter

popMessage

public java.lang.String popMessage()
Removes the top of the stack.

Returns:
the top of the stack

clearLogFile

public void clearLogFile()
Clear the currently selected logfile


writeLogFile

public void writeLogFile(java.lang.String text,
                         java.lang.String scriptpath)
Append a new report to the currently selected logfile

Parameters:
text - the report to append
scriptpath - the path to the active script generating the report

getReport

public java.lang.String getReport(java.lang.String scriptpath)
Retrieves the total report as the stack is at the moment Adds this report to the actual file-log, if turned on

Parameters:
scriptpath - The path to the acive script
Returns:
A String with all messages as lines

getBundleString

public static java.lang.String getBundleString(java.lang.String S)
Gets a string from a resource bundle: wxtgui/guiStrings

Parameters:
S - The key
Returns:
The string found with S, or S if nothing found

getBundleString

public static java.lang.String getBundleString(java.lang.String S,
                                               java.lang.String t1)
Gets a string from a resource bundle: wxtgui/guiStrings combined with a parameter at %1

Parameters:
S - The key
t1 - The string that will be inserted for %1 in the string found
Returns:
The modified string found with S, or S if nothing found

getBundleString

public static java.lang.String getBundleString(java.lang.String S,
                                               java.lang.String t1,
                                               java.lang.String t2)
Gets a string from a resource bundle: wxtgui/guiStrings combined with a parameter at %1 and one at %2

Parameters:
S - The key
t1 - The string that will be inserted for %1 in the string found
t2 - The string that will be inserted for %2 in the string found
Returns:
The modified string found with S, or S if nothing found

displaySystemProps

public static void displaySystemProps()
Nice to have during debugging