Package adams.data.barcode.encode
Class QRCode
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,Serializable
public class QRCode extends AbstractBarcodeEncoder
Draws a QR code at a specified location and size.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-x <int> (property: x) X position of the top-left corner. default: 1 minimum: 1
-y <int> (property: y) Y position of the top-left corner. default: 1 minimum: 1
-width <int> (property: width) Width of the barcode in pixels. default: 100 minimum: 1
-height <int> (property: height) Height of the barcode in pixels. default: 100 minimum: 1
-margin <int> (property: margin) White margin surrounding the barcode. default: 5 minimum: 0
-text <java.lang.String> (property: text) Text to be encoded. default: foobar
-errorCorrectionLevel <L|M|Q|H> (property: errorCorrectionLevel) Error correction level. default: L
- 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 com.google.zxing.qrcode.decoder.ErrorCorrectionLevelm_ErrorCorrectionLevelError correction level.protected Stringm_TextText to be encoded.-
Fields inherited from class adams.data.barcode.encode.AbstractBarcodeEncoder
m_Height, m_Margin, m_Width, m_X, m_Y
-
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 QRCode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected BufferedImageContainerdoEncode(String payload, BufferedImageContainer cont, MessageCollection errors)Encodes the supplied payload.StringerrorCorrectionLevelTipText()Returns the tip text for this property.com.google.zxing.qrcode.decoder.ErrorCorrectionLevelgetErrorCorrectionLevel()Sets the error correction level of the QR code.protected StringgetPayload()Returns the payload to use for generating the barcode.StringgetText()Returns the text to be encoded in the QR code.StringglobalInfo()Returns a string describing the object.protected StringisValid(String payload)Checks whether the payload can be processed.voidsetErrorCorrectionLevel(com.google.zxing.qrcode.decoder.ErrorCorrectionLevel value)Returns the error correction level of the QR code.voidsetText(String value)Sets the text to be encoded in the QR code.StringtextTipText()Returns the tip text for this property.-
Methods inherited from class adams.data.barcode.encode.AbstractBarcodeEncoder
check, doDraw, encode, encode, getHeight, getMargin, getWidth, getX, getY, heightTipText, marginTipText, newImage, setHeight, setMargin, setWidth, setX, setY, widthTipText, xTipText, yTipText
-
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, 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
-
-
-
-
Field Detail
-
m_ErrorCorrectionLevel
protected com.google.zxing.qrcode.decoder.ErrorCorrectionLevel m_ErrorCorrectionLevel
Error correction level.
-
m_Text
protected String m_Text
Text to be encoded.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractBarcodeEncoder
-
getText
public String getText()
Returns the text to be encoded in the QR code.- Returns:
- the text
-
setText
public void setText(String value)
Sets the text to be encoded in the QR code.- Parameters:
value- the text
-
textTipText
public String textTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setErrorCorrectionLevel
public void setErrorCorrectionLevel(com.google.zxing.qrcode.decoder.ErrorCorrectionLevel value)
Returns the error correction level of the QR code.- Parameters:
value- the error correction level
-
getErrorCorrectionLevel
public com.google.zxing.qrcode.decoder.ErrorCorrectionLevel getErrorCorrectionLevel()
Sets the error correction level of the QR code.- Returns:
- the error correction level
-
errorCorrectionLevelTipText
public String errorCorrectionLevelTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getPayload
protected String getPayload()
Returns the payload to use for generating the barcode.- Specified by:
getPayloadin classAbstractBarcodeEncoder- Returns:
- the payload
-
isValid
protected String isValid(String payload)
Checks whether the payload can be processed.- Specified by:
isValidin classAbstractBarcodeEncoder- Parameters:
payload- the code to check- Returns:
- null if valid, otherwise error message
-
doEncode
protected BufferedImageContainer doEncode(String payload, BufferedImageContainer cont, MessageCollection errors)
Encodes the supplied payload.- Specified by:
doEncodein classAbstractBarcodeEncoder- 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
-
-