Class UPCEANBean
java.lang.Object
org.krysalis.barcode4j.impl.AbstractBarcodeBean
org.krysalis.barcode4j.impl.upcean.UPCEANBean
- All Implemented Interfaces:
BarcodeGenerator
This is an abstract base class for UPC and EAN barcodes.
- Version:
- $Id: UPCEANBean.java,v 1.5 2008-05-13 13:00:44 jmaerki Exp $
- Author:
- Jeremias Maerki
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final doubleThe default module width for UPC and EAN.Fields inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, fontName, fontSize, height, moduleWidth, msgPos, pattern, quietZone, quietZoneVertical -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalcDimensions(String msg) Calculates the dimension of a barcode with the given message.abstract UPCEANLogicImplFactory method for the logic implementation.voidgenerateBarcode(CanvasProvider canvas, String msg) Generates a barcode using the given Canvas to render the barcode to its output format.doublegetBarWidth(int width) Returns the effective width of a bar with a given logical width.Returns the current checksum mode.voidsetChecksumMode(ChecksumMode mode) Sets the checksum modeprotected doublesupplementalWidth(String msg) Calculates the width for the optional supplemental part.Methods inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, getBarHeight, getFontName, getFontSize, getHeight, getHumanReadableHeight, getModuleWidth, getMsgPosition, getPattern, getQuietZone, getVerticalQuietZone, hasFontDescender, hasQuietZone, setBarHeight, setFontName, setFontSize, setHeight, setModuleWidth, setMsgPosition, setPattern, setQuietZone, setVerticalQuietZone
-
Field Details
-
DEFAULT_MODULE_WIDTH
protected static final double DEFAULT_MODULE_WIDTHThe default module width for UPC and EAN.- See Also:
-
-
Constructor Details
-
UPCEANBean
public UPCEANBean()Create a new instance.
-
-
Method Details
-
getChecksumMode
Returns the current checksum mode.- Returns:
- ChecksumMode the checksum mode
-
setChecksumMode
Sets the checksum mode- Parameters:
mode- the checksum mode
-
getBarWidth
public double getBarWidth(int width) Description copied from class:AbstractBarcodeBeanReturns the effective width of a bar with a given logical width.- Specified by:
getBarWidthin classAbstractBarcodeBean- Parameters:
width- the logical width (1=narrow, 2=wide)- Returns:
- the effective width of a bar (in mm)
- See Also:
-
generateBarcode
Description copied from class:AbstractBarcodeBeanGenerates a barcode using the given Canvas to render the barcode to its output format.- Specified by:
generateBarcodein interfaceBarcodeGenerator- Specified by:
generateBarcodein classAbstractBarcodeBean- Parameters:
canvas- CanvasProvider that the barcode is to be rendered on.msg- message to encode- See Also:
-
calcDimensions
Description copied from class:AbstractBarcodeBeanCalculates the dimension of a barcode with the given message. The dimensions are dependant on the configuration of the barcode generator.- Specified by:
calcDimensionsin interfaceBarcodeGenerator- Overrides:
calcDimensionsin classAbstractBarcodeBean- Parameters:
msg- message to use for calculation.- Returns:
- BarcodeDimension a BarcodeDimension object containing the barcode's dimensions
- See Also:
-
createLogicImpl
Factory method for the logic implementation.- Returns:
- the newly created logic implementation instance
-
supplementalWidth
Calculates the width for the optional supplemental part.- Parameters:
msg- the full message- Returns:
- the width of the supplemental part
-