barcode4j 2.1.0

org.krysalis.barcode4j.impl.postnet
Class POSTNETBean

java.lang.Object
  extended by org.krysalis.barcode4j.impl.AbstractBarcodeBean
      extended by org.krysalis.barcode4j.impl.HeightVariableBarcodeBean
          extended by org.krysalis.barcode4j.impl.postnet.POSTNETBean
All Implemented Interfaces:
BarcodeGenerator

public class POSTNETBean
extends HeightVariableBarcodeBean

Implements the United States Postal Service POSTNET barcode.

Version:
$Id: POSTNETBean.java,v 1.9 2008/05/13 13:00:44 jmaerki Exp $
Author:
Chris Dolphy

Field Summary
 
Fields inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, fontName, fontSize, height, moduleWidth, msgPos, pattern, quietZone
 
Constructor Summary
POSTNETBean()
          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 getBarHeight(int height)
          Returns the effective height of a bar with a given logical height.
 double getBarWidth(int width)
          Returns the effective width of a bar with a given logical width.
 BaselineAlignment getBaselinePosition()
          Returns the baseline position.
 ChecksumMode getChecksumMode()
          Returns the current checksum mode.
 double getIntercharGapWidth()
          Returns the width between encoded characters.
 double getShortBarHeight()
          Returns the height of a short bar.
 double getVerticalQuietZone()
          Returns the vertical quiet zone.
 boolean isDisplayChecksum()
          Indicates whether the checksum will be displayed as part of the human-readable message.
 void setBaselinePosition(BaselineAlignment baselinePosition)
          Sets the baseline position.
 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 setIntercharGapWidth(double width)
          Sets the width between encoded characters.
 void setShortBarHeight(double height)
          Sets the height of a short bar.
 void setVerticalQuietZone(double height)
          Sets the height of the vertical quiet zone.
 
Methods inherited from class org.krysalis.barcode4j.impl.AbstractBarcodeBean
doQuietZone, getBarHeight, getFontName, getFontSize, getHeight, getHumanReadableHeight, getModuleWidth, getMsgPosition, getPattern, getQuietZone, hasFontDescender, hasQuietZone, setBarHeight, setFontName, setFontSize, setHeight, setModuleWidth, setMsgPosition, setPattern, setQuietZone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POSTNETBean

public POSTNETBean()
Create a new instance.

Method Detail

setVerticalQuietZone

public void setVerticalQuietZone(double height)
Sets the height of the vertical quiet zone. If this value is not explicitely set the vertical quiet zone has the same width as the horizontal quiet zone.

Overrides:
setVerticalQuietZone in class AbstractBarcodeBean
Parameters:
height - the height of the vertical quiet zone (in mm)

getVerticalQuietZone

public double getVerticalQuietZone()
Returns the vertical quiet zone. If no vertical quiet zone is set explicitely, the value if AbstractBarcodeBean.getQuietZone() is returned.

Overrides:
getVerticalQuietZone in class AbstractBarcodeBean
Returns:
the height of the vertical quiet zone (in mm)

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

getShortBarHeight

public double getShortBarHeight()
Returns the height of a short bar.

Returns:
the height of a short bar

setShortBarHeight

public void setShortBarHeight(double height)
Sets the height of a short bar.

Parameters:
height - the height of a short bar

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)

getBarHeight

public double getBarHeight(int height)
Returns the effective height of a bar with a given logical height.

Specified by:
getBarHeight in class HeightVariableBarcodeBean
Parameters:
height - the logical height (1=short, 2=tall)
Returns:
double

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

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

getBaselinePosition

public BaselineAlignment getBaselinePosition()
Returns the baseline position. Indicates whether the bars are top-align or bottom-aligned.

Returns:
the baseline position

setBaselinePosition

public void setBaselinePosition(BaselineAlignment baselinePosition)
Sets the baseline position. Indicates whether the bars are top-align or bottom-aligned.

Parameters:
baselinePosition - the baseline position

barcode4j 2.1.0

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