Class FileIO

java.lang.Object
  |
  +--FileIO

public class FileIO
extends java.lang.Object

This is the FileIO class it handles all the interaction between the user and the filesystem.


Field Summary
(package private)  CircuitDiagram circuitdiagram
          The Circuit Diagram/
(package private)  GateBuilder gatebuilder
          The GateBuilder
(package private)  Logic logic
          The logic space.
(package private)  Workspace workspace
          The Workspace.
 
Constructor Summary
FileIO(CircuitDiagram cd, GateBuilder gb)
          Nominal Constructor for FileIO class.
FileIO(Logic _logic, Workspace _workspace, CircuitDiagram _circuitdiagram)
          Deprecated.  
 
Method Summary
 void exportMacro()
          Saves a macro to a user specified file.
 java.lang.String importMacro()
          Imports a macro from a user specified file.
 void importMacro(java.io.InputStream inStream)
          Imports a macro from the specified inputstream.
 void importMacro(java.lang.String uri)
          Imports a macro from a given loactions.
static void main(java.lang.String[] args)
          This is for testing the FileIO class directly.
 java.lang.String open()
          This opens a file open dialog, gets the filename and then parses the file.
 java.lang.String openUrl()
           
 void save(java.lang.String filename)
          Opens a save dialog and saves the GBX file in the user specified location.
 void save(java.lang.String filename, boolean firstTime)
          Opens a save dialog and saves the GBX file in the user specified locaiton.
 java.lang.String saveAs(java.lang.String filename)
          Saves the current workspace as a user specified name and returns the name of the saved file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logic

Logic logic
The logic space.

workspace

Workspace workspace
The Workspace.

circuitdiagram

CircuitDiagram circuitdiagram
The Circuit Diagram/

gatebuilder

GateBuilder gatebuilder
The GateBuilder
Constructor Detail

FileIO

public FileIO(Logic _logic,
              Workspace _workspace,
              CircuitDiagram _circuitdiagram)
Deprecated.  

Nominal Constructor for FileIO class.
Parameters:
_logic - The logic part of a GateBuilder Session.
_workspace - The graphics part of a GateBuilder Session.
_circuitdiagram - The circuit diagram of a GateBuilder Session.

FileIO

public FileIO(CircuitDiagram cd,
              GateBuilder gb)
Nominal Constructor for FileIO class.
Parameters:
cd - The circuit diagram.
gb - The gateBuilder.
Method Detail

open

public java.lang.String open()
                      throws CancelException
This opens a file open dialog, gets the filename and then parses the file.
Returns:
The filename so that it can be displayed on the workspace frame.

openUrl

public java.lang.String openUrl()
                         throws CancelException

save

public void save(java.lang.String filename)
          throws CancelException
Opens a save dialog and saves the GBX file in the user specified location. This is just a wrapper around the other save.
Parameters:
filename - the name of the current workspace.
Throws:
CancelException - If the user chooses cancel.

save

public void save(java.lang.String filename,
                 boolean firstTime)
          throws CancelException
Opens a save dialog and saves the GBX file in the user specified locaiton.
Parameters:
filename - The name of the current file to be saved.
firstTime - Whether or not this is the first time the file has been saved.
Throws:
CancelException - If the user chooses cancel.

saveAs

public java.lang.String saveAs(java.lang.String filename)
                        throws CancelException
Saves the current workspace as a user specified name and returns the name of the saved file.
Parameters:
filename - name of the current workspace.
Returns:
The name of the saved workspace.
Throws:
CancelException - If the user chooses cancel.

importMacro

public java.lang.String importMacro()
                             throws CancelException
Imports a macro from a user specified file.
Throws:
CancelException - If the user chooses cancel.

importMacro

public void importMacro(java.lang.String uri)
Imports a macro from a given loactions.
Parameters:
uri - The location of the macro.

importMacro

public void importMacro(java.io.InputStream inStream)
Imports a macro from the specified inputstream.
Parameters:
inStream - the input stream from which to get the macro.

exportMacro

public void exportMacro()
                 throws CancelException
Saves a macro to a user specified file.
Throws:
CancelException - If the user chooses cancel.

main

public static void main(java.lang.String[] args)
This is for testing the FileIO class directly.
Parameters:
args - commandline arguments.