Class Barcodescanner

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zkmax.zul.Barcodescanner
All Implemented Interfaces:
Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl

public class Barcodescanner extends org.zkoss.zul.impl.XulElement
A Barcode scanner Only works for Chrome, Firefox and Edge. iOS Safari is supported since 11. (iOS WebView browsers like Chrome are not supported yet)
Since:
8.6.0
Author:
klyvechen
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent

    org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrl

    Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

    org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo
  • Field Summary

    Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent

    _zclass

    Fields inherited from interface org.zkoss.zk.ui.Component

    APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE

    Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl

    AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the consistency buffer size (used in 1D barcode).
    int
    Returns the consistency threshold (used in 1D barcode).
    Returns the constraints.
    Returns the constraints in JSON String format.
    boolean
    Deprecated.
    As release of ZK 10.0, please use isContinuous()
    boolean
    Deprecated.
    As of release 10.0.0, replaced with isEnable()
    double
    Returns the error acceptance (used in 1D barcode).
    double
    Returns the scan interval of the barcode scanner.
    Returns the types which the barcode scanner is dealing with.
    boolean
    Returns the continue scan status of the barcode scanner.
    boolean
    Returns the enabled status of the barcode scanner.
    protected void
    renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
     
    void
    service(org.zkoss.zk.au.AuRequest request, boolean everError)
     
    void
    setConsistencyBufferSize(int bufferSize)
    Sets the consistency buffer size (used in 1D barcode).
    void
    setConsistencyThreshold(int threshold)
    Sets the consistency threshold (used in 1D barcode).
    void
    setConstraints(Map constraints)
    Sets the constraints, if not specify constraints, it will use {video: {facingMode: 'environment'}}.
    void
    Sets the constraints in JSON String format, if not specify constraints, it will use {video: {facingMode: 'environment'}}.
    void
    setContinuous(boolean continuous)
    Set the continuous scan function of barcode scanner, true is enable continue scan function, false is disable the function
    void
    setEnable(boolean enable)
    Set the enabled status of barcode scanner, true is enable the scanner function, false is disable the scanner function.
    void
    setErrorAcceptance(double acceptance)
    Sets the error acceptance (used in 1D barcode). 0 means no error allowed, 1 (100%) means no check.
    void
    setInterval(int interval)
    Set the scan interval of barcode scanner, it works only when the continuous is true.
    void
    A string which is a combination of types, separated by comma, the widget can detect all the defined types at a same time.

    Methods inherited from class org.zkoss.zul.impl.XulElement

    clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes

    Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent

    addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setSkeleton, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly

    Methods inherited from class org.zkoss.zk.ui.AbstractComponent

    addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Barcodescanner

      public Barcodescanner()
  • Method Details

    • getType

      public String getType()
      Returns the types which the barcode scanner is dealing with.

      Default: "CODE128".

      Returns:
      String.
    • setType

      public void setType(String type)
      A string which is a combination of types, separated by comma, the widget can detect all the defined types at a same time. The more specific the types is, the more efficient the widget is. Example: "code128,EAN,qr"
      Parameters:
      type - .
    • getContinuous

      public boolean getContinuous()
      Deprecated.
      As release of ZK 10.0, please use isContinuous()
      Returns the continuous scan status of the barcode scanner.

      Default: false.

      Returns:
      boolean
    • isContinuous

      public boolean isContinuous()
      Returns the continue scan status of the barcode scanner.

      Default: false.

      Returns:
      boolean
    • setContinuous

      public void setContinuous(boolean continuous)
      Set the continuous scan function of barcode scanner, true is enable continue scan function, false is disable the function
      Parameters:
      continuous -
    • getEnable

      public boolean getEnable()
      Deprecated.
      As of release 10.0.0, replaced with isEnable()
      Returns the enable status of the barcode scanner.

      Default: "true".

      Returns:
      boolean
    • isEnable

      public boolean isEnable()
      Returns the enabled status of the barcode scanner.

      Default: true.

    • setEnable

      public void setEnable(boolean enable)
      Set the enabled status of barcode scanner, true is enable the scanner function, false is disable the scanner function.
      Parameters:
      enable -
    • getInterval

      public double getInterval()
      Returns the scan interval of the barcode scanner.

      Default: 1000. Unit: millisecond.

      Returns:
      double
    • setInterval

      public void setInterval(int interval)
      Set the scan interval of barcode scanner, it works only when the continuous is true. Unit: millisecond.
      Parameters:
      interval -
    • getConstraints

      public Map getConstraints()
      Returns the constraints. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints Default: null.
      Returns:
      the constraints
    • setConstraints

      public void setConstraints(Map constraints)
      Sets the constraints, if not specify constraints, it will use {video: {facingMode: 'environment'}}. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints
      Parameters:
      constraints - the constraints
    • getConstraintsString

      public String getConstraintsString()
      Returns the constraints in JSON String format. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints

      Default: null.

      Returns:
      the constraints in JSON String format
    • setConstraintsString

      public void setConstraintsString(String constraints)
      Sets the constraints in JSON String format, if not specify constraints, it will use {video: {facingMode: 'environment'}}. About allowed constraints setting, see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints
      Parameters:
      constraints - the constraints in JSON String format
    • getConsistencyBufferSize

      public int getConsistencyBufferSize()
      Returns the consistency buffer size (used in 1D barcode).

      Default: 5.

      Returns:
      buffer size
    • setConsistencyBufferSize

      public void setConsistencyBufferSize(int bufferSize)
      Sets the consistency buffer size (used in 1D barcode).
      Parameters:
      bufferSize - buffer size. Must be > 0 and >= threshold.
    • getConsistencyThreshold

      public int getConsistencyThreshold()
      Returns the consistency threshold (used in 1D barcode). In other way, the result is required to be scanned at least N times out of consistency buffer size.

      Default: 3.

      Returns:
      threshold
    • setConsistencyThreshold

      public void setConsistencyThreshold(int threshold)
      Sets the consistency threshold (used in 1D barcode). In other way, the result is required to be scanned at least N times out of consistency buffer size.
      Parameters:
      threshold - threshold. Must be > 0 and <= buffer size.
    • getErrorAcceptance

      public double getErrorAcceptance()
      Returns the error acceptance (used in 1D barcode).

      Default: 0.1 (means 10%)

      Returns:
      acceptance
      Since:
      8.6.1
    • setErrorAcceptance

      public void setErrorAcceptance(double acceptance)
      Sets the error acceptance (used in 1D barcode). 0 means no error allowed, 1 (100%) means no check.
      Parameters:
      acceptance - Error acceptance. Must be >= 0 and <= 1.
      Since:
      8.6.1
    • service

      public void service(org.zkoss.zk.au.AuRequest request, boolean everError)
      Specified by:
      service in interface org.zkoss.zk.ui.sys.ComponentCtrl
      Overrides:
      service in class org.zkoss.zk.ui.HtmlBasedComponent
    • renderProperties

      protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException
      Overrides:
      renderProperties in class org.zkoss.zul.impl.XulElement
      Throws:
      IOException