Package com.storedobject.pdf
Class PDF.ObjectFormTable<T extends StoredObject>
java.lang.Object
com.storedobject.pdf.PDFTable
com.storedobject.pdf.PDF.ObjectFormTable<T>
- Type Parameters:
T
- Class type of theStoredObject
instance
- All Implemented Interfaces:
PDFElement
- Enclosing class:
PDF
Define a table where
StoredObject
instances can be added in a "form" style (Each attribute is printed
in a separate row).-
Field Summary
Fields inherited from interface com.storedobject.pdf.PDFElement
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, TEXT_DIRECTION_DEFAULT, TEXT_DIRECTION_LTR, TEXT_DIRECTION_NO_BIDI, TEXT_DIRECTION_RTL
-
Constructor Summary
ConstructorsConstructorDescriptionObjectFormTable
(Class<T> objectClass, StringList attributes) Create a table for the given type ofStoredObject
class.ObjectFormTable
(Class<T> objectClass, String... attributes) Create a table for the given type ofStoredObject
class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an object instance to the table.void
configureAttribute
(String attribute, Function<T, ?> valueFunction) Configure the given attribute to use the supplied function for obtaining its values instead of the method of the object's class.protected PDFCell
createLabelCell
(String attribute, String label) Create the label cell.protected PDFCell
createValueCell
(String attribute, Object value) Create the value cell.void
By invoking this method, the output can be made available as stringified (decoded) values.Methods inherited from class com.storedobject.pdf.PDFTable
addBlankCell, addBlankCell, addBlankCell, addBlankCell, addBlankRow, addBlankRow, addBlankRow, addBlankRow, addBlankRow, addBlankRow, addCell, addCell, addCell, addCell, addCell, addRowCell, addRowCell, deleteBodyRows, deleteLastRow, deleteRow, getAbsoluteWidths, getChunks, getDefaultCell, getFooterHeight, getFooterRows, getHeaderHeight, getHeaderRows, getHorizontalAlignment, getKeepTogether, getNumberOfColumns, getNumberOfRows, getRowHeight, getTextDirection, getTotalHeight, getTotalWidth, getWidthPercentage, isComplete, isSkipFirstHeader, isSkipLastFooter, isSplitRows, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBreakPoints, setComplete, setFooterRows, setHeaderRows, setHorizontalAlignment, setKeepTogether, setSkipFirstHeader, setSkipLastFooter, setSplitRows, setTextDirection, setTotalWidth, setTotalWidth, setWidthPercentage, setWidthPercentage, setWidths, setWidths
-
Constructor Details
-
ObjectFormTable
Create a table for the given type ofStoredObject
class.- Parameters:
objectClass
- Object classattributes
- List of attributes to be reported
-
ObjectFormTable
Create a table for the given type ofStoredObject
class.- Parameters:
objectClass
- Object classattributes
- List of attributes to be reported
-
-
Method Details
-
addObject
Add an object instance to the table. This will create one row for each attribute.- Parameters:
object
- Object to be added.
-
createLabelCell
Create the label cell. Override this method if you want a customized cell.- Parameters:
attribute
- Attribute for which cell to be createdlabel
- Label to be printed (Label is automatically generated from the attribute)- Returns:
- The cell that is created.
-
createValueCell
-
stringifyValues
public void stringifyValues()By invoking this method, the output can be made available as stringified (decoded) values.Note: This needs to be invoked before adding any objects to the table
-
configureAttribute
Configure the given attribute to use the supplied function for obtaining its values instead of the method of the object's class.Note: This needs to be invoked before adding any objects to the table
- Parameters:
attribute
- Name of the attribute to configure.valueFunction
- Function to obtain the attribute value.
-