Class PD4MLSvgCustomTag


  • public class PD4MLSvgCustomTag
    extends CustomTag
    • Field Summary

      • Fields inherited from class com.pd4ml.util.Base

        AES_128BIT, AES_256BIT, LOG_ALL, LOG_CACHE, LOG_CSS, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_FONTS, LOG_INFO, LOG_MINIMAL, LOG_PARSE, LOG_TRACE, LOG_USAGE, LOG_VERBOSE, LOG_WARN, NO_LOG, PD4ML_LOG_LEVEL, RC4_128BIT, RC4_40BIT
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static com.pd4ml.svg.parser.SVGParser createSvgParser()  
      int getHeight​(int base)
      Returns the natural height of the element.
      CustomTag getInstance​(java.lang.String code, com.pd4ml.fonts.FontCache fontCache)
      Creates the handler instance for one occurrence of the tag.
      int getWidth​(int base)
      Returns the natural width of the element.
      boolean isEmptyTag()
      Tells the parser whether the tag is an empty element without content or closing tag, like <br>.
      void paint​(float x, float y, float width, float height, float containerWidth, float containerHeight, java.awt.Graphics2D g)
      Draws the element.
      • Methods inherited from class com.pd4ml.util.Base

        log, log2, printLog, shouldForceException
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PD4MLSvgCustomTag

        public PD4MLSvgCustomTag()
      • PD4MLSvgCustomTag

        public PD4MLSvgCustomTag​(java.lang.String code,
                                 com.pd4ml.fonts.FontCache fontCache,
                                 CustomTag prime)
    • Method Detail

      • getInstance

        public CustomTag getInstance​(java.lang.String code,
                                     com.pd4ml.fonts.FontCache fontCache)
        Description copied from class: CustomTag
        Creates the handler instance for one occurrence of the tag. PD4ML calls it on the registered handler while parsing the document. Subclasses override it to return an instance of themselves, typically created with CustomTag(String, FontCache, CustomTag).
        Overrides:
        getInstance in class CustomTag
        Parameters:
        code - the source code of the tag occurrence; see CustomTag.getInnerCode()
        fontCache - the font cache of the conversion
        Returns:
        the handler instance for this occurrence
      • isEmptyTag

        public boolean isEmptyTag()
        Description copied from class: CustomTag
        Tells the parser whether the tag is an empty element without content or closing tag, like <br>. The default implementation returns false: the parser reads everything up to the matching closing tag as part of the element.
        Overrides:
        isEmptyTag in class CustomTag
        Returns:
        true if the tag has no content and no closing tag
      • getWidth

        public int getWidth​(int base)
        Description copied from class: CustomTag
        Returns the natural width of the element. The default implementation returns the value set with CustomTag.setWidth(int).
        Overrides:
        getWidth in class CustomTag
        Parameters:
        base - the width available in the containing block, in pixels, for handlers that adapt their size to it
        Returns:
        the width in pixels
      • getHeight

        public int getHeight​(int base)
        Description copied from class: CustomTag
        Returns the natural height of the element. The default implementation returns the value set with CustomTag.setHeight(int).
        Overrides:
        getHeight in class CustomTag
        Parameters:
        base - the width available in the containing block, in pixels
        Returns:
        the height in pixels
      • paint

        public void paint​(float x,
                          float y,
                          float width,
                          float height,
                          float containerWidth,
                          float containerHeight,
                          java.awt.Graphics2D g)
                   throws java.io.IOException
        Description copied from class: CustomTag
        Draws the element. PD4ML calls this method for each output page the element appears on. The default implementation calls CustomTag.paint(float, float, Graphics2D).
        Overrides:
        paint in class CustomTag
        Parameters:
        x - the left edge of the element box in the coordinate system of g
        y - the top edge of the element box
        width - the width of the element box, after CSS sizing
        height - the height of the element box, after CSS sizing
        containerWidth - the width of the area the element is placed in
        containerHeight - the height of the area the element is placed in
        g - the graphics context to draw on; for PDF output, a PDF-generating implementation
        Throws:
        java.io.IOException - if drawing fails
      • createSvgParser

        public static com.pd4ml.svg.parser.SVGParser createSvgParser()