Compiere 3.1

org.compiere.print
Class PrintData

java.lang.Object
  extended by org.compiere.print.PrintData
All Implemented Interfaces:
Serializable

public class PrintData
extends Object
implements Serializable

Print Data Structure. Created by DataEngine A Structure has rows, wich contain elements. Elements can be end nodes (PrintDataElements) or data structures (PrintData). The row data is sparse - i.e. null if not existing. A Structure has optional meta info about content (PrintDataColumn).

Version:
$Id: PrintData.java,v 1.3 2006/07/30 00:53:02 jjanke Exp $
Author:
Jorg Janke
See Also:
Serialized Form

Field Summary
static String XML_ATTRIBUTE_COUNT
          XML Attribute Count
static String XML_ATTRIBUTE_FUNCTION_ROW
          XML Attribute Function Row
static String XML_ATTRIBUTE_NAME
          XML Attribute Name
static String XML_ATTRIBUTE_NO
          XML Attribute Number
static String XML_ROW_TAG
          XML Row Name
static String XML_TAG
          XML Element Name
 
Constructor Summary
PrintData(Ctx ctx, String name)
          Data Parent Constructor
PrintData(Ctx ctx, String name, ArrayList<Object> nodes)
          Data Parent Constructor
 
Method Summary
 void addNode(PrintData parent)
          Add Parent node to Data Structure row
 void addNode(PrintDataElement node)
          Add node to Data Structure row
 void addRow(boolean functionRow, int levelNo)
          Add Row
 boolean createXML(StreamResult result)
          Create XML representation to StreamResult
 boolean createXML(String fileName)
          Create XML representation to File
 void dump()
          Dump All Data - header and rows
 void dumpCurrentRow()
          Dump All Data
 void dumpHeader()
          Dump All Data
 PrintDataColumn[] getColumnInfo()
          Get optional Column Info
 Ctx getCtx()
          Get Context
 Document getDocument()
          Get XML Document representation
 int getIndex(int AD_Column_ID)
          Get Index of Node in Structure (not recursing) row
 int getIndex(String columnName)
          Get Index of Node in Structure (not recursing) row
 int getLineLevelNo()
          Get Line Level Number for current row
 String getName()
          Get Name
 Object getNode(int index)
          Get Node with index in row
 Object getNode(Integer AD_Column_ID)
          Get Node with AD_Column_ID in row
 Object getNode(String name)
          Get Node with Name in row
 int getNodeCount()
          Return Number of nodes in row
 PrintDataElement getPKey()
          Get Primary Key in row
 int getRowCount()
          Get Row Count
 int getRowIndex()
          Get Current Row Index
 ArrayList<ArrayList<Object>> getRows()
           
 String getSQL()
          Get optional SQL
 String getTableName()
          Get optional TableName
 boolean hasLevelNo()
          PrintData has Level No
 boolean isEmpty()
          Returns true if no Nodes in row
 boolean isFunctionRow()
          Is the current Row a Function Row
 boolean isFunctionRow(int row)
          Is the Row a Function Row
 boolean isPageBreak()
          Is the current Row a Function Row
static void main(String[] args)
          Test
static PrintData parseXML(Ctx ctx, File input)
          Create PrintData from XML
 void setColumnInfo(PrintDataColumn[] newInfo)
          Set optional Column Info
 void setHasLevelNo(boolean hasLevelNo)
          PrintData has Level No
 boolean setRowIndex(int row)
          Set Row Index
 boolean setRowNext()
          Set Row Index to next
 void setSQL(String sql)
          Set SQL (optional)
 void setTableName(String TableName)
          Set TableName (optional)
 String toString()
          String representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_TAG

public static final String XML_TAG
XML Element Name

See Also:
Constant Field Values

XML_ROW_TAG

public static final String XML_ROW_TAG
XML Row Name

See Also:
Constant Field Values

XML_ATTRIBUTE_NAME

public static final String XML_ATTRIBUTE_NAME
XML Attribute Name

See Also:
Constant Field Values

XML_ATTRIBUTE_COUNT

public static final String XML_ATTRIBUTE_COUNT
XML Attribute Count

See Also:
Constant Field Values

XML_ATTRIBUTE_NO

public static final String XML_ATTRIBUTE_NO
XML Attribute Number

See Also:
Constant Field Values

XML_ATTRIBUTE_FUNCTION_ROW

public static final String XML_ATTRIBUTE_FUNCTION_ROW
XML Attribute Function Row

See Also:
Constant Field Values
Constructor Detail

PrintData

public PrintData(Ctx ctx,
                 String name)
Data Parent Constructor

