ace.gui
Class ProjectFilesDialogBox

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 ace.gui.ProjectFilesDialogBox
All Implemented Interfaces:
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 ProjectFilesDialogBox
extends javax.swing.JFrame
implements java.awt.event.ActionListener

An object of this class represents a dialog box that can be used to find and store ACE configuration file paths.

The public fields of this class can be accessed in order to get the current paths. They are automatically updated as changes are made to the corresponding GUI fields. It would be best for them not to be changed directly by external objects, however. External objects may call the browsePath or the saveFileExternally methods to reset one of these paths using a dialog box.

Overall ACE projects can be stored in ace_project_files. New projects can be created externally using the startNewProject method, and the saveCurrentProject method can be used to save the settings currently in the dialog box to a file.

The Project file field holds the path of the currently loaded ace_project_file. The Browse button next to this field allows it to be updated.

The Use ARFF file rather than ACE XML files check box specifies whether or not Weka ARFF files are to be used rather than ACE feature_vector_files, taxonomy_files, feature_key_files and classifications_file. Selecting or deselecting this box deactivates and activates the appropriate GUI elements.

The Taxonomy file field holds the path of the currently specified ACE taxonomy_file. The Browse button next to this field allows it to be updated. This file holds the taxonomy to classify instances into.

The Feature definitions file field holds the path of the currently specified ACE feature_key_file. The Browse button next to this field allows it to be updated. This file holds details of the features which are used for classification.

The Feature vector files field holds the paths of the currently specified ACE feature_vector_files. The Add button next to this field allows files to be added to the list, and the Remove button deletes any currently selected files. This file holds extracted feature values for instances to be classified.

The Model classifications file field holds the path of the currently specified ACE classifications_file. The Browse button next to this field allows it to be updated. This file holds model classifications for instances. This can be used to train or test classifiers.

The GUI preferences file field holds the path of the currently specified ACE gui_preferences_file. The Browse button next to this field allows it to be updated. This file holds user preferences for configuring the ACE interface.

The Classifier settings file field holds the path of the currently specified ACE classifier_settings_file. The Browse button next to this field allows it to be updated. This file holds preferences for performing classifications and classifier optimization searches.

The Weka ARFF file field holds the path of the currently specified Weka ARFF file. The Browse button next to this field allows it to be updated. This file is an alternative to the native ACE file formats. It can hold feature values of instances, model classifications and an implied flat taxonomy.

The Start New Project button Brings up a dialog box that allows the user to choose the name of a new ACE project file and where to save it. The user is asked if s/he would like to copy the files referred to by the existing GUI fields to the new project directory. If so, they are copied to a new subdirectory with the same name as the project file.

The Save This Project button saves the paths displayed in the GUI fields to the path specified in the Project file field. If this field is empty, then the user is presented with a Start New Project dialog box.

The Save As Startup Defaults button stores the paths currently entered in the dialog box to disk so that they will be the defaults loaded when the ACE GUI is next run.

The Cancel button cancels all changes made in this dialog box, restores previously stored entries to the fields and hides this dialog box.

The Clear Paths button clears all GUI fields in this dialog box.

The OK button stores all changes made in this dialog box and hides this dialog box.

See Also:
Serialized Form

Nested Class Summary
 
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
 java.lang.String project_path
          Path of the current ACE XML project file.
 boolean use_arff_rather_than_ace_xml
          Denotes whether data is to be be loaded from ACE XML files or a Weka ARFF file.
 java.lang.String zip_path
          If current files were loaded from a zip file, this specified the file path to the file from which they were originally extracted.
 
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
ProjectFilesDialogBox(MainGUIFrame parent)
          Construct this dialog box, but do not set it to being visible.
ProjectFilesDialogBox(MainGUIFrame parent, java.lang.String project_file_name)
          Construct this dialog box, but do not set it to being visible.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Calls the appropriate methods when the buttons are pressed.
 boolean browsePath(java.lang.String what_to_browse, boolean called_externally)
          Opens a dialog box to browse for files of the appropriate type.
 void parseAllFiles()
          Stores the entries entered in the GUI fields in the public fields and loads and and parses all of the corresponding files.
 void saveCurrentProject()
          Save the paths displayed in the GUI fields to the path specified in the Project File field.
 java.io.File saveFileExternally(java.lang.String file_type, boolean can_erase)
          Opens a save dialog box that allows the user to choose the path of a file to be saved.
 void saveZipPrompt()
          Presents the user with the option of saving the files that are currently loaded back into an ACE zip file before quitting.
 void setText(java.lang.String selected_project_file)
          Updates the text fields of this project file dialog box to reflect the currently loaded ACE XML files.
 void startNewProject()
          Brings up a dialog box that allows the user to choose the name of a new project file and where to save it.
 
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, setTitle, 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 java.awt.MenuContainer
getFont, postEvent
 

