org.norvelle.textcite.gui.action
Class ExportRTFAction

java.lang.Object
  extended by org.norvelle.textcite.gui.action.ExportRTFAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, CancelListener
Direct Known Subclasses:
ExportTranslationsAction

public class ExportRTFAction
extends java.lang.Object
implements java.awt.event.ActionListener, CancelListener

ExportPDFAction: Handles the exporting of citations in PDF format. Produces a dialog box, allowing the user to indicate preferences, then collects the citations required and uses the iText framework to produce a PDF document with the name the user chooses.

Author:
Erik Norvelle

Field Summary
protected  Font authorFont
           
protected  Font bookFont
           
protected  boolean cancelButtonPressed
           
protected  CitationSet citationSet
           
static int CODE_BIBTEX
           
static int CODE_CITATION
           
static int CODE_ENDNOTE
           
protected  int codeStyle
           
static int COMMENTARIES_IN_FOOTNOTES
           
static int COMMENTARIES_INTERWOVEN
           
static int COMMENTARIES_MAIN_TEXT
           
protected  double currentIndent
           
protected  int currOutlineLevel
           
protected  ExportRTFDialog dialog
           
protected  Document document
           
static int EXPORT_ALL
           
static int EXPORT_SELECTED
           
static int EXPORT_VIEW
           
protected  CitationExporter exporter
           
protected  java.io.File exportFile
           
protected  int exportSet
           
protected  java.lang.String footer
           
protected  java.lang.String header
           
protected  boolean includeCommentaries
           
protected  boolean includeOnlyRefs
           
protected  int inclusionType
           
static float INDENT_WIDTH
          Indentation equivalent to half an inch.
protected  boolean insertBibCodes
           
protected  MainFrame mainFrame
           
protected  ExportRTFAction me
           
protected  boolean numberPages
           
protected  int organization
           
static int ORGANIZE_AUTHOR_PUB
           
static int ORGANIZE_CURRENT_VIEW
           
static int ORGANIZE_OUTLINE
           
protected  Font outlineFont
           
protected  ProgressDialog progressDialog
          Objects for handling PDF output via iText
protected  Font titleFont
           
 
Constructor Summary
ExportRTFAction(MainFrame mainFrame)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent arg0)
          Called by the menu or toolbar when the user chooses the action.
protected  void addCitationsToDocument()
          For each Citation in the CitationSet, add it to the PDF document to be output, following the parameters selected by the user.
 void cancelPressed()
           
protected  void collectCitationSet()
          The routine that adds the chosen content to the document.
 void doExport(ExportRTFDialog dialog)
          This method is called once the dialog box has collected the necessary information from the user in order to perform the export.
 float getCurrentIndent()
           
 java.io.File getExportFile()
           
 java.lang.String getFooter()
           
 java.lang.String getHeader()
           
 boolean isIncludeCommentaries()
           
 boolean isNumberPages()
           
protected  void newAuthor(Citation c)
          Respond to a change in Author by outputting a new section header
protected  void newBook(Citation c)
          Respond to a change in Book by outputting a new section header
protected  void newOutlineNumber(Citation c)
          Respond to a change in outline number by outputting a new section header
 void process()
          The controller routine for the export process.
 void setCodeStyle(int style)
           
 void setCommentaryInclusionType(int inclusionType)
           
protected  void setExporter()
          Set up the CitationExporter according to the user's choice
 void setExportFile(java.io.File exportFile)
           
 void setExportSet(int exportSet)
           
 void setFooter(java.lang.String footer)
           
 void setHeader(java.lang.String header)
           
 void setIncludeCommentaries(boolean includeCommentaries)
           
 void setIncludeOnlyReferences(boolean include)
           
 void setInsertBibCodes(boolean insert)
           
 void setOrganization(int organizationType)
           
protected  void setSortColumns()
          Figures out what the sorting columns should be and configures the CitationSet appropriately
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPORT_ALL

public static final int EXPORT_ALL
See Also:
Constant Field Values

EXPORT_SELECTED

public static final int EXPORT_SELECTED
See Also:
Constant Field Values

EXPORT_VIEW

public static final int EXPORT_VIEW
See Also:
Constant Field Values

ORGANIZE_CURRENT_VIEW

public static final int ORGANIZE_CURRENT_VIEW
See Also:
Constant Field Values

ORGANIZE_AUTHOR_PUB

public static final int ORGANIZE_AUTHOR_PUB
See Also:
Constant Field Values

ORGANIZE_OUTLINE

public static final int ORGANIZE_OUTLINE
See Also:
Constant Field Values

COMMENTARIES_IN_FOOTNOTES

public static final int COMMENTARIES_IN_FOOTNOTES
See Also:
Constant Field Values

COMMENTARIES_INTERWOVEN

public static final int COMMENTARIES_INTERWOVEN
See Also:
Constant Field Values

