Class EAN128Bean

All Implemented Interfaces:
BarcodeGenerator

public class EAN128Bean extends Code128Bean
This class is an implementation of the Code 128 barcode.
Author:
Jeremias Maerki, Dietmar Bürkle
  • Field Details

    • DEFAULT_GROUP_SEPARATOR

      public static final char DEFAULT_GROUP_SEPARATOR
      Defines the default group separator character
      See Also:
    • DEFAULT_CHECK_DIGIT_MARKER

      public static final char DEFAULT_CHECK_DIGIT_MARKER
      Defines the default character for the check digit marker
      See Also:
  • Constructor Details

    • EAN128Bean

      public EAN128Bean()
      Create a new instance.
  • Method Details

    • generateBarcode

      public void generateBarcode(CanvasProvider canvas, String msg)
      Description copied from class: Code128Bean
      Generates a barcode using the given Canvas to render the barcode to its output format.
      Specified by:
      generateBarcode in interface BarcodeGenerator
      Overrides:
      generateBarcode in class Code128Bean
      Parameters:
      canvas - CanvasProvider that the barcode is to be rendered on.
      msg - message to encode
      See Also:
    • calcDimensions

      public BarcodeDimension calcDimensions(String msg)
      Description copied from class: Code128Bean
      Calculates the dimension of a barcode with the given message. The dimensions are dependant on the configuration of the barcode generator.
      Specified by:
      calcDimensions in interface BarcodeGenerator
      Overrides:
      calcDimensions in class Code128Bean
      Parameters:
      msg - message to use for calculation.
      Returns:
      BarcodeDimension a BarcodeDimension object containing the barcode's dimensions
      See Also:
    • getChecksumMode

      public ChecksumMode getChecksumMode()
      Returns the current checksum mode.
      Returns:
      ChecksumMode the checksum mode
    • setChecksumMode

      public void setChecksumMode(ChecksumMode mode)
      Sets the checksum mode
      Parameters:
      mode - the checksum mode
    • getGroupSeparator

      public char getGroupSeparator()
      Returns:
      the group separator character
    • setGroupSeparator

      public void setGroupSeparator(char c)
      Sets the group separator character. Normally, either ASCII GS or 0xF1 is used.
      Parameters:
      c - the group separator character.
    • getTemplate

      public String getTemplate()
      Returns:
      the message template with the fields for the EAN message
    • setTemplate

      public void setTemplate(String string)
      Sets the message template with the fields for the EAN message.

      The format of the templates here is a repeating set of AI number (in brackets) followed by a field description. The allowed data types are "n" (numeric), "an" (alpha-numeric), "d" (date) and "cd" (check digit). Examples: "n13" defines a numeric field with exactly 13 digits. "n13+cd" defines a numeric field with exactly 13 digits plus a check digit. "an1-9" defines an alpha-numeric field with 1 to 9 characters.

      Parameters:
      string - a template like "(01)n13+cd(421)n3+an1-9(10)an1-20"
    • getCheckDigitMarker

      public char getCheckDigitMarker()
      Returns:
      the character used as the check digit marker.
    • setCheckDigitMarker

      public void setCheckDigitMarker(char c)
      Sets the character that will be used as the check digit marker.
      Parameters:
      c - the character for the check digit marker
    • isOmitBrackets

      public boolean isOmitBrackets()
      Returns:
      true if the brackets in the human-readable part should be omitted
    • setOmitBrackets

      public void setOmitBrackets(boolean b)
      Indicates whether brackets should be used in the human-readable part around the AIs.
      Parameters:
      b - true if the brackets in the human-readable part should be omitted