Class ORCodeCustomTag


  • public final class ORCodeCustomTag
    extends CustomTag
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_SIZE  
      static boolean disable  
      • 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 Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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 xx, float yy, java.awt.Graphics2D g)
      Draws the element at the given position, at its natural size.
      • 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
    • Field Detail

      • disable

        public static boolean disable
    • Constructor Detail

      • ORCodeCustomTag

        public ORCodeCustomTag()
                        throws java.lang.UnsatisfiedLinkError
        Throws:
        java.lang.UnsatisfiedLinkError
      • ORCodeCustomTag

        public ORCodeCustomTag​(java.lang.String code,
                               com.pd4ml.fonts.FontCache fontCache,
                               CustomTag prime)
                        throws java.lang.UnsatisfiedLinkError
        Throws:
        java.lang.UnsatisfiedLinkError
    • Method Detail

      • getInstance

        public CustomTag getInstance​(java.lang.String code,
                                     com.pd4ml.fonts.FontCache fontCache)
                              throws java.lang.UnsatisfiedLinkError
        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
        Throws:
        java.lang.UnsatisfiedLinkError
      • 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)
                     throws java.io.IOException
        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
        Throws:
        java.io.IOException - if the size cannot be determined
      • getHeight

        public int getHeight​(int base)
                      throws java.io.IOException
        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
        Throws:
        java.io.IOException - if the size cannot be determined
      • paint

        public void paint​(float xx,
                          float yy,
                          java.awt.Graphics2D g)
                   throws java.io.IOException
        Description copied from class: CustomTag
        Draws the element at the given position, at its natural size. The default implementation draws a placeholder box labeled "DUMMY".
        Overrides:
        paint in class CustomTag
        Parameters:
        xx - the left edge of the element box in the coordinate system of g
        yy - the top edge of the element box
        g - the graphics context to draw on
        Throws:
        java.io.IOException - if drawing fails