barcode4j 2.1.0

org.krysalis.barcode4j.impl.upcean
Class UPCEANBean

java.lang.Object
  extended by org.krysalis.barcode4j.impl.AbstractBarcodeBean
      extended by org.krysalis.barcode4j.impl.upcean.UPCEANBean
All Implemented Interfaces:
BarcodeGenerator
Direct Known Subclasses:
EAN13Bean, EAN8Bean, UPCABean, UPCEBean

public abstract class UPCEANBean
extends AbstractBarcodeBean

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
protected static double DEFAULT_MODULE_WIDTH
          The 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
UPCEANBean()
          Create a new instance.
 
Method Summary
 BarcodeDimension calcDimensions(java.lang.String msg)
          Calculates the dimension of a barcode with the given message.
abstract  UPCEANLogicImpl createLogicImpl()
          Factory method for the logic implementation.
 void generateBarcode(CanvasProvider canvas, java.lang.String msg)
          Generates a barcode using the given Canvas to render the barcode to its output format.
 double getBarWidth(int width)
          Returns the effective width of a bar with a given logical width.
 ChecksumMode getChecksumMode()
          Returns the current checksum mode.
 void setChecksumMode(ChecksumMode mode)
          Sets the checksum mode
protected  double supplementalWidth(java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MODULE_WIDTH

protected static final double DEFAULT_MODULE_WIDTH
The default module width for UPC and EAN.

See Also:
Constant Field Values
Constructor Detail

UPCEANBean

public UPCEANBean()
Create a new instance.

Method Detail

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

getBarWidth

public double getBarWidth(int width)
Description copied from class: AbstractBarcodeBean
Returns the effective width of a bar with a given logical width.

Specified by:
getBarWidth in class AbstractBarcodeBean
Parameters:
width - the logical width (1=narrow, 2=wide)
Returns:
the effective width of a bar (in mm)
See Also:
AbstractBarcodeBean.getBarWidth(int)

createLogicImpl

public abstract UPCEANLogicImpl createLogicImpl()
Factory method for the logic implementation.

Returns:
the newly created logic implementation instance

generateBarcode

public void generateBarcode(CanvasProvider canvas,
                            java.lang.String msg)
Description copied from class: AbstractBarcodeBean
Generates a barcode using the given Canvas to render the barcode to its output format.

Specified by:
generateBarcode in interface BarcodeGenerator
Specified by:
generateBarcode in class AbstractBarcodeBean
Parameters:
canvas - CanvasProvider that the barcode is to be rendered on.
msg - message to encode
See Also:
BarcodeGenerator.generateBarcode(CanvasProvider, String)

supplementalWidth

protected double supplementalWidth(java.lang.String msg)
Calculates the width for the optional supplemental part.

Parameters:
msg - the full message
Returns:
the width of the supplemental part

calcDimensions

public BarcodeDimension calcDimensions(java.lang.String msg)
Description copied from class: AbstractBarcodeBean
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 AbstractBarcodeBean
Parameters:
msg - message to use for calculation.
Returns:
BarcodeDimension a BarcodeDimension object containing the barcode's dimensions
See Also:
BarcodeGenerator.calcDimensions(String)

barcode4j 2.1.0

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