harmonic.mz.manager
Class FileManager

java.lang.Object
  |
  +--harmonic.mz.manager.FileManager

public class FileManager
extends java.lang.Object

This is the section of the database responsible for keeping track of open files and staring the file saver and opener.


Method Summary
 FileNode _open_(java.lang.String filename, boolean bMakeCurrent, boolean bLocked, boolean bVisible)
           
 void _save_(FileNode file, java.lang.String filename, boolean bSaveImage, boolean bCompress, java.lang.String desc)
          Lower level save that wont change name kept in model sub tree
static boolean accept(java.lang.String filename, java.lang.String ext)
          Runs filename through ExtentionFilter
 void addFile(FileNode file)
          Add model file to database without making current.
 void addModelFileListener(ModelFileListener listener)
           
 void cancelFileOpen(java.lang.String filename)
          Stops the current file opening thread.
 void close(FileNode file)
          Close the given file
 void close(FileNode file, boolean bCheckCurrent)
           
 void closeAll(boolean bCheckCurrent)
          Close all files
 void closeCurrent()
          Remove the current file.
 void closeNotCurrent()
          Close all files except the current file.
 void exportRawGeometries()
          This was writtin for doing demos originally
static java.lang.String forceExtention(java.lang.String path, java.lang.String ext)
          Makes extension to be .mvg
 FileNode getCurrentFile()
          Returns the current FileNode.
 FileNode getFileGroup(java.lang.String filename)
          Search the database for the file with given name (the complete path relative to the application root) and return a reference.
 java.util.Vector getFiles()
          Return list of open model files.
 java.lang.String getFileTypes()
          Return types of files thie manager knows how to deal with, as a comma separated list.
static java.lang.String getJustDir(java.lang.String path)
          Returns parent directories (without filename)
static java.lang.String getJustName(java.lang.String path)
          Returns filename (without parent directories)
 java.lang.String getReadSettingsFile(java.lang.String workingDir, java.lang.String remainder)
          Get the complete path to read a settings file.
 java.util.Vector getRecentDirectories()
           
 java.util.Vector getRecentFiles()
           
static java.lang.String getRelativeName(java.lang.String baseDir, java.lang.String absolute)
          Return relative path of absolute for baseDir.
 java.lang.String getSaveDir()
          Return the save directory
 java.lang.String getSettingsDir()
          Get the complete path to read a settings file.
 java.lang.String getTempDir()
          Returns temp directory
 java.lang.String getWriteSettingsFile(java.lang.String workingDir, java.lang.String remainder)
          Get location of settings files for current user.
 void importIndependantSubset(DataNode[] set)
           
 FileNode makeNewUnnamed()
          Makes a new unnamed model file.
 void onSaveDirectory(NodeEvent e)
           
 FileNode open(java.lang.String filename)
          Short version of open()
 FileNode open(java.lang.String filename, boolean bMakeCurrent, boolean bLocked, boolean bVisible)
          Open the model file from disk.
 FileNode openLocal(java.lang.String filename)
          Opens a file and return reference to it.
static java.lang.String removeDots(java.lang.String selPath)
          Removes extra ./ directories from path
 void removeFile(FileNode file)
           
 void removeModelFileListener(ModelFileListener listener)
           
 FileNode retrieveFile(java.lang.String filename)
          Retrieve file from database or from open from disk.
 void save(FileNode file, java.lang.String filename, boolean bSaveImage, boolean bCompress, java.lang.String desc)
          Saves the model sub tree as a file of the given name, and set the name kept in the model subtree node to the given name.
 void saveIndependantSubset(DataNode[] set, java.lang.String filename, boolean bSaveImage, boolean bCompress, java.lang.String desc)
          Builds a new database with objects of the selection set (and their children) layed out under one node.
 void saveLocal(FileNode file)
          This is the equivolant of openLocal().
 void setCurrentFile_Temp(FileNode file)
           
 void setCurrentFile(FileNode file)
          Set the current model file.
 void setFileTitle(FileNode file)
          Set the frame title to show that the given file is current.
 void setRecentDirectories(java.util.Vector recentDirectories)
           
 void setRecentFiles(java.util.Vector recentFiles)
           
 void setSyncedToDisc(FileNode file, boolean b)
          Flag the current file as synced to disk or not
 void writeDefaultPrototypes()
           
 void writeGeneralSettings()
          Write user interface settings not associated with any module
 void writeModuleSettings(Module mod)
          Save user interface settings for the module
 void writeModuleStubFiles()
          Write module stubs
 void writeRecentFiles()
          Write the recent model file list
 void writeSettings()
          Save all user interface settings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addModelFileListener

public void addModelFileListener(ModelFileListener listener)

removeModelFileListener

public void removeModelFileListener(ModelFileListener listener)

makeNewUnnamed

public FileNode makeNewUnnamed()
Makes a new unnamed model file. The file is automatically set to be the current file.


getSaveDir

public java.lang.String getSaveDir()
Return the save directory


getTempDir

public java.lang.String getTempDir()
Returns temp directory


getFileTypes

public java.lang.String getFileTypes()
Return types of files thie manager knows how to deal with, as a comma separated list.


onSaveDirectory

public void onSaveDirectory(NodeEvent e)

getJustName

public static java.lang.String getJustName(java.lang.String path)
Returns filename (without parent directories)


getJustDir

public static java.lang.String getJustDir(java.lang.String path)
Returns parent directories (without filename)


forceExtention

public static java.lang.String forceExtention(java.lang.String path,
                                              java.lang.String ext)
Makes extension to be .mvg


getRelativeName

