faa.tg.dra.gui
Class Drat

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by faa.tg.dra.gui.Drat
All Implemented Interfaces:
DratPanelDropListener, PopDeleteInterface, JPanelDropListener, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class Drat
extends javax.swing.JFrame
implements java.awt.event.ActionListener, DratPanelDropListener, PopDeleteInterface

 Drat starts the Data Reduction and Analysis Toolkit GUI.

 This file does not need to be changed to add a tool to the Drat GUI.
 To add a tool, create a panel class for the tool in the package
 "faa.tg.dra.gui". The class must be named "<toolClassName>Panel".
 Then add the Panel information to the drat.properties file.
 (See other Panels in the directory for examples.)
 
See the source: Drat.java

Version:
$Id: Drat.java,v 3.22 2009/01/07 23:43:29 danaw Exp $
Author:
Ed Jaggard, FAA/ACT-510 Mon Aug 24, 1998, Dana N. Whicker, Titan/SRC, Wed Aug 6 1999
See Also:
Serialized Form

Nested Class Summary
(package private)  class Drat.AboutAction
          Action to Process a About Request.
private  class Drat.ActionChangedListener
           
protected  class Drat.AppCloser
          To terminate the DRAT GUI when run as an application.
(package private)  class Drat.ClearAllAction
          Action to Process an RmFilter Request: remove all components from the scrollingPanel.
(package private)  class Drat.ExitAction
          Minimal implementation of an exit command.
(package private)  class Drat.FilterColorAction
          Action to Select a background color for the panels.
(package private)  class Drat.HelpAction
          Action to Process a Help Request
(package private)  class Drat.HelpBrowseAction
          Action to process a help request that selects a browser: executes system call: "<browser> <helpFileName>" .
 class Drat.NewAction
          Clears the filter list.
(package private)  class Drat.OpenAction
          Opens a DRAT configuration file and uses it to load the filter list.
(package private)  class Drat.OpenRecentAction
          Opens a recently used used DRAT configuration file
(package private)  class Drat.PanelAddAction
          Action to generate a DR&A panel on the DRAT GUI display.
(package private)  class Drat.PlotAction
          Perform action to run the current DR&A configuration.
(package private)  class Drat.RmFilterAction
          Action to Process an RmFilter Request - Remove a component from scrollingPanel
(package private)  class Drat.RunAction
          Perform action to run the current DR&A configuration.
(package private)  class Drat.SaveAction
          Save the filter list under current DRAT configuration file.
(package private)  class Drat.SaveAsAction
          Saves the filter list as a DRAT configuration file.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String aboutAction
           
static java.lang.String actionSuffix
          Suffix applied to the key used in resource file lookups for an action.
static java.lang.String clearAllAction
           
static java.lang.String currentUI
           
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
static java.lang.String DEFAULT_TITLE
           
private  javax.swing.Action[] defaultActions
          Actions defined by the Gui class
static java.lang.String defaultFilesProperties
          File path is relative to the package directory Drat is in.
(package private)  DragAndDropMouseListener dndListener
           
(package private)  DraPanelList draPanels
           
(package private)  javax.swing.JFrame dratFrame
           
static java.lang.String exitAction
           
(package private) static java.awt.Color filterColor
           
static java.lang.String filterColorAction
           
private  java.util.Hashtable<java.lang.Object,javax.swing.Action> guiActions
           
private  java.lang.String guiTitle
           
static java.lang.String helpAction
           
static java.lang.String helpBrowseAction
           
private static java.lang.String helpFileName
          The help file for the DRAT GUI (default "dratmanual.htm").
(package private)  HookupManager hookupManager
           
static java.lang.String imageSuffix
          Suffix applied to the key used in resource file lookups for an image.
private static java.text.NumberFormat integerFormatter
           
private static boolean keepAsterisk
           
static java.lang.String labelSuffix
          Suffix applied to the key used in resource file lookups for a label.
protected  java.lang.String lastFileNameUsed
           
(package private)  javax.swing.JPanel mainPanel
           
static int MAXIMUM_GUI_WIDTH
           
private  javax.swing.JMenuBar menubar
           
private  java.util.Hashtable<java.lang.String,javax.swing.JMenuItem> menuItems
           
protected  java.util.Vector<java.lang.String> names
           
static java.lang.String newAction
           
static java.lang.String openAction
          Constants for GUI menu setup; for more information see GUI properties.
static java.lang.String openRecentAction
           
(package private)  java.awt.Window parentWindow
           
private static java.text.NumberFormat percentFormatter
           
static java.lang.String PLOT_XML_DIR_PROP
           
static java.lang.String plotAction
           
static java.lang.String RECENT_CONFIG_FILE
          the name of the file where a list of recent DRAT files is kept
static int RECENT_SIZE
          Number of recently used drat configuration files to keep
private static java.util.ResourceBundle resources
           
static java.lang.String rmFilterAction
           
static java.lang.String runAction
           
private  javax.swing.JButton runButton
           
static java.lang.String saveAction
           
static java.lang.String saveAsAction
           
private  javax.swing.JScrollPane scroller
           
(package private)  javax.swing.JPanel scrollingPanel
           
(package private) static long serialVersionUID
           
static java.util.regex.Pattern stdTokensPattern
           
static java.lang.String tipSuffix
          Suffix applied to the key used in resource file lookups for tooltip text.
private static java.util.regex.Pattern toolbarDividerPattern
           
private  javax.swing.JPanel toolbarPanel
          The panel containing the toolbar(s).
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Drat()
          Constructor for the Data Reduction & Analysis Toolkit (DRAT) graphical user interface.
Drat(java.lang.String[] params)
          Constructor for the Data Reduction & Analysis Toolkit (DRAT) graphical user interface.
Drat(java.lang.String dratConfigFileName, java.lang.String recFileName)
          Creates a DRAT GUI with a specified configuration file already loaded, and allowing the input/output file names to be sat according to a specified recording file name.
Drat(java.awt.Window parentWindow)
          Constructor for the Data Reduction & Analysis Toolkit (DRAT) graphical user interface that allows this GUI to be the child of another window.
Drat(java.awt.Window parentWin, java.lang.String dratConfigFileName)
          Creates a DRAT GUI with a specified configuration file already loaded.
Drat(java.awt.Window parentWin, java.lang.String dratConfigFileName, java.lang.String recFileName)
          Creates a DRAT GUI with a specified configuration file already loaded, and allowing the input/output file names to be sat according to a specified recording file name.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Provides the method for the ActionListener interface.
 void addName(java.lang.String newName)
          Adds new to list of recently used DRAT config files
 boolean canMovePanelInto(DraggableJPanel panel)
          returns whether a panel can be moved into here
protected  java.beans.PropertyChangeListener createActionChangeListener(javax.swing.JMenuItem b)
           
protected  javax.swing.JMenu createMenu(java.lang.String key)
          Create a menu for the app.
protected  javax.swing.JMenuBar createMenubar()
          Create the menubar for the app.
protected  javax.swing.JMenuItem createMenuItem(java.lang.String cmd)
          This is the hook through which all menu items are created.
protected  java.awt.Component createTool(java.lang.String key)
          Hook through which every toolbar item is created.
protected  javax.swing.JButton createToolbarButton(java.lang.String key)
          Create a button to go inside of the toolbar.
private  javax.swing.JPanel createToolbarPanel()
          Create the toolbar panel.
protected  javax.swing.Action getAction(java.lang.String cmd)
          Fetch the action indicated by the command String.
 javax.swing.Action[] getActions()
          Fetch the list of actions supported.
static java.util.Iterator getConfigIterator()
          Gets an iterator for the predefined configuration filenames stored in the config directory.
static java.io.File getConfigResourceFile(java.lang.String dratFileName)
          Get the configuration file from the given filename: if the file does not exist, use the name to lookup a DRAT configuration file in the config directory.
static java.lang.String getDefaultFileProperty(java.lang.String propertyName)
          Returns default file property, or returns null if file not found: converts file separator characters if necessary.
 DraPanelList getDraPanels()
          Get the DraPanels stored by the DRAT.
protected static java.net.URL getDratResource(java.lang.String key)
          Returns the URL for the resource indicated by the input parameter.
protected static java.lang.String getDratResourceString(java.lang.String nm)
          Returns the URL for the resource indicated by the input parameter.
static java.lang.String getHelpFileName()
           
protected  javax.swing.JMenuBar getMenubar()
          Returns the menubar for the DRAT GUI.
protected  javax.swing.JMenuItem getMenuItem(java.lang.String cmd)
          Fetch the menu item that was created for the given command.
private static java.lang.String getOutFileName(java.lang.String dratConfig, java.lang.String recFile)
          Returns a filename derived fom the input filename prefix and the DRAT configuration filename.
 int getPanelWidth()
          Return the width of the DRAT GUI panel.
private  java.io.File getRecentFile()
          gets file that contains recently used config files
static java.net.URL getResource(java.lang.String name)
          Gets a resource using a path relative to the Drat.class directory.
static java.io.InputStream getResourceAsStream(java.lang.String name)
          Gets an input stream for reading a resource using a path relative to the Drat.class directory.
static java.net.URL getResourceFileURL(java.lang.String name)
          Gets a DRAT resource file, checking secondary locations if resource was not found in the path relative to the Drat.class directory.
protected  javax.swing.JPanel getToolbarPanel()
          Return the DRAT GUI toolbar panel.
private  void initializeActions()
          Initialize the actions that the GUI menu performs.
 void loadConfigFile(java.io.File dratConfigFile)
          Load a panel configuration from a DRAT configuration file.
static void main(java.lang.String[] args)
           
 void movePanelBelow(DraggableJPanel panelToMove, DraggableJPanel panelToMoveBelow)
          Moves the panelToMove to the location after the panelToPlaceAfter.
 void movePanelInto(DraggableJPanel panel)
          Moves panel into newPanel caller is responsible for removing panel from old container panel
 void readInNames()
          Reads in recently used drat config file names
 void removeAllDraPanels()
          Remove all the DraPanels from the current DRAT GUI configuration.
static void runConfig(java.lang.String dratConfig)
          Run a DRAT configuration for the File described by the given filename: does not affect the GUI or use it as input.
static void runConfig(java.lang.String dratConfig, java.lang.String[] recFiles)
          Run a configuration for each of a set of input files, replacing the DRAT configuration's input and output files with derived filenames.
static void runConfigs(java.lang.String[] dratConfigs, java.lang.String[] recFiles)
          Run a set of DRAT configuration for each of a set of input files, replacing the input and output files of each DRAT configuration with derived filenames.
 void runCurrentConfiguration()
          Run the DRAT configuration specified by DRAT's GUI interface.
 void setDraPanelProperties(java.util.Properties inputProps, int idx)
          Set the properties of the index of the specified DraPanel.
 void setDraPanelProperty(java.lang.String name, java.lang.String value, int idx)
          Set the properties of the index of the specified DraPanel.
 void setDraPanels(DraPanelList draPanels)
          Set the DraPanels to be used by the DRAT.
 void setTitle(java.lang.String title)
          Sets the title to the specified string.
 void setTitleSuffix(java.lang.String titleSuffix)
          Sets the title suffix to the specified string.
private  void startDratGui()
          Drat GUI processing (instead of parameter-activated batch processing).
protected static java.io.File storeJarFileAsTempFile(java.net.URL url, java.lang.String tempTypeName, java.lang.String fileExt)
          Extracts file from JAR and stores it as a temporary file in the default temporary directory and returns the new temp file name.
static DraPanel toDraPanel(java.util.Properties panelProps)
          Return DraPanel defined by a Properties object.
static DraPanelList toDraPanelList(java.io.File dratConfigFile)
          Return list of filter/factory panel instances from the DRAT configuration file.
static DraPanelList toDraPanelList(java.io.File dratConfigFile, java.lang.String recFile)
          Return list of filter/factory panel instances from the DRAT configuration file, replacing the configuration's recording file name with the given file name and replacing the configuration's output file name with a derived name.
static DraPanelList toDraPanelList(PropertyPerLine ppl)
          Return list of DraPanels defined by a PropertyPerLine object.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface faa.tg.dra.gui.DratPanelDropListener
getTitle
 
Methods inherited from interface faa.tg.dra.gui.PopDeleteInterface
repaint
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID

See Also:
Constant Field Values

DEFAULT_TITLE

public static final java.lang.String DEFAULT_TITLE
See Also:
Constant Field Values

MAXIMUM_GUI_WIDTH

public static final int MAXIMUM_GUI_WIDTH
See Also:
Constant Field Values

currentUI

public static final java.lang.String currentUI
See Also:
Constant Field Values

defaultFilesProperties

public static final java.lang.String defaultFilesProperties
File path is relative to the package directory Drat is in.

See Also:
Constant Field Values

PLOT_XML_DIR_PROP

public static final java.lang.String PLOT_XML_DIR_PROP
See Also:
Constant Field Values

helpFileName

private static java.lang.String helpFileName
The help file for the DRAT GUI (default "dratmanual.htm").


resources

private static java.util.ResourceBundle resources

filterColor

static java.awt.Color filterColor

percentFormatter

private static java.text.NumberFormat percentFormatter

integerFormatter

private static java.text.NumberFormat integerFormatter

toolbarDividerPattern

private static java.util.regex.Pattern toolbarDividerPattern

stdTokensPattern

public static final java.util.regex.Pattern stdTokensPattern

keepAsterisk

private static boolean keepAsterisk

guiTitle

private java.lang.String guiTitle

runButton

private javax.swing.JButton runButton

scroller

private javax.swing.JScrollPane scroller

scrollingPanel

javax.swing.JPanel scrollingPanel

parentWindow

java.awt.Window parentWindow

dratFrame

javax.swing.JFrame dratFrame

mainPanel

javax.swing.JPanel mainPanel

hookupManager

HookupManager hookupManager

draPanels

DraPanelList draPanels

dndListener

DragAndDropMouseListener dndListener

guiActions

private java.util.Hashtable<java.lang.Object,javax.swing.Action> guiActions

menuItems

private java.util.Hashtable<java.lang.String,javax.swing.JMenuItem> menuItems

menubar

private javax.swing.JMenuBar menubar

toolbarPanel

private javax.swing.JPanel toolbarPanel
The panel containing the toolbar(s).


imageSuffix

public static final java.lang.String imageSuffix
Suffix applied to the key used in resource file lookups for an image.

See Also:
Constant Field Values

labelSuffix

public static final java.lang.String labelSuffix
Suffix applied to the key used in resource file lookups for a label.

See Also:
Constant Field Values

actionSuffix

public static final java.lang.String actionSuffix
Suffix applied to the key used in resource file lookups for an action.

See Also:
Constant Field Values

tipSuffix

public static final java.lang.String tipSuffix
Suffix applied to the key used in resource file lookups for tooltip text.

See Also:
Constant Field Values

openAction

public static final java.lang.String openAction
Constants for GUI menu setup; for more information see GUI properties.

drat.properties

See Also:
Constant Field Values

openRecentAction

public static final java.lang.String openRecentAction
See Also:
Constant Field Values

newAction

public static final java.lang.String newAction
See Also:
Constant Field Values

saveAction

public static final java.lang.String saveAction
See Also:
Constant Field Values

saveAsAction

public static final java.lang.String saveAsAction
See Also:
Constant Field Values

exitAction

public static final java.lang.String exitAction
See Also:
Constant Field Values

plotAction

public static final java.lang.String plotAction
See Also:
Constant Field Values

runAction

public static final java.lang.String runAction
See Also:
Constant Field Values

helpAction

public static final java.lang.String helpAction
See Also:
Constant Field Values

helpBrowseAction

public static final java.lang.String helpBrowseAction
See Also:
Constant Field Values

aboutAction

public static final java.lang.String aboutAction
See Also:
Constant Field Values

rmFilterAction

public static final java.lang.String rmFilterAction
See Also:
Constant Field Values

clearAllAction

public static final java.lang.String clearAllAction
See Also:
Constant Field Values

filterColorAction

public static final java.lang.String filterColorAction
See Also:
Constant Field Values

RECENT_SIZE

public static final int RECENT_SIZE
Number of recently used drat configuration files to keep

See Also:
Constant Field Values

names

protected java.util.Vector<java.lang.String> names

lastFileNameUsed

protected java.lang.String lastFileNameUsed

RECENT_CONFIG_FILE

public static final java.lang.String RECENT_CONFIG_FILE
the name of the file where a list of recent DRAT files is kept

See Also:
Constant Field Values

defaultActions

private javax.swing.Action[] defaultActions
Actions defined by the Gui class

Constructor Detail

Drat

public Drat()
     throws DraException
Constructor for the Data Reduction & Analysis Toolkit (DRAT) graphical user interface.

Throws:
DraException - User or configuration error while running DRAT.

Drat

public Drat(java.awt.Window parentWindow)
     throws DraException
Constructor for the Data Reduction & Analysis Toolkit (DRAT) graphical user interface that allows this GUI to be the child of another window. If the parent window is not set, all other windows will be terminated when this window exits.

Parameters:
parentWindow - Parent window for the DRAT GUI.
Throws:
DraException - User or configuration error while running DRAT.

Drat

public Drat(java.awt.Window parentWin,
            java.lang.String dratConfigFileName)
     throws DraException,
            java.io.IOException
Creates a DRAT GUI with a specified configuration file already loaded. If the parent window is not set, all other windows will be terminated when this window exits.

Parameters:
parentWin - Parent window for the DRAT GUI.
dratConfigFileName - Configuration file saved by DRAT.
Throws:
DraException - User or configuration error while running DRAT.
java.io.IOException - Thrown if error while loading configuration file.

Drat

public Drat(java.lang.String dratConfigFileName,
            java.lang.String recFileName)
     throws DraException,
            java.io.IOException
Creates a DRAT GUI with a specified configuration file already loaded, and allowing the input/output file names to be sat according to a specified recording file name. The output filename is set to the input recording file prefix (name before the last ".") concatenated to a "." and the DRAT configuration file name prefix.

Parameters:
dratConfigFileName - Configuration file saved by DRAT.
recFileName - Name of a TGF recording file for a simulation.
Throws:
DraException - User or configuration error while running DRAT.
java.io.IOException - Thrown if error while loading configuration file.

Drat

public Drat(java.awt.Window parentWin,
            java.lang.String dratConfigFileName,
            java.lang.String recFileName)
     throws DraException,
            java.io.IOException
Creates a DRAT GUI with a specified configuration file already loaded, and allowing the input/output file names to be sat according to a specified recording file name. The output filename is set to the input recording file prefix (name before the last ".") concatenated to a "." and the DRAT configuration file name prefix. If the parent window is not set, all other windows will be terminated when this window exits.

Parameters:
parentWin - Parent window for the DRAT GUI.
dratConfigFileName - Configuration file saved by DRAT.
recFileName - Name of a TGF recording file for a simulation.
Throws:
DraException - User or configuration error while running DRAT.
java.io.IOException - Thrown if error while loading configuration file.

Drat

public Drat(java.lang.String[] params)
     throws DraException
Constructor for the Data Reduction & Analysis Toolkit (DRAT) graphical user interface.

Parameters:
params - Command line or specified parameters.
Throws:
DraException - User or configuration error while running DRAT.
Method Detail

initializeActions

private void initializeActions()
Initialize the actions that the GUI menu performs.


startDratGui

private void startDratGui()
                   throws java.lang.RuntimeException
Drat GUI processing (instead of parameter-activated batch processing).

Throws:
java.lang.RuntimeException

getDraPanels

public DraPanelList getDraPanels()
Get the DraPanels stored by the DRAT.

Specified by:
getDraPanels in interface PopDeleteInterface
Returns:
List of DraPanels.

setDraPanels

public void setDraPanels(DraPanelList draPanels)
Set the DraPanels to be used by the DRAT.

Specified by:
setDraPanels in interface PopDeleteInterface
Parameters:
draPanels - List of DraPanels.

canMovePanelInto

public boolean canMovePanelInto(DraggableJPanel panel)
returns whether a panel can be moved into here

Specified by:
canMovePanelInto in interface DratPanelDropListener
Parameters:
panel - - the panel to move
Returns:
returns true if given panel can be moved into new panel otherwise, returns false

movePanelInto

public void movePanelInto(DraggableJPanel panel)
                   throws javax.naming.OperationNotSupportedException
Moves panel into newPanel caller is responsible for removing panel from old container panel

Specified by:
movePanelInto in interface DratPanelDropListener
Parameters:
panel - - the panel to move
Throws:
javax.naming.OperationNotSupportedException - - is thrown if panel can not be moved into new container

movePanelBelow

public void movePanelBelow(DraggableJPanel panelToMove,
                           DraggableJPanel panelToMoveBelow)
Moves the panelToMove to the location after the panelToPlaceAfter.

Specified by:
movePanelBelow in interface JPanelDropListener
Parameters:
panelToMove - DraggableJPanel being moved.
panelToMoveBelow - DraggableJPanel to place the panelToMove after.

setDraPanelProperty

