Class CodabarBean
java.lang.Object
org.krysalis.barcode4j.impl.AbstractBarcodeBean
org.krysalis.barcode4j.impl.codabar.CodabarBean
- All Implemented Interfaces:
BarcodeGenerator
This class is an implementation of the Codabar barcode.
- Version:
- $Id: CodabarBean.java,v 1.7 2008-11-22 09:57:10 jmaerki Exp $
- Author:
- Jeremias Maerki
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final booleanThe default display start/stop value for Codabar.protected static final doubleThe default module width for Codabar.protected static final doubleThe default wide factor for Codabar.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.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.doubleReturns the factor by which wide bars are broader than narrow bars.booleanIndicates whether the start and stop character will be displayed as part of the human-readable message.voidsetChecksumMode(ChecksumMode mode) Sets the checksum modevoidsetDisplayStartStop(boolean value) Enables or disables the use of the start and stop characters in the human-readable message.voidsetWideFactor(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
-
Field Details
-
DEFAULT_MODULE_WIDTH
protected static final double DEFAULT_MODULE_WIDTHThe default module width for Codabar.- See Also:
-
DEFAULT_WIDE_FACTOR
protected static final double DEFAULT_WIDE_FACTORThe default wide factor for Codabar.- See Also:
-
DEFAULT_DISPLAY_START_STOP
protected static final boolean DEFAULT_DISPLAY_START_STOPThe default display start/stop value for Codabar.- See Also:
-
-
Constructor Details
-
CodabarBean
public CodabarBean()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
-
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)
-
getBarWidth
public double getBarWidth(int width) Returns 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)
-
generateBarcode
Generates 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
-
calcDimensions
Calculates 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
-
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
-