Parameters:
ctx - context
name - data element name

PrintData

public PrintData(Ctx ctx,
                 String name,
                 ArrayList<Object> nodes)
Data Parent Constructor

Parameters:
ctx - context
name - data element name
nodes - ArrayList with nodes (content not checked)
Method Detail

getCtx

public Ctx getCtx()
Get Context

Returns:
context

getName

public String getName()
Get Name

Returns:
name

setColumnInfo

public void setColumnInfo(PrintDataColumn[] newInfo)
Set optional Column Info

Parameters:
newInfo - Column Info

getColumnInfo

public PrintDataColumn[] getColumnInfo()
Get optional Column Info

Returns:
Column Info

setSQL

public void setSQL(String sql)
Set SQL (optional)

Parameters:
sql - SQL

getSQL

public String getSQL()
Get optional SQL

Returns:
SQL

setTableName

public void setTableName(String TableName)
Set TableName (optional)

Parameters:
TableName - TableName

getTableName

public String getTableName()
Get optional TableName

Returns:
TableName

toString

public String toString()
String representation

Overrides:
toString in class Object
Returns:
info

isEmpty

public boolean isEmpty()
Returns true if no Nodes in row

Returns:
true if no Nodes in row

getNodeCount

public int getNodeCount()
Return Number of nodes in row

Returns:
number of nodes in row

addRow

public void addRow(boolean functionRow,
                   int levelNo)
Add Row

Parameters:
functionRow - true if function row
levelNo - Line detail Level Number 0=Normal

setRowIndex

public boolean setRowIndex(int row)
Set Row Index

Parameters:
row - row index
Returns:
true if success

setRowNext

public boolean setRowNext()
Set Row Index to next

Returns:
true if success

getRowCount

public int getRowCount()
Get Row Count

Returns:
row count

getRowIndex

public int getRowIndex()
Get Current Row Index

Returns:
row index

isFunctionRow

public boolean isFunctionRow(int row)
Is the Row a Function Row

Parameters:
row - row no
Returns:
true if function row

isFunctionRow

public boolean isFunctionRow()
Is the current Row a Function Row

Returns:
true if function row

isPageBreak

public boolean isPageBreak()
Is the current Row a Function Row

Returns:
true if function row

setHasLevelNo

public void setHasLevelNo(boolean hasLevelNo)
PrintData has Level No

Parameters:
hasLevelNo - true if sql contains LevelNo

hasLevelNo

public boolean hasLevelNo()
PrintData has Level No

Returns:
true if sql contains LevelNo

getLineLevelNo

public int getLineLevelNo()
Get Line Level Number for current row

Returns:
line level no 0 = default

addNode

public void addNode(PrintData parent)
Add Parent node to Data Structure row

Parameters:
parent - parent

addNode

public void addNode(PrintDataElement node)
Add node to Data Structure row

Parameters:
node - node

getNode

public Object getNode(int index)
Get Node with index in row

Parameters:
index - index
Returns:
PrintData(Element) of index or null

getNode

public Object getNode(String name)
Get Node with Name in row

Parameters:
name - name
Returns:
PrintData(Element) with Name or null

getNode

public Object getNode(Integer AD_Column_ID)
Get Node with AD_Column_ID in row

Parameters:
AD_Column_ID - AD_Column_ID
Returns:
PrintData(Element) with AD_Column_ID or null

getPKey

public PrintDataElement getPKey()
Get Primary Key in row

Returns:
PK or null

getIndex

public int getIndex(String columnName)
Get Index of Node in Structure (not recursing) row

Parameters:
columnName - name
Returns:
index or -1

getIndex

public int getIndex(int AD_Column_ID)
Get Index of Node in Structure (not recursing) row

Parameters:
AD_Column_ID - AD_Column_ID
Returns:
index or -1

dump

public void dump()
Dump All Data - header and rows


dumpHeader

public void dumpHeader()
Dump All Data


dumpCurrentRow

public void dumpCurrentRow()
Dump All Data


getDocument

public Document getDocument()
Get XML Document representation

Returns:
XML document

createXML

public boolean createXML(StreamResult result)
Create XML representation to StreamResult

Parameters:
result - StreamResult
Returns:
true if success

createXML

public boolean createXML(String fileName)
Create XML representation to File

Parameters:
fileName - file name
Returns:
true if success

parseXML

public static PrintData parseXML(Ctx ctx,
                                 File input)
Create PrintData from XML

Parameters:
ctx - context
input - InputSource
Returns:
PrintData

getRows

public ArrayList<ArrayList<Object>> getRows()

main

public static void main(String[] args)
Test

Parameters:
args - test

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.