edu.harvard.mgh.purcell.gCLINE.general
Class GCFileChooser

java.lang.Object
  extended by edu.harvard.mgh.purcell.gCLINE.general.GCFileChooser

public class GCFileChooser
extends java.lang.Object

This class launches dailogs that allow the user to pick files on either a remote or local computer. This file name selection then launches an event (defined as a subclass) that can then be passed to the appropreate object.

Author:
Kathe Todd-Brown

Nested Class Summary
 class GCFileChooser.FileChoosenEvent
          Create an EventObject to notify the selection of a file.
static interface GCFileChooser.FileChoosenListener
          Create an EventListener for our internally defined event.
 
Field Summary
private  java.util.Vector<GCFileChooser.FileChoosenListener> allListeners
          Keep a vector of the listeners
private  SshClient conn
           
private  java.lang.String currentDir
           
private  boolean dirSelected
           
private  javax.swing.DefaultListModel editableList
           
private  javax.swing.JList fileList
           
 java.lang.String fileName
          The file name that is selected
private  javax.swing.JFileChooser localPicker
          A dialog that allows hte user to select a local file.
private static org.apache.log4j.Logger logger
          Log comments and errors
private  boolean onlyDir
           
private  boolean onlyLocal
          Flag file we are looking for as local or remote.
private  javax.swing.JFrame parent
          Attached the dialogs to our main window and access the record through
private  javax.swing.JDialog parent2
           
private  javax.swing.JDialog remotePicker
          A dialog that alows the user to select a remote file.
private  javax.swing.JTextField remotePicks
           
 
Constructor Summary
GCFileChooser(javax.swing.JDialog p, javax.swing.filechooser.FileFilter f, boolean pickLocal, boolean pickDirectory, SshClient c, java.lang.String startDir)
          Create an instance of our custom file chooser.
GCFileChooser(javax.swing.JFrame p, javax.swing.filechooser.FileFilter f, boolean pickLocal, boolean pickDirectory, SshClient c, java.lang.String startDir)
          Create an instance of our custom file chooser.
 
Method Summary
 void addFileChoosenListener(GCFileChooser.FileChoosenListener listener)
          Add a listener to the list.
private  javax.swing.JPanel createButton()
          Create a button panel for the remote dialog.
private  void createContent(javax.swing.DefaultListModel editableList)
           
private  javax.swing.JScrollPane createFileList()
           
private  void initalize(javax.swing.filechooser.FileFilter f)
           
 void removeFileChoosenListener(GCFileChooser.FileChoosenListener listener)
          Remove a listener from the list.
 void showChooser()
          Show the file chooser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.log4j.Logger logger
Log comments and errors


parent

private javax.swing.JFrame parent
Attached the dialogs to our main window and access the record through


parent2

private javax.swing.JDialog parent2

fileName

public java.lang.String fileName
The file name that is selected


remotePicker

private javax.swing.JDialog remotePicker
A dialog that alows the user to select a remote file.


localPicker

private javax.swing.JFileChooser localPicker
A dialog that allows hte user to select a local file.


allListeners

private java.util.Vector<GCFileChooser.FileChoosenListener> allListeners
Keep a vector of the listeners


onlyLocal

private boolean onlyLocal
Flag file we are looking for as local or remote.


onlyDir

private boolean onlyDir

conn

private SshClient conn

currentDir

private java.lang.String currentDir

fileList

private javax.swing.JList fileList

remotePicks

private javax.swing.JTextField remotePicks

dirSelected

private boolean dirSelected

editableList

private javax.swing.DefaultListModel editableList
Constructor Detail

GCFileChooser

public GCFileChooser(javax.swing.JFrame p,
                     javax.swing.filechooser.FileFilter f,
                     boolean pickLocal,
                     boolean pickDirectory,
                     SshClient c,
                     java.lang.String startDir)
Create an instance of our custom file chooser.

Parameters:
p - JFrame that we attach the file picking dialogs too and access the Record
f - FileFilter that filters the files.
pickLocal - A boolean that flags if the chooser is local or remote.

GCFileChooser

public GCFileChooser(javax.swing.JDialog p,
                     javax.swing.filechooser.FileFilter f,
                     boolean pickLocal,
                     boolean pickDirectory,
                     SshClient c,
                     java.lang.String startDir)
Create an instance of our custom file chooser.

Parameters:
p - JDialog that we attach the file picking dialogs too and access the Record
f - FileFilter that filters the files.
pickLocal - A boolean that flags if the chooser is local or remote.
pickDirectory - A boolean that flags if directory are valid selections
c - The SshClient that used to connect to a remote server
startDir - A String that is the defines the directory to start looking for files in.
Method Detail

initalize

private void initalize(javax.swing.filechooser.FileFilter f)

showChooser

public void showChooser()
Show the file chooser.


createContent

private void createContent(javax.swing.DefaultListModel editableList)

createFileList

private javax.swing.JScrollPane createFileList()

createButton

private javax.swing.JPanel createButton()
Create a button panel for the remote dialog.

Returns:
JPanel that holds the buttons for the remote panel.

addFileChoosenListener

public void addFileChoosenListener(GCFileChooser.FileChoosenListener listener)
Add a listener to the list.

Parameters:
listener - FileChooserListener that we want to add to the list

removeFileChoosenListener

public void removeFileChoosenListener(GCFileChooser.FileChoosenListener listener)
Remove a listener from the list.

Parameters:
listener - FileChooserListner that we want to remove from the list. If it's not in the list then we don't do anytking.