|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cs.ai.kreator.control.FileController
public class FileController
This Controller handles every file-operation, like opening, saving or closing DataFiles
.
In addition to that, it contains methods to export files to latex or spirit.
Field Summary | |
---|---|
static java.lang.String |
CMD_CLOSEALLFILES
|
static java.lang.String |
CMD_CLOSEFILE
|
static java.lang.String |
CMD_CLOSEOTHERFILES
|
static java.lang.String |
CMD_EXPORTTOLATEXFROMTAB
|
static java.lang.String |
CMD_EXPORTTOLATEXFROMTREE
|
static java.lang.String |
CMD_NEWFILE
|
static java.lang.String |
CMD_NEWKNOWLEGEBASEFILE
|
static java.lang.String |
CMD_NEWSAMPLECOLLECTIONFILE
|
static java.lang.String |
CMD_NEWSCRIPTFILE
|
static java.lang.String |
CMD_OPENFILES
|
static java.lang.String |
CMD_PRINT
|
static java.lang.String |
CMD_REMOVEFILEFROMFILETAB
|
static java.lang.String |
CMD_REMOVEFILEFROMTREE
|
static java.lang.String |
CMD_RENAMEFILE
|
static java.lang.String |
CMD_RENAMEFILEFROMFILETAB
|
static java.lang.String |
CMD_SAVEALLFILES
|
static java.lang.String |
CMD_SAVEFILE
|
static java.lang.String |
CMD_SAVEFILEAS
|
static org.apache.log4j.Logger |
LOG
|
Constructor Summary | |
---|---|
FileController()
|
Method Summary | ||
---|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
|
boolean |
checkForExistingAndSaved(DataFile file)
Checks whether the given file exists and has no unsaved changes. |
|
protected boolean |
closeAllDataFiles()
Tries to close all DataFile s that are opened in the GUI. |
|
protected boolean |
closeAllProjectDataFiles()
Check out, whether the file is contained in the current project |
|
boolean |
closeDataFile()
Tells the GUI to close the current DataFile . |
|
boolean |
closeDataFile(DataFile file)
Tells the GUI to close a DataFile . |
|
protected void |
closeDataFileForced(DataFile file)
Tells the GUI to close a DataFile . |
|
protected boolean |
closeOtherDataFiles()
Tries to close all DataFile s that are opened in the GUI
except the current working file |
|
|
createDataFile(java.io.File file,
java.lang.Class<T> Class)
Creates an appropriate instance of DataFile based on the extension of the given path (e.g. a KnowledgebaseFile for *.rme, ...). |
|
void |
deleteAndRemoveDataFileConfirmed(DataFile file)
Deletes the given file from the project and file-system. |
|
protected void |
deleteDataFile(DataFile file)
Deletes the give DataFile. |
|
boolean |
deleteExistingFile(DataFile file,
java.lang.String message)
Checks whether a given file exists. |
|
java.lang.String |
exportToLatexFromConsole(java.lang.String file)
Exports the given data file to LaTeX and prints the LaTex code in Console. |
|
DataFile |
getDataFile(java.io.File file)
Generates an appropriate instance of DataFile based on the extension of the file (e.g. a KnowledgebaseFile for *.rme, ...). |
|
|
getDataFile(java.io.File file,
java.lang.Class<T> Class)
Generates an appropriate instance of DataFile based on the extension of the file (e.g. a KnowledgebaseFile for *.rme, ...). |
|
DataFile |
getDataFile(java.lang.String path)
Generates an appropriate instance of DataFile based on the extension of the given path (e.g. a KnowledgebaseFile for *.rme, ...). |
|
|
getDataFile(java.lang.String path,
java.lang.Class<T> Class)
Generates an appropriate instance of DataFile based on the extension of the given path (e.g. a KnowledgebaseFile for *.rme, ...). |
|
|
getExistingDataFile(java.io.File file,
java.lang.Class<T> Class)
Generates an appropriate instance of DataFile based on the extension of the given path (e.g. a KnowledgebaseFile for *.rme, ...). |
|
|
getExistingDataFile(java.lang.String path,
java.lang.Class<T> Class)
Generates an appropriate instance of DataFile based on the extension of the given path (e.g. a KnowledgebaseFile for *.rme, ...). |
|
DataFile |
getNewDataFileName(java.io.File fileOrDir,
AbstractFileFilter ff)
Shows the user a "New file..." |
|
protected java.io.File |
getStartingDirectory()
Returns a directory, which should be used as the starting directory in file choosers. |
|
void |
init()
|
|
DataFile |
newAndOpenDataFile(AbstractFileFilter ff)
Shows the user a "New file..." |
|
void |
openDataFile(DataFile file)
Opens a DataFile in the GUI. |
|
void |
saveDataFile(DataFile file)
Tells the file to save itself. |
|
DataFile |
saveDataFileAs(DataFile file)
Does everything to "save a file as...". |
|
boolean |
shutDown()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.log4j.Logger LOG
public static final java.lang.String CMD_NEWFILE
public static final java.lang.String CMD_NEWKNOWLEGEBASEFILE
public static final java.lang.String CMD_NEWSCRIPTFILE
public static final java.lang.String CMD_NEWSAMPLECOLLECTIONFILE
public static final java.lang.String CMD_OPENFILES
public static final java.lang.String CMD_CLOSEFILE
public static final java.lang.String CMD_CLOSEOTHERFILES
public static final java.lang.String CMD_CLOSEALLFILES
public static final java.lang.String CMD_SAVEFILE
public static final java.lang.String CMD_SAVEFILEAS
public static final java.lang.String CMD_SAVEALLFILES
public static final java.lang.String CMD_PRINT
public static final java.lang.String CMD_RENAMEFILE
public static final java.lang.String CMD_RENAMEFILEFROMFILETAB
public static final java.lang.String CMD_REMOVEFILEFROMTREE
public static final java.lang.String CMD_REMOVEFILEFROMFILETAB
public static final java.lang.String CMD_EXPORTTOLATEXFROMTAB
public static final java.lang.String CMD_EXPORTTOLATEXFROMTREE
Constructor Detail |
---|
public FileController()
Method Detail |
---|
public void init()
public boolean shutDown()
public <T extends DataFile> T getDataFile(java.io.File file, java.lang.Class<T> Class) throws DataFileNotGeneratedException, UnsupportedFileTypeException
KnowledgebaseFile
for *.rme, ...).UnsupportedFileTypeException
will be thrown.#getExistingDataFile()
or #createDataFile()
when needed.
file
- The file, for which we want to generate an appropriate DataFileClass
- The class to which the given file should be cast. If this cast is not allowed an UnsupportedFileTypeException will be thrown.
DataFile
representing this File
UnsupportedFileTypeException
- if the given file type (read: extension) cannot be cast to the given class
DataFileNotGeneratedException
- if something different than unsupported file type goes wrongpublic DataFile getDataFile(java.io.File file) throws DataFileNotGeneratedException
KnowledgebaseFile
for *.rme, ...).#getExistingDataFile()
or #createDataFile()
when needed.
file
-
DataFileNotGeneratedException
- when something goes wrong.getDataFile(File, Class)
public <T extends DataFile> T getDataFile(java.lang.String path, java.lang.Class<T> Class) throws DataFileNotGeneratedException, UnsupportedFileTypeException
KnowledgebaseFile
for *.rme, ...).UnsupportedFileTypeException
will be thrown.#getExistingDataFile()
or #createDataFile()
when needed.
path
- the path of the fileClass
- The class to which the given file should be cast. If this cast is not allowed an UnsupportedFileTypeException will be thrown.
UnsupportedFileTypeException
- if the given file type (read: extension) cannot be cast to the given class
DataFileNotGeneratedException
- if something different than unsupported file type goes wronggetDataFile(File)
public DataFile getDataFile(java.lang.String path) throws DataFileNotGeneratedException
KnowledgebaseFile
for *.rme, ...).#getExistingDataFile()
or #createDataFile()
when needed.
path
- the path of the fileClass
- The class to which the given file should be cast. If this cast is not allowed an UnsupportedFileTypeException will be thrown.
UnsupportedFileTypeException
java.io.FileNotFoundException
DataFileNotGeneratedException
getDataFile(String)
public <T extends DataFile> T getExistingDataFile(java.io.File file, java.lang.Class<T> Class) throws java.io.FileNotFoundException, DataFileNotGeneratedException, UnsupportedFileTypeException
KnowledgebaseFile
for *.rme, ...).UnsupportedFileTypeException
.
file
- Class
-
java.io.FileNotFoundException
- if the file does not exist
UnsupportedFileTypeException
- if the given file type (read: extension) cannot be cast to the given class
DataFileNotGeneratedException
- if something different than unsupported file type goes wronggetDataFile(File, Class)
public <T extends DataFile> T getExistingDataFile(java.lang.String path, java.lang.Class<T> Class) throws DataFileNotGeneratedException, UnsupportedFileTypeException, java.io.FileNotFoundException
KnowledgebaseFile
for *.rme, ...).UnsupportedFileTypeException
.
file
-
java.io.FileNotFoundException
- if the file does not exist
UnsupportedFileTypeException
- if the given file type (read: extension) cannot be cast to the given class
DataFileNotGeneratedException
- if something different than unsupported file type goes wrong
java.io.FileNotFoundException
getExistingDataFile(File, Class)
public <T extends DataFile> T createDataFile(java.io.File file, java.lang.Class<T> Class) throws DataFileNotGeneratedException, UnsupportedFileTypeException, FileExistsException
KnowledgebaseFile
for *.rme, ...).FileExistsException
file
- Class
-
java.io.FileNotFoundException
- if the file does not exist
UnsupportedFileTypeException
- if the given file type (read: extension) cannot be cast to the given class
DataFileNotGeneratedException
- if something different than unsupported file type goes wrong
FileExistsException
getDataFile(File, Class)
public void openDataFile(DataFile file)
DataFile
in the GUI.
Asks the user, if he wants to add the file to the current project, if it isn't already.
file
- public boolean closeDataFile(DataFile file)
DataFile
.
This method respects the stained status of the file.
If the file has stained views, it asks the user if he wants to save it.
closeDataFileForced(DataFile)
file
-
public boolean closeDataFile()
DataFile
.
It respects the stained status of the file.closeDataFile(DataFile)
for details.
file
-
protected void closeDataFileForced(DataFile file)
DataFile
.
Does not respect the stained status of the file!
file
- protected boolean closeAllDataFiles()
DataFile
s that are opened in the GUI.
Respects their stained status.closeAllDataFiles(List)
.
protected boolean closeOtherDataFiles()
DataFile
s that are opened in the GUI
except the current working file
protected boolean closeAllProjectDataFiles()
public DataFile getNewDataFileName(java.io.File fileOrDir, AbstractFileFilter ff) throws DataFileNotGeneratedException
fileOrDir
- if this is a directory the filechooser starts in it. If it is a file, the filechoose will use it as the initial filename.ff
- the FileFilter, which the dialog will use.
DataFileNotGeneratedException
public DataFile newAndOpenDataFile(AbstractFileFilter ff) throws FileNotSavedException, DataFileNotGeneratedException
ff
- The FileFilter used by the "New file..."-dialog
FileNotSavedException
DataFileNotGeneratedException
#getnewDataFileName()
public void saveDataFile(DataFile file) throws FileNotSavedException
file
-
FileNotSavedException
public boolean checkForExistingAndSaved(DataFile file)
file
- the file to be checked
public DataFile saveDataFileAs(DataFile file) throws FileNotSavedException, DataFileNotGeneratedException
file
-
DataFile
or null, if the user chose to abort the operation.
FileNotSavedException
DataFileNotGeneratedException
protected void deleteDataFile(DataFile file)
public void deleteAndRemoveDataFileConfirmed(DataFile file)
file
- public boolean deleteExistingFile(DataFile file, java.lang.String message)
file
- the file to be deletedmessage
- the dialog's message
public java.lang.String exportToLatexFromConsole(java.lang.String file) throws ParsingException, java.io.IOException, DataFileNotGeneratedException
file
-
ParsingException
java.io.IOException
DataFileNotGeneratedException
protected java.io.File getStartingDirectory()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |