Package com.itextpdf.forms.form.renderer
Class RadioRenderer
- java.lang.Object
-
- com.itextpdf.layout.renderer.AbstractRenderer
-
- com.itextpdf.layout.renderer.BlockRenderer
-
- com.itextpdf.forms.form.renderer.AbstractFormFieldRenderer
-
- com.itextpdf.forms.form.renderer.RadioRenderer
-
- All Implemented Interfaces:
IPropertyContainer,IRenderer
public class RadioRenderer extends AbstractFormFieldRenderer
TheAbstractFormFieldRendererimplementation for radio buttons.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRadioRenderer.FlatParagraphRenderer
-
Field Summary
Fields Modifier and Type Field Description private static ColorDEFAULT_CHECKED_COLORprivate static HorizontalAlignmentDEFAULT_HORIZONTAL_ALIGNMENTprivate static floatDEFAULT_SIZEprivate static VerticalAlignmentDEFAULT_VERTICAL_ALIGNMENT-
Fields inherited from class com.itextpdf.forms.form.renderer.AbstractFormFieldRenderer
flatRenderer
-
Fields inherited from class com.itextpdf.layout.renderer.AbstractRenderer
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties
-
-
Constructor Summary
Constructors Constructor Description RadioRenderer(Radio modelElement)Creates a newRadioRendererinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadjustFieldLayout(LayoutContext layoutContext)Adjusts the field layout.protected voidapplyAcroField(DrawContext drawContext)Applies the AcroField widget.protected RectangleapplyBorderBox(Rectangle rect, Border[] borders, boolean reverse)Applies the given border box (borders) on the given rectangleprotected IRenderercreateFlatRenderer()Creates the flat renderer instance.voiddrawBackground(DrawContext drawContext)Draws a background layer if it is defined by a keyProperty.BACKGROUNDin either the layout element or thisIRendereritself.voiddrawBorder(DrawContext drawContext)Performs the drawing operation for the border of this renderer, if defined by theProperty.BORDER_TOP,Property.BORDER_RIGHT,Property.BORDER_BOTTOMandProperty.BORDER_LEFTvalues in either the layout element or thisIRendereritself.IRenderergetNextRenderer()Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifIRenderer.layout(LayoutContext)is called more than once.booleanisBoxChecked()Defines whether the radio is checked or not.private booleanisDrawCircledBorder()protected booleanisLayoutBasedOnFlatRenderer()Determines, whether the layout is based in the renderer itself or flat renderer.-
Methods inherited from class com.itextpdf.forms.form.renderer.AbstractFormFieldRenderer
applyAccessibilityProperties, draw, drawChildren, getConformance, getDefaultValue, getLang, getMinMaxWidth, getModelId, isFlatten, isRendererFit, layout, writeAcroFormFieldLangAttribute
-
Methods inherited from class com.itextpdf.layout.renderer.BlockRenderer
applyRotationLayout, applyVerticalAlignment, beginRotationIfApplied, createOverflowRenderer, createRotationTransformInsideOccupiedArea, createSplitRenderer, endRotationIfApplied, getMinMaxWidth, getOccupiedAreaBBox, getResolvedFont
-
Methods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllProperties, addChild, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAction, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMargins, applyPaddings, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateBBox, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createXObject, deleteOwnProperty, deleteProperty, endElementOpacityApplying, endTransformationIfApplied, getBackgroundArea, getBorderAreaBBox, getBorderRadii, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getLastYLineRecursively, getMargins, getModelElement, getOccupiedArea, getOwnProperties, getOwnProperty, getPaddings, getParent, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsColor, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFont, getPropertyAsInteger, getPropertyAsTransparentColor, getPropertyAsUnitValue, hasAbsoluteUnitValue, hasOwnOrModelProperty, hasOwnProperty, hasProperty, hasRelativeUnitValue, initElementAreas, isAbsolutePosition, isBorderBoxSizing, isFirstOnRootArea, isFixedLayout, isFlushed, isKeepTogether, isNotFittingHeight, isNotFittingLayoutArea, isNotFittingWidth, isOverflowFit, isOverflowProperty, isOverflowProperty, isOverflowProperty, isPositioned, isRelativePosition, isStaticLayout, move, rectangleToPointsList, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveResolvedDeclaredHeight, retrieveUnitValue, retrieveUnitValue, retrieveWidth, setBorders, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
-
-
-
-
Field Detail
-
DEFAULT_CHECKED_COLOR
private static final Color DEFAULT_CHECKED_COLOR
-
DEFAULT_SIZE
private static final float DEFAULT_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_HORIZONTAL_ALIGNMENT
private static final HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT
-
DEFAULT_VERTICAL_ALIGNMENT
private static final VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT
-
-
Constructor Detail
-
RadioRenderer
public RadioRenderer(Radio modelElement)
Creates a newRadioRendererinstance.- Parameters:
modelElement- the model element
-
-
Method Detail
-
getNextRenderer
public IRenderer getNextRenderer()
Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifIRenderer.layout(LayoutContext)is called more than once.- Returns:
- new renderer instance
-
drawBorder
public void drawBorder(DrawContext drawContext)
Performs the drawing operation for the border of this renderer, if defined by theProperty.BORDER_TOP,Property.BORDER_RIGHT,Property.BORDER_BOTTOMandProperty.BORDER_LEFTvalues in either the layout element or thisIRendereritself.- Overrides:
drawBorderin classAbstractRenderer- Parameters:
drawContext- the context (canvas, document, etc.) of this drawing operation
-
drawBackground
public void drawBackground(DrawContext drawContext)
Draws a background layer if it is defined by a keyProperty.BACKGROUNDin either the layout element or thisIRendereritself.- Overrides:
drawBackgroundin classAbstractRenderer- Parameters:
drawContext- the context (canvas, document, etc) of this drawing operation.
-
applyBorderBox
protected Rectangle applyBorderBox(Rectangle rect, Border[] borders, boolean reverse)
Applies the given border box (borders) on the given rectangle- Overrides:
applyBorderBoxin classAbstractRenderer- Parameters:
rect- a rectangle paddings will be applied on.borders- thebordersto be applied on the given rectanglereverse- indicates whether the border box will be applied inside (in case of false) or outside (in case of false) the rectangle.- Returns:
- a
border boxof the renderer
-
createFlatRenderer
protected IRenderer createFlatRenderer()
Creates the flat renderer instance.- Specified by:
createFlatRendererin classAbstractFormFieldRenderer- Returns:
- the renderer instance.
-
adjustFieldLayout
protected void adjustFieldLayout(LayoutContext layoutContext)
Adjusts the field layout.- Specified by:
adjustFieldLayoutin classAbstractFormFieldRenderer- Parameters:
layoutContext- layout context
-
isBoxChecked
public boolean isBoxChecked()
Defines whether the radio is checked or not.- Returns:
- the default value of the radio field
-
applyAcroField
protected void applyAcroField(DrawContext drawContext)
Applies the AcroField widget.- Specified by:
applyAcroFieldin classAbstractFormFieldRenderer- Parameters:
drawContext- the draw context
-
isLayoutBasedOnFlatRenderer
protected boolean isLayoutBasedOnFlatRenderer()
Determines, whether the layout is based in the renderer itself or flat renderer.- Overrides:
isLayoutBasedOnFlatRendererin classAbstractFormFieldRenderer- Returns:
trueif layout is based on flat renderer, false otherwise.
-
isDrawCircledBorder
private boolean isDrawCircledBorder()
-
-