iRex DR1000 Manager v0.5.2

it.andynaz.irex.dr1000.document
Class Document

java.lang.Object
  extended by it.andynaz.irex.dr1000.document.Document
Direct Known Subclasses:
Note, PdfDocument

public abstract class Document
extends Object

Document on a iRex DR1000. This class ia a model for both a PDF document or a note: it has an associated SQLite database file, where the scribbles are stored.

Version:
2013/10/01
Author:
andynaz

Field Summary
protected  File db
          Database file.
 
Constructor Summary
protected Document(File db)
          Creates a new Document with an associated database file.
 
Method Summary
 void exportToPNG()
           
 void exportToPNG(File dir)
          Export the scribbles to PNG files.
 void exportToPNG(String dirPath)
           
 void format(String outputFile)
          Deprecated. only for debug purpuse; will be deleted in future release
abstract  String getDefaultFileName()
          Return the default filename used to create the output files.
static Document getDocument(File file)
           
protected abstract  String getFileName()
          Return the file name as it is present in the database file.
protected  ScribbleMgr getScribbleMgr()
          Returns an initialized ScribbleMgr.
 void merge(String outFilePath)
          Creates the output PDF file.
abstract  void merge(String outFilePath, Color color)
          Creates the output PDF file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

protected File db
Database file.

Constructor Detail

Document

protected Document(File db)
Creates a new Document with an associated database file.

Parameters:
db - database file
Throws:
IllegalArgumentException - if the db file does not exists or is not a file
Method Detail

getDocument

public static Document getDocument(File file)
Parameters:
file -
Returns:

getScribbleMgr

protected ScribbleMgr getScribbleMgr()
Returns an initialized ScribbleMgr.

Returns:
a ScribbleMgr that is already connected to the database file

getFileName

protected abstract String getFileName()
Return the file name as it is present in the database file. Subclasses implement the correct format of the file_metadata.filename column.

Returns:
the name of the file as written in the database
See Also:
ScribbleMgr

getDefaultFileName

public abstract String getDefaultFileName()
Return the default filename used to create the output files. The filemane returned should be without the file extensions or suffixes (if needed, they will be added in the calling methods).

Returns:
the filename used to create the output PDF file, when no one is specified

merge

public void merge(String outFilePath)
Creates the output PDF file. The PDF is created using the default color for the strokes (as returned by the ColorMgr.getColor() method).

Parameters:
outFilePath - the path to the output PDF file; if it is null or empty, the default one returned by getDefaultFileName() is used

merge

public abstract void merge(String outFilePath,
                           Color color)
Creates the output PDF file. The PDF is created using the color passed as argument.

Parameters:
outFilePath - the path to the output PDF file; if it is null or empty, the default one returned by getDefaultFileName() is used
color - strokes' color

exportToPNG

public void exportToPNG(File dir)
Export the scribbles to PNG files. The files are saved in the folder specified by 'dir'.

For each page of scribble, a PNG file is created and saved as name-pgNum.png, where 'name' is the name returned by the getDefaultFileName() method and 'pgNum' is the page number.


exportToPNG

public void exportToPNG(String dirPath)

exportToPNG

public void exportToPNG()

format

public void format(String outputFile)
Deprecated. only for debug purpuse; will be deleted in future release

Create a file with all the scribbles in a text format.

Parameters:
outputFile - path to the output text file; if it is null or empty, the default one returned by getDefaultFileName() is used

iRex DR1000 Manager v0.5.2

© 2013 andynaz - http://andynaz.altervista.org