Class Barcode

All Implemented Interfaces:
Serializable, Cloneable, Component, Scope, ComponentCtrl

public class Barcode extends XulElement
Represents a barcode

A barcode is a component to handle 1D and 2D barcode image.

Since:
8.6.0
See Also:
  • Constructor Details

    • Barcode

      public Barcode()
  • Method Details

    • getType

      public String getType()
      Returns the encoded and decoded type of this component. The built-in types are
      • CODE family: CODE39, CODE128, CODE128A, CODE128B, CODE128C
      • EAN family: EAN13, EAN8, EAN5, EAN2
      • ITF family: ITF14, ITF
      • MSI family: MSI, MSI10, MSI11, MSI1010, MSI1110
      • others: UPC, PHARMACODE , CODABAR, QR
      Some of the types have character and length limit. You can check it at https://en.wikipedia.org/wiki/Barcode

      Default: "CODE128".

      Returns:
      A value of the barcode current type.
    • setType

      public void setType(String type)
      Sets the encode and decode type of this component. Example: type="code128", type="qr"
      Parameters:
      type - decide the render type function.
    • getValue

      public String getValue()
      Returns the value of the barcode image.

      Default: "".

      Returns:
      The barcode's value
    • setValue

      public void setValue(String value)
      Sets the value that will be encoded to the barcode image.
      Parameters:
      value - The value to be encoded into barcode.
    • getDisplayValue

      public boolean getDisplayValue()
      Returns the visibility of the value of barcode component (only for 1D barcode).

      Default: false.

      Returns:
      true if displaying value is enable.
    • setDisplayValue

      public void setDisplayValue(boolean displayValue)
      Sets the visibility of the value of barcode component.
      Parameters:
      displayValue - Whether to show the value text or not, only for 1D barcode.
    • getFontSize

      public int getFontSize()
      Returns the fontSize of barcode (only for 1D barcode).

      Default: 10.

      Returns:
      the font size of the barcode text.
    • setFontSize

      public void setFontSize(int fontSize)
      Sets the fontSize of barcode.
      Parameters:
      fontSize - The fontSize of the barcode text, only for 1D barcode.
    • getBarWidth

      public int getBarWidth()
      Returns the width of single bar (only for 1D barcode).

      Default: 2.

      Returns:
      the single bar width
    • setBarWidth

      public void setBarWidth(int barWidth)
      Sets the width of single bar.
      Parameters:
      barWidth - The single width of the 1D barcode bar. It would affect the total width of the barcode;
    • renderProperties

      protected void renderProperties(ContentRenderer renderer) throws IOException
      Description copied from class: HtmlBasedComponent
      Renders the content of this component, excluding the enclosing tags and children.

      See also ZK Client-side Reference: Property Rendering

      Overrides:
      renderProperties in class XulElement
      Throws:
      IOException