public void setDraPanelProperty(java.lang.String name,
                                java.lang.String value,
                                int idx)
Set the properties of the index of the specified DraPanel.


setDraPanelProperties

public void setDraPanelProperties(java.util.Properties inputProps,
                                  int idx)
                           throws OldTgfFileException
Set the properties of the index of the specified DraPanel.

Throws:
OldTgfFileException - Obsolete properties file format.

loadConfigFile

public void loadConfigFile(java.io.File dratConfigFile)
Load a panel configuration from a DRAT configuration file. Writes error messages if the panels are old file format or an error occured reading the file.


runCurrentConfiguration

public void runCurrentConfiguration()
                             throws DraException
Run the DRAT configuration specified by DRAT's GUI interface. Provides progress dialogs for the readers.

Throws:
DraException - Error from configuration setup.

removeAllDraPanels

public void removeAllDraPanels()
Remove all the DraPanels from the current DRAT GUI configuration.

Specified by:
removeAllDraPanels in interface PopDeleteInterface

getOutFileName

private static java.lang.String getOutFileName(java.lang.String dratConfig,
                                               java.lang.String recFile)
Returns a filename derived fom the input filename prefix and the DRAT configuration filename. Format:
    <inputFnamePrefix>.<dratConfigFnamePrefix>
 


getConfigResourceFile

public static java.io.File getConfigResourceFile(java.lang.String dratFileName)
                                          throws DraException
Get the configuration file from the given filename: if the file does not exist, use the name to lookup a DRAT configuration file in the config directory.

Parameters:
dratFileName - The filename of the DRAT configuration file.
Returns:
Returns file containing the specified DRAT configuration file.
Throws:
DraException - Configuration file "name.drat" was not found in the configuration directory.

getHelpFileName

public static java.lang.String getHelpFileName()
Returns:
Returns the name of the DRAT help file.

storeJarFileAsTempFile

protected static java.io.File storeJarFileAsTempFile(java.net.URL url,
                                                     java.lang.String tempTypeName,
                                                     java.lang.String fileExt)
Extracts file from JAR and stores it as a temporary file in the default temporary directory and returns the new temp file name.

Parameters:
url - URL for input stream to import JAR file from.
tempTypeName - Type of file to extract (minimum 3 chars).
fileExt - The desired file extension, or null if unimportant.
Returns:
File name of the help file copied from the URL location.

toDraPanel

public static DraPanel toDraPanel(java.util.Properties panelProps)
                           throws OldTgfFileException
Return DraPanel defined by a Properties object. The Properties MUST have a property named "className" that has as its value the full class name of the DraPanel to be created.

Parameters:
panelProps - The Properties defining the DraPanel.
Throws:
OldTgfFileException - File configuration format is obsolete.

toDraPanelList

public static DraPanelList toDraPanelList(PropertyPerLine ppl)
                                   throws OldTgfFileException
Return list of DraPanels defined by a PropertyPerLine object.

Parameters:
ppl - The PropertiesPerLine object storing the class instances.
Throws:
OldTgfFileException - Obsolete configuration properties format.

toDraPanelList

public static DraPanelList toDraPanelList(java.io.File dratConfigFile)
                                   throws java.io.IOException,
                                          OldTgfFileException
Return list of filter/factory panel instances from the DRAT configuration file. The configuration file contains multiple Properties in the PropertyPerLine format.

Parameters:
dratConfigFile - Configuration file in PropertyPerLine format that stores the class instances.
Throws:
java.io.IOException - Thrown if error while loading configuration file.
OldTgfFileException - File configuration format is obsolete.

toDraPanelList

public static DraPanelList toDraPanelList(java.io.File dratConfigFile,
                                          java.lang.String recFile)
                                   throws java.io.IOException,
                                          DraException
Return list of filter/factory panel instances from the DRAT configuration file, replacing the configuration's recording file name with the given file name and replacing the configuration's output file name with a derived name. Creates a DraPanelList from a configuration file, replacing the input file name with the specified recording file name and creating DRAT configuration's input and output files with derived filenames.

Does not affect the GUI or use it as input.

If the recFile name is null or "", the DraPanelList returned is what was specified by the DRAT configuration file. Otherwise, the recFile name replaces the input file name of the configuration file and the filename of the output will be derived from the recFile name and the DRAT configuration filename:

   <inputFilenamePrefix>.<dratConfigurationPrefix> 
