A button control (displaying a bar code icon) to start the bar code scanning process. If the native scanning feature is not available, the button is either hidden or it provides a fallback by opening a dialog with an input field where the bar code can be entered manually.
Event Summary
inputLiveUpdate(oControlEvent)Event is fired when the text in the dialog's input field is changed. scanFail(oControlEvent)Event is fired when the native scanning process is failed. scanSuccess(oControlEvent)Event is fired when the scanning is finished or cancelled Method Summary
sap.ndc.BarcodeScannerButton.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ndc.BarcodeScannerButton with name sClassName
and enriches it with the information contained in oClassInfo
. attachInputLiveUpdate(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the inputLiveUpdate
event of this sap.ndc.BarcodeScannerButton
. attachScanFail(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the scanFail
event of this sap.ndc.BarcodeScannerButton
. attachScanSuccess(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the scanSuccess
event of this sap.ndc.BarcodeScannerButton
. detachInputLiveUpdate(fnFunction, oListener)Detaches event handler fnFunction
from the inputLiveUpdate
event of this sap.ndc.BarcodeScannerButton
. detachScanFail(fnFunction, oListener)Detaches event handler fnFunction
from the scanFail
event of this sap.ndc.BarcodeScannerButton
. detachScanSuccess(fnFunction, oListener)Detaches event handler fnFunction
from the scanSuccess
event of this sap.ndc.BarcodeScannerButton
. fireScanFail(mArguments?)Fires event scanFail
to attached listeners. getVisible()Gets current value of property visible
. getWidth()Gets current value of property width
. setVisible(bVisible)Sets a new value for property visible
. setWidth(sWidth)Sets a new value for property width
. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getAccessibilityInfo,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
hasStyleClass,
invalidate,
isBusy,
onAfterRendering,
onBeforeRendering,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
exit,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
init,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.ndc.BarcodeScannerButton(sId?, mSettings?)
Constructor for a new BarcodeScannerButton.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- Aggregations
- Events
- scanSuccess : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- scanFail : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- inputLiveUpdate : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
Parameters:
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
Event Detail
inputLiveUpdate(oControlEvent)
Event is fired when the text in the dialog's input field is changed.
Parameters:
scanFail(oControlEvent)
Event is fired when the native scanning process is failed.
Parameters:
scanSuccess(oControlEvent)
Event is fired when the scanning is finished or cancelled
Parameters:
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{string} | oControlEvent.getParameters.text | The the text representation of the bar code data. |
{string} | oControlEvent.getParameters.format | The type of the bar code detected. |
{boolean} | oControlEvent.getParameters.cancelled | Indicates whether or not the user cancelled the scan. |
Method Detail
sap.ndc.BarcodeScannerButton.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ndc.BarcodeScannerButton with name
sClassName
and enriches it with the information contained in
oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.ndc.BarcodeScannerButton.
Returns:
Attaches event handler
fnFunction
to the
inputLiveUpdate
event of this
sap.ndc.BarcodeScannerButton
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ndc.BarcodeScannerButton
itself.
Event is fired when the text in the dialog's input field is changed.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ndc.BarcodeScannerButton itself |
Returns:
Attaches event handler
fnFunction
to the
scanFail
event of this
sap.ndc.BarcodeScannerButton
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ndc.BarcodeScannerButton
itself.
Event is fired when the native scanning process is failed.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ndc.BarcodeScannerButton itself |
Returns:
Attaches event handler
fnFunction
to the
scanSuccess
event of this
sap.ndc.BarcodeScannerButton
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ndc.BarcodeScannerButton
itself.
Event is fired when the scanning is finished or cancelled
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ndc.BarcodeScannerButton itself |
Returns:
Detaches event handler
fnFunction
from the
inputLiveUpdate
event of this
sap.ndc.BarcodeScannerButton
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
scanFail
event of this
sap.ndc.BarcodeScannerButton
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
scanSuccess
event of this
sap.ndc.BarcodeScannerButton
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Fires event
inputLiveUpdate
to attached listeners.
Expects the following event parameters:
newValue
of type string
The new value of the input field.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event scanFail
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event
scanSuccess
to attached listeners.
Expects the following event parameters:
text
of type string
The the text representation of the bar code data.format
of type string
The type of the bar code detected.cancelled
of type boolean
Indicates whether or not the user cancelled the scan.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getProvideFallback(): boolean
Gets current value of property
provideFallback
.
If set to true, the button remains visible if the scanner is not available and triggers a dialog to enter bar code.
Default value is true
.
Returns:
{boolean} | Value of property provideFallback |
getVisible(): boolean
Gets current value of property
visible
.
The invisible bar code scanner button is not rendered regardless of the availability of the native scan feature.
Default value is true
.
Returns:
{boolean} | Value of property visible |
Gets current value of property
width
.
Defines the width of the scanner button.
Returns:
Sets a new value for property
provideFallback
.
If set to true, the button remains visible if the scanner is not available and triggers a dialog to enter bar code.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bProvideFallback | New value for property provideFallback |
Returns:
Sets a new value for property
visible
.
The invisible bar code scanner button is not rendered regardless of the availability of the native scan feature.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bVisible | New value for property visible |
Returns:
Sets a new value for property
width
.
Defines the width of the scanner button.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns: