com.photoviewer.client.parse
Class FileObject

java.lang.Object
  extended bycom.photoviewer.client.parse.MemObject
      extended bycom.photoviewer.client.parse.FileObject

public class FileObject
extends MemObject

Specialization of a MemObject (DOM-like class) that represents a File element or directory element in the directory.xml (.zip) file that is used by the PhotoViewer client.

Author:
John De Regnaucourt

Field Summary
static int DIRECTORY
           
static int FILE
           
 
Fields inherited from class com.photoviewer.client.parse.MemObject
m_parent
 
Constructor Summary
FileObject(int type, FileObject parent)
           
 
Method Summary
protected  java.lang.String getDirPath(boolean master)
           
 java.lang.String getMasterName()
          Get the master image file name "path/*" where * is the file name.
 java.util.Vector getOnlyFileChildren()
           
 java.lang.String getPrettyName()
           
 java.lang.String getScreenName()
          Get the screen-size image file name "path/n-*" where * is the rest of the file name.
 java.lang.String getThumbnailName()
          Get the thumbnail image file name "path/t-*" where * is the rest of the file name.
 int getType()
           
protected  java.lang.String webFileName(java.lang.String fn)
          WFN = WebFileName.
 
Methods inherited from class com.photoviewer.client.parse.MemObject
addSubElement, getAttribute, getParent, getSubElements, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTORY

public static final int DIRECTORY
See Also:
Constant Field Values

FILE

public static final int FILE
See Also:
Constant Field Values
Constructor Detail

FileObject

public FileObject(int type,
                  FileObject parent)
Parameters:
type - indicates what this FileObject represents, a FILE or a DIRECTORY.
parent - Parent FileObject
Method Detail

getOnlyFileChildren

public java.util.Vector getOnlyFileChildren()
Returns:
int number of "file" (thumbnail) m_children of the current element.

getThumbnailName

public java.lang.String getThumbnailName()
Get the thumbnail image file name "path/t-*" where * is the rest of the file name. The "t-" is the file name prefix, generated by the photoGenerator for thumbnail size (96x96).

Returns:
thumbnail image file name,

getScreenName

public java.lang.String getScreenName()
Get the screen-size image file name "path/n-*" where * is the rest of the file name. The "n-" is the file name prefix, generated by the photoGenerator for screen size (800x600) images.

Returns:
screen image file name,

getMasterName

public java.lang.String getMasterName()
Get the master image file name "path/*" where * is the file name.

Returns:
original image file name (the full size image, no reduction).

getDirPath

protected java.lang.String getDirPath(boolean master)
Parameters:
master - boolean set to 'true' to indicate that the path returned should be for the directory containing the master images.
Returns:
a String that contains the path from the web servers root directory to the image that this FileObject represents.

getPrettyName

public java.lang.String getPrettyName()
Returns:
String representing the "pretty" name of the file. This is the note from the descript.ion file if one exists, otherwise it is the filename.

webFileName

protected java.lang.String webFileName(java.lang.String fn)
WFN = WebFileName. Convert '&' and ' ' into their web equivelent so that the browser won't be confused by the name.

Parameters:
fn - file name
Returns:
String filename with spaces and & converted to %20 and & respectively.

getType

public int getType()
Returns:
the type of this FileObject, a DIRECTORY or a FILE.