The configuration file contains multiple Properties in the PropertyPerLine format.

If there is more than one reader panel, the later reader panels will have the sequence number of their panel appended to the input filename. The same will occur for output filenames if there is more than one writer panel.

Parameters:
dratConfigFile - Configuration file in PropertyPerLine format that stores the class instances.
recFile - Recording file name to replace configuration's input file name with: output file name prefix also derives from this.
Throws:
OldTgfFileException - File configuration format is obsolete.
DraException - No readers, or error setting filename.
java.io.IOException - Thrown if error while loading configuration file.

getDefaultFileProperty

public static java.lang.String getDefaultFileProperty(java.lang.String propertyName)
                                               throws java.io.IOException
Returns default file property, or returns null if file not found: converts file separator characters if necessary.

Throws:
java.io.IOException - If error loading the properties file.

runConfig

public static void runConfig(java.lang.String dratConfig)
                      throws DraException
Run a DRAT configuration for the File described by the given filename: does not affect the GUI or use it as input.

Parameters:
dratConfig - The name of the configuration file to run with.
Throws:
DraException - User or configuration error while running DRAT.

runConfig

public static void runConfig(java.lang.String dratConfig,
                             java.lang.String[] recFiles)
                      throws DraException
Run a configuration for each of a set of input files, replacing the DRAT configuration's input and output files with derived filenames.

Does not affect the GUI or use it as input.

If the recFiles array is null, the configuration file is run, as is. If the recFiles array contains a list of input files, the configuration file is run on each input file in the list rather than on the input file specified in the configuration. The filename of the output will be derived from the input filename and the DRAT configuration name:

   <inputFilenamePrefix>.<dratConfigurationPrefix> 

Parameters:
dratConfig - The name of the configuration file to run with.
recFiles - Array of names of input files to run DRAT on.
Throws:
DraException - Setup error for the given input configuration.

runConfigs

public static void runConfigs(java.lang.String[] dratConfigs,
                              java.lang.String[] recFiles)
                       throws DraException
Run a set of DRAT configuration for each of a set of input files, replacing the input and output files of each DRAT configuration with derived filenames.

Does not affect the GUI or use it as input.

Parameters:
dratConfigs - Array of names of configuration files to run with.
recFiles - Array of names of input files to run DRAT on.
Throws:
DraException - Setup error for the given input configuration.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Provides the method for the ActionListener interface. If the Run button is pressed, the configuration displayed on the DRAT GUI is run.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - The ActionEvent to perform.

getActions

public javax.swing.Action[] getActions()
Fetch the list of actions supported.

Returns:
Returns an array containing each supported Action.

getPanelWidth

public int getPanelWidth()
Return the width of the DRAT GUI panel.

Returns:
Returns the width of the DRAT GUI panel.

setTitle

public void setTitle(java.lang.String title)
Sets the title to the specified string.

Overrides:
setTitle in class java.awt.Frame
Parameters:
title - The String to set the title to.

setTitleSuffix

public void setTitleSuffix(java.lang.String titleSuffix)
Sets the title suffix to the specified string.

Parameters:
titleSuffix - The String to set the title suffix to.

getDratResourceString

protected static java.lang.String getDratResourceString(java.lang.String nm)
Returns the URL for the resource indicated by the input parameter.

Parameters:
nm - The name of the resource String to return.
Returns:
Returns the String corresponding to the resource key.

getDratResource

protected static java.net.URL getDratResource(java.lang.String key)
Returns the URL for the resource indicated by the input parameter.

Parameters:
key - The key String that indicates the resource to return.
Returns:
Returns a URL for the resource.

getResource

public static java.net.URL getResource(java.lang.String name)
Gets a resource using a path relative to the Drat.class directory. Uses Class.getResource() to load the resource with the Drat package directory as the base directory. If TGF is being run through a JNLP file or by using AppletViewer, then the method ClassLoader.getSystemResource() will not find the TGF resource, so this should be used instead. This also keeps all resource file paths relative to the package directory of this class.

Parameters:
name - The resource name.
Returns:
The URL of the loaded resource using the TGF tree.
See Also:
Class.getResource(String)

getResourceFileURL

public static java.net.URL getResourceFileURL(java.lang.String name)
Gets a DRAT resource file, checking secondary locations if resource was not found in the path relative to the Drat.class directory. If not found, looks in the current directory and then the home directory for the resource. If still not found, returns null.

