Package org.zkoss.stateless.sul

## Interface IBarcodescanner

- All Superinterfaces:
    `IAnyGroup<IBarcodescanner>`, `IComponent<IBarcodescanner>`, `IHtmlBasedComponent<IBarcodescanner>`, `IXulElement<IBarcodescanner>`

      public interface IBarcodescanner
      extends IXulElement<IBarcodescanner>, IAnyGroup<IBarcodescanner>

  Immutable `Barcodescanner` component

  Only works for Chrome, Firefox and Edge. iOS Safari is supported since 11. (iOS WebView browsers like Chrome are not supported yet)

  ### Support @Action

  Name | Action Type
  --- | ---
  onDetect | ActionData: `DetectData` Notifies if the barcode scanner detect a barcode message.

  Author:
    katherine
  See Also:
    `Barcodescanner`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static class` | `IBarcodescanner.Builder` | Builds instances of type `IBarcodescanner`.
    `static class` | `IBarcodescanner.Updater` | Builds an updater of type `IBarcodescanner` for `UiAgent.smartUpdate(Locator, SmartUpdater)`.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static IBarcodescanner` | `DEFAULT` | Constant for default attributes of this immutable component.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default int` | `getConsistencyBufferSize()` | Returns the consistency buffer size (used in 1D barcode).
    `default int` | `getConsistencyThreshold()` | Returns the consistency threshold (used in 1D barcode).
    `java.util.Map<java.lang.String,​java.lang.Object>` | `getConstraints()` | Returns the constraints.
    `default double` | `getErrorAcceptance()` | Returns the error acceptance (used in 1D barcode).
    `default double` | `getInterval()` | Returns the scan interval of the barcode scanner.
    `default java.lang.String` | `getType()` | Returns the types which the barcode scanner is dealing with.
    `default java.lang.String` | `getWidgetClass()` | Returns the client widget class.
    `default boolean` | `isContinuous()` | Returns the continuous scan status of the barcode scanner.
    `default boolean` | `isEnable()` | Returns the enabled status of the barcode scanner.
    `static IBarcodescanner` | `ofId​(java.lang.String id)` | Returns the instance with the given id.
    `static IBarcodescanner` | `ofInterval​(int interval)` | Returns the instance with the given interval
    `static IBarcodescanner` | `ofType​(java.lang.String type)` | Returns the instance with the given type
    `IBarcodescanner` | `withConsistencyBufferSize​(int consistencyBufferSize)` | Returns a copy of `this` immutable component with the specified `consistencyBufferSize`.
    `IBarcodescanner` | `withConsistencyThreshold​(int consistencyThreshold)` | Returns a copy of `this` immutable component with the specified `consistencyThreshold`.
    `IBarcodescanner` | `withConstraints​(java.util.Map<java.lang.String,​? extends java.lang.Object> constraints)` | Returns a copy of `this` immutable component with the specified `constraints`.
    `IBarcodescanner` | `withContinuous​(boolean continuous)` | Returns a copy of `this` immutable component with the specified `continuous`.
    `IBarcodescanner` | `withEnable​(boolean enable)` | Returns a copy of `this` immutable component with the specified `enable`.
    `IBarcodescanner` | `withErrorAcceptance​(double errorAcceptance)` | Returns a copy of `this` immutable component with the specified `errorAcceptance`.
    `IBarcodescanner` | `withInterval​(double interval)` | Returns a copy of `this` immutable component with the specified `interval`.
    `IBarcodescanner` | `withType​(java.lang.String type)` | Returns a copy of `this` immutable component with the specified `type`.

    - ### Methods inherited from interface org.zkoss.stateless.sul.IComponent

      `getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent

      `getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IXulElement

      `getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip`

- - ### Field Detail

    - #### DEFAULT

          static final IBarcodescanner DEFAULT

      Constant for default attributes of this immutable component.

  - ### Method Detail

    - #### getWidgetClass

          default java.lang.String getWidgetClass()

      Returns the client widget class.

      Default: `"zkmax.barscanner.Barcodescanner"`

      Specified by:
        `getWidgetClass` in interface `IComponent<IBarcodescanner>`

    - #### getConstraints

          @Nullable
          java.util.Map<java.lang.String,​java.lang.Object> getConstraints()

      Returns the constraints. About allowed constraints setting, see MediaStreamConstraints

      Default: `null`.

    - #### withConstraints

          IBarcodescanner withConstraints​(@Nullable
                                          java.util.Map<java.lang.String,​? extends java.lang.Object> constraints)

      Returns a copy of `this` immutable component with the specified `constraints`.

      Sets the constraints. About allowed constraints setting, see MediaStreamConstraints

      Parameters:
        `constraints` - The constraints setting.

        Default: `null`.

      Returns:
        A modified copy of the `this` object

    - #### getType

          default java.lang.String getType()

      Returns the types which the barcode scanner is dealing with.

      Default: `"CODE128"`.

    - #### withType

          IBarcodescanner withType​(java.lang.String type)

      Returns a copy of `this` immutable component with the specified `type`.

      Sets 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 types have character and length limit. You can check it at https://en.wikipedia.org/wiki/Barcode
      Parameters:
        `type` - The encoded and decoded type of this component.

        Default: `"CODE128"`.

      Returns:
        A modified copy of the `this` object

    - #### getInterval

          default double getInterval()

      Returns the scan interval of the barcode scanner.

      Default: `1000`. Unit: millisecond.

    - #### withInterval

          IBarcodescanner withInterval​(double interval)

      Returns a copy of `this` immutable component with the specified `interval`.

      Sets the scan interval of the barcode scanner.

      Parameters:
        `interval` - The scan interval of the barcode scanner.

        Default: `1000`. Unit: millisecond.

      Returns:
        A modified copy of the `this` object

    - #### getConsistencyBufferSize

          default int getConsistencyBufferSize()

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

      Default: `5`.

    - #### withConsistencyBufferSize

          IBarcodescanner withConsistencyBufferSize​(int consistencyBufferSize)

      Returns a copy of `this` immutable component with the specified `consistencyBufferSize`.

      Sets the consistency buffer size (used in 1D barcode).

      Parameters:
        `consistencyBufferSize` - The consistency buffer size (used in 1D barcode).

        Default: `5`.

      Returns:
        A modified copy of the `this` object

    - #### getConsistencyThreshold

          default 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`.

    - #### withConsistencyThreshold

          IBarcodescanner withConsistencyThreshold​(int consistencyThreshold)

      Returns a copy of `this` immutable component with the specified `consistencyThreshold`.

      Sets the consistency threshold (used in 1D barcode).

      Parameters:
        `consistencyThreshold` - The consistency threshold (used in 1D barcode).

        Default: `3`.

      Returns:
        A modified copy of the `this` object

    - #### getErrorAcceptance

          default double getErrorAcceptance()

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

      Default: `0.1` (means 10%)

    - #### withErrorAcceptance

          IBarcodescanner withErrorAcceptance​(double errorAcceptance)

      Returns a copy of `this` immutable component with the specified `errorAcceptance`.

      Sets the error acceptance (used in 1D barcode).

      Parameters:
        `errorAcceptance` - The error acceptance (used in 1D barcode).

        Default: `0.1` (means 10%).

      Returns:
        A modified copy of the `this` object

    - #### isContinuous

          default boolean isContinuous()

      Returns the continuous scan status of the barcode scanner.

      Default: `false`.

      Returns:
        boolean

    - #### withContinuous

          IBarcodescanner withContinuous​(boolean continuous)

      Returns a copy of `this` immutable component with the specified `continuous`.

      Sets the continuous scan status of the barcode scanner.

      Parameters:
        `continuous` - The continuous scan status of the barcode scanner.

        Default: `false`.

      Returns:
        A modified copy of the `this` object

    - #### isEnable

          default boolean isEnable()

      Returns the enabled status of the barcode scanner.

      Default: `true`.

    - #### withEnable

          IBarcodescanner withEnable​(boolean enable)

      Returns a copy of `this` immutable component with the specified `enable`.

      Sets the enabled status of the barcode scanner.

      Parameters:
        `enable` - The enabled status of the barcode scanner.

        Default: `true`.

      Returns:
        A modified copy of the `this` object

    - #### ofType

          static IBarcodescanner ofType​(java.lang.String type)

      Returns the instance with the given type
      Parameters:
        `type` - The encoded or decoded type of the component.

    - #### ofInterval

          static IBarcodescanner ofInterval​(int interval)

      Returns the instance with the given interval

      By calling this, `isContinuous()` to be true.

      Parameters:
        `interval` - The scan interval of the barcode scanner.

    - #### ofId

          static IBarcodescanner ofId​(java.lang.String id)

      Returns the instance with the given id.
      Parameters:
        `id` - The id to identify this component