net.rim.device.api.barcodelib
Class BarcodeScannerOverlayField

java.lang.Object
  extended by net.rim.device.api.ui.Field
      extended by net.rim.device.api.amms.control.camera.ViewfinderOverlay.VideoControlOverlayField
          extended by net.rim.device.api.barcodelib.BarcodeScannerOverlayField
All Implemented Interfaces:
ViewfinderOverlay.OverlayCanvas.Positionable

public class BarcodeScannerOverlayField
extends ViewfinderOverlay.VideoControlOverlayField

Provides an overlay for the viewfinder when using a BarcodeDecoder.

Since:
BlackBerry API 7.0.0

Field Summary
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, AXIS_HORIZONTAL, AXIS_SEQUENTIAL, AXIS_VERTICAL, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEADING, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_TRAILING, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH, VISUAL_STATE_ACTIVE, VISUAL_STATE_DISABLED, VISUAL_STATE_DISABLED_FOCUS, VISUAL_STATE_FOCUS, VISUAL_STATE_NORMAL
 
Constructor Summary
BarcodeScannerOverlayField(BarcodeDecoder decoder, VideoControl videoControl)
          Creates a new instance of BarcodeScannerOverlayField.
 
Method Summary
 void addResultPoint(ResultPoint point)
          The DecodeHintType.NEED_RESULT_POINT_CALLBACK that's registered calls this method to add ResultPoint for painting.
 void enableRectangeHint(boolean enable)
          Enables a rectange hint that can help users place a barcode.
 void enableScanLineHint(boolean enable)
          Enables a scan line hint that can help users place a barcode.
protected  void paint(Graphics graphics)
          Invoked by the framework to redraw a portion of this field.
 
Methods inherited from class net.rim.device.api.amms.control.camera.ViewfinderOverlay.VideoControlOverlayField
getDisplayHeight, getDisplayWidth, getPreferredHeight, getPreferredWidth, getXPosition, getYPosition, layout
 
Methods inherited from class net.rim.device.api.ui.Field
cursorClick, cursorUnclick, drawFocus, drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getAccessibleContext, getBackground, getBackground, getBorder, getBorder, getBorder, getChangeListener, getCommandItemProvider, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFocusRect, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getOriginal, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getScreen, getStyle, getTextFillColor, getTextStrokeColor, getTop, getVisualState, getWidth, invalidate, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isEnabled, isFocus, isFocusable, isLeftToRight, isMuddy, isPasteable, isScrollCopyable, isSelectable, isSelecting, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isSpellCheckable, isStyle, isVisible, keyChar, keyControl, keyDown, keyRepeat, keyStatus, keyUp, makeContextMenu, moveFocus, moveFocus, navigationClick, navigationMovement, navigationUnclick, onDisplay, onExposed, onFocus, onMenuDismissed, onMenuDismissed, onObscured, onUndisplay, onUnfocus, onVisibilityChange, paste, select, selectionCopy, selectionCut, selectionDelete, setBackground, setBackground, setBorder, setBorder, setBorder, setBorder, setChangeListener, setCommandItemProvider, setCookie, setDirty, setEditable, setEnabled, setExtent, setFocus, setFocusListener, setFont, setFont, setMargin, setMargin, setMuddy, setNonSpellCheckable, setPadding, setPadding, setPosition, setVisualState, touchEvent, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

BarcodeScannerOverlayField

public BarcodeScannerOverlayField(BarcodeDecoder decoder,
                                  VideoControl videoControl)
Creates a new instance of BarcodeScannerOverlayField. If the BarcodeDecoder is configured to scan for 1D barcodes, this BarcodeScannerOverlayField may be augmented with a hint that will help scan 1D barcodes. Similarly, if the BarcodeDecoder is configured to scan for 2D barcodes, this BarcodeScannerOverlayField may be augmented with a hint that will help scan 2D barcodes.

Parameters:
decoder - BarcodeDecoder that owns this overlay.
control - VideoControl that owns this overlay.
Throws:
IllegalArgumentException - if videoControl is null.
IllegalArgumentException - if decoder is null.
Since:
BlackBerry API 7.0.0


Method Detail

addResultPoint

public void addResultPoint(ResultPoint point)
The DecodeHintType.NEED_RESULT_POINT_CALLBACK that's registered calls this method to add ResultPoint for painting. Can be overriden with no-op to disable result points.

Parameters:
point - ResultPoint of interest. If point is null this method does nothing.
Since:
BlackBerry API 7.0.0

enableRectangeHint

public void enableRectangeHint(boolean enable)
Enables a rectange hint that can help users place a barcode. This is helpful for 2D barcodes as it will help users place a 2D barcode in the viewfinder.

Parameters:
enable - true to enable the hint, false otherwise.
Since:
BlackBerry API 7.0.0

enableScanLineHint

public void enableScanLineHint(boolean enable)
Enables a scan line hint that can help users place a barcode. This is helpful for 1D barcodes as it will help users place a 1D barcode in the viewfinder.

Parameters:
enable - true to enable the hint, false otherwise.
Since:
BlackBerry API 7.0.0

paint

protected void paint(Graphics graphics)
Description copied from class: Field
Invoked by the framework to redraw a portion of this field.

This is an abstract method; any class that extends Field must implement this method appropriate to its needs.

A field's manager invokes this method when an area of this field has been marked as invalid. All painting should be done in field-local coordinates (for example, (0,0) is the top left corner of the field's pane).

The clipping rectangle is available (in local coordinates) through Graphics.getClippingRect(). You can use this rectangle to determine the minimal amount of drawing required to satisfy the paint request. Large controls should make use of this for more efficient painting, particularly during scroll operations.

Preconditions for the paint method
Routines that invoke this method on a field ensure that this.getFont() returns an equivalent value to graphics.getFont() and that the appropriate clipping rect and transformation stack are set up, so that this method draws on the appropriate area of this field.

Should you implement a layout manager (for example) of your own, be aware that you must ensure these conditions are met before invoking this method in child Fields.

Specified by:
paint in class Field
Parameters:
graphics - The graphics context for drawing in this field.
See Also:
Field.paint(net.rim.device.api.ui.Graphics)
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal