|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--UtilPRP
Class UtilPRP contains common utility fcts. for string-numeric conversions messages to the three message lines in the bottom page as well as displayURL functionality. This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government and Djamel Medjahed (SAIC-Frederick). As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file.
This work was derived from MAExplorer under the Mozilla 1.1 Open Source Public License by Peter Lemkin of the National Cancer Institute, an agency of the United States Government subject to the limitations noted in the accompanying LEGAL file. See licence info on http://maexplorer.sourceforge.org/
| Field Summary | |
static float |
defaultFloat
Default value of float for cvs2f() calls |
static int |
defaultInt
Default value of int for cvs2i() calls |
private java.awt.Color |
lastBG1
last foreground, background colors cached |
private java.awt.Color |
lastBG2
last foreground, background colors cached |
private java.awt.Color |
lastBG3
last foreground, background colors cached |
private java.awt.Color |
lastBG4
last foreground, background colors cached |
private java.awt.Color |
lastFG1
last foreground, background colors cached |
private java.awt.Color |
lastFG2
last foreground, background colors cached |
private java.awt.Color |
lastFG3
last foreground, background colors cached |
private java.awt.Color |
lastFG4
last foreground, background colors cached |
static java.lang.String |
mStatus
|
static int |
nStateEntries
# of (name,value) pairs read from the "protplot.prpstate" file |
private int |
parseDelimChar
current delim of "name(delim)value" pair |
private java.lang.String |
parseName
current name of "name=value" pair |
private java.lang.String |
parseValue
current value of "name=value" pair |
private static ProtPlot |
prp
instance of ProtPlot |
private static ShowScatterPlotPopup |
spp
instance of ShowScatterPlotPopup |
| Constructor Summary | |
(package private) |
UtilPRP(ProtPlot prp)
Util() - constructor |
| Method Summary | |
(package private) static int[] |
bubbleSortIndex(float[] data,
int len,
boolean ascending)
bubbleSortIndex() - sort copy of float[0:len-1] data with bubble sort, return index[]. |
(package private) static int[] |
bubbleSortIndex(java.lang.String[] data,
int len,
boolean ascending,
boolean ignoreCaseFlag)
bubbleSortIndex() - sort copy of String[0:len-1] data with bubble sort, return index[]. |
static java.lang.String |
chkDirFinalSeparator(java.lang.String sPath,
java.lang.String fS)
chkDirFinalSeparator() - make dir path end in fileSeparator. |
boolean |
copyFile(java.lang.String srcName,
java.lang.String dstName,
java.lang.String optUpdateMsg,
int optEstInputFileLth)
copyFile() - binary copy of one file or URL toa local file |
static java.lang.String |
cvd2s(double v,
int precision)
cvd2s() - convert double to string with precision # of digits If precision > 0 then limit # of digits in fraction |
static java.lang.String |
cvf2s(float v,
int precision)
cvf2s() - convert float to string with precision # of digits If precision > 0 then limit # of digits in fraction |
static double |
cvs2d(java.lang.String str)
cvs2d() - convert String to double |
static float |
cvs2f(java.lang.String str)
cvs2f() - convert String to float |
static float |
cvs2f(java.lang.String str,
float defVal)
cvs2f() - convert String to float |
static int |
cvs2i(java.lang.String str)
cvs2i() - convert String to int |
static int |
cvs2i(java.lang.String str,
int defVal)
cvs2i() - convert String to int |
static long |
cvs2long(java.lang.String str)
cvs2long() - convert String to int |
(package private) static java.lang.String |
cvtSpacesToUnderscores(java.lang.String str)
cvtSpacesToUnderscores() - replace spaces and other illegal file name characters with '_' chars to make file names highly portable. |
static java.lang.String |
cvtUnderscores2Spaces(java.lang.String sInput)
cvtUnderscores2Spaces() - change underscores to spaces |
(package private) static java.lang.String |
cvtValueToStars(float val,
float valMax,
int maxStars,
boolean rightFillFlag)
cvtValueToStars() - cvt val in[0:valMax] to "****"+" " string where the maximum # of stars for v==vMax is specified. |
(package private) static java.lang.String |
dateStr()
dateStr() - return a new Date string of the current day and time |
boolean |
deleteLocalFile(java.lang.String fileName)
deleteLocalFile() - delete local file. |
void |
displayURL(java.lang.String url)
displayURL() - Display a file in the system browser. |
(package private) float |
getFloatValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
getFloatValFromLine() - get next line and parse value for key 'name='. |
java.lang.String |
getHelpBaseURL()
getHelpBaseURL() - get the base URL for HELP based on prp.useLocalDocFlag It will either be the ProtPlot server or the /Doc/ directory |
(package private) int |
getIntValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
getIntValFromLine() - get next line and parse value for key 'name='. |
(package private) long |
getLongValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
getLongValFromLine() - get next line and parse value for key 'name='. |
(package private) int |
getNextInt(java.util.StringTokenizer parser)
getNextInt() - parse next int from StringTokenizer the integers are separated by ',' or '\n'. |
(package private) boolean |
getNextStrNameValFromLine(java.util.StringTokenizer parser)
getNextStrNameValFromLine() - get next line and parse 'name=value\n'. |
java.lang.String |
getStateStr()
getStateStr() - generate a tab-delim ProtPlot State string The format is tab-delimted (name \t value \n) with one entry/line. |
(package private) java.lang.String |
getStrValFromLine(java.lang.String key)
getStrValFromLine() - parse value for key 'name=value\n'. |
(package private) java.lang.String |
getStrValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
getStrValFromLine() - get line and parse value for key 'name=value\n'. |
static boolean |
isNameInList(java.lang.String[] sList,
java.lang.String s)
isNameInList() - test if String s is in a list of strings sList[]. |
static int |
nextZoomMag(int val,
int maxVal)
nextZoomMag() - modulo 1X, 2X, 5X, 10X, 20X, 30X, 40X, 50X, |
void |
popupAlertMsg(java.lang.String msg)
popupAlertMsg() - popup ALERT message and then timeout. |
void |
popupViewer(java.net.URL urlBase,
java.lang.String fileIn,
java.lang.String windowName)
popupViewer() - popup another web browser for the help HTML file. |
byte[] |
readBytesFromURL(java.lang.String srcName,
java.lang.String optUpdateMsg)
readBytesFromURL() - read binary data from URL |
(package private) boolean |
readNamedProteinSet(java.lang.String protSetName,
java.lang.String destSetName)
readNamedProteinSet() - read named protein set file and save it Cluster or Filter Save list. |
java.util.Hashtable |
readState(java.lang.String stateFile)
readState() - read the ProtPlot State file stateFile |
(package private) boolean |
saveNamedProteinSet(java.lang.String protSetName,
java.lang.String srcSetName)
saveNamedProteinSet() - save the named protein set as a "Set/*.set" file. |
java.lang.String |
setPlotModeName()
setPlotModeName() - lookup the plot mode name |
void |
setText1(java.lang.String text)
setText1() - change the text1 msg for the panel. |
void |
setText1(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
setText1() - change the text1 field in the panel with fg, bg colors You can save the msg as the title. |
void |
setText2(java.lang.String msg)
setText2() - change the text2 field in the panel. |
void |
setText2(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
setText2() - change the text2 field in the panel with fg, bg colors |
void |
setText3(java.lang.String msg)
setText3() - change the text3 field in the panel. |
void |
setText3(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
setText3() - change the text3 field in the panel with fg, bg colors |
void |
setText4(java.lang.String msg)
setText4() - change the text4 field in the panel. |
void |
setText4(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
setText4() - change the text4 field in the panel with fg, bg colors |
void |
showFeatures(java.lang.String msg2,
java.lang.String msg3)
showFeatures() - print features to txtField2 and txtField3 |
void |
showMsg(java.lang.String msg)
showMsg() - print msg to showStatus() and to txtField1 |
void |
showMsg(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
showMsg() - print msg to showStatus() and to txtField1 |
void |
showMsg1(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
showMsg1() - print msg to showStatus() and to txtField1 and change color |
void |
showMsg2(java.lang.String msg2)
showMsg2() - print msg2 to txtField2 |
void |
showMsg2(java.lang.String msg2,
java.awt.Color fg,
java.awt.Color bg)
showMsg2() - print msg2 to txtField2 and change color |
void |
showMsg3(java.lang.String msg3)
showMsg3() - print msg3 to txtField3 |
void |
showMsg3(java.lang.String msg3,
java.awt.Color fg,
java.awt.Color bg)
showMsg3() - print msg3 to txtField3 ALSO: side effect of setting cursor to WAIT_CURSOR if the (fg,bg) is not (black,white). |
void |
showMsg4(java.lang.String msg4)
showMsg4() - print msg2 to txtField4 |
void |
showMsg4(java.lang.String msg4,
java.awt.Color fg,
java.awt.Color bg)
showMsg4() - print msg4 to txtField4 ALSO: side effect of setting cursor to WAIT_CURSOR if the (fg,bg) is not (black,white). |
static void |
sleepMsec(int sleepMsec)
sleepMsec() - sleep nMsec where nMsec must be >= 0 milliseconds. |
(package private) boolean |
updateProtPlotJarFile()
updateProtPlotJarFile() - update ProtPlot.jar into program install area. |
(package private) boolean |
updateProtPlotProgram()
updateProtPlotProgram() - verify that want to update the ProtPlot.jar file from the maexplorer.sourceforge.net server. |
(package private) boolean |
updateProtPlotPRPdatabase()
updateProtPlotPRPdatabase() - verify that want to update PRP/*.prp files from the current server. |
(package private) boolean |
updateProtPlotPRPfile(int n,
java.lang.String prpFname)
updateProtPlotPRPfile() - update ProtPlot PRP/*.prp files into PRP/ install area. |
boolean |
writeState(java.lang.String stateFile)
writeState() - write the ProtPlot State into stateFile in the same directory that the project is in. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static ProtPlot prp
private static ShowScatterPlotPopup spp
public static java.lang.String mStatus
public static int nStateEntries
public static int defaultInt
public static float defaultFloat
private java.lang.String parseName
private java.lang.String parseValue
private int parseDelimChar
private java.awt.Color lastFG1
private java.awt.Color lastBG1
private java.awt.Color lastFG2
private java.awt.Color lastBG2
private java.awt.Color lastFG3
private java.awt.Color lastBG3
private java.awt.Color lastFG4
private java.awt.Color lastBG4
| Constructor Detail |
UtilPRP(ProtPlot prp)
prp - is instance of ProtPlot| Method Detail |
public void showMsg(java.lang.String msg)
msg2 - to display
public void showMsg(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
msg - to displayfg - is forground colorbg - is background color
public void showMsg1(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
msg - to displayfg - is forground colorbg - is background color
public void showFeatures(java.lang.String msg2,
java.lang.String msg3)
msg2 - to displaymsg3 - to displaypublic void showMsg2(java.lang.String msg2)
msg2 - to display
public void showMsg2(java.lang.String msg2,
java.awt.Color fg,
java.awt.Color bg)
msg2 - to displayfg - is forground colorbg - is background colorpublic void showMsg3(java.lang.String msg3)
msg3 - to display
public void showMsg3(java.lang.String msg3,
java.awt.Color fg,
java.awt.Color bg)
msg3 - to displayfg - is forground colorbg - is background colorpublic void showMsg4(java.lang.String msg4)
msg4 - to display
public void showMsg4(java.lang.String msg4,
java.awt.Color fg,
java.awt.Color bg)
msg4 - to displayfg - is forground colorbg - is background colorpublic void popupAlertMsg(java.lang.String msg)
msg - to display in popup alertpublic void setText1(java.lang.String text)
text - to display
public void setText1(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
public void setText2(java.lang.String msg)
public void setText2(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
public void setText3(java.lang.String msg)
msg - to display
public void setText3(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
msg - to displayfg - is forground colorbg - is background colorpublic void setText4(java.lang.String msg)
msg - to display
public void setText4(java.lang.String msg,
java.awt.Color fg,
java.awt.Color bg)
msg - to displayfg - is forground colorbg - is background color
public void popupViewer(java.net.URL urlBase,
java.lang.String fileIn,
java.lang.String windowName)
urlBase - is the base class of the serverfileIne - is the file to displaywindowName - is the optional window name if not nullpublic void displayURL(java.lang.String url)
Examples:
displayURL("http://www.javaworld.com")
displayURL("file://c:\\docs\\index.html")
displayURL("file:///user/joe/index.html");
Under Unix, the system browser is hard-coded to be 'netscape'.
Netscape must be in your PATH for this to work.
Under Windows, this will bring up the default browser under windows,
usually either Netscape or Microsoft IE. The default browser is
determined by the OS.
adapted from :
http://www.javaworld.com/javaworld/javatips/jw-javatip66_p.html
NOTE: param url the file's url (the url must start with either
"http://" or"file://").
[TODO] Handle the Mac.
url - is the URL to display.public java.lang.String setPlotModeName()
public static java.lang.String cvf2s(float v,
int precision)
v - is the value to convertprecision - is the # of digits to display
public static java.lang.String cvd2s(double v,
int precision)
v - is the value to convertprecision - is the # of digits to displaypublic static double cvs2d(java.lang.String str)
str - is the string to convert to a numberpublic static float cvs2f(java.lang.String str)
str - is the string to convert to a number
public static float cvs2f(java.lang.String str,
float defVal)
str - is the string to convert to a numberdefVal - is the explicit default valuepublic static int cvs2i(java.lang.String str)
str - is the string to convert to a number
public static int cvs2i(java.lang.String str,
int defVal)
str - is the string to convert to a numberdefVal - is the explicit default valuepublic static long cvs2long(java.lang.String str)
str - is the string to convert to a number
public static java.lang.String chkDirFinalSeparator(java.lang.String sPath,
java.lang.String fS)
sPath - is the path to checkfS - is the file separatorpublic static java.lang.String cvtUnderscores2Spaces(java.lang.String sInput)
sInput - is the input stringstatic java.lang.String cvtSpacesToUnderscores(java.lang.String str)
: space( ) ; " { } < > = , ? \ / % * ! @ & | ' ` \t
str - to be converted
static java.lang.String cvtValueToStars(float val,
float valMax,
int maxStars,
boolean rightFillFlag)
val - is value to be converted to startsvalMax - is maximum value expectedmaxStars - is max # of stars to use for largest valuerightFillFlag - if true will right fill the string with spaces
public boolean copyFile(java.lang.String srcName,
java.lang.String dstName,
java.lang.String optUpdateMsg,
int optEstInputFileLth)
srcName - is either a full path local file name or
a http:// prefixed URL string of the source file.dstName - is the full path of the local destination file nameoptUpdateMsg - (opt) will display message in showMsg() and
increasing ... in showMsg2(). One '.' for every 10K bytes read.
This only is used when reading a URL. Set to null if not used.optEstInputFileLth - is the estimate size of the input file if known
else 0. Used in progress bar.
public byte[] readBytesFromURL(java.lang.String srcName,
java.lang.String optUpdateMsg)
srcName - is either a full path local file name or
a http:// prefixed URL string of the source file.optUpdateMsg - (opt) will display message in showMsg() and
increasing ... in showMsg2(). One '.' for every 10K bytes read.
This only is used when reading a URL. Set to null if not used.public boolean deleteLocalFile(java.lang.String fileName)
final boolean updateProtPlotJarFile()
[1] Define directory for ProtPlot.jar path and other file and URL names.
[2] Backup the old ProtPlot.jar as ProtPlot.jar.bkup
[3] Open the url: from tmapJarURL. This is hardwired to be
"http://TMAP.sourceforge.net/ProtPlot.jar"
and read the file from the Web into local file "ProtPlot.jar.tmp"
[4] Move the "ProtPlot.jar.tmp" file into "ProtPlot.jar" in the program
directory
Since changing the ProtPlot.jar file is a potential security risk,
we make this procedure final and hardwire the maeJarURL!
copyFile(java.lang.String, java.lang.String, java.lang.String, int),
deleteLocalFile(java.lang.String)boolean updateProtPlotProgram()
final boolean updateProtPlotPRPfile(int n,
java.lang.String prpFname)
[1] Define directory for PRP/*.prp path and other file and URL names.
[2] Backup the old PRP/*.prp files as PRP.*.prp.bkup
[3] Open the url: from tmapJarURL. This is hardwired to be
"http://---homepage---/TMAP/PRP/xxx.prp"
and read the file from the Web into local file "PRP/xxx.prp.tmp"
[4] Move the "PRP/xxx.prp.tmp" file into "PRP/xxx.prp" in the program
directory
Since changing the PRP/* files is a potential security risk,
we make this procedure final and hardwire the maeJarURL!
n - is the nth file being updateprpFname - is the name of the .prp file to updatecopyFile(java.lang.String, java.lang.String, java.lang.String, int),
deleteLocalFile(java.lang.String)boolean updateProtPlotPRPdatabase()
First read the server PRPdir.txt file which is a list of all .prp files
in PRP/ created when TMAP is updated using
(cd PRP/; ls -1c *.prp | sort > ../PRPdir.txt; cd ..)
public static boolean isNameInList(java.lang.String[] sList,
java.lang.String s)
sList - is the array of strings to tests - is the string to test if it is in sListpublic static void sleepMsec(int sleepMsec)
sleepMsec - # of milliseconds to sleep
static int[] bubbleSortIndex(float[] data,
int len,
boolean ascending)
len - size of subarray array of data to be sorted [0:len-1]ascending - sort if true
static int[] bubbleSortIndex(java.lang.String[] data,
int len,
boolean ascending,
boolean ignoreCaseFlag)
data - array of data to be sortedlen - size of subarray array of data to be sorted [0:len-1]ascending - sort assending if trueignoreCaseFlag - sort by case as wellpublic java.util.Hashtable readState(java.lang.String stateFile)
stateFile - is the name of the ProtPlot state filepublic java.lang.String getStateStr()
public boolean writeState(java.lang.String stateFile)
stateFile - is the name of the ProtPlot state filepublic java.lang.String getHelpBaseURL()
static java.lang.String dateStr()
public static int nextZoomMag(int val,
int maxVal)
val - is the value to use in computing next zoom value mod maxValmaxVal - is the maximum value to useis - the next zoom value, else 1 if failed
boolean saveNamedProteinSet(java.lang.String protSetName,
java.lang.String srcSetName)
protSetName - is name of the protein save setsrcSetName - is the source set "Cluster" or "Filter"
boolean readNamedProteinSet(java.lang.String protSetName,
java.lang.String destSetName)
protSetName - is name of the protein save setdestSetName - is the destination set "Cluster" or "Filter"boolean getNextStrNameValFromLine(java.util.StringTokenizer parser)
parser - is the string tokenizer
java.lang.String getStrValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
key - is the key to useparser - is the string tokenizergetNextStrNameValFromLine(java.util.StringTokenizer)java.lang.String getStrValFromLine(java.lang.String key)
key - is the key to use
int getIntValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
key - is the key to useparser - is the string tokenizergetStrValFromLine(java.lang.String, java.util.StringTokenizer)
long getLongValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
key - is the key to useparser - is the string tokenizergetStrValFromLine(java.lang.String, java.util.StringTokenizer)
float getFloatValFromLine(java.lang.String key,
java.util.StringTokenizer parser)
key - is the key to useparser - is the string tokenizergetStrValFromLine(java.lang.String, java.util.StringTokenizer)int getNextInt(java.util.StringTokenizer parser)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||