com.iproject.wbmpcreator
Class WBMPTable

java.lang.Object
  |
  +--com.iproject.wbmpcreator.WBMPfile
        |
        +--com.iproject.wbmpcreator.WBMPTable

public class WBMPTable
extends WBMPfile

See Also:
Serialized Form

Fields inherited from class com.iproject.wbmpcreator.WBMPfile
ALIGN_CENTER, ALIGN_HORIZONTAL_CENTER, ALIGN_HORIZONTAL_LEFT, ALIGN_HORIZONTAL_RIGHT, ALIGN_VERTICAL_BOTTOM, ALIGN_VERTICAL_CENTER, ALIGN_VERTICAL_TOP, APPEND_MODE_CONTINUOUS, APPEND_MODE_DIVISION, LINE_CHAIN3_1, LINE_CHAIN3_2, LINE_INT2_1, LINE_INT2_2, LINE_INT3_2, LINE_POINT1, LINE_POINT2, LINE_POINT3, MIX_MODE_AND, MIX_MODE_NOT, MIX_MODE_OR, MIX_MODE_XOR
 
Constructor Summary
WBMPTable()
          Empty constructor of a WBMPTable.
WBMPTable(java.lang.String newColumnNames, java.util.Vector newColumnData)
          Constructor of a WBMPTable.
 
Method Summary
 java.util.Vector getColumnData()
          Gets all data from WBMPTable.
 java.lang.String getColumnNames()
          Gets the header.
 java.awt.Font getDataFont()
          Gets the font of data in a table.
 java.awt.Font getHeaderFont()
          Gets the font of the header.
 WBMPDimension getTableSize()
          Gets desired dimension of a resulting image.
static WBMPfile getWBMPCustomTable(CustomFont userFont, WBMPDimension tableSize, java.util.Vector colWidth, java.util.Vector header, java.util.Vector body, boolean isHeaderOnEveryPage)
          Method to get the WBMP representation of a table using Custom Font.
 void saveWBMPTable(java.lang.String filename, boolean headerOnEachPiece)
          Saves WBMPTable to file(s) with the given filename mask.
This method saves table to one or several *.wbmp files depending on table size.
 void setColumnData(java.util.Vector newColumnData)
          Fills WBMPTable with data.
 void setColumnNames(java.lang.String newColumnNames)
          Sets the header.
 void setDataFont(java.awt.Font newDataFont)
          Sets the font of data in a table.
 void setHeaderFont(java.awt.Font newHeaderFont)
          Sets the font of the header.
 void setTableSize(WBMPDimension newTableSize)
          Sets the desired resolution of resulting WBMP image.
 
Methods inherited from class com.iproject.wbmpcreator.WBMPfile
align, convert2WBMPfile, convert2WBMPfile, createWBMPFile, destroyWBMPFile, draw3DRect, drawArc, drawCircle, drawCustomString, drawLine, drawOval, drawPoint, drawRect, drawSpecialLine, drawString, drawTTFString, executeSequence, getByteArray, getElementAt, getRectArea, getString, getWBMPLength, getWBMPpic, getWBMPWidth, invertWBMPImage, mix, mix, openEWBMPFile, openWBMPFile, printWBMPImage, reduce, rotate, saveEWBMP2File, saveWBMPFile, setElementAt, setWBMPLength, setWBMPWidth, writeWBMPFile
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WBMPTable

public WBMPTable()
Empty constructor of a WBMPTable. If WBMPTable is created using this constructor, it is necessary to call the following methods:

1. setColumnNames() - to set header (names of the columns)

2. setColumnData() - to insert data into table


WBMPTable

public WBMPTable(java.lang.String newColumnNames,
                 java.util.Vector newColumnData)
Constructor of a WBMPTable. Includes all data required.
Parameters:
newColumnNames - the names of the columns in a string.
newColumnData - the Vector of data in the same format.
Method Detail

setColumnNames

public void setColumnNames(java.lang.String newColumnNames)
Sets the header.
Parameters:
newColumnNames - new header

getColumnNames

public java.lang.String getColumnNames()
Gets the header.

setColumnData

public void setColumnData(java.util.Vector newColumnData)
Fills WBMPTable with data.
Parameters:
newColumnData - new data Vector for a table

getColumnData

public java.util.Vector getColumnData()
Gets all data from WBMPTable.

setHeaderFont

public void setHeaderFont(java.awt.Font newHeaderFont)
Sets the font of the header.
Parameters:
newHeaderFont - new font

getHeaderFont

public java.awt.Font getHeaderFont()
Gets the font of the header.

setDataFont

public void setDataFont(java.awt.Font newDataFont)
Sets the font of data in a table.
Parameters:
newDataFont - new font

getDataFont

public java.awt.Font getDataFont()
Gets the font of data in a table.

setTableSize

public void setTableSize(WBMPDimension newTableSize)
Sets the desired resolution of resulting WBMP image. The resulting image will be NOT more that desired (Y size may be less if necessary).
Parameters:
newTableSize - dimension of a resulting image.

getTableSize

public WBMPDimension getTableSize()
Gets desired dimension of a resulting image.

saveWBMPTable

public void saveWBMPTable(java.lang.String filename,
                          boolean headerOnEachPiece)
Saves WBMPTable to file(s) with the given filename mask.
This method saves table to one or several *.wbmp files depending on table size.
Parameters:
filename - file name WITHOUT extension.
headerOnEachPiece - a flag to show/not show the header in 2..inf image

getWBMPCustomTable

public static WBMPfile getWBMPCustomTable(CustomFont userFont,
                                          WBMPDimension tableSize,
                                          java.util.Vector colWidth,
                                          java.util.Vector header,
                                          java.util.Vector body,
                                          boolean isHeaderOnEveryPage)
                                   throws java.lang.Exception
Method to get the WBMP representation of a table using Custom Font. It allows user draw table of ANY COMPLEXITY with multiple rows and columns of various size. This method is MUCH more preferrable than the TTF fonts using one because it works faster, gives readable result and lets put to the page as much information as possible.
Parameters:
userFont - the CustomFont instance. If the WBMPCustomFont.getDefaultFont() font is specified - the default 4x6 font is used.
tableSize - the size of each part of the table
colWidth - the size of columns in percents. NOTE that all numeric values are added as Strings!
header - the header of a table
body - the body of a table
isHeaderOnEveryPage - a flag representing existance of a header on every page

How to use it? See the sample:

Vector v=new Vector();
v.add("20"); // 1 column size
v.add("30"); // 2 column size
v.add("50"); // 3 column size
Vector v1=new Vector(); // header columns names
v1.add("COL1");
v1.add("COL2");
v1.add("COL3");
Vector v2=new Vector(); //body - a Vector of Vectors.
Vector s=new Vector();
s.add("COLUMN DATA 1");
s.add("COLUMN DATA 2");
s.add("COLUMN DATA 3");
v2.add(s);
WBMPTable.getWBMPCustomTable(WBMPCustomFont.getDefaultFont(),
new WBMPDimension(0,0,95,60),v,v1,v2,false).saveWBMP2File("c:\\test.wbmp");

It is evident that users can add to the table body as much rows as they need. All rows are delimited with horizontal lines.
If the table representation exceeds one image, the resulting WBMPfile instance contains several images which can be obtained by the WBMPfile.getRectArea() method.
Since:
1.43