sbr.resources.io
Class FileHandler

java.lang.Object
  extended by sbr.resources.io.FileHandler

public class FileHandler
extends java.lang.Object

Allows the saving of web pages and the opening and saving of the code files for the generation of the web pages by SurveyBuildR (.sbr files).

Version:
0.1.0
Author:
John H. Krantz
See Also:
SBRParse, ItemParse

Field Summary
static java.lang.String[] AP_ITEMS
          text for a combo box to display and load html and survey code files (.sbr) via cutting and pasting into a text field.
static boolean[] AP_SHIFT
           
static int[] AP_SHORT_CUTS
          Short cuts for he select menu
static java.lang.String[] ITEMS
          Text for a combobox to open/save survey files as an applications
static int NEW
          Code for new survey
static int OPEN_SBR
          Code to indicate that a survey code file (.sbr) is to be opened.
static int SAVE_HTML
          Code to indicate that a web page is to be saved.
static int SAVE_SBR
          Code to indicate that a survey code file (.sbr) is to be saved.
static int[] SHORT_CUTS
          Shortcut keys for the file menu
 
Constructor Summary
FileHandler()
           
 
Method Summary
 java.lang.String openFile(java.lang.String directory)
          The file opener.
 java.lang.String saveAs(java.lang.String text, java.lang.String directory, java.lang.String[] ext, java.lang.String title)
          Saves all the text to a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEW

public static final int NEW
Code for new survey

See Also:
Constant Field Values

SAVE_HTML

public static final int SAVE_HTML
Code to indicate that a web page is to be saved.

See Also:
Constant Field Values

SAVE_SBR

public static final int SAVE_SBR
Code to indicate that a survey code file (.sbr) is to be saved.

See Also:
Constant Field Values

OPEN_SBR

public static final int OPEN_SBR
Code to indicate that a survey code file (.sbr) is to be opened.

See Also:
Constant Field Values

ITEMS

public static final java.lang.String[] ITEMS
Text for a combobox to open/save survey files as an applications


SHORT_CUTS

public static final int[] SHORT_CUTS
Shortcut keys for the file menu


AP_ITEMS

public static final java.lang.String[] AP_ITEMS
text for a combo box to display and load html and survey code files (.sbr) via cutting and pasting into a text field.


AP_SHORT_CUTS

public static final int[] AP_SHORT_CUTS
Short cuts for he select menu


AP_SHIFT

public static final boolean[] AP_SHIFT
Constructor Detail

FileHandler

public FileHandler()
Method Detail

saveAs

public java.lang.String saveAs(java.lang.String text,
                               java.lang.String directory,
                               java.lang.String[] ext,
                               java.lang.String title)
Saves all the text to a file. Set 'path' to "" to display a save as dialog. Returns 'false' if the user cancels the save as dialog.

Parameters:
text - the text of the file to be saved.
directory - the default director to do the saving of the file
ext - the required extensions for the file. If one of these extensions are not added by the user they will be appended to the file.
Returns:
String dir. the directory the file is saved in to serve as the default directory for the next save.

openFile

public java.lang.String openFile(java.lang.String directory)
The file opener. In this case the file is assumed to be a survey builder code file (.sbr).

Parameters:
directory - The default directory to find the file to open.
Returns:
String file. The string representation of the file. It will need to be parsed.