|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jstatcom.io.FileSupport
public final class FileSupport
Support for convenient file selection. This class is a Singleton and can be
accessed by the getInstance
method.
Method Summary | |
---|---|
java.io.File |
chooseDirectory(java.awt.Component parent,
java.lang.String titleText)
Lets the user choose a directory with the JFileChooser. |
FileSupportSettings |
getFileSupportSettings()
Gets the settings instance according to the previously made file selections. |
static FileSupport |
getInstance()
Gets the Singleton instance of this class. |
DataHandlerTypes |
getSelectedImportHandlerType()
Gets the handler type chosen for data import. |
DataHandlerTypes |
getSelectedSaveHandlerType()
Gets the handler type chosen for data export. |
java.lang.String |
readTextFile(java.lang.String fileName)
Reads the contents of a text file and returns it as a string. |
java.io.File |
saveDataFile(java.awt.Component parent,
java.lang.String filenameShort,
DataHandlerTypes... types)
Selects a data file for saving with a file chooser. |
java.io.File |
saveProjectFile(java.awt.Component parent)
Selects a project file for saving with a file chooser. |
void |
saveStringToFile(java.io.File file,
java.lang.String stringDat,
boolean append)
Stores stringDat to file . |
java.io.File |
saveTextFile(java.awt.Component parent)
Selects a text file for saving with a file chooser. |
java.io.File |
selectDataFile(java.awt.Component parent,
DataHandlerTypes... types)
Selects a data file to open with a file chooser. |
java.io.File |
selectProjectFile(java.awt.Component parent)
Selects a project file to open with a file chooser. |
void |
setDefaultPath(java.lang.String newDefaultPath)
Sets the directory that will be displayed as default selection when a file chooser is created. |
void |
setFileSupportSettings(FileSupportSettings settings)
Sets the selected files and directories to the settings argument. |
void |
startWorkers()
Starts the SwingWorker threads to create
JFileChooser instances in the background. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public java.io.File chooseDirectory(java.awt.Component parent, java.lang.String titleText)
parent
- the parent component for the FileChooser DialogtitleText
- the title String for the dialog
public static FileSupport getInstance()
FileSupport
public java.lang.String readTextFile(java.lang.String fileName)
fileName
- of file ro read from
java.lang.IllegalArgumentException
- if (fileName == null)
public java.io.File saveDataFile(java.awt.Component parent, java.lang.String filenameShort, DataHandlerTypes... types)
parent
- the parent component for the dialogsfilenameShort
- the selected filename without path, can be null
types
- the data handler types, the last element will be set as
default
null
otherwisepublic java.io.File saveProjectFile(java.awt.Component parent)
parent
- the parent component for the dialogs
null
otherwisepublic void saveStringToFile(java.io.File file, java.lang.String stringDat, boolean append)
stringDat
to file
.
file
- the file to store stringDat
tostringDat
- the string to saveappend
- true
if string should be appended to existing
file,public java.io.File saveTextFile(java.awt.Component parent)
parent
- the parent component for the dialogs
null
otherwisepublic java.io.File selectDataFile(java.awt.Component parent, DataHandlerTypes... types)
parent
- the parent component for the dialogstypes
- the data handler types, the last element will be set as
default
null
otherwisepublic java.io.File selectProjectFile(java.awt.Component parent)
parent
- the parent component for the dialogs
null
otherwisepublic void setDefaultPath(java.lang.String newDefaultPath)
newDefaultPath
- the new default path to be selected initiallypublic void startWorkers()
SwingWorker
threads to create
JFileChooser
instances in the background.
public void setFileSupportSettings(FileSupportSettings settings)
null
or does not have at least
6 rows.
settings
- holds the file parameterspublic FileSupportSettings getFileSupportSettings()
public DataHandlerTypes getSelectedImportHandlerType()
public DataHandlerTypes getSelectedSaveHandlerType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |