Package adams.data.barcode.encode
Class AbstractBarcodeEncoder
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.transformer.draw.AbstractDrawOperation
-
- adams.data.barcode.encode.AbstractBarcodeEncoder
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
EAN13
,PassThrough
,QRCode
,UPCA
public abstract class AbstractBarcodeEncoder extends AbstractDrawOperation
Ancestor for barcode encoders, i.e., classes that generated barcode images.- Version:
- $Revision$
- Author:
- lx51 (lx51 at students dot waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_Height
Height of barcode.protected int
m_Margin
Margin around the barcode.protected int
m_Width
Width of barcode.protected int
m_X
Top left x of the barcode.protected int
m_Y
Top left y of the barcode.-
Fields inherited from class adams.flow.transformer.draw.AbstractDrawOperation
m_Owner
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractBarcodeEncoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
check(BufferedImageContainer image)
Additional checks to the image.void
defineOptions()
Adds options to the internal list of options.protected String
doDraw(BufferedImageContainer image)
Performs the actual draw operation.protected abstract BufferedImageContainer
doEncode(String payload, BufferedImageContainer cont, MessageCollection errors)
Encodes the supplied payload.BufferedImageContainer
encode(String payload, MessageCollection errors)
Encodes the supplied payload.BufferedImageContainer
encode(String payload, BufferedImageContainer cont, MessageCollection errors)
Encodes the supplied payload.int
getHeight()
Returns the height of the barcode.int
getMargin()
Returns the margin around the barcode.protected abstract String
getPayload()
Returns the payload to use for generating the barcode.int
getWidth()
Returns the width of the barcode.int
getX()
Returns the X position of the pixel.int
getY()
Returns the Y position of the pixel.String
heightTipText()
Returns the tip text for this property.protected abstract String
isValid(String payload)
Checks whether the payload can be processed.String
marginTipText()
Returns the tip text for this property.protected BufferedImage
newImage()
Generates a new image according to the specified dimensions.void
setHeight(int value)
Sets the height of the barcode.void
setMargin(int value)
Sets the margin around the barcode.void
setWidth(int value)
Sets the width of the barcode.void
setX(int value)
Sets the X position of the pixel.void
setY(int value)
Sets the Y position of the pixel.String
widthTipText()
Returns the tip text for this property.String
xTipText()
Returns the tip text for this property.String
yTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.draw.AbstractDrawOperation
draw, getOwner, getQuickInfo, setOwner
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
defineOptions
public void defineOptions()
Description copied from class:AbstractOptionHandler
Adds options to the internal list of options. Derived classes must override this method to add additional options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
check
protected String check(BufferedImageContainer image)
Additional checks to the image.- Overrides:
check
in classAbstractDrawOperation
- Parameters:
image
- the image to check- Returns:
- null if OK, otherwise error message
-
getX
public int getX()
Returns the X position of the pixel.- Returns:
- the position
-
setX
public void setX(int value)
Sets the X position of the pixel.- Parameters:
value
- the position
-
xTipText
public String xTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getY
public int getY()
Returns the Y position of the pixel.- Returns:
- the position
-
setY
public void setY(int value)
Sets the Y position of the pixel.- Parameters:
value
- the position
-
yTipText
public String yTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getWidth
public int getWidth()
Returns the width of the barcode.- Returns:
- the width
-
setWidth
public void setWidth(int value)
Sets the width of the barcode.- Parameters:
value
- the width
-
widthTipText
public String widthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getHeight
public int getHeight()
Returns the height of the barcode.- Returns:
- the height
-
setHeight
public void setHeight(int value)
Sets the height of the barcode.- Parameters:
value
- the height
-
heightTipText
public String heightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getMargin
public int getMargin()
Returns the margin around the barcode.- Returns:
- the margin
-
setMargin
public void setMargin(int value)
Sets the margin around the barcode.- Parameters:
value
- the margin
-
marginTipText
public String marginTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
isValid
protected abstract String isValid(String payload)
Checks whether the payload can be processed.- Parameters:
payload
- the code to check- Returns:
- null if valid, otherwise error message
-
newImage
protected BufferedImage newImage()
Generates a new image according to the specified dimensions.- Returns:
- the new image
-
encode
public BufferedImageContainer encode(String payload, MessageCollection errors)
Encodes the supplied payload.- Parameters:
payload
- the payload to encodeerrors
- for collecting error messages- Returns:
- the generated barcode, null if failed to generate
-
doEncode
protected abstract BufferedImageContainer doEncode(String payload, BufferedImageContainer cont, MessageCollection errors)
Encodes the supplied payload.- Parameters:
payload
- the payload to encodecont
- the container to add the barcode; creates a new one if nullerrors
- for collecting error messages- Returns:
- the updated/generated container, null if failed to generate
-
encode
public BufferedImageContainer encode(String payload, BufferedImageContainer cont, MessageCollection errors)
Encodes the supplied payload.- Parameters:
payload
- the payload to encodecont
- the container to add the barcode; creates a new one if nullerrors
- for collecting error messages- Returns:
- the updated/generated container, null if failed to generate
-
getPayload
protected abstract String getPayload()
Returns the payload to use for generating the barcode.- Returns:
- the payload
-
doDraw
protected String doDraw(BufferedImageContainer image)
Performs the actual draw operation.- Specified by:
doDraw
in classAbstractDrawOperation
- Parameters:
image
- the image to draw on- Returns:
- null if OK, otherwise error message
-
-