Class CheckBoxRenderer

All Implemented Interfaces:
IPropertyContainer, IRenderer

public class CheckBoxRenderer extends AbstractFormFieldRenderer
The AbstractFormFieldRenderer implementation for checkboxes.
  • Field Details

  • Constructor Details

    • CheckBoxRenderer

      public CheckBoxRenderer (CheckBox modelElement)
      Creates a new CheckBoxRenderer instance.
      Parameters:
      modelElement - the model element
  • Method Details

    • getNextRenderer

      public IRenderer getNextRenderer()
      Gets a new instance of this class to be used as a next renderer, after this renderer is used, if IRenderer.layout(LayoutContext) is called more than once.
      Returns:
      new renderer instance
    • getRenderingMode

      public RenderingMode getRenderingMode()
      Gets the rendering mode of the checkbox.
      Returns:
      the rendering mode of the checkbox
    • isPdfA

      @Deprecated public boolean isPdfA()
      Deprecated.
      since 8.0.4 will be removed
      Returns whether or not the checkbox is in PDF/A mode.
      Returns:
      true if the checkbox is in PDF/A mode, false otherwise
    • getCheckBoxType

      public CheckBoxType getCheckBoxType()
      Gets the checkBoxType.
      Returns:
      the checkBoxType
    • createCheckBoxRenderStrategy

      public ICheckBoxRenderingStrategy createCheckBoxRenderStrategy()
      creates a ICheckBoxRenderingStrategy based on the current settings.
      Returns:
      the ICheckBoxRenderingStrategy
    • drawBackground

      public void drawBackground (DrawContext drawContext)
      Draws a background layer if it is defined by a key Property.BACKGROUND in either the layout element or this IRenderer itself.
      Overrides:
      drawBackground in class AbstractRenderer
      Parameters:
      drawContext - the context (canvas, document, etc) of this drawing operation.
    • drawBorder

      public void drawBorder (DrawContext drawContext)
      Performs the drawing operation for the border of this renderer, if defined by any of the Property.BORDER values in either the layout element or this IRenderer itself.
      Overrides:
      drawBorder in class AbstractRenderer
      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:
      applyBorderBox in class AbstractRenderer
      Parameters:
      rect - a rectangle paddings will be applied on.
      borders - the borders to be applied on the given rectangle
      reverse - indicates whether the border box will be applied inside (in case of false) or outside (in case of false) the rectangle.
      Returns:
      a border box of the renderer
    • isBoxChecked

      public boolean isBoxChecked()
      Defines whether the box is checked or not.
      Returns:
      the default value of the checkbox field
    • adjustFieldLayout

      protected void adjustFieldLayout (LayoutContext layoutContext)
      Adjusts the field layout.
      Specified by:
      adjustFieldLayout in class AbstractFormFieldRenderer
      Parameters:
      layoutContext - layout context
    • applyPaddings

      protected Rectangle applyPaddings (Rectangle rect, UnitValue[] paddings, boolean reverse)
      Applies given paddings to the given rectangle. Checkboxes don't support setting of paddings as they are always centered. So that this method returns the rectangle as is.
      Overrides:
      applyPaddings in class AbstractRenderer
      Parameters:
      rect - a rectangle paddings will be applied on.
      paddings - the paddings to be applied on the given rectangle
      reverse - indicates whether paddings will be applied inside (in case of false) or outside (in case of true) the rectangle.
      Returns:
      The rectangle NOT modified by the paddings.
    • createFlatRenderer

      public IRenderer createFlatRenderer()
      Creates a flat renderer for the checkbox.
      Specified by:
      createFlatRenderer in class AbstractFormFieldRenderer
      Returns:
      an IRenderer object for the flat renderer
    • applyAcroField

      protected void applyAcroField (DrawContext drawContext)
      Applies the AcroField widget.
      Specified by:
      applyAcroField in class AbstractFormFieldRenderer
      Parameters:
      drawContext - the draw context
    • isLayoutBasedOnFlatRenderer

      protected boolean isLayoutBasedOnFlatRenderer()
      Determines, whether the layout is based in the renderer itself or flat renderer.
      Overrides:
      isLayoutBasedOnFlatRenderer in class AbstractFormFieldRenderer
      Returns:
      true if layout is based on flat renderer, false otherwise.