issrg.utils
Class Util

java.lang.Object
  extended by issrg.utils.Util

public class Util
extends java.lang.Object

This is a class that contains useful routines. They are public and static.

Version:
1.0
Author:
A Otenko

Field Summary
static java.lang.String JFC_CLOSE_BRACKET
          This constant specifies the closing bracket string that the jfc will be looking for when approving selection.
static java.lang.String JFC_OPEN_BRACKET
          This constant sets the opening bracket string that the jfc will be looking for when approving selection.
 
Constructor Summary
Util()
           
 
Method Summary
static void bewail(java.lang.String s, java.lang.Throwable th, java.awt.Component f)
          Outputs an error dialog box and optionally prints out the exception stack trace, if it is not null.
static javax.swing.JFileChooser createFileChooser()
          This method creates a javax.swing.JFileChooser that is responsible for substituting the right sort of extensions (by examining the filter description contents) and for asking for overwriting confirmation.
static boolean extensionMatch(java.lang.String filename, java.lang.String extension)
          This routine returns whether or not the filename ends with the extension.
static javax.swing.JDialog showSplash(java.awt.Frame owner, java.lang.String title, java.lang.String message)
          This method creates a splash dialog with a given title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JFC_OPEN_BRACKET

public static final java.lang.String JFC_OPEN_BRACKET
This constant sets the opening bracket string that the jfc will be looking for when approving selection.

When approving selection, jfc JFileChooser will look up for the default extensions for the file to read or save. This is obtained by parsing the description string. The first occurence of JFC_OPEN_BRACKET specifies the start of the extension specification, the first occurence of the JFC_CLOSE_BRACKET after the opening bracket signifies the end of the extension specification. The string inbetween them is treated as the default extension (leading and trailing spaces removed).

If the brackets are not encountered, or only one is found, the file is treated as is: no extension is added to it. The filename is not updated also if the "All files" filer has been chosen.

See Also:
Constant Field Values

JFC_CLOSE_BRACKET

public static final java.lang.String JFC_CLOSE_BRACKET
This constant specifies the closing bracket string that the jfc will be looking for when approving selection.

See Also:
JFC_OPEN_BRACKET, Constant Field Values
Constructor Detail

Util

public Util()
Method Detail

showSplash

public static javax.swing.JDialog showSplash(java.awt.Frame owner,
                                             java.lang.String title,
                                             java.lang.String message)
This method creates a splash dialog with a given title. Display it till you have completed your background calculations and your Frame is ready to accept input. Being displayed modally, this dialog will disable any input to the Frame till you close it.


createFileChooser

public static javax.swing.JFileChooser createFileChooser()
This method creates a javax.swing.JFileChooser that is responsible for substituting the right sort of extensions (by examining the filter description contents) and for asking for overwriting confirmation.

See Also:
JFC_OPEN_BRACKET

extensionMatch

public static boolean extensionMatch(java.lang.String filename,
                                     java.lang.String extension)
This routine returns whether or not the filename ends with the extension. It checks for extensions by case insensitive comparison.

Parameters:
filename - is the examined filename
extension - is the extension in question; in fact, it can be any ending of a filename, so please be careful and don't forget the "." to match the extensions only; otherwise "trace" and "tr.ace" would match the same extension "ace", unless you specify it as ".ace"
Returns:
true if the filename ends with that extension

bewail

public static void bewail(java.lang.String s,
                          java.lang.Throwable th,
                          java.awt.Component f)
Outputs an error dialog box and optionally prints out the exception stack trace, if it is not null.

Parameters:
s - the message to output as an error.
th - the throwable of which the stack trace will be output to err; can be null, if no stack trace is to be output
f - is the frame or Dialog to which the error message is modal