edu.rice.cs.drjava.project
Class DocFile

java.lang.Object
  extended by java.io.File
      extended by edu.rice.cs.drjava.project.DocFile
All Implemented Interfaces:
Serializable, Comparable<File>

public class DocFile
extends File

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
DocFile(File f)
          Creates a docfile that has the same path as the given file, with default values for everything else.
DocFile(File f, Pair<Integer,Integer> selection, Pair<Integer,Integer> scroll, boolean active, String srcRoot)
           
DocFile(String pathname)
          Creates a docfile from the given pathname with default values for everything else.
DocFile(String pathname, Pair<Integer,Integer> selection, Pair<Integer,Integer> scroll, boolean active, String srcRoot)
           
DocFile(String parent, String child)
          Creates a docfile from the given parent and child with default values for everything else.
DocFile(String parent, String child, Pair<Integer,Integer> selection, Pair<Integer,Integer> scroll, boolean active, String srcRoot)
           
 
Method Summary
 DocFile getAbsoluteFile()
           
 DocFile getCanonicalFile()
           
 String getPackage()
           
 long getSavedModDate()
           
 Pair<Integer,Integer> getScroll()
           
 Pair<Integer,Integer> getSelection()
           
 boolean isActive()
           
 void setActive(boolean active)
           
 void setPackage(String pkg)
           
 void setSavedModDate(long mod)
          Sets lastModified for this file to the time the including project file was saved.
 void setScroll(int vert, int horiz)
           
 void setScroll(Pair<Integer,Integer> scroll)
           
 void setSelection(int start, int end)
           
 void setSelection(Pair<Integer,Integer> sel)
           
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsolutePath, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocFile

public DocFile(File f)
Creates a docfile that has the same path as the given file, with default values for everything else.


DocFile

public DocFile(String pathname)
Creates a docfile from the given pathname with default values for everything else.


DocFile

public DocFile(String parent,
               String child)
Creates a docfile from the given parent and child with default values for everything else.


DocFile

public DocFile(String pathname,
               Pair<Integer,Integer> selection,
               Pair<Integer,Integer> scroll,
               boolean active,
               String srcRoot)

DocFile

public DocFile(File f,
               Pair<Integer,Integer> selection,
               Pair<Integer,Integer> scroll,
               boolean active,
               String srcRoot)

DocFile

public DocFile(String parent,
               String child,
               Pair<Integer,Integer> selection,
               Pair<Integer,Integer> scroll,
               boolean active,
               String srcRoot)
Method Detail

getAbsoluteFile

public DocFile getAbsoluteFile()
Overrides:
getAbsoluteFile in class File

getCanonicalFile

public DocFile getCanonicalFile()
                         throws IOException
Overrides:
getCanonicalFile in class File
Throws:
IOException

getSelection

public Pair<Integer,Integer> getSelection()
Returns:
the selection with the start and ending locations paired together. The cursor location is at the second location in the pair while the selection is defined between the two.

setSelection

public void setSelection(Pair<Integer,Integer> sel)
Parameters:
sel - the pair to set the selection to

setSelection

public void setSelection(int start,
                         int end)
Parameters:
start - the start of the selection
end - the end of the selection (and the cursor position)

getScroll

public Pair<Integer,Integer> getScroll()
Returns:
the selection with the first element being the vertical scroll and the second being the horizontal scroll.

setScroll

public void setScroll(Pair<Integer,Integer> scroll)
Parameters:
scroll - the pair to set the selection to

setScroll

public void setScroll(int vert,
                      int horiz)
Parameters:
vert - the vertical scroll of the scroll pane
horiz - the horizonal scroll of the scroll pane

isActive

public boolean isActive()
Returns:
true if this file is supposed to be the active document when opened.

setActive

public void setActive(boolean active)
Parameters:
active - Whether this file should be the active document when opened.

getPackage

public String getPackage()
Returns:
the package of the document stored in this file

setPackage

public void setPackage(String pkg)
Parameters:
pkg - The name of the package defined in the document text.

setSavedModDate

public void setSavedModDate(long mod)
Sets lastModified for this file to the time the including project file was saved. The lastModified date any documents saved after the project file was written will not match the date recorded in the project file.

Parameters:
mod - the last known modification date when the project was saved.

getSavedModDate

public long getSavedModDate()
Returns:
The modification date of this file at the time the project file was generated.