edu.upenn.crimson.gui
Class GUIUtils

java.lang.Object
  extended by edu.upenn.crimson.gui.GUIUtils

public class GUIUtils
extends java.lang.Object

Static methods used throughout the GUI.

Version:
$Id: GUIUtils.java,v 1.40 2007/05/16 18:55:58 fisher Exp $
Notes:
The global file type descriptions and extensions be user modifiable.

Nested Class Summary
static class GUIUtils.DocumentLengthFilter
          Filter used to limit JTextAreas to 4000 characters.
static class GUIUtils.PyFilter
          Python specific FileFilter.
 
Field Summary
private static javax.swing.JFileChooser fileChooser
          The file chooser begins with the current working directory.
private static boolean SHOW_ALL_FILES
          By using global static variables, these values will persist across instances of the open/save fileChoosers.
private static boolean USE_FILE_EXTENSIONS
           
 
Constructor Summary
GUIUtils()
           
 
Method Summary
static java.io.File directoryChooser()
          Create a file chooser for selecting a directory.
static javax.swing.text.DocumentFilter getDocLengthFilter()
           
static java.lang.String getFilename(java.io.File file)
          On Windows machines the path contains "\\", however, when converted to a String, this becomes "\".
static javax.swing.filechooser.FileFilter getPyFilter()
           
static void launchWalrus(java.lang.String filename)
          This will start a Walrus 3D session using the file given.
static void openDatabase()
          Use a FieldEditDialog to query the user for 'username', 'password', and 'database' info and then use this info to open a connection to the database.
static java.io.File openFileChooser(java.lang.String title, javax.swing.filechooser.FileFilter filter)
          Create a file chooser for opening files.
static void resetGUIDefaults()
          RE-set GUI user defaults.
static java.io.File saveFileChooser(java.lang.String title, java.lang.String name, javax.swing.filechooser.FileFilter filter)
          Create a file chooser for saving files.
static void setDBType()
           
static void setShowAllFiles(boolean showAllFiles)
          Set the SHOW_ALL_FILES flag.
static void setUseFileExtensions(boolean useFileExtensions)
          Set the USE_FILE_EXTENSIONS flag.
static boolean showAllFiles()
           
static boolean useFileExtensions()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileChooser

private static javax.swing.JFileChooser fileChooser
The file chooser begins with the current working directory. This is not saved across sessions.


SHOW_ALL_FILES

private static boolean SHOW_ALL_FILES
By using global static variables, these values will persist across instances of the open/save fileChoosers.


USE_FILE_EXTENSIONS

private static boolean USE_FILE_EXTENSIONS
Constructor Detail

GUIUtils

public GUIUtils()
Method Detail

setShowAllFiles

public static void setShowAllFiles(boolean showAllFiles)
Set the SHOW_ALL_FILES flag.


showAllFiles

public static boolean showAllFiles()

setUseFileExtensions

public static void setUseFileExtensions(boolean useFileExtensions)
Set the USE_FILE_EXTENSIONS flag.


useFileExtensions

public static boolean useFileExtensions()

getPyFilter

public static javax.swing.filechooser.FileFilter getPyFilter()

getDocLengthFilter

public static javax.swing.text.DocumentFilter getDocLengthFilter()

launchWalrus

public static void launchWalrus(java.lang.String filename)
This will start a Walrus 3D session using the file given.


resetGUIDefaults

public static void resetGUIDefaults()
RE-set GUI user defaults.


getFilename

public static java.lang.String getFilename(java.io.File file)
On Windows machines the path contains "\\", however, when converted to a String, this becomes "\". So we are doubling them here, to preserver the "\\".


setDBType

public static void setDBType()

openDatabase

public static void openDatabase()
Use a FieldEditDialog to query the user for 'username', 'password', and 'database' info and then use this info to open a connection to the database. The 'username' and 'database' will be saved as an application preference so they can be used as defaults the next time around.


directoryChooser

public static java.io.File directoryChooser()
Create a file chooser for selecting a directory.


openFileChooser

public static java.io.File openFileChooser(java.lang.String title,
                                           javax.swing.filechooser.FileFilter filter)
Create a file chooser for opening files.


saveFileChooser

public static java.io.File saveFileChooser(java.lang.String title,
                                           java.lang.String name,
                                           javax.swing.filechooser.FileFilter filter)
Create a file chooser for saving files.




Copyright 2006 Stephen Fisher, Susan Davidson, and Junhyong Kim, University of Pennsylvania.