Class AbstractPLHBox<IMPLTYPE extends AbstractPLHBox<IMPLTYPE>>
java.lang.Object
com.helger.pdflayout.base.AbstractPLObject<IMPLTYPE>
com.helger.pdflayout.base.AbstractPLRenderableObject<IMPLTYPE>
com.helger.pdflayout.element.hbox.AbstractPLHBox<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:
PLHBox,PLTableRow
public abstract class AbstractPLHBox<IMPLTYPE extends AbstractPLHBox<IMPLTYPE>>
extends AbstractPLRenderableObject<IMPLTYPE>
implements IPLSplittableObject<IMPLTYPE,IMPLTYPE>
Horizontal box - groups several columns. Each column was a width with one of
the supported types:
- absolute - the width is explicitly specified in user units
- percentage - the width is specified in percentage of the surrounding element
- star - the width of all columns with this type is evenly spaced on the available width. So if at least one 'star' width column is available, the hbox uses the complete available width.
- auto - the width of the column is determined by the width of the content. The maximum width assigned to this column type is the same as for 'star' width columns.
- Author:
- Philip Helger
-
Field Summary
Fields inherited from interface com.helger.pdflayout.base.IPLSplittableObject
DEFAULT_VERT_SPLITTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAndReturnColumn(int nIndex, IPLRenderableObject<?> aElement, WidthSpec aWidth) addAndReturnColumn(IPLRenderableObject<?> aElement, WidthSpec aWidth) addColumn(int nIndex, IPLRenderableObject<?> aElement, WidthSpec aWidth) addColumn(IPLRenderableObject<?> aElement, WidthSpec aWidth) booleanvoidforEachColumn(Consumer<? super PLHBoxColumn> aConsumer) voidforEachColumnByIndex(ObjIntConsumer<? super PLHBoxColumn> aConsumer) com.helger.commons.collection.impl.ICommonsList<PLHBoxColumn>getColumnAtIndex(int nIndex) intgetColumnElementAtIndex(int nIndex) protected AbstractPLRenderableObject<?>internalCreateVertSplitEmptyElement(IPLRenderableObject<?> aSrcObject, float fWidth, float fHeight) Create an empty element that is to be used as a place holder for splitting.final 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.removeColumn(int nIndex) setBasicDataFrom(IMPLTYPE aSource) For copying stuff internally.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
-
Constructor Details
-
AbstractPLHBox
public AbstractPLHBox()
-
-
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 AbstractPLHBox<IMPLTYPE>>- Overrides:
setBasicDataFromin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLHBox<IMPLTYPE>>- Parameters:
aSource- Source object to copy from. May not benull.- Returns:
- this for chaining
-
getColumnCount
- Returns:
- The number of columns. Always ≥ 0.
-
getAllColumns
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PLHBoxColumn> getAllColumns()- Returns:
- All columns. Never
null.
-
getColumns
- Returns:
- All columns. Never
null.
-
forEachColumn
-
forEachColumnByIndex
-
getColumnAtIndex
-
getFirstColumn
-
getLastColumn
-
getColumnElementAtIndex
-
getFirstColumnElement
-
getLastColumnElement
-
addAndReturnColumn
@Nonnull public PLHBoxColumn addAndReturnColumn(@Nonnull IPLRenderableObject<?> aElement, @Nonnull WidthSpec aWidth) -
addColumn
-
addAndReturnColumn
@Nonnull public PLHBoxColumn addAndReturnColumn(@CheckForSigned int nIndex, @Nonnull IPLRenderableObject<?> aElement, @Nonnull WidthSpec aWidth) -
addColumn
@Nonnull public IMPLTYPE addColumn(@CheckForSigned int nIndex, @Nonnull IPLRenderableObject<?> aElement, @Nonnull WidthSpec aWidth) -
removeColumn
-
isVertSplittable
public final boolean isVertSplittable()- Specified by:
isVertSplittablein interfaceIPLObject<IMPLTYPE extends AbstractPLHBox<IMPLTYPE>>- Specified by:
isVertSplittablein interfaceIPLSplittableObject<IMPLTYPE extends AbstractPLHBox<IMPLTYPE>,IMPLTYPE extends AbstractPLHBox<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 AbstractPLHBox<IMPLTYPE>,IMPLTYPE extends AbstractPLHBox<IMPLTYPE>> - Parameters:
bVertSplittable-trueif this element is splittable,falseotherwise.- Returns:
- this for chaining
-
containsAnyVertSplittableElement
public boolean containsAnyVertSplittableElement() -
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 AbstractPLHBox<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 AbstractPLHBox<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 AbstractPLHBox<IMPLTYPE>>
-
internalCreateVertSplitEmptyElement
@Nonnull protected AbstractPLRenderableObject<?> internalCreateVertSplitEmptyElement(@Nonnull IPLRenderableObject<?> aSrcObject, float fWidth, float fHeight) Create an empty element that is to be used as a place holder for splitting. The returned object must be prepared!- Parameters:
aSrcObject- Source element of the hbox to be splitfWidth- Column widthfHeight- Column height- Returns:
- Never
null.
-
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 AbstractPLHBox<IMPLTYPE>,IMPLTYPE extends AbstractPLHBox<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 AbstractPLHBox<IMPLTYPE>>- Parameters:
aCtx- Rendering context. Nevernull.- Throws:
IOException- In case of a PDFBox error
-
toString
- Overrides:
toStringin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLHBox<IMPLTYPE>>
-