export
This module contains resources for performing export operations from the browser, and implementing your own export operations.
Performing an export
In Workbench or the HTML5 Hx Profile, there will be an Export button shown in the toolbar. There will also be an Export button in the right-click menu on exportable objects. Either will open the Export Dialog for the selected object.
In the Export Dialog, the Exporter list will show the available exporters on the current object or Widget. Configuration options will be shown for the selected exporter to allow you to choose how the export will be performed.
The Destination list will show the available destinations: where to send the exported data. Configuration options will also be shown for the selected export destination.
In addition, APIs are provided to allow you to implement new ways of extracting data out of your Niagara system.
Implementing Export behavior in the Station and Workbench
BExporter
To implement a new exporter, subclass baja:Exporter and implement the export() method. This method receives a Niagara object and converts it to a stream of text or binary data. If the exporter should work only in Workbench, implement workbench:IWbViewExporter and the exporter will export the current workbench:WbView.
See the Bajadoc for baja:Exporter for more details.
BIExportDestinationType
Workbench provides a set of export destinations out of the box, such as Save To File or View In Workbench. If you would like to implement a way of sending exported data to a different destination (e.g. Dropbox, Gmail, a REST endpoint), implement the export:IExportDestinationType interface. This provides a way to define which environments in which the destination is valid, and how the transformed data will be sent there.
See the Bajadoc for export:IExportDestinationType for more details.
Implementing Export behavior in the browser
TransformOperationProvider
All baja:Exporter classes that work in the Station will be accessible for use in the browser. Some bajaux Widgets may also export their own data in their own way, using JavaScript. To allow your Widget to hook into the Export Dialog to perform an export right from the browser, implement the TransformOperationProvider interface on your top-level Widget. In this way, your Widget can define additional transform operations to be performed when the user clicks the Export button in the toolbar.
Your Widget instance can simply implement the getTransformOperations method. Each TransformOperation encapsulates a transform operation: the object to be transformed, the transformer used to transform it, and the destination to which the transformed data will be sent. See the JSDocs for more details.
ExportDestinationType
Similar to export:IExportDestinationType, the ExportDestinationType JavaScript module allows transformed data to be sent to a different destination, such as a POST from the browser to a REST endpoint. To implement, simply subclass ExportDestinationType. See the JSDocs for more details.
For the destination to appear in the destination list in the Export Dialog, its existence must be registered with the framework. To do this, implement a Java class implementing export:IJavaScriptExportDestination and point it at your JavaScript module.