to top
Datalogic APIs
public class

VisualFormatter

extends Object
java.lang.Object
   ↳ com.datalogic.decode.VisualFormatter

Class Overview

VisualFormatter is a class used to install and manage the different projects created from the Visual Formatter tool available inside Scan2Deploy Studio.
A project consists of a list of items of 2 types:
- FORMATTER: Takes as input the barcode received from the scanner and transforms it as desired, returning the modified barcode as output;
- DISPATCHER: Takes as input the barcode received from the scanner and selects the FORMATTER items to execute.
After a project is installed, one of its items will be set as the active item. When a new barcode is read its contents will be passed to the active item in order to be managed. The active item can also be changed in any moment.

Summary

Nested Classes
class VisualFormatter.Item VisualFormatter.Item is a class representing a visual formatting item, used to manipulate the input barcode data when set as active item. 
enum VisualFormatter.PersistenceType VisualFormatter.PersistenceType is an enumeration representing the persistence type of the installed visual formatter configuration. 
Public Methods
VisualFormatter.Item getActiveItem()
Gets the currently active item if any, or null otherwise.
int getFeatureLevel()
Gets the Visual Formatter feature level.
static VisualFormatter getInstance()
Gets an instance of the VisualFormatter, if it is supported but the platform.
List<VisualFormatter.Item> getItems()
Lists all available formatting items.
int getTimeout()
Gets the Visual Formatter script execution timeout.
int install(String path, VisualFormatter.PersistenceType persistenceType, boolean overwriteExisting)
Installs a new formatter project by specifying a zip file.
boolean isEnabled()
Checks if the Visual Formatter is enabled.
int remove(String projectId)
Remove the items of the specified project.
int remove(VisualFormatter.PersistenceType persistenceType)
Remove the items of the specified persistence type.
int resetToDefault()
Removes all items that are reboot or enterprise reset persistent.
int setActiveItem(VisualFormatter.Item activeItem)
Sets the item to make active.
int setEnable(boolean enable)
Enables or disables the Visual Formatter.
int setTimeout(int timeout)
Sets the Visual Formatter script execution timeout.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public VisualFormatter.Item getActiveItem ()

Added in revision 24

Gets the currently active item if any, or null otherwise.

Returns
  • The currently active item if found, or null otherwise.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int getFeatureLevel ()

Added in revision 26

Gets the Visual Formatter feature level.

Returns
  • The maximum supported feature level.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public static VisualFormatter getInstance ()

Added in revision 24

Gets an instance of the VisualFormatter, if it is supported but the platform.

Returns
  • A VisualFormatter object if supported, null otherwise.

public List<VisualFormatter.Item> getItems ()

Added in revision 24

Lists all available formatting items.

Returns
  • The available items, the list is empty if no items are available.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int getTimeout ()

Added in revision 24

Gets the Visual Formatter script execution timeout.

Returns
  • The timeout in milliseconds.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int install (String path, VisualFormatter.PersistenceType persistenceType, boolean overwriteExisting)

Added in revision 24

Installs a new formatter project by specifying a zip file. It also sets the active item to one of the items found inside the zip file.

Parameters
path The path to a zip file containing the formatter project. The file can contain multitple scripts corresponding to different formatting items.
persistenceType The type of persistence required for this formatter configuration. Can only be reboot or enterprise reset persistent.
overwriteExisting Used when some items with the same project ID of the new project are already installed in the device. It will clear all items found with the same project ID of the new one before installing it.
Returns
  • DecodeException.SUCCESS in case it succeeds, otherwise it returns an error code if the exceptions are disabled or throws a DecodeException in case the exceptions are enabled.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public boolean isEnabled ()

Added in revision 24

Checks if the Visual Formatter is enabled.

Returns
  • true in case the Visual Formater is enabled, false otherwise or in case of failure.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int remove (String projectId)

Added in revision 24

Remove the items of the specified project.

Parameters
projectId The project id.
Returns
  • DecodeException.SUCCESS in case it succeeds, otherwise it returns an error code if the exceptions are disabled or throws a DecodeException in case the exceptions are enabled.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int remove (VisualFormatter.PersistenceType persistenceType)

Added in revision 24

Remove the items of the specified persistence type.

Parameters
persistenceType The persistence type of the items to remove.
Returns
  • DecodeException.SUCCESS in case it succeeds, otherwise it returns an error code if the exceptions are disabled or throws a DecodeException in case the exceptions are enabled.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int resetToDefault ()

Added in revision 24

Removes all items that are reboot or enterprise reset persistent.

Returns
  • SUCCESS in case it succeeds, otherwise it returns an error code if the exceptions are disabled or throws a DecodeException in case the exceptions are enabled.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int setActiveItem (VisualFormatter.Item activeItem)

Added in revision 24

Sets the item to make active.

Parameters
activeItem The item to make active.
Returns
  • SUCCESS in case it succeeds, otherwise it returns an error code if the exceptions are disabled or throws a DecodeException in case the exceptions are enabled.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int setEnable (boolean enable)

Added in revision 24

Enables or disables the Visual Formatter. When enabled, the Visual Formatter will execute the script associated with the current active item. If no item is active it will not execute.

Parameters
enable True to enable the Visual Formatter, false to disable it.
Returns
  • SUCCESS in case it succeeds, otherwise it returns an error code if the exceptions are disabled or throws a DecodeException in case the exceptions are enabled.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.

public int setTimeout (int timeout)

Added in revision 24

Sets the Visual Formatter script execution timeout. If during the execution of a script the timeout is reached, an error is returned.

Parameters
timeout The timeout in milliseconds, with accepted values in range 10-1000.
Returns
  • SUCCESS in case it succeeds, otherwise it returns an error code if the exceptions are disabled or throws a DecodeException in case the exceptions are enabled.
Throws
DecodeException in case of error, when exceptions are enabled through the ErrorManager singleton.