barcode4j 2.1.0

org.krysalis.barcode4j.impl.code128
Class EAN128Bean

java.lang.Object
  extended by org.krysalis.barcode4j.impl.AbstractBarcodeBean
      extended by org.krysalis.barcode4j.impl.code128.Code128Bean
          extended by org.krysalis.barcode4j.impl.code128.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 Summary
static char DEFAULT_CHECK_DIGIT_MARKER
          Defines the default character for the check digit marker
static char DEFAULT_GROUP_SEPARATOR
          Defines the default group separator character
 
Fields inherited from class org.krysalis.barcode4j.impl.code128.Code128Bean
DEFAULT_CODESET, DEFAULT_MODULE_WIDTH
 
Fields inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, fontName, fontSize, height, moduleWidth, msgPos, pattern, quietZone, quietZoneVertical
 
Constructor Summary
EAN128Bean()
          Create a new instance.
 
Method Summary
 BarcodeDimension calcDimensions(java.lang.String msg)
          Calculates the dimension of a barcode with the given message. The dimensions are dependant on the configuration of the barcode generator.
 void generateBarcode(CanvasProvider canvas, java.lang.String msg)
          Generates a barcode using the given Canvas to render the barcode to its output format.
 char getCheckDigitMarker()
           
 ChecksumMode getChecksumMode()
          Returns the current checksum mode.
 char getGroupSeparator()
           
 java.lang.String getTemplate()
           
 boolean isOmitBrackets()
           
 void setCheckDigitMarker(char c)
          Sets the character that will be used as the check digit marker.
 void setChecksumMode(ChecksumMode mode)
          Sets the checksum mode
 void setGroupSeparator(char c)
          Sets the group separator character.
 void setOmitBrackets(boolean b)
          Indicates whether brackets should be used in the human-readable part around the AIs.
 void setTemplate(java.lang.String string)
          Sets the message template with the fields for the EAN message.
 
Methods inherited from class org.krysalis.barcode4j.impl.code128.Code128Bean
getBarWidth, getCodeset, hasFontDescender, setCodeset
 
Methods inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, getBarHeight, getFontName, getFontSize, getHeight, getHumanReadableHeight, getModuleWidth, getMsgPosition, getPattern, getQuietZone, getVerticalQuietZone, hasQuietZone, setBarHeight, setFontName, setFontSize, setHeight, setModuleWidth, setMsgPosition, setPattern, setQuietZone, setVerticalQuietZone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_GROUP_SEPARATOR

public static final char DEFAULT_GROUP_SEPARATOR
Defines the default group separator character

See Also:
Constant Field Values

DEFAULT_CHECK_DIGIT_MARKER

public static final char DEFAULT_CHECK_DIGIT_MARKER
Defines the default character for the check digit marker

See Also:
Constant Field Values
Constructor Detail

EAN128Bean

public EAN128Bean()
Create a new instance.

Method Detail

calcDimensions

public BarcodeDimension calcDimensions(java.lang.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:
BarcodeGenerator.calcDimensions(String)

generateBarcode

public void generateBarcode(CanvasProvider canvas,
                            java.lang.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:
BarcodeGenerator.generateBarcode(CanvasProvider, String)

setChecksumMode

public void setChecksumMode(ChecksumMode mode)
Sets the checksum mode

Parameters:
mode - the checksum mode

getChecksumMode

public ChecksumMode getChecksumMode()
Returns the current checksum mode.

Returns:
ChecksumMode 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 java.lang.String getTemplate()
Returns:
the message template with the fields for the EAN message

setTemplate

public void setTemplate(java.lang.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

barcode4j 2.1.0

Copyright © 2000-2010 Jeremias Maerki. All rights reserved.