Allows file choosers to work when executing from a JAR file.

Uses Class.getResource() to load the resource with the Drat package directory as the base directory. If TGF is being run through a JNLP file or by using AppletViewer, this will find the TGF resource (which is not found by the method ClassLoader.getSystemResource(). This also keeps all resource file paths relative to the package directory of this class.

Parameters:
name - The resource name.
Returns:
The URL of the loaded resource using the TGF tree.
See Also:
Class.getResource(String)

getResourceAsStream

public static java.io.InputStream getResourceAsStream(java.lang.String name)
Gets an input stream for reading a resource using a path relative to the Drat.class directory. Uses Class.getResourceAsStream() to load the resource with the Drat package directory as the base directory. If TGF is being run through a JNLP file or by using AppletViewer, then the method ClassLoader.getSystemResourceAsStream() will not find the TGF resource, so this should be used instead. This also keeps all resource file paths relative to the package directory of this class.

Parameters:
name - The resource name.
Returns:
An input stream for reading the resource, or null if the resource could not be found.
See Also:
Class.getResourceAsStream(String)

getConfigIterator

public static java.util.Iterator getConfigIterator()
Gets an iterator for the predefined configuration filenames stored in the config directory.

Returns:
An iterator containing names of predefined configuration files.

getMenubar

protected javax.swing.JMenuBar getMenubar()
Returns the menubar for the DRAT GUI.

Returns:
Returns the menu bar for the DRAT GUI.

createMenubar

protected javax.swing.JMenuBar createMenubar()
Create the menubar for the app. By default this pulls the definition of the menu from the associated resource file.

Returns:
Returns the menu bar from the DRAT GUI.

createMenu

protected javax.swing.JMenu createMenu(java.lang.String key)
Create a menu for the app. By default this pulls the definition of the menu from the associated resource file.

Parameters:
key - The key String that inicates the menu to return.
Returns:
Returns a JMenu for the DRAT GUI.

createActionChangeListener

protected java.beans.PropertyChangeListener createActionChangeListener(javax.swing.JMenuItem b)

createMenuItem

protected javax.swing.JMenuItem createMenuItem(java.lang.String cmd)
This is the hook through which all menu items are created. It registers the result with the menu item hashtable so that it can be fetched with getMenuItem().

Parameters:
cmd - The command string that inicates the menu item to return.
Returns:
Returns a JMenuItem for the DRAT GUI.
See Also:
getMenuItem(java.lang.String)

getMenuItem

protected javax.swing.JMenuItem getMenuItem(java.lang.String cmd)
Fetch the menu item that was created for the given command.

Parameters:
cmd - Name of the action.
Returns:
Item created for the given command (null if not created).

getAction

protected javax.swing.Action getAction(java.lang.String cmd)
Fetch the action indicated by the command String. If no action is found for the command string, the PanelAddAction is created and returned.

Parameters:
cmd - Name of the action.
Returns:
Action corresponding to command String, or else PanelAddAction.

getToolbarPanel

protected javax.swing.JPanel getToolbarPanel()
Return the DRAT GUI toolbar panel.

Returns:
Returns the DRAT GUI toolbar panel.

createToolbarPanel

private javax.swing.JPanel createToolbarPanel()
Create the toolbar panel. By default this reads the resource file for the definition of the toolbar.

Returns:
Returns the DRAT GUI toolbar panel.

createTool

protected java.awt.Component createTool(java.lang.String key)
Hook through which every toolbar item is created.

Returns:
Returns the DRAT GUI tool button created.

createToolbarButton

protected javax.swing.JButton createToolbarButton(java.lang.String key)
Create a button to go inside of the toolbar. By default this will load an image resource. The image filename is relative to the classpath (including the '.' directory if its a part of the classpath), and may either be in a JAR file or a separate file.

Parameters:
key - Key in the resource file to serve as the basis of lookups.

addName

public void addName(java.lang.String newName)
Adds new to list of recently used DRAT config files

Parameters:
newName - - the name to add to the recently used DRAT config files

readInNames

public void readInNames()
Reads in recently used drat config file names


getRecentFile

private java.io.File getRecentFile()
gets file that contains recently used config files


main

public static void main(java.lang.String[] args)