COMMENTARIES_MAIN_TEXT

public static final int COMMENTARIES_MAIN_TEXT
See Also:
Constant Field Values

CODE_BIBTEX

public static final int CODE_BIBTEX
See Also:
Constant Field Values

CODE_ENDNOTE

public static final int CODE_ENDNOTE
See Also:
Constant Field Values

CODE_CITATION

public static final int CODE_CITATION
See Also:
Constant Field Values

INDENT_WIDTH

public static final float INDENT_WIDTH
Indentation equivalent to half an inch.

See Also:
Constant Field Values

exportFile

protected java.io.File exportFile

header

protected java.lang.String header

footer

protected java.lang.String footer

numberPages

protected boolean numberPages

includeCommentaries

protected boolean includeCommentaries

exportSet

protected int exportSet

organization

protected int organization

dialog

protected ExportRTFDialog dialog

mainFrame

protected MainFrame mainFrame

document

protected Document document

citationSet

protected CitationSet citationSet

cancelButtonPressed

protected boolean cancelButtonPressed

inclusionType

protected int inclusionType

includeOnlyRefs

protected boolean includeOnlyRefs

insertBibCodes

protected boolean insertBibCodes

codeStyle

protected int codeStyle

exporter

protected CitationExporter exporter

currentIndent

protected double currentIndent

currOutlineLevel

protected int currOutlineLevel

me

protected ExportRTFAction me

progressDialog

protected ProgressDialog progressDialog
Objects for handling PDF output via iText


titleFont

protected Font titleFont

authorFont

protected Font authorFont

bookFont

protected Font bookFont

outlineFont

protected Font outlineFont
Constructor Detail

ExportRTFAction

public ExportRTFAction(MainFrame mainFrame)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent arg0)
Called by the menu or toolbar when the user chooses the action. Pops up the dialog box. When the user closes the dialog box,

Specified by:
actionPerformed in interface java.awt.event.ActionListener

doExport

public void doExport(ExportRTFDialog dialog)
This method is called once the dialog box has collected the necessary information from the user in order to perform the export. It creates a SwingWorker object, which gives us the ability to do work without blocking the GUI (which means that we can produce a meaningful progress dialog).


process

public void process()
The controller routine for the export process. It collects the chosen citation set, creates an iText object, and inserts the citations into the iText object, writing the destination file when finished.


setSortColumns

protected void setSortColumns()
Figures out what the sorting columns should be and configures the CitationSet appropriately


setExporter

protected void setExporter()
                    throws RTFExportException
Set up the CitationExporter according to the user's choice

Throws:
RTFExportException

collectCitationSet

protected void collectCitationSet()
The routine that adds the chosen content to the document.


addCitationsToDocument

protected void addCitationsToDocument()
                               throws DocumentException
For each Citation in the CitationSet, add it to the PDF document to be output, following the parameters selected by the user.

Throws:
DocumentException

cancelPressed

public void cancelPressed()
Specified by:
cancelPressed in interface CancelListener

newAuthor

protected void newAuthor(Citation c)
Respond to a change in Author by outputting a new section header


newBook

protected void newBook(Citation c)
Respond to a change in Book by outputting a new section header

Parameters:
changedCitation - The citation that contains the new Book

newOutlineNumber

protected void newOutlineNumber(Citation c)
Respond to a change in outline number by outputting a new section header

Parameters:
changedCitation - The citation that contains the new Book

getExportFile

public java.io.File getExportFile()
Returns:
Returns the exportFile.

setExportFile

public void setExportFile(java.io.File exportFile)
Parameters:
exportFile - The exportFile to set.

getFooter

public java.lang.String getFooter()
Returns:
Returns the footer.

setFooter

public void setFooter(java.lang.String footer)
Parameters:
footer - The footer to set.

getHeader

public java.lang.String getHeader()
Returns:
Returns the header.

setHeader

public void setHeader(java.lang.String header)
Parameters:
header - The header to set.

isIncludeCommentaries

public boolean isIncludeCommentaries()
Returns:
Returns the includeCommentaries.

setIncludeCommentaries

public void setIncludeCommentaries(boolean includeCommentaries)
Parameters:
includeCommentaries - The includeCommentaries to set.

isNumberPages

public boolean isNumberPages()
Returns:
Returns the numberPages.

setExportSet

public void setExportSet(int exportSet)
Parameters:
exportSet - The export set, i.e. whether all, selected or currently visible citations are to be exported.

setOrganization

public void setOrganization(int organizationType)

setCommentaryInclusionType

public void setCommentaryInclusionType(int inclusionType)

setIncludeOnlyReferences

public void setIncludeOnlyReferences(boolean include)

setInsertBibCodes

public void setInsertBibCodes(boolean insert)

setCodeStyle

public void setCodeStyle(int style)

getCurrentIndent

public float getCurrentIndent()