|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nih.nlm.swing.SwingToolkit
gov.nih.nlm.mms.MMSToolkit
public class MMSToolkit
Utility class containing methods for MetamorphoSys applications.
| Field Summary |
|---|
| Fields inherited from class gov.nih.nlm.swing.SwingToolkit |
|---|
key_map, properties |
| Fields inherited from interface gov.nih.nlm.swing.SwingConstants |
|---|
EMPTY_BORDER, EMPTY_BORDER_NO_TOP, EMPTY_INSETS, GRID_INSETS, HAS_POPUP_BORDER, IS_REQUIRED_BORDER, VIEW |
| Constructor Summary | |
|---|---|
MMSToolkit()
|
|
| Method Summary | |
|---|---|
static boolean |
archiveContainsDir(File file,
String dir)
Returns true if the given archive File
contains the given directory. |
static void |
cancel()
Determines whether or not a cancel operation should call System.Exit. |
static File |
chooseFile(String title,
String button_text,
int selection_mode,
File current_dir,
File selected_file,
FileFilter fileFilter,
Frame owner)
Prompts user to choose a file, specifying a file filter. |
static File |
chooseFile(String title,
String button_text,
int selection_mode,
File current_dir,
File selected_file,
FileFilter fileFilter,
String fileExtension,
Frame owner)
Prompts user to choose a file to save, specifying a file filter and file extension. |
static File |
chooseFile(String title,
String button_text,
int selection_mode,
File current_dir,
File selected_file,
Frame owner)
Prompt user to choose a file. |
static boolean |
containsUnicode(String str)
Indicates whether or not the given String has
any extended unicode characters in it. |
static void |
copyResourceToFile(InputStream resource_stream,
String write_file,
String subset_dir)
Copies the contents of the given InputStream to a new directory
with a given file name. |
static void |
Exit(int return_value)
Cleans up system resources, then exits. |
static void |
exitToWelcomeGUI(JFrame frame)
Closes given JFrame and returns to the WelcomeGUI. |
static String |
getApplicationBuildDate()
Returns the application timestamp from MMSYS/config/timestamp.dat. |
static String |
getApplicationVersion()
Returns the application version from MMSYS/config/version.dat. |
static String |
getBuildDate()
Returns build date of the UMLS from release.dat. |
static String |
getExtension(File f)
Returns the extension portion of the file's name. |
static MetamorphoSysGUI |
getGui()
Returns the MetamorphoSysGUI. |
static String[] |
getInterfaceImplementations(String interface_name)
Scans all .jar files in the CLASSPATH
and returns all fully qualified class names that implement
the specified interface. |
static String[] |
getInterfaceImplementations(String interface_name,
List dir_list)
Scans all .jar files in the CLASSPATH
and returns all fully qualified class names that implement
the specified interface. |
static String |
getLvgVersion()
Returns the lvg version from release.dat. |
static String |
getReleaseDate()
Returns release date of the UMLS from release.dat. |
static String |
getReleaseDatNullValue()
Returns the null value defined in release.dat This is meant to accommodate MySQL. |
static Properties |
getReleaseDatProperties()
Get a copy of the release.dat Properties with the property list filled in. |
static String |
getReleaseDescription()
Returns release description of the UMLS from release.dat. |
static String |
getReleaseVersion()
Returns release version of the UMLS from release.dat. |
static JMenuItem |
getResourceHelpMenu(String title,
String url,
Frame owner)
Returns a JMenuItem for a "Help" menu that opens a browser with
the specified URL. |
static String |
getTableForFile(String file_name)
Converts a file name into a database table name. |
static JMenuItem |
getURLHelpMenu(String title,
String url,
GlassPaneListener gpl)
Returns a JMenuItem for a "Help" menu that opens a browser with
the specified URL. |
static Object |
instantiateObject(String name)
Instantiates an object of the specified fully qualified type. |
static JPanel |
makeCard(JTable table,
String title)
Helper function to make panels for the MetamorphoSysGUI
tabbed pane. |
static void |
printStackTrace(Exception e,
BufferedWriter b)
Prints the stack trace from the given Exception to the
given BufferedWriter. |
static boolean |
readTar(InputStream in,
String untarDir,
File tgz_file,
Frame owner)
|
static void |
setGui(MetamorphoSysGUI gui)
Sets a reference to the MetamorphoSysGUI. |
static void |
setIconImage(JFrame frame)
Add corner application image |
static void |
setReleaseDatLocation(String rd)
Sets the location of the |
static void |
setReleaseDatNullValue(String nv)
Sets the null value defined in release.dat This is meant to accommodate MySQL. |
static void |
setUsingView(boolean view)
Sets the "using view" flag. |
static void |
showLogAndExitToWelcomeGUI(String title,
File log_file)
Cleans up system resources, shows the log file, then exits. |
static String[] |
splitString(String to_split,
int line_length)
Splits a string on word boundaries so that each element of the string array returned represents a "line" of the original string that is no longer than the specified max line length. |
static long |
timeDifference(Date now,
Date then)
Compute the time difference between the specified parameters. |
static String |
timeToString(long time)
Convert a long representing a time to
a string representing hours, minutes, and seconds. |
static void |
writeReleaseDatFile(String mr_dir)
Helper method for writing release.dat. |
| Methods inherited from class gov.nih.nlm.swing.SwingToolkit |
|---|
confirmRequest, confirmRequest, confirmRequestWithOption, copy, displayTextFile, displayTextFile, displayTextFile, displayURL, getHexForColor, getMultiLineUserInput, getMultiLineUserInput, getMultipleColors, getPanelForHTML, getProperties, getProperty, getProperty, getUserInput, getUserInput, makeColorTransparent, md5, notifyUser, notifyUser, notifyUser, notifyUserWithOption, readScaledImage, removeProperty, reportError, reportError, reportError, setProperties, setProperty, unzip, unzip, usingView |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MMSToolkit()
| Method Detail |
|---|
public static void setUsingView(boolean view)
view - a boolean flag indicating whether or
not the current application is using a GUI.
public static File chooseFile(String title,
String button_text,
int selection_mode,
File current_dir,
File selected_file,
Frame owner)
title - the title of the dialogbutton_text - the text on the buttonselection_mode - the selection mode (i.e. Files/Directories/both)current_dir - the current directoryselected_file - Fileowner - parent Component
File selected by the user
public static File chooseFile(String title,
String button_text,
int selection_mode,
File current_dir,
File selected_file,
FileFilter fileFilter,
Frame owner)
title - the title of the dialogbutton_text - the text on the buttonselection_mode - the selection mode (i.e. Files/Directories/both)current_dir - the current directoryselected_file - FilefileFilter - FileFilter on accepted file type(s)owner - parent Component
File selected by the user
public static File chooseFile(String title,
String button_text,
int selection_mode,
File current_dir,
File selected_file,
FileFilter fileFilter,
String fileExtension,
Frame owner)
title - the title of the dialogbutton_text - the text on the buttonselection_mode - the selection mode (i.e. Files/Directories/both)current_dir - the current directoryselected_file - FilefileFilter - FileFilter on accepted file type(s)fileExtension - desired file extensionowner - parent Component
File selected by the userpublic static String getExtension(File f)
f - File on which to find extension
String if none.FileFilter.accept(java.io.File)
public static boolean containsUnicode(String str)
throws UnsupportedEncodingException
String has
any extended unicode characters in it.
str - given String
true extended Unicode characters are present
false extended Unicode characters are not present
UnsupportedEncodingException
public static boolean archiveContainsDir(File file,
String dir)
throws Exception
true if the given archive File
contains the given directory.
file - archive Filedir - directory name
true if archive contains the given directory
false otherwise
Exceptionpublic static String timeToString(long time)
long representing a time to
a string representing hours, minutes, and seconds.
time - the time in milliseconds
String representation "HH:MM:SS"
public static long timeDifference(Date now,
Date then)
now - the later timethen - the earlier time
long indicating the number
of milliseconds between the specified dates
public static String[] getInterfaceImplementations(String interface_name)
throws ClassNotFoundException,
IOException
.jar files in the CLASSPATH
and returns all fully qualified class names that implement
the specified interface.
interface_name - the fully qualified interface name
String[] of all fully qualified
class names implementing that interface
ClassNotFoundException
IOException
public static String[] getInterfaceImplementations(String interface_name,
List dir_list)
throws ClassNotFoundException,
IOException
.jar files in the CLASSPATH
and returns all fully qualified class names that implement
the specified interface.
interface_name - the fully qualified interface namedir_list - List
String[] of all fully qualified
class names implementing that interface
ClassNotFoundException
IOExceptionpublic static void Exit(int return_value)
return_value - the System.exit(int) status codepublic static void exitToWelcomeGUI(JFrame frame)
JFrame and returns to the WelcomeGUI.
frame - {JFrame} of sub-application to exit
public static void showLogAndExitToWelcomeGUI(String title,
File log_file)
title - for the loglog_file - File for log
public static JPanel makeCard(JTable table,
String title)
MetamorphoSysGUI
tabbed pane. Each panel displays the configuration GUI for one
filter.
table - a JTable to be displayedtitle - title for the panel
JPanel with the table and title on itpublic static Object instantiateObject(String name)
name - a fully qualified class name
Object that was instantiated
public static JMenuItem getResourceHelpMenu(String title,
String url,
Frame owner)
JMenuItem for a "Help" menu that opens a browser with
the specified URL. The title is used for the help menu item label.
title - for help menuurl - for help menu displayowner - parent Component
JMenuItem for a "Help" menu item
public static JMenuItem getURLHelpMenu(String title,
String url,
GlassPaneListener gpl)
JMenuItem for a "Help" menu that opens a browser with
the specified URL. The title is used for the help menu item label.
title - for help menuurl - to be displayedgpl - GlassPaneListener
JMenuItem for a "Help" menu itempublic static String getApplicationBuildDate()
MMSYS/config/timestamp.dat.
MMSYS/config/timestamp.dat.public static String getApplicationVersion()
MMSYS/config/version.dat.
MMSYS/config/version.dat.public static String getReleaseVersion()
release.dat.
release.datpublic static String getReleaseDescription()
release.dat.
release.datpublic static String getReleaseDate()
release.dat.
release.datpublic static String getBuildDate()
release.dat.
release.datpublic static String getLvgVersion()
release.dat.
release.datpublic static String getReleaseDatNullValue()
public static void setReleaseDatNullValue(String nv)
nv - the null value
public static void writeReleaseDatFile(String mr_dir)
throws IOException
release.dat.
mr_dir - directory location for release.dat
IOException - if the file cannot be writtenpublic static Properties getReleaseDatProperties()
public static void setReleaseDatLocation(String rd)
throws IOException
rd - the location of the release.dat file
IOExceptionpublic static String getTableForFile(String file_name)
file_name -
public static void copyResourceToFile(InputStream resource_stream,
String write_file,
String subset_dir)
throws IOException
InputStream to a new directory
with a given file name. It treats the stream as a character stream
by wrapping it with
resource_stream - InputStream of resource to be copiedwrite_file - String name of subset filesubset_dir - String subset directory
IOException - if anything goes wrongpublic static void setGui(MetamorphoSysGUI gui)
MetamorphoSysGUI.
gui - the MetamorphoSysGUIpublic static MetamorphoSysGUI getGui()
MetamorphoSysGUI.
MetamorphoSysGUIpublic static void cancel()
public static String[] splitString(String to_split,
int line_length)
to_split - the String to split upline_length - the maximum line length, or -1 to
accept the default setting.
String[] of the lines
public static void printStackTrace(Exception e,
BufferedWriter b)
Exception to the
given BufferedWriter.
e - Exceptionb - BufferedWriter
public static boolean readTar(InputStream in,
String untarDir,
File tgz_file,
Frame owner)
throws IOException
in - InputStreamuntarDir - directory in which to extract tgz_filetgz_file - tgz fileowner - Frame
true if effective o/w false if failed
IOExceptionpublic static void setIconImage(JFrame frame)
frame - JFrame
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||