Class AbstractSelectFieldRenderer

    • Method Detail

      • 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.
      • 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 java.lang.String getModelId()
        Gets the model id.
        Returns:
        the model id.
      • 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.
      • getConformance

        protected PdfConformance getConformance​(PdfDocument document)
        Gets the conformance. If the conformance is not set, the conformance of the document is used.
        Parameters:
        document - the document
        Returns:
        the conformance or null if the conformance is not set.
      • getOptionsMarkedSelected

        protected java.util.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.
      • isOptGroupRenderer

        static boolean isOptGroupRenderer​(IRenderer renderer)
      • isOptionRenderer

        static boolean isOptionRenderer​(IRenderer child)