Class AbstractSelectFieldRenderer

All Implemented Interfaces:
IPropertyContainer, IRenderer
Direct Known Subclasses:
SelectFieldComboBoxRenderer, SelectFieldListBoxRenderer

public abstract class AbstractSelectFieldRenderer extends BlockRenderer
Abstract BlockRenderer for select form fields.
  • Constructor Details

  • Method Details

    • layout

      public LayoutResult layout (LayoutContext layoutContext)
      This method simulates positioning of the renderer, including all of its children, and returns the LayoutResult, representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc. LayoutResult can be extended to return custom layout results for custom elements, e.g. TextRenderer uses TextLayoutResult as its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called before IRenderer.draw(DrawContext), to prepare the renderer to be flushed to the output stream.
      Specified by:
      layout in interface IRenderer
      Overrides:
      layout in class BlockRenderer
      Parameters:
      layoutContext - the description of layout area and any other additional information
      Returns:
      result of the layout process
    • draw

      public void draw (DrawContext drawContext)
      Flushes the renderer subtree contents, i.e. draws itself on canvas, adds necessary objects to the PdfDocument etc.
      Specified by:
      draw in interface IRenderer
      Overrides:
      draw in class BlockRenderer
      Parameters:
      drawContext - contains the PdfDocument to which the renderer subtree if flushed, the PdfCanvas on which the renderer subtree is drawn and other additional parameters needed to perform drawing
    • drawChildren

      public void drawChildren (DrawContext drawContext)
      Performs the drawing operation for all children of this renderer.
      Overrides:
      drawChildren in class AbstractRenderer
      Parameters:
      drawContext - the context (canvas, document, etc) of this drawing operation.
    • getLang

      protected String getLang()
      Gets the accessibility language.
      Returns:
      the accessibility language.
    • writeAcroFormFieldLangAttribute

      protected void writeAcroFormFieldLangAttribute (PdfDocument pdfDoc)
      Sets the form accessibility language identifier of the form element in case the document is tagged.
      Parameters:
      pdfDoc - the document which contains form field.
    • applyAccessibilityProperties

      protected void applyAccessibilityProperties (PdfFormField formField, PdfDocument pdfDocument)
      Applies the accessibility properties to the form field.
      Parameters:
      formField - The form field to which the accessibility properties should be applied.
      pdfDocument - The document to which the form field belongs.
    • createFlatRenderer

      protected abstract IRenderer createFlatRenderer()
      Creates the flat renderer instance.
      Returns:
      IRenderer instance.
    • applyAcroField

      protected abstract void applyAcroField (DrawContext drawContext)
      Applies the AcroField widget.
      Parameters:
      drawContext - the draw context
    • isFlatten

      protected boolean isFlatten()
      Checks if form fields need to be flattened.
      Returns:
      true, if fields need to be flattened.
    • getModelId

      protected String getModelId()
      Gets the model id.
      Returns:
      the model id.
    • setupBuilderValues

      protected void setupBuilderValues (ChoiceFormFieldBuilder builder, AbstractSelectField field)
      Retrieve the options from select field (can be combo box or list box field) and set them to the form field builder.
      Parameters:
      builder - ChoiceFormFieldBuilder to set options to
      field - AbstractSelectField to retrieve the options from
    • getFinalSelectFieldHeight

      protected float getFinalSelectFieldHeight (float availableHeight, float actualHeight, boolean isClippedHeight)
      Returns final height of the select field.
      Parameters:
      availableHeight - available height of the layout area
      actualHeight - actual occupied height of the select field
      isClippedHeight - indicates whether the layout area's height is clipped or not
      Returns:
      final height of the select field.
    • getConformanceLevel

      @Deprecated protected PdfAConformanceLevel getConformanceLevel (PdfDocument document)
      Deprecated.
      since 8.0.4 will be return IConformanceLevel
      Gets the conformance level. If the conformance level is not set, the conformance level of the document is used.
      Parameters:
      document - the document
      Returns:
      the conformance level or null if the conformance level is not set.
    • getGenericConformanceLevel

      @Deprecated protected IConformanceLevel getGenericConformanceLevel (PdfDocument document)
      Deprecated.
      since 8.0.4 will be renamed to getConformanceLevel()
      Gets the conformance level. If the conformance level is not set, the conformance level of the document is used.
      Parameters:
      document - the document
      Returns:
      the conformance level or null if the conformance level is not set.
    • getOptionsMarkedSelected

      protected List<IRenderer> getOptionsMarkedSelected (IRenderer optionsSubTree)
      Gets options that are marked as selected from the select field options subtree.
      Parameters:
      optionsSubTree - options subtree to get selected options
      Returns:
      selected options list.