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 intm_HeightHeight of barcode.protected intm_MarginMargin around the barcode.protected intm_WidthWidth of barcode.protected intm_XTop left x of the barcode.protected intm_YTop 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 Stringcheck(BufferedImageContainer image)Additional checks to the image.voiddefineOptions()Adds options to the internal list of options.protected StringdoDraw(BufferedImageContainer image)Performs the actual draw operation.protected abstract BufferedImageContainerdoEncode(String payload, BufferedImageContainer cont, MessageCollection errors)Encodes the supplied payload.BufferedImageContainerencode(String payload, MessageCollection errors)Encodes the supplied payload.BufferedImageContainerencode(String payload, BufferedImageContainer cont, MessageCollection errors)Encodes the supplied payload.intgetHeight()Returns the height of the barcode.intgetMargin()Returns the margin around the barcode.protected abstract StringgetPayload()Returns the payload to use for generating the barcode.intgetWidth()Returns the width of the barcode.intgetX()Returns the X position of the pixel.intgetY()Returns the Y position of the pixel.StringheightTipText()Returns the tip text for this property.protected abstract StringisValid(String payload)Checks whether the payload can be processed.StringmarginTipText()Returns the tip text for this property.protected BufferedImagenewImage()Generates a new image according to the specified dimensions.voidsetHeight(int value)Sets the height of the barcode.voidsetMargin(int value)Sets the margin around the barcode.voidsetWidth(int value)Sets the width of the barcode.voidsetX(int value)Sets the X position of the pixel.voidsetY(int value)Sets the Y position of the pixel.StringwidthTipText()Returns the tip text for this property.StringxTipText()Returns the tip text for this property.StringyTipText()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:AbstractOptionHandlerAdds options to the internal list of options. Derived classes must override this method to add additional options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
check
protected String check(BufferedImageContainer image)
Additional checks to the image.- Overrides:
checkin 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:
doDrawin classAbstractDrawOperation- Parameters:
image- the image to draw on- Returns:
- null if OK, otherwise error message
-
-