org.foray.mif
Class MifBook

java.lang.Object
  extended by org.foray.mif.MifBook
All Implemented Interfaces:
org.axsl.mif.MifBook

public class MifBook
extends Object
implements org.axsl.mif.MifBook

class representing a MIF document. The document is built up by calling various methods and then finally output to given filehandle using output method.

Author:
Seshadri G

Field Summary
static String EOL
          Constant for the end-of-line String, used in building mif output.
static String TAB
          Constant for the tab String, used in building mif output.
 
Constructor Summary
MifBook(org.apache.commons.logging.Log logger)
          Creates an empty MIF document.
 
Method Summary
 void addImage(String url, int x, int y, int w, int h)
          Creates a new image.
 void addToStream(String s)
          Adds a given string to the output.
 void createFrame(int x, int y, int w, int h)
          Creates a new anchored frame.
 void createPage()
           
 void createTable()
           
 void createTextRect(int numCols)
          Creates a new text rectangle.
 void endTable()
          Switch the reference back from the table to the current textflow.
 int getNewId()
          Returns the next available id for this document.
static String mifEncode(String val)
          Encode a String using the MIF encoding.
 void output(OutputStream stream)
           
 void setBlockProp(int startIndent, int endIndent)
           
 void setColumnProp(int colWidth)
          Add a column to the current table.
 void setCurrent(String current)
           
 void setDocumentHeightWidth(int height, int width)
           
 void setTextRectProp(int left, int top, int width, int height)
          Sets the properties of the current text rectangle.
 void startCell(int rowSpan, int colSpan)
           
 void startLine()
          Starts a new line.
 void startRow()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOL

public static final String EOL
Constant for the end-of-line String, used in building mif output.

See Also:
Constant Field Values

TAB

public static final String TAB
Constant for the tab String, used in building mif output.

See Also:
Constant Field Values
Constructor Detail

MifBook

public MifBook(org.apache.commons.logging.Log logger)
Creates an empty MIF document.

Parameters:
logger - The logger to use for user messages.
Method Detail

mifEncode

public static final String mifEncode(String val)
Encode a String using the MIF encoding.

Parameters:
val - The unencoded String.
Returns:
The encoded String.

createPage

public void createPage()
Specified by:
createPage in interface org.axsl.mif.MifBook

addToStream

public void addToStream(String s)
Adds a given string to the output.

Parameters:
s - The String to add to the output.

output

public void output(OutputStream stream)
            throws org.axsl.output.OutputException
Specified by:
output in interface org.axsl.mif.MifBook
Throws:
org.axsl.output.OutputException

setDocumentHeightWidth

public void setDocumentHeightWidth(int height,
                                   int width)
Specified by:
setDocumentHeightWidth in interface org.axsl.mif.MifBook

createTextRect

public void createTextRect(int numCols)
Creates a new text rectangle.

Parameters:
numCols - The number of columns in the new rectangle.

setTextRectProp

public void setTextRectProp(int left,
                            int top,
                            int width,
                            int height)
Sets the properties of the current text rectangle.

Parameters:
left - The x coordinate, in millipoints (??).
top - The y coordinate, in millipoints (??).
width - The width, in millipoints (??).
height - The height, in millipoints (??).

startLine

public void startLine()
Starts a new line.


setBlockProp

public void setBlockProp(int startIndent,
                         int endIndent)
Specified by:
setBlockProp in interface org.axsl.mif.MifBook

createFrame

public void createFrame(int x,
                        int y,
                        int w,
                        int h)
Creates a new anchored frame.

Parameters:
x - The x coordinate, in millipoints (??).
y - The y coordinate, in millipoints (??).
w - The width, in millipoints (??).
h - The height, in millipoints (??).

addImage

public void addImage(String url,
                     int x,
                     int y,
                     int w,
                     int h)
Creates a new image.

Parameters:
url - The URL to the image content.
x - The x coordinate, in millipoints (??).
y - The y coordinate, in millipoints (??).
w - The width, in millipoints (??).
h - The height, in millipoints (??).

createTable

public void createTable()
Specified by:
createTable in interface org.axsl.mif.MifBook

setColumnProp

public void setColumnProp(int colWidth)
Add a column to the current table.

Parameters:
colWidth - The width of the new column.

setCurrent

public void setCurrent(String current)
Specified by:
setCurrent in interface org.axsl.mif.MifBook

startRow

public void startRow()
Specified by:
startRow in interface org.axsl.mif.MifBook

startCell

public void startCell(int rowSpan,
                      int colSpan)
Specified by:
startCell in interface org.axsl.mif.MifBook

endTable

public void endTable()
Switch the reference back from the table to the current textflow.


getNewId

public int getNewId()
Returns the next available id for this document.

Returns:
The next available id for this document.


Copyright © 2017. All rights reserved.