Package com.helger.pdflayout.element.box
Class AbstractPLInlineBox<IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>>
java.lang.Object
com.helger.pdflayout.base.AbstractPLObject<IMPLTYPE>
com.helger.pdflayout.base.AbstractPLRenderableObject<IMPLTYPE>
com.helger.pdflayout.base.AbstractPLElement<IMPLTYPE>
com.helger.pdflayout.element.box.AbstractPLInlineBox<IMPLTYPE>
- Type Parameters:
IMPLTYPE- Implementation type
- All Implemented Interfaces:
com.helger.commons.id.IHasID<String>,com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>,IPLElement<IMPLTYPE>,IPLHasBorder<IMPLTYPE>,IPLHasFillColor<IMPLTYPE>,IPLHasMargin<IMPLTYPE>,IPLHasMarginBorderPadding<IMPLTYPE>,IPLHasOutline,IPLHasPadding<IMPLTYPE>,IPLObject<IMPLTYPE>,IPLRenderableObject<IMPLTYPE>,IPLSplittableObject<IMPLTYPE,,IMPLTYPE> IPLVisitable
- Direct Known Subclasses:
AbstractPLExternalLink
public abstract class AbstractPLInlineBox<IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>>
extends AbstractPLElement<IMPLTYPE>
implements IPLSplittableObject<IMPLTYPE,IMPLTYPE>
A box is a simple element that encapsulates another element and has a
padding, border and margin itself as well as it can align the contained
element.
- Since:
- 6.0.1
- Author:
- Philip Helger
-
Field Summary
Fields inherited from interface com.helger.pdflayout.base.IPLElement
DEFAULT_MAX_SIZE, DEFAULT_MIN_SIZEFields inherited from interface com.helger.pdflayout.base.IPLHasBorder
DEFAULT_BORDERFields inherited from interface com.helger.pdflayout.base.IPLHasFillColor
DEFAULT_FILL_COLORFields inherited from interface com.helger.pdflayout.base.IPLHasMargin
DEFAULT_MARGINFields inherited from interface com.helger.pdflayout.base.IPLHasPadding
DEFAULT_PADDINGFields inherited from interface com.helger.pdflayout.base.IPLSplittableObject
DEFAULT_VERT_SPLITTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal IPLRenderableObject<?>protected final SizeSpecfinal booleanprotected final voidfinal 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.setBasicDataFrom(IMPLTYPE aSource) For copying stuff internally.final IMPLTYPEsetElement(IPLRenderableObject<?> aElement) 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.AbstractPLElement
getBorder, getFillColor, getMargin, getMaxSize, getMinSize, getPadding, getRenderSize, setBorder, setFillColor, setMargin, setMaxSize, setMinSize, setPaddingMethods inherited from class com.helger.pdflayout.base.AbstractPLRenderableObject
getPrepareAvailableSize, getPreparedSize, 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.IPLElement
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, setExactHeight, setExactSize, setExactWidth, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidthMethods inherited from interface com.helger.pdflayout.base.IPLHasBorder
getBorderBottomWidth, getBorderLeftWidth, getBorderRightWidth, getBorderTopWidth, getBorderXSumWidth, getBorderYSumWidth, setBorder, setBorder, setBorder, setBorder, setBorderBottom, setBorderLeft, setBorderRight, setBorderTop, setBorderX, setBorderYMethods inherited from interface com.helger.pdflayout.base.IPLHasFillColor
hasFillColorMethods inherited from interface com.helger.pdflayout.base.IPLHasMargin
addMarginBottom, addMarginLeft, addMarginRight, addMarginTop, addMarginX, addMarginY, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMarginXSum, getMarginYSum, setMargin, setMargin, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMarginX, setMarginYMethods inherited from interface com.helger.pdflayout.base.IPLHasMarginBorderPadding
getOutlineBottom, getOutlineLeft, getOutlineRight, getOutlineTop, getOutlineXSum, getOutlineYSumMethods inherited from interface com.helger.pdflayout.base.IPLHasPadding
addPaddingBottom, addPaddingLeft, addPaddingRight, addPaddingTop, addPaddingX, addPaddingY, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPaddingXSum, getPaddingYSum, setPadding, setPadding, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPaddingX, setPaddingYMethods inherited from interface com.helger.pdflayout.base.IPLObject
getAsSplittable, getDebugID, hasIDMethods inherited from interface com.helger.pdflayout.base.IPLRenderableObject
beforeRender, getPreparedHeight, getPreparedSize, getPreparedWidth, getRenderHeight, getRenderSize, getRenderWidth, isPrepared, prepare, renderMethods inherited from interface com.helger.pdflayout.base.IPLSplittableObject
internalCreateNewVertSplitObject
-
Constructor Details
-
AbstractPLInlineBox
-
-
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 AbstractPLInlineBox<IMPLTYPE>>- Overrides:
setBasicDataFromin classAbstractPLElement<IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>>- Parameters:
aSource- Source object to copy from. May not benull.- Returns:
- this for chaining
-
getElement
- Returns:
- The element passed in the constructor. May be
null.
-
hasElement
public final boolean hasElement()- Returns:
trueif an element is contained,falseif not.
-
setElement
-
isVertSplittable
public final boolean isVertSplittable()- Specified by:
isVertSplittablein interfaceIPLObject<IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>>- Specified by:
isVertSplittablein interfaceIPLSplittableObject<IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>,IMPLTYPE extends AbstractPLInlineBox<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 AbstractPLInlineBox<IMPLTYPE>,IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>> - Parameters:
bVertSplittable-trueif this element is splittable,falseotherwise.- 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 AbstractPLInlineBox<IMPLTYPE>>- Parameters:
aVisitor- The visitor to use. May not benull.- Returns:
EChange.CHANGEDif something changed internally.- Throws:
IOException- on PDFBox error
-
getElementPreparedSize
- Returns:
- The prepared size of the contained element. May be
nullif this box was not yet prepared or if no element is contained.
-
internalSetElementPreparedSize
-
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 AbstractPLInlineBox<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 AbstractPLInlineBox<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 AbstractPLInlineBox<IMPLTYPE>,IMPLTYPE extends AbstractPLInlineBox<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
@OverridingMethodsMustInvokeSuper protected void onRender(@Nonnull PageRenderContext aCtx) throws IOException Description copied from class:AbstractPLRenderableObjectAbstract method to be implemented by subclasses.- Specified by:
onRenderin classAbstractPLRenderableObject<IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>>- Parameters:
aCtx- Rendering context. Nevernull.- Throws:
IOException- In case of a PDFBox error
-
toString
- Overrides:
toStringin classAbstractPLElement<IMPLTYPE extends AbstractPLInlineBox<IMPLTYPE>>
-