/**
* Copyright (c) 2006 by Know-Center, Graz, Austria
*
* This software is the confidential and proprietary information of Know-Center,
* Graz, Austria. You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with Know-Center.
*
* KNOW-CENTER MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT. KNOW-CENTER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
* LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES.
*
* $Id: TablePos.java,v 1.1 2006/08/25 17:10:08 wprinz Exp $
*/
package at.knowcenter.wag.egov.egiz.pdf;
import java.io.Serializable;
import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
/**
* Class that holds the exact position where the table should be written to the
* document.
*
* @author wprinz
* @author mruhmer
*/
public class TablePos implements Serializable
{
/**
* SVUID.
*/
private static final long serialVersionUID = -5299027706623518059L;
/**
* The page on which the block should be displayed.
*
*/
private int page = 0;
/**
* The x position.
*/
private float pos_x = 0.0f;
/**
* The y position.
*/
private float pos_y = 0.0f;
/**
* The width of the block.
*/
private float width = 0.0f;
/**
* The top y position of the footer line.
*/
public float footer_line = 0.0f;
/**
* The y position.
*/
public String myposstring = "";
private boolean newpage = false;
private boolean autoX = true;
private boolean autoY = true;
private boolean autoW = true;
private boolean autoP = true;
public boolean isXauto()
{
return this.autoX;
}
public boolean isYauto()
{
return this.autoY;
}
public boolean isWauto()
{
return this.autoW;
}
public boolean isPauto()
{
return this.autoP;
}
public boolean isNewPage()
{
return this.newpage;
}
public int getPage()
{
return this.page;
}
public float getFooterLine()
{
//ignore if newpage and y is not auto
if (!this.autoY || this.newpage)
{
return 0.0f;
}
return this.footer_line;
}
public float getPosX()
{
return this.pos_x;
}
public float getPosY()
{
return this.pos_y;
}
public float getWidth()
{
return this.width;
}
public TablePos()
{
//nothing to do --> default
}
/**
* Constructor.
*
* @param pos_string The pos instruction.
* format : [x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo]
* x_algo:='auto' ... automatic positioning x
* floatvalue ... absolute x
* y_algo:='auto' ... automatic positioning y
* floatvalue ... absolute y
* w_algo:='auto' ... automatic width
* floatvalue ... absolute width
* p_algo:='auto' ... automatic last page
* 'new' ... new page
* intvalue ... pagenumber
* f_algo floatvalue ... consider footerline (only if y_algo is auto and p_algo is not 'new')
* @throws PDFDocumentException
*/
public TablePos(String pos_string) throws PDFDocumentException
{
//parse posstring and throw exception
//[x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo]
String[] strs = pos_string.split(";");
try
{
for (int cmds = 0;cmds