Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.flexstor.common.gui.imprt
Class FileViewerModel  view FileViewerModel download FileViewerModel.java

java.lang.Object
  extended byjava.util.Observable
      extended bycom.flexstor.common.gui.imprt.FileViewerModel
All Implemented Interfaces:
ConfigFileModelI, java.util.Observer

public class FileViewerModel
extends java.util.Observable
implements ConfigFileModelI


Field Summary
protected  com.flexstor.common.io.xfile.FlexXFile[] array
           
protected  boolean bIsCtlChanged
           
protected  java.lang.String currFile
           
protected  java.lang.String location
           
static java.lang.String SEPARATOR
           
 
Fields inherited from class java.util.Observable
 
Constructor Summary
FileViewerModel(java.lang.String location)
           
 
Method Summary
private  boolean checkDestination(com.flexstor.common.io.xfile.FlexXFile destination)
           
 void deleteFile(com.flexstor.common.io.xfile.FlexXFile xFile)
          Deletes the specified file.
 void deleteFile(java.lang.String fileName)
          Deletes the specified file.
private  void dumpBufferIntoFile(byte[] buffer, com.flexstor.common.io.xfile.FlexXFile dest)
           
 void enableInput(boolean mode)
          Enables or disables the input on the UI.
 java.lang.String getCurrentFile()
          Returns the current file viwed or changed by the user.
private  com.flexstor.common.io.xfile.FlexXFile getFile(java.lang.String fileName)
           
 com.flexstor.common.io.xfile.FlexXFile[] getFileList()
          Returns the list of files under the initial location (dir) provided.
 java.lang.String getInitialLocation()
          Returns the initial location (dir) from where the files are browsed.
 boolean isControlFileChanged()
          Among all the config files we expect that there would be a file with extension .ctl, which is the control file for the import.
private  boolean isLocalPath(java.lang.String loc)
           
 java.lang.StringBuffer loadBufferFromFile(com.flexstor.common.io.xfile.FlexXFile file)
          Returns the string buffer of the file specified as parameter.
 java.lang.StringBuffer loadBufferFromFile(java.lang.String fileName)
          Returns the string buffer of the file specified as parameter.
private  void notifyAllObservers(Notification notification)
           
private  void parsePath()
           
 void saveFile(java.lang.String fileName, byte[] buffer)
           
 void saveFile(java.lang.String fileName, java.lang.String buffer)
          Saves the string into the file.
 void saveFile(java.lang.String fileName, java.lang.StringBuffer buffer)
          Saves the buffer into the file
 void setCtlChanged(boolean bool)
           
 void setCurrentFile(java.lang.String fName)
          Sets the current file viwed or changed by the user.
 void setInitialLocation(java.lang.String loc)
          Sets the initial location (dir) from where the files are browsed.
 void update(java.util.Observable obs, java.lang.Object notification)
          This method is called whenever the observable object changes, and has called notifyObservers.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.flexstor.common.gui.imprt.ConfigFileModelI
addObserver, deleteObserver
 

Field Detail

location

protected java.lang.String location

currFile

protected java.lang.String currFile

array

protected com.flexstor.common.io.xfile.FlexXFile[] array

SEPARATOR

public static java.lang.String SEPARATOR

bIsCtlChanged

protected boolean bIsCtlChanged
Constructor Detail

FileViewerModel

public FileViewerModel(java.lang.String location)
Method Detail

getInitialLocation

public java.lang.String getInitialLocation()
Description copied from interface: ConfigFileModelI
Returns the initial location (dir) from where the files are browsed.

Specified by:
getInitialLocation in interface ConfigFileModelI

setInitialLocation

public void setInitialLocation(java.lang.String loc)
Description copied from interface: ConfigFileModelI
Sets the initial location (dir) from where the files are browsed.

Specified by:
setInitialLocation in interface ConfigFileModelI

setCurrentFile

public void setCurrentFile(java.lang.String fName)
Description copied from interface: ConfigFileModelI
Sets the current file viwed or changed by the user.

Specified by:
setCurrentFile in interface ConfigFileModelI

getCurrentFile

public java.lang.String getCurrentFile()
Description copied from interface: ConfigFileModelI
Returns the current file viwed or changed by the user.

Specified by:
getCurrentFile in interface ConfigFileModelI

isControlFileChanged

public boolean isControlFileChanged()
Description copied from interface: ConfigFileModelI
Among all the config files we expect that there would be a file with extension .ctl, which is the control file for the import. If this changes, a reloading is necessary on the GUI, hence the function.

Specified by:
isControlFileChanged in interface ConfigFileModelI

setCtlChanged

public void setCtlChanged(boolean bool)

saveFile

public void saveFile(java.lang.String fileName,
                     java.lang.StringBuffer buffer)
              throws com.flexstor.common.exceptions.FileOperationFailedException
Description copied from interface: ConfigFileModelI
Saves the buffer into the file

Specified by:
saveFile in interface ConfigFileModelI

saveFile

public void saveFile(java.lang.String fileName,
                     java.lang.String buffer)
              throws com.flexstor.common.exceptions.FileOperationFailedException
Description copied from interface: ConfigFileModelI
Saves the string into the file.

Specified by:
saveFile in interface ConfigFileModelI

saveFile

public void saveFile(java.lang.String fileName,
                     byte[] buffer)
              throws com.flexstor.common.exceptions.FileOperationFailedException

deleteFile

public void deleteFile(java.lang.String fileName)
                throws com.flexstor.common.exceptions.FileOperationFailedException
Description copied from interface: ConfigFileModelI
Deletes the specified file. Returns the status.

Specified by:
deleteFile in interface ConfigFileModelI

deleteFile

public void deleteFile(com.flexstor.common.io.xfile.FlexXFile xFile)
                throws com.flexstor.common.exceptions.FileOperationFailedException
Description copied from interface: ConfigFileModelI
Deletes the specified file. Returns the status.

Specified by:
deleteFile in interface ConfigFileModelI

getFileList

public com.flexstor.common.io.xfile.FlexXFile[] getFileList()
                                                     throws com.flexstor.common.exceptions.FileOperationFailedException
Description copied from interface: ConfigFileModelI
Returns the list of files under the initial location (dir) provided.

Specified by:
getFileList in interface ConfigFileModelI

loadBufferFromFile

public java.lang.StringBuffer loadBufferFromFile(java.lang.String fileName)
                                          throws com.flexstor.common.exceptions.FileOperationFailedException
Description copied from interface: ConfigFileModelI
Returns the string buffer of the file specified as parameter.

Specified by:
loadBufferFromFile in interface ConfigFileModelI

loadBufferFromFile

public java.lang.StringBuffer loadBufferFromFile(com.flexstor.common.io.xfile.FlexXFile file)
                                          throws com.flexstor.common.exceptions.FileOperationFailedException
Description copied from interface: ConfigFileModelI
Returns the string buffer of the file specified as parameter.

Specified by:
loadBufferFromFile in interface ConfigFileModelI

enableInput

public void enableInput(boolean mode)
Description copied from interface: ConfigFileModelI
Enables or disables the input on the UI.

Specified by:
enableInput in interface ConfigFileModelI

update

public void update(java.util.Observable obs,
                   java.lang.Object notification)
Description copied from interface: java.util.Observer
This method is called whenever the observable object changes, and has called notifyObservers. The Observable object can pass arbitrary information in the second parameter.

Specified by:
update in interface java.util.Observer

getFile

private com.flexstor.common.io.xfile.FlexXFile getFile(java.lang.String fileName)
                                                throws com.flexstor.common.exceptions.FileOperationFailedException

parsePath

private void parsePath()

dumpBufferIntoFile

private void dumpBufferIntoFile(byte[] buffer,
                                com.flexstor.common.io.xfile.FlexXFile dest)
                         throws com.flexstor.common.exceptions.FileOperationFailedException

checkDestination

private boolean checkDestination(com.flexstor.common.io.xfile.FlexXFile destination)

isLocalPath

private boolean isLocalPath(java.lang.String loc)

notifyAllObservers

private void notifyAllObservers(Notification notification)