dea.common
Class Display

java.lang.Object
  extended bydea.common.Display
All Implemented Interfaces:
IDebugLevels

public class Display
extends java.lang.Object
implements IDebugLevels

This class holds methods for formating page and debug output. TODO:This class needs some clean up to better wrapper log4j.


Field Summary
 
Fields inherited from interface dea.common.IDebugLevels
BASIC, DEBUG_ALL, ERROR, METH_DETAIL, METH_ENTER, METH_EXIT, METH_EXT, METH_GET, METH_SET, METH_VARS, SHOW_PASS
 
Constructor Summary
Display()
           
 
Method Summary
static java.lang.String convertStr(java.lang.String s)
          convert chars that will give SQL problems to chars that will not
static long dateStr2val(java.lang.String yrStr, java.lang.String mthStr, java.lang.String dayStr, java.lang.String hrStr, java.lang.String minStr)
          Convert date in from the form fields and converts it to a long
static void dprint(int dlvl, java.lang.String msg)
          If debug is on then call logIt(String) for msg
static void dprint(int dlvl, java.lang.String msg, boolean bool)
          Print "message = true or false" if debug set
static void dprint(int dlvl, java.lang.String msg, boolean[] aH)
          Print boolean array values if debug set
static void dprint(int dlvl, java.lang.String msg, byte[] aS)
          Print int array values if debug set
static void dprint(int dlvl, java.lang.String msg, char c)
           
static void dprint(int dlvl, java.lang.String msg, float f)
          Print String "message = value" if debug set
static void dprint(int dlvl, java.lang.String msg, int i)
          Print String "message = value" if debug set
static void dprint(int dlvl, java.lang.String msg, int[] aH)
          Print int array values if debug set
 void dprint(int dlvl, java.lang.String msg, InternetAddress[] aIa)
          Print InternetAddress array values if debug set
static void dprint(int dlvl, java.lang.String msg, long l)
          Print String "message = value" if debug set
 void dprint(int dlvl, java.lang.String msg, java.lang.Object obj)
          Print value being retrieved if debug set.
static void dprint(int dlvl, java.lang.String msg, java.util.Properties prop)
          Print Properties keys and values if debug set
static void dprint(int dlvl, java.lang.String msg, java.util.Set set)
          Print Set values with class name if debug set
static void dprint(int dlvl, java.lang.String msg, java.lang.String s)
          Print String of "message = (value)" if debug set
static void dprint(int dlvl, java.lang.String msg, java.lang.String[] aS)
          Print String array values if debug set
 void dprint(int dlvl, java.lang.String msg, java.lang.Throwable e)
          Print "message exception info" if debug set
static void dprint(int dlvl, java.lang.String msg, java.sql.Timestamp timestamp)
          Print String of "message = (value)" if debug set
static java.lang.String exceptionToStr(java.lang.String msg, java.lang.Throwable e)
          Create a String from the message and Throwable passed.
static java.lang.String getDayList(int select)
          Generate options for day select list
static int getDebug()
          Get method for debug (debug level in force)
static Display getInstance()
          get singleton
static java.lang.String getLogName()
           
static java.lang.String getMonthList(int select)
          Generate options for month select list
static java.lang.String getTimeList(java.lang.String select)
          Generate options for time select list
static java.lang.String getYearList(int select)
          Generate options for year select list for this and the next 2 years
static java.lang.String getYearList(int select, int rangeFwd, int rangeBak)
          Generate options for year select list
static java.lang.String isChecked(int button, int val)
          gen HTML to mark button CHECKED if data show it should be
static java.lang.String isChecked(java.lang.String button, java.lang.String val)
          gen HTML to mark button CHECKED if data show it should be
static void logIt(java.lang.String msg)
          * Wrapper for log4j All messages sent at error level so we can alter debug level on the fly with out having to reset the server.
static void logItOld(java.lang.String msg)
          * Crude log for jsp debug.
static void markLog(int dlvl, java.lang.String msg)
          If debug is on then call logIt(String) for msg
static java.lang.String null2str(int i)
          if String is null then return blank string
static java.lang.String null2str(java.lang.String s)
          if String is null then return blank string
static void setDebug(int newDebug)
          Set method for debug (debug level in force)
static void setLogName(java.lang.String newLogName)
           
 void showError(java.lang.String msg, java.lang.Throwable e)
          Prints out more than you want to know about a caught Exception.
static int str2int(java.lang.String s)
          return int from String or 0 if empty or invalid
static long str2Long(java.lang.String s)
          If String is null or invalid returns 0 otherwise the number the string represents.
static java.lang.String truncStr(java.lang.String fullStr, java.lang.String baseStr)
          return a string that is s1 relative to s2 just a simple truncation for now
if fullStr equals null or baseStr then return empty string
static java.lang.String val2DateStr(java.lang.String timeStr, java.lang.String fieldNameBase, boolean showTime)
          Convert date in the form of a long to form fields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Display

public Display()
Method Detail

getInstance

public static Display getInstance()
get singleton


getLogName

public static java.lang.String getLogName()

setLogName

public static void setLogName(java.lang.String newLogName)

str2Long

public static long str2Long(java.lang.String s)
If String is null or invalid returns 0 otherwise the number the string represents.

Parameters:
s - number as a String.

null2str

public static java.lang.String null2str(java.lang.String s)
if String is null then return blank string


null2str

public static java.lang.String null2str(int i)
if String is null then return blank string


convertStr

public static java.lang.String convertStr(java.lang.String s)
convert chars that will give SQL problems to chars that will not

Parameters:
s - - source string

truncStr

public static java.lang.String truncStr(java.lang.String fullStr,
                                        java.lang.String baseStr)
return a string that is s1 relative to s2 just a simple truncation for now
if fullStr equals null or baseStr then return empty string


str2int

public static int str2int(java.lang.String s)
return int from String or 0 if empty or invalid


getDebug

public static int getDebug()
Get method for debug (debug level in force)

Returns:
int

setDebug

public static void setDebug(int newDebug)
Set method for debug (debug level in force)

Parameters:
newDebug - new debug level

exceptionToStr

public static java.lang.String exceptionToStr(java.lang.String msg,
                                              java.lang.Throwable e)
Create a String from the message and Throwable passed.

Parameters:
msg -
e -
Returns:
String

showError

public void showError(java.lang.String msg,
                      java.lang.Throwable e)
Prints out more than you want to know about a caught Exception.

Parameters:
msg - message to put in the header line
e - The Exception to get the error from

isChecked

public static java.lang.String isChecked(java.lang.String button,
                                         java.lang.String val)
gen HTML to mark button CHECKED if data show it should be

Parameters:
button - value of button
val - value to check against
Returns:
String "CHECKED" if (button.equalsIgnoreCase(val))

isChecked

public static java.lang.String isChecked(int button,
                                         int val)
gen HTML to mark button CHECKED if data show it should be

Parameters:
button - value of button
val - value to check against
Returns:
String "CHECKED" if ((button & val) == val)

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          int i)
Print String "message = value" if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
i - value to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          char c)

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          long l)
Print String "message = value" if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
l - value to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          float f)
Print String "message = value" if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
f - value to print
See Also:
IDebugLevels

dprint

public void dprint(int dlvl,
                   java.lang.String msg,
                   java.lang.Object obj)
Print value being retrieved if debug set. Note known object types such as Vectors and Hashtables are enumerated to display the values they contain.

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
obj - object to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          java.lang.String[] aS)
Print String array values if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
aS - array to print
See Also:
IDebugLevels

dprint

public void dprint(int dlvl,
                   java.lang.String msg,
                   InternetAddress[] aIa)
Print InternetAddress array values if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
aIa - array to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          boolean[] aH)
Print boolean array values if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
aH - array to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          int[] aH)
Print int array values if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
aH - array to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          byte[] aS)
Print int array values if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
aS - array to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          java.util.Properties prop)
Print Properties keys and values if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
prop - Properties to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          java.util.Set set)
Print Set values with class name if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
set - Set to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          java.lang.String s)
Print String of "message = (value)" if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
s - value to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          java.sql.Timestamp timestamp)
Print String of "message = (value)" if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
timestamp - value to print
See Also:
IDebugLevels

dprint

public void dprint(int dlvl,
                   java.lang.String msg,
                   java.lang.Throwable e)
Print "message exception info" if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
e - exception to print info of
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg,
                          boolean bool)
Print "message = true or false" if debug set

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
bool - boolean to print
See Also:
IDebugLevels

dprint

public static void dprint(int dlvl,
                          java.lang.String msg)
If debug is on then call logIt(String) for msg

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
See Also:
IDebugLevels

logIt

public static void logIt(java.lang.String msg)
* Wrapper for log4j All messages sent at error level so we can alter debug level on the fly with out having to reset the server.

Parameters:
msg - message to log

logItOld

public static void logItOld(java.lang.String msg)
* Crude log for jsp debug. dprint also calls this so we get a log along with the stdout that the server does not log.

Parameters:
msg - message to log

val2DateStr

public static java.lang.String val2DateStr(java.lang.String timeStr,
                                           java.lang.String fieldNameBase,
                                           boolean showTime)
Convert date in the form of a long to form fields

Parameters:
timeStr - long as String
fieldNameBase - base fro field names
showTime - add selection lists for time as well
Returns:
String that contains a SELECT list for month (field name = fieldNameBase_month) a SELECT list for day (field name = fieldNameBase_day) and and INPUT for the year (field name = fieldNameBase_year) if showTime is true then you also get a SELECT list for hour (field name = fieldNameBase_hour) and SELECT list for minute (field name = fieldNameBase_minute)

dateStr2val

public static long dateStr2val(java.lang.String yrStr,
                               java.lang.String mthStr,
                               java.lang.String dayStr,
                               java.lang.String hrStr,
                               java.lang.String minStr)
Convert date in from the form fields and converts it to a long

Parameters:
yrStr -
mthStr -
dayStr -
hrStr -
minStr -
Returns:
long

getMonthList

public static java.lang.String getMonthList(int select)
Generate options for month select list

Parameters:
select - default (CHECKED) option
Returns:
String in the format on option lines for a select tag

getDayList

public static java.lang.String getDayList(int select)
Generate options for day select list

Parameters:
select - default (CHECKED) option
Returns:
String in the format on option lines for a select tag

getYearList

public static java.lang.String getYearList(int select)
Generate options for year select list for this and the next 2 years

Parameters:
select - default (CHECKED) option
Returns:
String in the format on option lines for a select tag

getYearList

public static java.lang.String getYearList(int select,
                                           int rangeFwd,
                                           int rangeBak)
Generate options for year select list

Parameters:
select - default (CHECKED) option
rangeFwd - number of years forward to add to list
rangeBak - number of years back to add to list
Returns:
String in the format on option lines for a select tag

getTimeList

public static java.lang.String getTimeList(java.lang.String select)
Generate options for time select list

Parameters:
select - default (CHECKED) option
Returns:
String in the format on option lines for a select tag

markLog

public static void markLog(int dlvl,
                           java.lang.String msg)
If debug is on then call logIt(String) for msg

Parameters:
dlvl - print only if ((dlvl & bDebug) == dlvl)
msg - message to print.
See Also:
IDebugLevels


Copyright © 2001-2005 Round Mountain Rescue Ranch. All Rights Reserved.