barcode4j 2.1.0

org.krysalis.barcode4j.impl.code39
Class Code39Bean

java.lang.Object
  extended by org.krysalis.barcode4j.impl.AbstractBarcodeBean
      extended by org.krysalis.barcode4j.impl.code39.Code39Bean
All Implemented Interfaces:
BarcodeGenerator

public class Code39Bean
extends AbstractBarcodeBean

This class is an implementation of the Code39 barcode.

Version:
$Id: Code39Bean.java,v 1.9 2009/02/20 09:33:43 jmaerki Exp $
Author:
Jeremias Maerki

Field Summary
protected static double DEFAULT_MODULE_WIDTH
          The default module width for Code 39.
protected static double DEFAULT_WIDE_FACTOR
          The default wide factor for Code 39
 
Fields inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, fontName, fontSize, height, moduleWidth, msgPos, pattern, quietZone, quietZoneVertical
 
Constructor Summary
Code39Bean()
          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.
 double getBarWidth(int width)
          Returns the effective width of a bar with a given logical width.
 ChecksumMode getChecksumMode()
          Returns the current checksum mode.
 double getIntercharGapWidth()
          Returns the width between encoded characters.
 double getWideFactor()
          Returns the factor by which wide bars are broader than narrow bars.
 boolean isDisplayChecksum()
          Indicates whether the checksum will be displayed as part of the human-readable message.
 boolean isDisplayStartStop()
          Indicates whether the start and stop character will be displayed as part of the human-readable message.
 boolean isExtendedCharSetEnabled()
          Indicates whether the extended character set is enabled.
 void setChecksumMode(ChecksumMode mode)
          Sets the checksum mode
 void setDisplayChecksum(boolean value)
          Enables or disables the use of the checksum in the human-readable message.
 void setDisplayStartStop(boolean value)
          Enables or disables the use of the start and stop characters in the human-readable message.
 void setExtendedCharSetEnabled(boolean value)
          Enables or disables the extended character set.
 void setIntercharGapWidth(double width)
          Sets the width between encoded characters.
 void setWideFactor(double value)
          Sets the factor by which wide bars are broader than narrow bars.
 
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 Code 39.

See Also:
Constant Field Values

DEFAULT_WIDE_FACTOR

protected static final double DEFAULT_WIDE_FACTOR
The default wide factor for Code 39

See Also:
Constant Field Values
Constructor Detail

Code39Bean

public Code39Bean()
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

getIntercharGapWidth

public double getIntercharGapWidth()
Returns the width between encoded characters.

Returns:
the interchar gap width

setIntercharGapWidth

public void setIntercharGapWidth(double width)
Sets the width between encoded characters.

Parameters:
width - the interchar gap width

getWideFactor

public double getWideFactor()
Returns the factor by which wide bars are broader than narrow bars.

Returns:
the wide factor

setWideFactor

public void setWideFactor(double value)
Sets the factor by which wide bars are broader than narrow bars.

Parameters:
value - the wide factory (should be > 1.0)

isDisplayStartStop

public boolean isDisplayStartStop()
Indicates whether the start and stop character will be displayed as part of the human-readable message.

Returns:
true if leading and trailing "*" will be displayed

setDisplayStartStop

public void setDisplayStartStop(boolean value)
Enables or disables the use of the start and stop characters in the human-readable message.

Parameters:
value - true to enable the start/stop character, false to disable

isDisplayChecksum

public boolean isDisplayChecksum()
Indicates whether the checksum will be displayed as part of the human-readable message.

Returns:
true if checksum will be included in the human-readable message

setDisplayChecksum

public void setDisplayChecksum(boolean value)
Enables or disables the use of the checksum in the human-readable message.

Parameters:
value - true to include the checksum in the human-readable message, false to ignore

isExtendedCharSetEnabled

public boolean isExtendedCharSetEnabled()
Indicates whether the extended character set is enabled.

Returns:
true if the extended character set is enabled

setExtendedCharSetEnabled

public void setExtendedCharSetEnabled(boolean value)
Enables or disables the extended character set. The extended character set enables the whole ASCII 7-bit character set for Code39.

Parameters:
value - true to enable the extended character set

getBarWidth

public double getBarWidth(int width)
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)

generateBarcode

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

calcDimensions

public 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.

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

barcode4j 2.1.0

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