org.pz.platypus.plugin.pdf
Class Columns

java.lang.Object
  extended by org.pz.platypus.plugin.pdf.Columns

public class Columns
extends java.lang.Object

Keeps track of the number of columns, their size, and the gutter size. Does no implementation. For implementation, see the appropriate Column class.

Author:
alb

Field Summary
private  java.util.ArrayList<Column> columns
           
 
Constructor Summary
Columns(int howMany, float verticalSkip, PdfData pdf)
           
Columns(PdfData pdf)
          Create an arrayList of default number of columns with no preceding vertical space
 
Method Summary
(package private)  float calculateColumnWidth(float textWidth, int cols, PdfData pdf)
           
 int createColumns(int newCount, float verticalSkip, PdfData pdf)
          Sets the number of columns.
 java.lang.String dump(GDD gdd)
           
 Column getColumn(int whichCol)
          Return a designated column
 int getCount()
           
private  float getRecommendedGutterSize(int numberOfCols)
          Figure out the recommended gutter size for a given number of regular columns
 int size()
           
 int startColumnsAtTop(PdfData pdf)
          If we changed column count in the middle of a page, then the columns at the bottom half of the page will be partial height.
(package private)  int validateColumnCount(int colCount, GDD gdd)
          Make sure the specified number of columns is correct ( > 0 ).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columns

private java.util.ArrayList<Column> columns
Constructor Detail

Columns

public Columns(PdfData pdf)
Create an arrayList of default number of columns with no preceding vertical space

Parameters:
pdf - the data on this PDF file

Columns

public Columns(int howMany,
               float verticalSkip,
               PdfData pdf)
Method Detail

createColumns

public int createColumns(int newCount,
                         float verticalSkip,
                         PdfData pdf)
Sets the number of columns. For the time being, these are equally wide and spaced columns. Eventually, we'll permit irregular shapes and varying widths.

Parameters:
verticalSkip - distance to skip on the page before the top of the columns.
newCount - number of new columns
pdf - the Pdf document data
Returns:
number of created columns

validateColumnCount

int validateColumnCount(int colCount,
                        GDD gdd)
Make sure the specified number of columns is correct ( > 0 ). If not set it to 1.

Parameters:
colCount - how many columns
gdd - contains the error logger
Returns:
if valid, the column count; otherwise, 1.

calculateColumnWidth

float calculateColumnWidth(float textWidth,
                           int cols,
                           PdfData pdf)

startColumnsAtTop

public int startColumnsAtTop(PdfData pdf)
If we changed column count in the middle of a page, then the columns at the bottom half of the page will be partial height. However, when we start a succeeding page, those columns should now start at the top of the text area of the new page. This function handles that change by reducing verticalSkip to 0 and adjusting height to be the full height of the text area.

Parameters:
pdf - the PdfData bag
Returns:
how many columns were modified.

getColumn

public Column getColumn(int whichCol)
Return a designated column

Parameters:
whichCol - the index of the column to get ( 0 = leftmost )
Returns:
the specified column, or null on error

getCount

public int getCount()

getRecommendedGutterSize

private float getRecommendedGutterSize(int numberOfCols)
Figure out the recommended gutter size for a given number of regular columns

Parameters:
numberOfCols - number of columns on the page
Returns:
recommended size of gutter in points.

dump

public java.lang.String dump(GDD gdd)

size

public int size()


Copyright © 2008-10 Pacific Data Works LLC