Class AbstractBarcodeEncoder

    • Field Detail

      • m_X

        protected int m_X
        Top left x of the barcode.
      • m_Y

        protected int m_Y
        Top left y of the barcode.
      • m_Width

        protected int m_Width
        Width of barcode.
      • m_Height

        protected int m_Height
        Height of barcode.
      • m_Margin

        protected int m_Margin
        Margin around the barcode.
    • Constructor Detail

      • AbstractBarcodeEncoder

        public AbstractBarcodeEncoder()
    • Method Detail

      • getX

        public int getX()
        Returns the X position of the pixel.
        Returns:
        the position
      • setX

        public void setX​(int value)
        Sets the X position of the pixel.
        Parameters:
        value - the position
      • xTipText

        public String xTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getY

        public int getY()
        Returns the Y position of the pixel.
        Returns:
        the position
      • setY

        public void setY​(int value)
        Sets the Y position of the pixel.
        Parameters:
        value - the position
      • yTipText

        public String yTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getWidth

        public int getWidth()
        Returns the width of the barcode.
        Returns:
        the width
      • setWidth

        public void setWidth​(int value)
        Sets the width of the barcode.
        Parameters:
        value - the width
      • widthTipText

        public String widthTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getHeight

        public int getHeight()
        Returns the height of the barcode.
        Returns:
        the height
      • setHeight

        public void setHeight​(int value)
        Sets the height of the barcode.
        Parameters:
        value - the height
      • heightTipText

        public String heightTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getMargin

        public int getMargin()
        Returns the margin around the barcode.
        Returns:
        the margin
      • setMargin

        public void setMargin​(int value)
        Sets the margin around the barcode.
        Parameters:
        value - the margin
      • marginTipText

        public String marginTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • isValid

        protected abstract String isValid​(String payload)
        Checks whether the payload can be processed.
        Parameters:
        payload - the code to check
        Returns:
        null if valid, otherwise error message
      • newImage

        protected BufferedImage newImage()
        Generates a new image according to the specified dimensions.
        Returns:
        the new image
      • encode

        public BufferedImageContainer encode​(String payload,
                                             MessageCollection errors)
        Encodes the supplied payload.
        Parameters:
        payload - the payload to encode
        errors - for collecting error messages
        Returns:
        the generated barcode, null if failed to generate
      • doEncode

        protected abstract BufferedImageContainer doEncode​(String payload,
                                                           BufferedImageContainer cont,
                                                           MessageCollection errors)
        Encodes the supplied payload.
        Parameters:
        payload - the payload to encode
        cont - the container to add the barcode; creates a new one if null
        errors - for collecting error messages
        Returns:
        the updated/generated container, null if failed to generate
      • encode

        public BufferedImageContainer encode​(String payload,
                                             BufferedImageContainer cont,
                                             MessageCollection errors)
        Encodes the supplied payload.
        Parameters:
        payload - the payload to encode
        cont - the container to add the barcode; creates a new one if null
        errors - for collecting error messages
        Returns:
        the updated/generated container, null if failed to generate
      • getPayload

        protected abstract String getPayload()
        Returns the payload to use for generating the barcode.
        Returns:
        the payload