Class AbstractPLVBox<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>
java.lang.Object
com.helger.pdflayout.base.AbstractPLObject<IMPLTYPE>
com.helger.pdflayout.base.AbstractPLRenderableObject<IMPLTYPE>
com.helger.pdflayout.element.vbox.AbstractPLVBox<IMPLTYPE>
- Type Parameters:
IMPLTYPE- Implementation type
- All Implemented Interfaces:
com.helger.commons.id.IHasID<String>,com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>,IPLHasOutline,IPLObject<IMPLTYPE>,IPLRenderableObject<IMPLTYPE>,IPLSplittableObject<IMPLTYPE,,IMPLTYPE> IPLVisitable
- Direct Known Subclasses:
PLVBox
public abstract class AbstractPLVBox<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>
extends AbstractPLRenderableObject<IMPLTYPE>
implements IPLSplittableObject<IMPLTYPE,IMPLTYPE>
Vertical box - groups several rows.
- Author:
- Philip Helger
-
Field Summary
FieldsFields inherited from interface com.helger.pdflayout.base.IPLSplittableObject
DEFAULT_VERT_SPLITTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAndReturnRow(int nIndex, IPLRenderableObject<?> aElement, HeightSpec aHeight) Add a row to this VBox.addAndReturnRow(IPLRenderableObject<?> aElement) Add a row to this VBox using auto height.final PLVBoxRowaddAndReturnRow(IPLRenderableObject<?> aElement, HeightSpec aHeight) Add a row to this VBox.addRow(int nIndex, IPLRenderableObject<?> aElement, HeightSpec aHeight) Add a row to this VBox.addRow(IPLRenderableObject<?> aElement) Add a row to this VBox using auto height.final IMPLTYPEaddRow(IPLRenderableObject<?> aElement, HeightSpec aHeight) Add a row to this VBox.booleanvoidforEachRow(Consumer<? super PLVBoxRow> aConsumer) voidforEachRowByIndex(ObjIntConsumer<? super PLVBoxRow> aConsumer) com.helger.commons.collection.impl.ICommonsList<PLVBoxRow>final intgetRowAtIndex(int nIndex) Get the row at the specified index.intgetRowElementAtIndex(int nIndex) Get the element in the row at the specified index.getRows()final booleanfinal booleanprotected voidPL objects need to overwrite this method to reset their preparation state.protected SizeSpeconPrepare(PreparationContext aCtx) The abstract method that must be implemented by all subclasses.protected voidonRender(PageRenderContext aCtx) Abstract method to be implemented by subclasses.removeRow(int nIndex) Remove the row with the specified index.setBasicDataFrom(IMPLTYPE aSource) For copying stuff internally.final IMPLTYPEsetFullWidth(boolean bFullWidth) Set usage of full width.final IMPLTYPEsetHeaderRowCount(int nHeaderRowCount) Set the number of header rows in this table.final IMPLTYPEsetVertSplittable(boolean bVertSplittable) Change the vertical splitability of this object.splitElementVert(float fAvailableWidth, float fAvailableHeight) Split this element vertically into sub-elements according to the available height.toString()com.helger.commons.state.EChangevisit(IPLVisitor aVisitor) Visit this object and all descendantsMethods inherited from class com.helger.pdflayout.base.AbstractPLRenderableObject
getPrepareAvailableSize, getPreparedSize, getRenderSize, getRenderSize, internalCheckAlreadyPrepared, internalCheckNotPrepared, internalMarkAsNotPrepared, internalMarkAsNotPreparedDontPropagate, internalMarkAsPrepared, isPrepared, onRenderSizeChange, prepare, renderMethods inherited from class com.helger.pdflayout.base.AbstractPLObject
getDebugID, getID, onAfterSetID, setIDMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.traits.IGenericImplTrait
thisAsTMethods inherited from interface com.helger.commons.id.IHasID
getIDMethods inherited from interface com.helger.pdflayout.base.IPLHasOutline
getOutlineBottom, getOutlineLeft, getOutlineRight, getOutlineTop, getOutlineXSum, getOutlineYSumMethods inherited from interface com.helger.pdflayout.base.IPLObject
getAsSplittable, getDebugID, hasIDMethods inherited from interface com.helger.pdflayout.base.IPLRenderableObject
beforeRender, getPreparedHeight, getPreparedWidth, getRenderHeight, getRenderWidthMethods inherited from interface com.helger.pdflayout.base.IPLSplittableObject
internalCreateNewVertSplitObject
-
Field Details
-
DEFAULT_FULL_WIDTH
public static final boolean DEFAULT_FULL_WIDTH- See Also:
-
-
Constructor Details
-
AbstractPLVBox
public AbstractPLVBox()
-
-
Method Details
-
setBasicDataFrom
@Nonnull @OverridingMethodsMustInvokeSuper public IMPLTYPE setBasicDataFrom(@Nonnull IMPLTYPE aSource) Description copied from interface:IPLObjectFor copying stuff internally. Must always call super method- Specified by:
setBasicDataFromin interfaceIPLObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>- Overrides:
setBasicDataFromin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>- Parameters:
aSource- Source object to copy from. May not benull.- Returns:
- this for chaining
-
getRowCount
- Returns:
- The number of rows. Always ≥ 0.
-
getAllRows
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PLVBoxRow> getAllRows()- Returns:
- All rows. Never
null.
-
getRows
- Returns:
- All rows. Never
null.
-
forEachRow
-
forEachRowByIndex
-
getRowAtIndex
Get the row at the specified index.- Parameters:
nIndex- The index to use. Should be ≥ 0.- Returns:
nullif an invalid index was provided.
-
getFirstRow
- Returns:
- The first row or
nullif no row is present.
-
getLastRow
- Returns:
- The last row or
nullif no row is present.
-
getRowElementAtIndex
Get the element in the row at the specified index.- Parameters:
nIndex- The index to use. Should be ≥ 0.- Returns:
nullif an invalid index was provided.
-
getFirstRowElement
- Returns:
- The element in the first row or
nullif no row is present.
-
getLastRowElement
- Returns:
- The element in the last row or
nullif no row is present.
-
getDefaultHeight
- Returns:
- The default height to be used for rows if none is provided. May not
be
null.
-
addAndReturnRow
Add a row to this VBox using auto height.- Parameters:
aElement- The row to be added. May not benull.- Returns:
- the created row
-
addAndReturnRow
@Nonnull public final PLVBoxRow addAndReturnRow(@Nonnull IPLRenderableObject<?> aElement, @Nonnull HeightSpec aHeight) Add a row to this VBox.- Parameters:
aElement- The row to be added. May not benull.aHeight- The height specification to use. May not benull.- Returns:
- the created row
-
addRow
Add a row to this VBox using auto height.- Parameters:
aElement- The row to be added. May not benull.- Returns:
- this
-
addRow
@Nonnull public final IMPLTYPE addRow(@Nonnull IPLRenderableObject<?> aElement, @Nonnull HeightSpec aHeight) Add a row to this VBox.- Parameters:
aElement- The row to be added. May not benull.aHeight- The height specification to use. May not benull.- Returns:
- this for chaining
-
addAndReturnRow
@Nonnull public PLVBoxRow addAndReturnRow(@Nonnegative int nIndex, @Nonnull IPLRenderableObject<?> aElement, @Nonnull HeightSpec aHeight) Add a row to this VBox.- Parameters:
nIndex- The index where the row should be added. Must be ≥ 0.aElement- The row to be added. May not benull.aHeight- The height specification to use. May not benull.- Returns:
- the created row. Never
null.
-
addRow
@Nonnull public IMPLTYPE addRow(@Nonnegative int nIndex, @Nonnull IPLRenderableObject<?> aElement, @Nonnull HeightSpec aHeight) Add a row to this VBox.- Parameters:
nIndex- The index where the row should be added. Must be ≥ 0.aElement- The row to be added. May not benull.aHeight- The height specification to use. May not benull.- Returns:
- this for chaining
-
removeRow
Remove the row with the specified index.- Parameters:
nIndex- The index to be removed.- Returns:
- this for chaining
-
isVertSplittable
public final boolean isVertSplittable()- Specified by:
isVertSplittablein interfaceIPLObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>- Specified by:
isVertSplittablein interfaceIPLSplittableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>,IMPLTYPE extends AbstractPLVBox<IMPLTYPE>> - Returns:
trueif this element is vertically splittable,falseotherwise. The default isIPLSplittableObject.DEFAULT_VERT_SPLITTABLE.
-
setVertSplittable
Description copied from interface:IPLSplittableObjectChange the vertical splitability of this object.- Specified by:
setVertSplittablein interfaceIPLSplittableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>,IMPLTYPE extends AbstractPLVBox<IMPLTYPE>> - Parameters:
bVertSplittable-trueif this element is splittable,falseotherwise.- Returns:
- this for chaining
-
getHeaderRowCount
- Returns:
- The number of header rows. By default 0. Always ≥ 0.
-
setHeaderRowCount
Set the number of header rows in this table. Header rows get repeated on every page upon rendering.- Parameters:
nHeaderRowCount- The number of header rows, to be repeated by page. Must be ≥ 0.- Returns:
- this
-
containsAnyVertSplittableElement
public boolean containsAnyVertSplittableElement() -
isFullWidth
public final boolean isFullWidth()- Returns:
- Should the VBox occupy the full width? The default is
DEFAULT_FULL_WIDTH.
-
setFullWidth
Set usage of full width.- Parameters:
bFullWidth-trueto enable full width,falseto use only what is available.- Returns:
- this for chaining
-
visit
@Nonnull public com.helger.commons.state.EChange visit(@Nonnull IPLVisitor aVisitor) throws IOException Description copied from interface:IPLVisitableVisit this object and all descendants- Specified by:
visitin interfaceIPLVisitable- Overrides:
visitin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>- Parameters:
aVisitor- The visitor to use. May not benull.- Returns:
EChange.CHANGEDif something changed internally.- Throws:
IOException- on PDFBox error
-
onPrepare
Description copied from class:AbstractPLRenderableObjectThe abstract method that must be implemented by all subclasses. It is ensured that this method is called only once per instance!- Specified by:
onPreparein classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>- Parameters:
aCtx- Preparation context. Nevernull.- Returns:
- The size of the rendered element without padding, border and
margin. May not be
null.
-
onMarkAsNotPrepared
protected void onMarkAsNotPrepared()Description copied from class:AbstractPLRenderableObjectPL objects need to overwrite this method to reset their preparation state. They also need to propagate this to their children!- Specified by:
onMarkAsNotPreparedin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>
-
splitElementVert
Description copied from interface:IPLSplittableObjectSplit this element vertically into sub-elements according to the available height. Splitting is always done after preparation and must return prepared objects!- Specified by:
splitElementVertin interfaceIPLSplittableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>,IMPLTYPE extends AbstractPLVBox<IMPLTYPE>> - Parameters:
fAvailableWidth- The available width without outline of the element.fAvailableHeight- The available height without outline of this element. Must be ≥ 0.- Returns:
nullif splitting makes no sense.
-
onRender
Description copied from class:AbstractPLRenderableObjectAbstract method to be implemented by subclasses.- Specified by:
onRenderin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>- Parameters:
aCtx- Rendering context. Nevernull.- Throws:
IOException- In case of a PDFBox error
-
toString
- Overrides:
toStringin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLVBox<IMPLTYPE>>
-