cz.hdf.cdnavigator
Class PrepareFiles

java.lang.Object
  extended by cz.hdf.cdnavigator.PrepareFiles

public class PrepareFiles
extends java.lang.Object

Prepare real files on CDs from file names stored in DB. Search files in cache or mount CD. Relative file names are specified by array of FileRecord objects. Array you go by method step(). Array indexation can be randomized (for slide show).

Author:
hunter

Field Summary
private  boolean cacheFiles
          cache new founded files on CD?
private  int index
          index in records array
private  java.util.ArrayList<java.lang.Integer> indexes
          records indexes order
private  int lastCDID
          CD ID of last shown file.
private  java.util.logging.Logger logger
          Logger.
private  cz.hdf.gui.HProgressDialog progressDialog
           
private  java.util.ArrayList<FileRecord> records
          file data to prepare
private  boolean slideRandom
          create indexes with random order
private  boolean slideRepeat
          create indexes with repeating numbers
 
Constructor Summary
PrepareFiles(java.util.ArrayList<FileRecord> _records, boolean _cacheFiles, boolean _slideRandom, boolean _slideRepeat)
          Initialize list of photos to cache.
PrepareFiles(java.util.ArrayList<FileRecord> _records, boolean _cacheFiles, boolean _slideRandom, boolean _slideRepeat, cz.hdf.gui.HProgressDialog _progressDialog)
          Initialize list of photos to cache.
 
Method Summary
static java.io.File getCacheFile(CDData _cd, java.lang.String _relFileName)
          Try to find file in cache.
static java.io.File getCDFile(java.io.File _mountDir, java.lang.String _relFileName)
          Try to find file on CD.
 java.io.File getFile(CDData _cd, java.lang.String _relFileName)
          Try to find file in cache.
 FileRecord getFileRecord()
          ?
 FileRecord getFileRecord(int _index)
          ?
 java.util.ArrayList<java.lang.Integer> getIndexes()
           
 FileRecord getNextFileRecord()
          ?
 java.io.File getPreparedFile()
          Try to find file in cache.
 java.io.File getPreparedNextFile()
          Try to find file in cache.
 FileRecord getPrevFileRecord()
          ?
 int getSize()
          Return the length of records array.
 boolean hasNext()
          ?
 boolean hasPrev()
          ?
 boolean isRandom()
           
 boolean isRepeat()
           
private  FileRecord prepareFile(int _index)
          prepare next file to show
 void removeFileRecord()
           
 void setIndex(int _index)
          Set relative index.
 void stepNext()
          ?
 void stepPrev()
          ?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

records

private java.util.ArrayList<FileRecord> records
file data to prepare


slideRandom

private boolean slideRandom
create indexes with random order


slideRepeat

private boolean slideRepeat
create indexes with repeating numbers


cacheFiles

private boolean cacheFiles
cache new founded files on CD?


index

private int index
index in records array


indexes

private java.util.ArrayList<java.lang.Integer> indexes
records indexes order


lastCDID

private int lastCDID
CD ID of last shown file.


progressDialog

private cz.hdf.gui.HProgressDialog progressDialog

logger

private java.util.logging.Logger logger
Logger. Hierarchy is set to name of this class.

Constructor Detail

PrepareFiles

public PrepareFiles(java.util.ArrayList<FileRecord> _records,
                    boolean _cacheFiles,
                    boolean _slideRandom,
                    boolean _slideRepeat)
Initialize list of photos to cache.

Parameters:
_records -
_cacheFiles -
_slideRandom -
_slideRepeat -

PrepareFiles

public PrepareFiles(java.util.ArrayList<FileRecord> _records,
                    boolean _cacheFiles,
                    boolean _slideRandom,
                    boolean _slideRepeat,
                    cz.hdf.gui.HProgressDialog _progressDialog)
Initialize list of photos to cache.

Parameters:
_records -
_cacheFiles -
_slideRandom -
_slideRepeat -
Method Detail

isRepeat

public boolean isRepeat()
Returns:

isRandom

public boolean isRandom()
Returns:

setIndex

public void setIndex(int _index)
Set relative index. This index points to indexes array.


getSize

public int getSize()
Return the length of records array. This number/size can be changed during preparing files. When user can not insert right CD and cancel copying.


prepareFile

private FileRecord prepareFile(int _index)
prepare next file to show

Parameters:
_index - real index to records array
Returns:

hasPrev

public boolean hasPrev()
?

Returns:

hasNext

public boolean hasNext()
?

Returns:

stepPrev

public void stepPrev()
?


stepNext

public void stepNext()
?


removeFileRecord

public void removeFileRecord()

getIndexes

public java.util.ArrayList<java.lang.Integer> getIndexes()
Returns:

getFileRecord

public FileRecord getFileRecord()
?

Returns:

getPrevFileRecord

public FileRecord getPrevFileRecord()
?

Returns:

getNextFileRecord

public FileRecord getNextFileRecord()
?

Returns:

getFileRecord

public FileRecord getFileRecord(int _index)
?

Parameters:
_index -
Returns:

getPreparedFile

public java.io.File getPreparedFile()
                             throws java.io.FileNotFoundException
Try to find file in cache. If file not found try to find file on CD. If file not found return null.

Returns:
file object or null
Throws:
java.io.FileNotFoundException

getPreparedNextFile

public java.io.File getPreparedNextFile()
                                 throws java.io.FileNotFoundException
Try to find file in cache. If file not found try to find file on CD. If file not found return null.

Returns:
file object or null
Throws:
java.io.FileNotFoundException

getFile

public java.io.File getFile(CDData _cd,
                            java.lang.String _relFileName)
                     throws java.io.FileNotFoundException
Try to find file in cache. If file not found try to find file on CD. If file not found return null.

Parameters:
_cdID - ID of CD with file
_relFileName - relative file name
Returns:
file object or null
Throws:
java.io.FileNotFoundException

getCacheFile

public static java.io.File getCacheFile(CDData _cd,
                                        java.lang.String _relFileName)
Try to find file in cache. If file not found return null.

Parameters:
_cdID - ID of CD with file
_relFileName - relative file name
Returns:
file object or null

getCDFile

public static java.io.File getCDFile(java.io.File _mountDir,
                                     java.lang.String _relFileName)
Try to find file on CD. If file not found return null.

Parameters:
_relFileName - relative file name
Returns:
file object or null


CDnavigator JavaDoc, HDF company www.hdf.cz