org.pz.platypus.plugin.rtf
Class Start

java.lang.Object
  extended by org.pz.platypus.plugin.rtf.Start
All Implemented Interfaces:
IPlugin

public class Start
extends java.lang.Object
implements IPlugin

Test plugin for converting Platypus files to Rich Text Format (rtf). Note: Methods order: constructor, methods in alphabetical order, getters and setters Error-handling convention: Output plugins handle all their own error messages. Platypus is made aware of a problem only by the value returned from calling process(). However, it does not issue any user messages as a result of this.

Author:
alb, ask

Field Summary
private  RtfCommandTable ctable
           
private  RtfOutfile outfile
           
private  RtfData rtd
           
 
Constructor Summary
Start()
          Start() is always called first by Platypus, followed by a call to process() Any plugin initialization code should go in here.
 
Method Summary
 void emitListing(java.io.FileWriter outfile, GDD gdd)
          Where the content of the listing file is written out
 void process(GDD gdd, CommandLineArgs clArgs)
          This is the main line of the plug-in.
 void processCommand(GDD gdd, RtfCommandTable commandTable, Token tok, int tokNum)
          Gets the RTF command and executes it.
 void processInputTokens(GDD gdd, RtfOutfile outfile)
          Where the content of the listing file is written out
 void processText(GDD gdd, Token tok, RtfOutfile outfile)
          Validates that there is text to output and then writes it as a string to the file.
 int processToken(GDD gdd, Token tok, RtfOutfile outfile, int tokenNumber)
          Processes the individual tokens
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outfile

private RtfOutfile outfile

rtd

private RtfData rtd

ctable

private RtfCommandTable ctable
Constructor Detail

Start

public Start()
Start() is always called first by Platypus, followed by a call to process() Any plugin initialization code should go in here.

Method Detail

process

public void process(GDD gdd,
                    CommandLineArgs clArgs)
This is the main line of the plug-in. Platypus calls only the Start constructor and this method.

Specified by:
process in interface IPlugin
Parameters:
gdd - The Global Document Data structure
clArgs - command-line arguments in a hash map (key = argument, value = parameters)

processInputTokens

public void processInputTokens(GDD gdd,
                               RtfOutfile outfile)
                        throws java.io.IOException
Where the content of the listing file is written out

Parameters:
outfile - the file being written to
gdd - the GDD.
Throws:
java.io.IOException - in the event the file can't be written to

processToken

public int processToken(GDD gdd,
                        Token tok,
                        RtfOutfile outfile,
                        int tokenNumber)
                 throws java.io.IOException
Processes the individual tokens

Parameters:
gdd - global document data (data structure)
tok - token being processed
outfile - output RTF file being created
tokenNumber - where the token is in the input token stream
Returns:
returns the number of tokens to skip. In vast majority of cases, returns 1.
Throws:
java.io.IOException - in event of an I/O error

processCommand

public void processCommand(GDD gdd,
                           RtfCommandTable commandTable,
                           Token tok,
                           int tokNum)
                    throws java.io.IOException
Gets the RTF command and executes it.

Parameters:
gdd - the GDD
commandTable - the command table holding the commands for RTF
tok - the token containing text
tokNum - the number of the token
Throws:
java.io.IOException - occurs if an I/O error occurred during output

processText

public void processText(GDD gdd,
                        Token tok,
                        RtfOutfile outfile)
                 throws java.io.IOException
Validates that there is text to output and then writes it as a string to the file.

Parameters:
gdd - the GDD
tok - the token containing text
outfile - the file to write the text to
Throws:
java.io.IOException - occurs if an I/O error occurred during output

emitListing

public void emitListing(java.io.FileWriter outfile,
                        GDD gdd)
                 throws java.io.IOException
Where the content of the listing file is written out

Parameters:
outfile - the file being written to
gdd - the GDD. Only the literals are used
Throws:
java.io.IOException - in the event the file can't be written to


Copyright © 2008-10 Pacific Data Works LLC