public static java.lang.String getRelativeName(java.lang.String baseDir,
                                               java.lang.String absolute)
Return relative path of absolute for baseDir. Base dir should end in "/".


removeDots

public static java.lang.String removeDots(java.lang.String selPath)
Removes extra ./ directories from path


accept

public static boolean accept(java.lang.String filename,
                             java.lang.String ext)
Runs filename through ExtentionFilter


addFile

public void addFile(FileNode file)
Add model file to database without making current. This function is called by makeNewUnnnamed and open


removeFile

public void removeFile(FileNode file)

getFiles

public java.util.Vector getFiles()
Return list of open model files. Will not return module settings files or application file group


setRecentFiles

public void setRecentFiles(java.util.Vector recentFiles)

getRecentFiles

public java.util.Vector getRecentFiles()

setRecentDirectories

public void setRecentDirectories(java.util.Vector recentDirectories)

getRecentDirectories

public java.util.Vector getRecentDirectories()

getFileGroup

public FileNode getFileGroup(java.lang.String filename)
Search the database for the file with given name (the complete path relative to the application root) and return a reference. This may return module settings files and the dummy application file root too (called "Prog-File"). Every node is considered, after first looking at the model file names.


setCurrentFile_Temp

public void setCurrentFile_Temp(FileNode file)

setCurrentFile

public void setCurrentFile(FileNode file)
Set the current model file. This is the model (a sub tree of the database) that will be effected by users actions.


getCurrentFile

public FileNode getCurrentFile()
Returns the current FileNode. This is the default file that is effected by user action.


setFileTitle

public void setFileTitle(FileNode file)
Set the frame title to show that the given file is current. This calles UIManager.setFileTitle().


cancelFileOpen

public void cancelFileOpen(java.lang.String filename)
Stops the current file opening thread.


retrieveFile

public FileNode retrieveFile(java.lang.String filename)
Retrieve file from database or from open from disk. Null is returned if it cant be found. File will not become current, but is added to the database if it has not been opened already


open

public FileNode open(java.lang.String filename)
Short version of open()


open

public FileNode open(java.lang.String filename,
                     boolean bMakeCurrent,
                     boolean bLocked,
                     boolean bVisible)
Open the model file from disk. This function uses MVGFileOpener to read the file (only the .MVG format is supported) and then it validates it synchronously and adds it to the database.


_open_

public FileNode _open_(java.lang.String filename,
                       boolean bMakeCurrent,
                       boolean bLocked,
                       boolean bVisible)

openLocal

public FileNode openLocal(java.lang.String filename)
Opens a file and return reference to it. Will not make current, bind any bindables or add it to database, or validate the model tree. The idea is return a temporary model that can be thown away.


closeCurrent

public void closeCurrent()
Remove the current file.


closeNotCurrent

public void closeNotCurrent()
Close all files except the current file.


closeAll

public void closeAll(boolean bCheckCurrent)
Close all files


close

public void close(FileNode file)
Close the given file


close

public void close(FileNode file,
                  boolean bCheckCurrent)

save

public void save(FileNode file,
                 java.lang.String filename,
                 boolean bSaveImage,
                 boolean bCompress,
                 java.lang.String desc)
Saves the model sub tree as a file of the given name, and set the name kept in the model subtree node to the given name. This function will first check the save directory exsists and query the user if not. Then it checks that the files external references have all been saved. It then uses MVGFileSaver to save the file.


_save_

public void _save_(FileNode file,
                   java.lang.String filename,
                   boolean bSaveImage,
                   boolean bCompress,
                   java.lang.String desc)
Lower level save that wont change name kept in model sub tree


saveLocal

public void saveLocal(FileNode file)
This is the equivolant of openLocal(). The saveing of the file group will have no side effects.


saveIndependantSubset

public void saveIndependantSubset(DataNode[] set,
                                  java.lang.String filename,
                                  boolean bSaveImage,
                                  boolean bCompress,
                                  java.lang.String desc)
Builds a new database with objects of the selection set (and their children) layed out under one node. The main shortcomming of this is that it does not deal with cross referencing to shared nodes outside the selection set, other than using the node.makeUnrerenced() funciton.


importIndependantSubset

public void importIndependantSubset(DataNode[] set)

exportRawGeometries

public void exportRawGeometries()
This was writtin for doing demos originally


setSyncedToDisc

public void setSyncedToDisc(FileNode file,
                            boolean b)
Flag the current file as synced to disk or not


getWriteSettingsFile

public java.lang.String getWriteSettingsFile(java.lang.String workingDir,
                                             java.lang.String remainder)
Get location of settings files for current user. Returns home-directory/.Modelzilla/remainder if user home is known. If it is known but no directory is there, the directories under the file are created. If user home is not known, returns workingDirectory/remainder


getReadSettingsFile

public java.lang.String getReadSettingsFile(java.lang.String workingDir,
                                            java.lang.String remainder)
Get the complete path to read a settings file. Returns home-directory/Modelzilla/remainder if this file exisits or workingDirectory/remainder


getSettingsDir

public java.lang.String getSettingsDir()
Get the complete path to read a settings file. Returns home-directory/Modelzilla if this file exisits or workingDirectory


writeSettings

public void writeSettings()
Save all user interface settings


writeDefaultPrototypes

public void writeDefaultPrototypes()

writeModuleSettings

public void writeModuleSettings(Module mod)
Save user interface settings for the module


writeRecentFiles

public void writeRecentFiles()
Write the recent model file list


writeModuleStubFiles

public void writeModuleStubFiles()
Write module stubs


writeGeneralSettings

public void writeGeneralSettings()
Write user interface settings not associated with any module