Field Detail

project_path

public java.lang.String project_path
Path of the current ACE XML project file.


zip_path

public java.lang.String zip_path
If current files were loaded from a zip file, this specified the file path to the file from which they were originally extracted.


use_arff_rather_than_ace_xml

public boolean use_arff_rather_than_ace_xml
Denotes whether data is to be be loaded from ACE XML files or a Weka ARFF file.

Constructor Detail

ProjectFilesDialogBox

public ProjectFilesDialogBox(MainGUIFrame parent,
                             java.lang.String project_file_name)
Construct this dialog box, but do not set it to being visible. Load the paths contained in the project file referred to by the project_file_name parameter.

Parameters:
parent - The main ACE GUI component.
project_file_name - The path of the project file to load.

ProjectFilesDialogBox

public ProjectFilesDialogBox(MainGUIFrame parent)
Construct this dialog box, but do not set it to being visible. Intialize the paths based on the contents of the Project object of the parent MainGUIFrame. If a default startup project (called default_ace_project.xml) is available, then the gui_settings_path and classifier_settings_file are loaded from it, otherwise they are defaulted to empty.

Parameters:
parent - The main ACE GUI component.
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Calls the appropriate methods when the buttons are pressed.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - The event that is to be reacted to.

parseAllFiles

public void parseAllFiles()
Stores the entries entered in the GUI fields in the public fields and loads and and parses all of the corresponding files. A warning message will be displayed if a project is already loaded.


browsePath

public boolean browsePath(java.lang.String what_to_browse,
                          boolean called_externally)
Opens a dialog box to browse for files of the appropriate type. Only XML files or ARFF files are displayed, as appropriate.

If the file to browse is an ace_project file, then this file is parsed and the fields of this dialog box are set to the appropriate values. No other types of files are parsed by this method, and calling this method with other types of files only results in the storing of the path to the file in the appropriate field(s).

Parameters:
what_to_browse - A code indicating what type of file to browse for. Options are ace_project, arff, taxonomy, feature_definitions, feature_vectors, model_classifications, gui_preferences, classifier_settings and trained_classifiers.
called_externally - Should be true if called by an external object and false if called by a browse button of this ProjectFilesDialogBox. If this is false, then only the GUI fields are changed. If it is true, then the stored public fields are changed as well.
Returns:
True if the OK button was pressed, false if the Cancel button was pressed.

saveFileExternally

public java.io.File saveFileExternally(java.lang.String file_type,
                                       boolean can_erase)
Opens a save dialog box that allows the user to choose the path of a file to be saved. Makes sure can write to this path and returns the corresponding File. Displays an error dialog box if there is a problem. Returns null if can or should not save. If the file is saved, then both the GUI and public fields are updated. Automatically adds .xml as an extension if this is not already present.

Parameters:
file_type - The code identifying the type of file to be saved. Options are arff, taxonomy, feature_definitions, feature_vectors, model_classifications, gui_preferences, classifier_settings and trained_classifiers.
can_erase - Whether or not existing files with the specified path should be overwritten without asking the user.
Returns:
A File if appropriate, null if nothing should be saved after all.

saveCurrentProject

public void saveCurrentProject()
Save the paths displayed in the GUI fields to the path specified in the Project File field. If this field is empty, then the user is presented with a Start New Project dialog box. None of the actual files referred to are resaved, as only the project file storing the paths to them is saved.


startNewProject

public void startNewProject()
Brings up a dialog box that allows the user to choose the name of a new project file and where to save it. The ace_project XML file is then created at the given location with the given name. The user is asked if s/he would like to copy the files referred to by the existing GUI fields to the new directory. If so, they are copied to a new subdirectory with the same name as the project file.


saveZipPrompt

public void saveZipPrompt()
Presents the user with the option of saving the files that are currently loaded back into an ACE zip file before quitting. This method is only called when the data was originally loaded from a zip file. The temporary directory into which the data files were extracted will be deleted when the program exits. Any changes that were made to the data within ACE will be lost unless the files are saved.


setText

public void setText(java.lang.String selected_project_file)
Updates the text fields of this project file dialog box to reflect the currently loaded ACE XML files.

Parameters:
selected_project_file - The path to the ACE XML project file from which the data of this project was loaded.