iRex DR1000 Manager v0.5.3

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. Scribbles can be managed using a ScribbleMgr; use the getScribbleMgr() method to retrieve on suitable for this document.

Version:
2013/11/06
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()
          Export the scribbles to PNG files.
 void exportToPNG(File dir)
          Export the scribbles to PNG files.
 void exportToPNG(String dirPath)
          Export the scribbles to PNG files.
 void format(String outputFile)
          Deprecated. only for debug purpuse; will be deleted in future release
protected abstract  String getDbName()
          Return the file name as it is present in the database file.
protected abstract  String getDefaultFileName()
          Return the default filename used to create the output files.
static Document getDocument(File file)
          Return the document suitable for 'file'.
protected  ScribbleMgr getScribbleMgr()
          Returns an initialized ScribbleMgr.
 void merge()
          Creates a PDF file with the scribbles.
abstract  void merge(File file)
          Creates a PDF file with the scribbles.
 void merge(String outFilePath)
          Creates a PDF file with the scribbles.
 
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)
Return the document suitable for 'file'.

Parameters:
file - a file
Returns:
a Document object that represent that file (a PDF or a note file)
Throws:
IllegalArgumentException - in case of unknown file

getScribbleMgr

protected ScribbleMgr getScribbleMgr()
Returns an initialized ScribbleMgr.

Returns:
a ScribbleMgr that is already connected to the scribble database of this document

getDbName

protected abstract String getDbName()
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

protected 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 default filename used to create the output files

merge

public void merge()
Creates a PDF file with the scribbles. The PDF is created using the default file name and the set color for the strokes.


merge

public void merge(String outFilePath)
Creates a PDF file with the scribbles. The PDF is created using the specified output file and the set color for the strokes.

Parameters:
outFilePath - path to the output file/folder; if it is null or empty, the default one is used

merge

public abstract void merge(File file)
Creates a PDF file with the scribbles. The PDF is created using the specified output file and the set color for the strokes.

Parameters:
file - output file

exportToPNG

public void exportToPNG()
Export the scribbles to PNG files. Each page of scribbles is saved in a different file in the current folder.

See Also:
exportToPNG(File)

exportToPNG

public void exportToPNG(String dirPath)
Export the scribbles to PNG files. Each page of scribbles is saved in a different file in the folder specified.

Parameters:
dirPath - output folder
See Also:
exportToPNG(File)

exportToPNG

public void exportToPNG(File dir)
Export the scribbles to PNG files. Each page of scribbles is saved in a different file in the folder specified.

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

Parameters:
dir - output folder; if it is null, the exportToPNG() method will be used

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.3

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