public abstract class AbstractTemplateGenerator extends Object implements TemplateGenerator
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
createLabelsInTemplate
Variable used to show labels in the template or not, if
createLabelsInTemplate is false only the bookmarks are added to the
template, without any label
|
protected DateFormat |
dateFormat |
static boolean |
DEBUG |
protected NumberFormat |
numberFormat |
| Constructor and Description |
|---|
AbstractTemplateGenerator() |
| Modifier and Type | Method and Description |
|---|---|
static int |
calculateRecordCount(Hashtable data)
Calculates the number of data rows.
|
static boolean |
containsHashtableValue(Hashtable data)
Returns true if some of the values in the input parameter is another
hashtable
|
static File |
createFileFieldData(File directory,
String data)
Creates the File 'fielddata.dat' in the specified directory
|
static File |
createImageDataFile(File directory,
Hashtable valuesImages)
Creates the data files with image values.
|
static File |
createTableDataDefinition(File directory,
Hashtable valuesTable,
DateFormat df)
Creates table definition files
Creates one file for each table and one index file (tableIndex.txt) |
static File |
createTableDataDefinition(File directory,
Hashtable valuesTable,
DateFormat df,
NumberFormat numberFormat) |
static File |
createTableDataFile(File directory,
Hashtable valuesTable)
Creates the data files with table values.
|
static File |
createTableDataFile(File directory,
Hashtable valuesTable,
String indexFileName) |
static String |
exportFieldData(Hashtable data,
String delimiter,
DateFormat df)
Creates a String with format: key1 + delimiter + value1 + delimiter +
key2 + delimiter + value2 + delimiter + ... + keyN + delimiter + valueN
|
static String |
exportFieldData(Hashtable data,
String delimiter,
DateFormat df,
NumberFormat numberFormat)
Creates a String with format: key1 + delimiter + value1 + delimiter +
key2 + delimiter + value2 + delimiter + ... + keyN + delimiter + valueN
|
static String |
exportTableData(Hashtable data)
Creates a String with all table data.
|
File |
fillDocument(InputStream input,
String nameFile,
Hashtable fieldValues,
Hashtable valuesTable,
Hashtable valuesImages)
Fills the template
|
File |
fillDocument(String resource,
Hashtable fieldValues,
Hashtable valuesTable,
Hashtable valuesImages)
Fills the specified template
|
File |
fillDocument(String resource,
Hashtable fieldValues,
Hashtable valuesTable,
Hashtable valuesImages,
Hashtable valuesPivotTable) |
static Object[] |
getKeysOrder(Hashtable data) |
protected static double |
getScreenPoints(int pixelsValue)
Calculates the screen point for a pixel value
|
protected static String |
parseNumber(Number number,
NumberFormat numberFormat) |
static void |
savePngImageFile(Image im,
File fImage)
Save the image in the specified File as a png Image.
|
void |
setCreateLabelsInTemplate(boolean createLabels) |
void |
setDateFormat(DateFormat df)
Sets the date format to use in the dates of the document
|
void |
setNumberFormat(NumberFormat nf)
Sets the number format to use in the numeric values of the document
|
static String |
transformFieldData(Hashtable dataField,
DateFormat df)
Creates a String with format: key1 + delimiter + value1 + delimiter +
key2 + delimiter + value2 + delimiter + ... + keyN + delimiter + valueN
Replace all "\n" for "\r" to delete the carriage return
|
static String |
transformFieldData(Hashtable dataField,
DateFormat df,
NumberFormat numberFormat)
Creates a String with format: key1 + delimiter + value1 + delimiter +
key2 + delimiter + value2 + delimiter + ... + keyN + delimiter + valueN
Replace all "\n" for "\r" to delete the carriage return
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateTemplate, fillDocument, queryTemplateFields, queryTemplateFields, setShowTemplatepublic static boolean DEBUG
protected static boolean createLabelsInTemplate
protected DateFormat dateFormat
protected NumberFormat numberFormat
public File fillDocument(String resource, Hashtable fieldValues, Hashtable valuesTable, Hashtable valuesImages) throws Exception
TemplateGeneratorfillDocument in interface TemplateGeneratorresource - : Resource where the template is located.fieldValues - Values for the data fieldsvaluesTable - Table valuesvaluesImages - Image valuesExceptionpublic File fillDocument(InputStream input, String nameFile, Hashtable fieldValues, Hashtable valuesTable, Hashtable valuesImages) throws Exception
TemplateGeneratorfillDocument in interface TemplateGeneratorinput - : Template to fill.nameFile - : Name used to save the filled templatefieldValues - : This object contains the data field values to insert in the
template. Keys must be the field names and values must have
the data field values to insert.valuesTable - : The object contains the table values to insert in the
template. Each key must be the table entity name and value
must be an EntityResultvaluesImages - : The object contains the image values to insert. Key must be
the image field name and value must be the image data. The
value could be an image object (Image), a BytesBlock or a
File.Exceptionpublic File fillDocument(String resource, Hashtable fieldValues, Hashtable valuesTable, Hashtable valuesImages, Hashtable valuesPivotTable) throws Exception
fillDocument in interface TemplateGeneratorExceptionpublic void setCreateLabelsInTemplate(boolean createLabels)
setCreateLabelsInTemplate in interface TemplateGeneratorpublic static String transformFieldData(Hashtable dataField, DateFormat df)
dataField - df - exportFieldData(Hashtable, String, DateFormat)public static String transformFieldData(Hashtable dataField, DateFormat df, NumberFormat numberFormat)
dataField - df - numberFormat - exportFieldData(Hashtable, String, DateFormat,NumberFormat)public static File createFileFieldData(File directory, String data) throws Exception
directory - Directorydata - File contentExceptionpublic static File createTableDataFile(File directory, Hashtable valuesTable) throws Exception
directory - Directory where the files will be created invaluesTable - The object contains the table values to insert in the
template. Each key must be the table entity name and value
must be an EntityResultExceptionpublic static File createTableDataFile(File directory, Hashtable valuesTable, String indexFileName) throws Exception
directory - Directory where the files will be created invaluesTable - The object contains the table values to insert in the
template. Each key must be the table entity name and value
must be an EntityResultindexFileName - Name of the returned file with the table indexExceptionpublic static File createTableDataDefinition(File directory, Hashtable valuesTable, DateFormat df) throws Exception
directory - Directory where the files will be created invaluesTable - The object contains the table data to create the template.
Each key must be the table entity name and value must be an
Hashtable with column names and labelsdf - Exceptionpublic static File createTableDataDefinition(File directory, Hashtable valuesTable, DateFormat df, NumberFormat numberFormat) throws Exception
Exceptionpublic static File createImageDataFile(File directory, Hashtable valuesImages) throws Exception
directory - Directory where the files will be created invaluesImages - The object contains the image values to insert. Key must be
the image field name and value must be the image data. The
value could be an image object (Image), a BytesBlock or a File
.Exceptionprotected static double getScreenPoints(int pixelsValue)
pixelsValue - number of pixelspublic static String exportFieldData(Hashtable data, String delimiter, DateFormat df)
data - Hashtable with all datadelimiter - Delimiter to separate the fieldsdf - Format to use in date data fieldspublic static String exportFieldData(Hashtable data, String delimiter, DateFormat df, NumberFormat numberFormat)
data - Hashtable with all datadelimiter - Delimiter to separate the fieldsdf - Format to use in date data fieldsnumberFormat - Format to use in the numeric fieldsprotected static String parseNumber(Number number, NumberFormat numberFormat)
public static String exportTableData(Hashtable data)
data - Table datapublic static int calculateRecordCount(Hashtable data)
data - public static void savePngImageFile(Image im, File fImage) throws IOException
im - Image to savefImage - FileIOExceptionpublic void setDateFormat(DateFormat df)
TemplateGeneratorsetDateFormat in interface TemplateGeneratordf - Formatpublic void setNumberFormat(NumberFormat nf)
TemplateGeneratorsetNumberFormat in interface TemplateGeneratorpublic static boolean containsHashtableValue(Hashtable data)
data - Copyright © 2016 Imatia Innovation S.L.. All rights reserved.