JavaScript interfaces for Neonto Studio plugins

This document lists all the "entry points" used by Neonto Studio to interface with plugins.

A plugin is loaded from a main JavaScript file (usually called Main.js). For each plugin instance, this JavaScript file is executed within a JavaScript object context. From the point of view of the plugin author, this object context is exposed as the "this" variable in the plugin script.

The object context has a number of purposes. Some properties on the object context are reserved by the host application (Neonto Studio). These properties are called "entry points" because the host application calls the plugin to discover its features and perform actions using these properties.

It is also possible to use the object context to store a plugin's internal data in memory. Many plugins use a property like this._data to keep an instance's internal state. However note that this data is not automatically saved. The plugin instance may get reconstructed at the host application's convenience, at which time the object context is restored to the values in your plugin's Main.js file. So if you want to store some data permanently, use the persist/unpersist methods described below.

Entry points common to all plugin types

(Functions implemented by plugin and called by the Neonto host app)

describePlugin(id, lang)

Provides localized information about the plugin. The parameter id is a string key describing the information needed. The parameter lang is a standard language + country code constant. (Currently lang is always "en-US" because there are no localizations yet.)

Example:

this.describePlugin = function(id, lang) {
switch (id) {
case 'displayName':
return "My Brilliant Plugin";
case 'shortDisplayText':
return "This plugin creates anything you can dream of by one click of a button.";
case 'defaultNameForNewInstance':
return "brilliant";
}
}

renderIcon(canvas)

Called by the host application to render an icon for this plugin. The canvas parameter is a Canvas object that implements most of the HTML5 Canvas API.

Note that the size of the canvas is not known in advance, so your code should read "canvas.width" and "canvas.height" and render its content accordingly.

It's possible to load your plugin icon from an image resource and draw that image into the canvas. Example:

this.renderIcon = function(canvas) {
var ctx = canvas.getContext('2d');
var w = canvas.width;
var h = canvas.height;
ctx.save();
if (this.icon == null) {
var path = Plugin.getPathForResource("my_brilliant_plugin_logo.png");
this.icon = Plugin.loadImage(path);
}
var iconW = this.icon.width;
var iconH = this.icon.height;
var aspectScale = Math.min(w/iconW, h/iconH);
var scale = 0.9 * aspectScale; // add some margin around icon
iconW *= scale;
iconH *= scale;
ctx.drawImage(this.icon, (w-iconW)*0.5, (h-iconH)*0.5, iconW, iconH);
ctx.restore();
};

persist()

Allows the plugin to write data that needs to persist when the plugin is saved and loaded from disk. Called when the host application saves the project file.

The return value must be a JavaScript object that can be encoded as JSON.

unpersist(obj)

This is the inverse of persist(). The parameter obj is an object that was previously saved by persist(). Called when the host application opens a project file.

inspectorUIDefinition

This property is used to create the user interface displayed in the host application's inspector panel (the right-hand side of the Neonto Studio interface).

The value must be an array containing objects, each of which describes a specific UI element. These elements will be visually stacked in the inspector view.

To respond to UI actions, elements can provide an "actionBinding" property that links to a function in the plugin's object context.

Following is an example taken from the Camera plugin:

this.inspectorUIDefinition = [
{
"type": "label",
"text": "Store photo to data slot:"
}, {
"type": "dataslot-picker",
"id": "dataSlot",
"actionBinding": "this.onPickDataSlot"
}, {
"type": "label",
"text": "Photo quality:"
}, {
"type": "multibutton",
"id": "photoQuality",
"labels": ["Best", "High", "Medium", "Low"],
"actionBinding": "this.onMultiButtonChange"
}, {
"type": "label",
"text": "Camera facing:"
}, {
"type": "multibutton",
"id": "cameraFacing",
"labels": ["Back", "Front"],
"actionBinding": "this.onMultiButtonChange"
}
];


Supported UI element types include:

This is not complete list. All UI element types, settings and properties for each type are described later in section 'UI element specifications'.

onCreateUI()

Called after the UI specified by inspectorUIDefinition has been created. This allows the plugin to set values in the newly created UI.

Example:

this.onCreateUI = function() {
var ui = this.getUI();
ui.getChildById("dataSlot").dataSlotName = this._data.dataSlotName;
}


Note the use of the getUI() method. This gives access to the UI object representing the entire UI created for this plugin, which then has a method named getChildById() to access a specific element by its id.

__pluginHostId

Used by the host application to determine the type of plugin. Example:

this.__pluginHostId = "com.neonto.studio.projectmap.webservice";

It's good practice to include this property so that the plugin's type can be deduced from its JavaScript file. Supported values are:

Note that there is a "nonvisual" subtype for Element plugins. This is useful for plugins that need to be instanced within a specific screen but don't actually provide a visible user interface. (Often these nonvisual elements are controller using actions from other elements.) Examples would be an audio player component, a timer, a number generator, etc.

UI element specifications

(Elements which can be shown in the inspector panel)

Plugins can define settings which will be visible to the user and can control behavior of the plugin. Settings are displayed in the inspector panel (the right-hand side of the Neonto Studio interface).

Each element provides certain kind of functionality, such as a button triggers an action or plain text shows some useful information to the user. Elements have different settings and properties depending on the element type. Properties are defined in the plugin's inspectorUIDefinition property and they control behavior and appearance of the element. Some of the elements also have a property for reading the current value in the plugin script for binding the element to do actually something useful.

Here's a brief description and list of settings and properties for each element type:

label

Shows a string value to the user. Useful for showing any kind of textual information, such as instructions.

Inspector UI definition example:

{
"type": "label",
"text": "<text visible to the user>"
}

textinput

Shows a text input field to the user.

Inspector UI definition example:

{
"type": "textinput",
"id": "mytext",
"actionBinding": "this.onTextInputChange"
}


Action function example:

this.onTextInputChange = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mytext") {
var text = control.text;
// do something with 'text'
}
}

numberinput

Shows a number input field to the user.

Inspector UI definition example:

{
"type": "numberinput",
"id": "mynumber",
"min": 0, "max": 100, "increment": 1,
"actionBinding": "this.onNumberInputChange"
}


Action function example:

this.onNumberInputChange = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mynumber") {
var number = control.numberValue;
// do something with 'number'
}
}

checkbox

Shows a checkbox (an input field with two values: true and false) to the user.

Inspector UI definition example:

{
"type": "checkbox",
"id": "mycheckbox",
"label": "<text visible to the user>",
"actionBinding": "this.onCheckboxChange"
}


Action function example:

this.onCheckboxChange = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mycheckbox") {
var checked = control.checked;
// do something with 'checked'
}
}

button

Shows a button to the user.

Inspector UI definition example:

{
"type": "button",
"id": "mybutton",
"label": "<text visible to the user>",
"actionBinding": "this.onButtonPress"
}


Action function example:

this.onButtonPress = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mybutton") {
// do something
}
}

multibutton

Shows a button consisting of multiple segments to the user. One of the segments is always selected and can be changed by clicking.

Inspector UI definition example:

{
"type": "multibutton",
"id": "mymultibutton",
"labels": ["<label 1>", "<label 2>", "<label 3>"],
"actionBinding": "this.onMultiButtonChange"
}


Action function example:

this.onMultiButtonChange = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mymultibutton") {
var selection = control.numberValue;
// do something with 'selection'
}
}

dataslot-picker

Shows a pop-up button with a list of data slots in the project to the user.

Inspector UI definition example:

{
"type": "dataslot-picker",
"id": "mydataslot",
"actionBinding": "this.onPickDataSlot"
}


Action function example:

this.onPickDataSlot = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mydataslot") {
var dataSlotName = control.dataSlotName;
// do something with 'dataSlotName'
}
}

datasheet-picker

Shows a pop-up button with a list of data sheets in the project to the user.

Inspector UI definition example:

{
"type": "datasheet-picker",
"id": "mydatasheet",
"actionBinding": "this.onPickDataSheet"
}


Action function example:

this.onPickDataSheet = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mydatasheet") {
var dataSheetName = control.dataSheetName;
// do something with 'dataSheetName'
}
}

screen-picker

Shows a pop-up button with a list of screens in the project to the user.

Inspector UI definition example:

{
"type": "screen-picker",
"id": "myscreen",
"actionBinding": "this.onPickScreen"
}


Action function example:

this.onPickScreen = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "myscreen") {
var screenName = control.screenName;
// do something with 'screenName'
}
}

element-picker

Shows a pop-up button with a list of elements in the containing screen to the user.

Inspector UI definition example:

{
"type": "element-picker",
"id": "myelement",
"actionBinding": "this.onPickElement"
}


Action function example:

this.onPickElement = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "myelement") {
var elementId = control.elementId;
// do something with 'elementId'
}
}

file-picker

Shows a button which allows the user to browse for a file in the file system.

Inspector UI definition example:

{
"type": "file-picker",
"id": "myfile",
"allowedFileTypes": ["rtf"],
"actionBinding": "this.onPickFile"
}


Action function example:

this.onPickFile = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "myfile") {
var filePath = control.filePath;
// do something with 'filePath'
}
}

colorpicker

Shows color controls to the user.

Inspector UI definition example:

{
"type": "colorpicker",
"id": "mycolor",
"label": "<text visible to the user>",
"actionBinding": "this.onColorChange"
}


Action function example:

this.onColorChange = function(controlId) {
var control = this.getUI().getChildById(controlId);
if (controlId == "mycolor") {
var color = control.stringValue;
// do something with 'color'
}
}

canvas

Custom drawing canvas.

Inspector UI definition example:

{
"type": "canvas",
"width": "300",
"height": "300"
}

hlist

A horizontal list, allows aligning controls horizontally.

Inspector UI definition example:

{
"type": "hlist",
"items": [
{
"type": "button",
"id": "mybutton1",
"label": "<text visible to the user>",
"actionBinding": "this.onButtonPress"
},
{
"type": "button",
"id": "mybutton2",
"label": "<text visible to the user>",
"actionBinding": "this.onButtonPress"
}
]
}

The object context functions

(Functions that a plugin can call)

In addition to the entry points called by the host application the JavaScript object context defines some important functions which for example give access to the project's data. These functions are called through “this” variable.

Available function are:

getElementName

Returns name of the project object which “owns” the plugin.

Example:

var elementName = this.getElementName();
// do something with 'elementName'

getUI

Get access to the inspector UI object.

Example:

var ui = this.getUI();
ui.getChildById("videourl").stringValue = this._data.videoUrl;

getDataSheetRows(dataSheetName)

Returns rows for a data sheet.

Example:

var rows = this.getDataSheetRows("Sheet 1");
for (var i = 0; i < rows.length; ++i) {
var row = rows[i];
var col1 = row["column1"];
// do something with 'col1'
}
}

getDataSheets

Returns all data sheets in the project.

Example:

var sheet = this.getDataSheets()["Localization sheet"];
var firstKey = sheet[0]["key"];
// do something with 'firstKey'

getDataSlotValue(dataSlotName)

Returns value of a data slot.

Example:

var value = this.getDataSlotValue("slot 1");
// do something with 'value'

getDataSlots

Returns all data slots in the project.

Example:

var value = this.getDataSlots()["slot 1"];
// do something with 'value'

loadImage(path/image)

Deprecated. Use Plugin.loadImage() function instead (described in 'The Plugin object' section).

The exporter bridge

(Functions that a plugin can call)

Many of the plugin methods receive an argument object named 'exporter'. This is called the "exporter bridge": it allows the plugin to call functions on the Neonto Studio native side.

A plugin can use the exporter bridge functions for tasks like file I/O (e.g. writing source code files into a generated project file); inspecting the Neonto Studio project state; and reporting errors back to the Studio UI.

Available functions are:

reportError(errorMsg)

Interrupts the export process and reportes the message 'errorMsg' back to the user.

getPackageName()

Returns a string containing the package identifier of the app being generated, e.g. "com.neonto.exampleproject".

getProjectObjectId()

Returns a string which is an id for the Neonto Studio project object that is currently being exported. Typically this would be the id for the screen containing the plugin.

writeSourceCode(file, text)

Writes the string 'text' to a source code file named 'file'.

writeImageAsset(name, srcPath)

Writes an image asset named 'name' from an image file at path 'srcPath'. The path would typically come from the plugin's resources. The format is assumed to be PNG.

writeVideoAsset(name, srcPath)

Writes a video asset named 'name' from an image file at path 'srcPath'. The path would typically come from the plugin's resources.

writeCustomAsset(srcPath)

Writes a custom asset for a file at path 'srcPath'. This is typically a resource file being included in the generated project(s).

writeArchive(dstPath, src)

Write an archive (a .zip file) to a specified project path. src-parameter can be a path to a file or a byte buffer object when used with methods such as HttpClient.load().

registerFontNamed(fontName)

Registers the font 'fontName' for inclusion into the generated project(s).

When a font is registered, Neonto Studio will try to discover a font by that name by looking up the font on the Mac. If found, the font file will be copied into the generated project(s).

getObjCImports()

For use in iOS code generation.

Returns a string containing #import lines that should be added at the top of any generated class. (The imports could be e.g. for data sheet classes referenced by the plugin.)

getPropertyDeclsForLinkedElements()

For use in both iOS and Android code generation.

Returns an array containing property/field declarations that should be added into the interface of any generated class. These properties are used at runtime to fill out references to other elements within the Neonto Studio project.

If the plugin's UI doesn't include any element link parameters, then this function doesn't need to be called. It's only needed for resolving references to other elements.

propertyAccessForDataSlotByName(dataSlotName)

For use in both iOS and Android code generation.

Returns a string containing code that can be used to access a data slot by the name 'dataSlotName'.

The code is an expression that can be used as a right-side value in your plugin code (for example, it might be something along the lines of "AppDelegate.dataSlotFooBar").

setValueCodeForDataSlotByName(dataSlotName, expr)

For use in both iOS and Android code generation.

Returns a string containing code that sets the value of a data slot by the name 'dataSlotName' to the value specified by 'expr'.

Use this to update a data slot's value in your plugin code.

propertyAccessForDataSheetByName(dataSheetName)

For use in both iOS and Android code generation.

Returns a string containing code that can be used to access a data sheet by the name 'dataSheetName'.

The code is an expression that can be used as a right-side value in your plugin code (for example, it might be something along the lines of "AppDelegate.dataSheetFooBar").

classNameForDataSheetByName(dataSheetName)

For use in both iOS and Android code generation.

Returns a string which is a generated class name for a corresponding data sheet block.

classNameForScreenByName(screenName)

For use in both iOS and Android code generation.

Returns a string which is a generated class name for a corresponding screen block (in Android a fragment class name).

activityClassNameForScreenByName(screenName)

For use in Android code generation.

Returns a string which is a generated activity class name for a corresponding screen block (as opposed to classNameForScreenByName(screenName) function which returns a fragment class name).

getIOSAppDelegateClassName()

For use in iOS code generation.

Returns a string which is a generated class name for the implementation of the generated Xcode project's UIApplicationDelegate protocol.

getAndroidApplicationClassName()

For use in Android code generation.

Returns a string which is a generated class name for the Application subclass in the generated Android Studio project.

varNameForDataSlotByName(dataSlotName)

For use in both iOS and Android code generation.

Returns a string which is a generated variable name for a corresponding data slot block.

varNameForDataSheetByName(dataSheetName)

For use in both iOS and Android code generation.

Returns a string which is a generated variable name for a corresponding data sheet block.

writeActionFinishedCode()

For use in both iOS and Android code generation.

Returns a string containing code that should be executed when an async interaction has finished. (Typically this might be a callback that executes the next interaction specified by the user in Neonto Studio.)

writeActionCanceledCode()

For use in both iOS and Android code generation.

Returns a string containing code that should be executed when an async interaction has been cancelled.

writeLoadImageFromDataSheetCode(dataSheetVar, dataSheetRow, columnName)

For use in both iOS and Android code generation.

Returns a string containing code that asynchronously loads an image using a value in a data sheet.

The value within the data sheet is specified using the 'dataSheetRow' (an integer) and 'columnName' (a string) parameters. The code generated by this call will check the value in the data sheet at that cell, and will execute an async load if the value is a suitable URL or asset reference.

escapeStringForSourceCode(str)

For use in both iOS and Android code generation.

Returns a string which is safe to assign to a string object in a source code file.

The Plugin object

(Utility functions that a plugin can call)

Plugins have an access to a global Plugin object which provides some useful utility functions for the plugin writer.

Available functions are:

readResourceFile(fileName, encoding)

Returns a string or byte buffer object of the contents of the specified file.

If encoding is 'utf8' or 'utf-8' the contents of a file will be returned as a string object otherwise it will be a byte buffer object.

getPathForResource(fileName)

Returns a string presenting a path of a file inside plugin's Resources folder.

loadImage(filePath/imageObj)

Returns an image object which can be used e.g. for drawing plugin preview in Neonto Studio.

Image can be loaded from a file path:

var path = Plugin.getPathForResource("image.png");
var image = Plugin.loadImage(path);


...or converted from an NSImage object (which can't be directly used with JavaScript Canvas):

var rows = this.getDataSheetRows(dataSheetName);
var image = Plugin.loadImage(rows[rowIndex]["image"]);

HttpClient bridge

(A class that plugins can use)

HttpClient is a utility class which allows plugins to create HTTP requests and get responses asynchronously through a callback function. Plugins can create an HttpClient object simply with the new operator:

var httpClient = new HttpClient();

loaded

This property holds a value (true or false) whether the load function is called on the object.

loadedUrl

This property holds a value passed as an url-parameter when calling the load function on the object. Will be null before the load function is called.

load(url, options, callbackFunc)

Triggers an HTTP request to the specified URL and gets response through a callback function. Following options can be configured for the request:

Example:

httpClient.load(url, {encoding: 'utf8', method: 'GET'}, function(err, httpStatus, data) {
if ( !err) {
try {
var obj = JSON.parse(data);
// do something with 'obj'
} catch (exc) {
err = new Error("Error loading data: "+exc);
}
}
});

wait()

This will stop execution of a plugin code until load-method has finished.

Element plugins

(Functions implemented by plugin and called by the Neonto host app)

publishedInteractActions

Describes the actions that this element can perform. Example from the Camera plugin:

this.publishedInteractActions = [
{
"id": "shoot",
"displayName": "Shoot",
"shortDisplayText": "Take a picture.",
"isAsync": true
}, {
"id": "switch",
"displayName": "Switch",
"shortDisplayText": "Switch to front/back facing camera."
}
];

renderEditingCanvasPreview(canvas)

Called to render a visual preview of the plugin element in the host application's editing area.

The canvas parameter is a Canvas object similar to the HTML5 Canvas API. (See renderIcon() discussion above.)

getIOSImports(exporter)

Used to specify additional header files used by the plugin. Will be written to the containing ViewController class. Must be an array.

Example:

this.getIOSImports = function(exporter) {
return [
'"myclass.h"'
];
}

exportAsIOSClass(className, exporter)

Called to write the element as an iOS Objective-C class.

The exporter object provides a "writeSourceCode" method to write the actual files. Example usage:

this.exportAsIOSClass = function(className, exporter) {
var head = this._writeObjCHeader(className);
var impl = this._writeObjCImpl(className);
exporter.writeSourceCode(className+".h", head);
exporter.writeSourceCode(className+".m", impl);
}

writeIOSInitCode(exporter, varName)

Called when an element is being instanced so the plugin can inject some code to initialize the element.

The code should use the varName parameter to manipulate the newly created instance in the generated code. Example:

this.writeIOSInitCode = function(exporter, varName) {
return varName + ".enableSomeStuff = YES;"
}

writeIOSCodeForViewControllerMethod(methodName, exporter, varName)

Called when certain methods are called on the containing view controller object by the operating system. Applicable method names are: viewWillAppear, viewDidAppear and viewDidDisappear.

Example:

this.writeIOSCodeForViewControllerMethod = function(methodName, exporter, varName) {
if (methodName == "viewWillAppear") {
return "[self."+varName+" start];\n";
}
else if (methodName == "viewDidDisappear") {
return "[self."+varName+" stop];\n";
}
}

writeIOSCodeForPublishedInteractAction(actionId, exporter, varName, arg)

Called when an action is performed on the plugin. The possible actions were described by the plugin using "publishedInteractActions" (see above).

Parameter actionId is one of the actions defined by the plugin in "publishedInteractActions".

Parameter varName should be used to refer to the object in the Objective-C code.

Parameter arg is an argument value that was specified by the user in the host application's interface. It is currently always a string.

At its simplest, this method's implementation could simply be a method call within the generated code, something like:

this.writeIOSCodeForPublishedInteractAction = function(actionId, exporter, varName, arg) {
return "[" + varName + " " + actionId + "]"
}


(Assuming your plugin's Objective-C code implements a method with the name given by 'actionId').

writeIOSTakeValuesFromDataSheetCode(exporter, varName, columnName)

Write code to update the element's content dynamically based on a value from a data sheet column.

Dynamic data in Neonto Studio is represented with data sheets. At runtime, a screen or list item can represent a specific row within a data sheet. The elements within that screen or list item will then "take values" from the data sheet row according to a specific column name. This is called data linkage in the Neonto Studio UI.

Example:

this.writeIOSTakeValuesFromDataSheetCode = function(exporter, varName, columnName) {
return ""
+ "if ([type isEqual:@\"text\"]) {\n"
+ " "+varName+".title = value;\n"
+ "}\n";
}

libraryDependenciesInExportedProject_iOS

Used to specify libraries used by the plugin. Libraries must be located in Contents/Libraries/iOS/ path inside the plugin bundle. The same function can be used to include system libraries too when it's not necessary to copy the libraries inside the plugin bundle.

Example:

this.libraryDependenciesInExportedProject_iOS = [
"mylib.framework"
];

getIOSEmbeddedBinaries

Copies and applies frameworks to the exporter project. This function will add frameworks specifically to the Embedded Binaries section in the Xcode project. More information: https://developer.apple.com/library/content/technotes/tn2435/_index.html

Example:

this.getIOSEmbeddedBinaries = [
"test.framework"
];

getIOSModuleImports(exporter)

Should be used together with the getIOSEmbeddedBinaries function.

Example:

this.getIOSModuleImports = function(exporter) {
return [
"test"
];
}

exportAsAndroidClass(className, exporter)

Similar to exportAsIOSClass above. Should write Java files using the exporter.

Example usage:

this.exportAsAndroidClass = function (className,exporter){
var java = this._writeJavaImpl (className,exporter);
exporter.writeSourceCode(className+".java",java);
}

writeAndroidInitCode(exporter, varName)

Similar to writeIOSInitCode above.

Example:

this.writeAndroidInitCode = function(exporter, varName) {
return varName+".enableSomeStuff(true);\n";
}

writeAndroidCodeForPublishedInteractAction(actionId, exporter, varName, arg)

Similar to iOS equivalent above.

Example:

this.writeAndroidCodeForPublishedInteractAction = function(actionId, exporter, varName, arg) {
return varName + "." + actionId + "();"
}

writeAndroidTakeValuesFromDataSheetCode(exporter, varName, columnName)

Similar to iOS equivalent above.

Example:

this.writeAndroidTakeValuesFromDataSheetCode = function(exporter, varName, columnName) {
return ""
+ "if ((val = row.get(\""+columnName+"\")) != null && val.get(\"type\").equals(\"text\")) {\n"
+ " "+varName+".title = (String) val.get(\"value\");\n"
+ "}\n";
}

getAndroidManifestPermissions()

A list of permissions needed by the app to be written to AndroidManifest.xml file in a generated Android Studio project. Must return an array.

Example:

this.getAndroidManifestPermissions = function() {
return [
"android.permission.CAMERA",
"android.permission.WRITE_EXTERNAL_STORAGE"
];
}

getAndroidManifestFeatures()

A list of features used by the app to be written to AndroidManifest.xml file in a generated Android Studio project. Must return an array.

Example:

this.getAndroidManifestFeatures = function() {
return [
"android.hardware.camera",
"android.hardware.camera.autofocus"
];
}

getAndroidManifestCustomActivities()

A list of custom activities to be written to AndroidManifest.xml file in a generated Android Studio project. Useful for e.g. activity classes defined in custom libraries. Must return a list with activity names as keys and a list of attributes as values.

Example:

this.getAndroidManifestCustomActivities = function() {
return {
"com.example.app.MyActivity": { "android:configChanges": "keyboardHidden|orientation" }
}
}

writeAndroidManifestCustomApplicationElements(exporter)

Write custom elements inside the application element in the exported project's AndroidManifest.xml file.

Example:

this.writeAndroidManifestCustomApplicationElements = function(exporter) {
return ""
+"<meta-data\n"
+" android:name=\"com.example.myIdentifier\"\n"
+" android:value=\"test\" />\n"
}

getAndroidGradleModuleDependencies(exporter)

Called for additional dependencies to be written to Android Studio project's Module build.gradle file.

Example:

this.getAndroidGradleModuleDependencies = function(exporter) {
return [
"'org.osmdroid:osmdroid-android:5.5:release@aar'"
];
}

getAndroidGradleProjectDependencies(exporter)

Called for additional dependencies to be written to Android Studio project's Project build.gradle file.

Example:

this.getAndroidGradleProjectDependencies = function(exporter) {
return [
"'com.google.gms:google-services:3.0.0'"
];
}

writeAndroidCodeForLifecycleMethod(methodName, exporter, varName)

Deprecated. Use writeAndroidCodeForFragmentMethod function instead.

Allows to write code to certain fragment class methods: onResume, onPause, onDestroy, onLowMemory.

Example:

this.writeAndroidCodeForLifecycleMethod = function(methodName, exporter, varName) {
if (methodName == "onPause") {
return varName+".pause();";
}
else if (methodName == "onResume") {
return varName+".resume();";
}
}

writeAndroidCodeForFragmentMethod(methodName, exporter, varName)

Allows to write code to certain fragment class methods: onActivityResult, onResume, onPause, onStop, onDestroy, onLowMemory.

Example:

this.writeAndroidCodeForFragmentMethod = function(methodName, exporter, varName) {
if (methodName == "onActivityResult") {
return varName+".onActivityResult(requestCode, resultCode, data);";
}
}

libraryDependenciesInExportedProject_Android

Used to specify libraries used by the plugin. Libraries must be located in Contents/Libraries/Android/ path inside the plugin bundle.

Example:

this.libraryDependenciesInExportedProject_Android = [
"mylib.jar"
];

getLinkedElements()

Can be used to inform the host application that specific elements are linked together. element-picker inspector UI elements should be used to obtain required elementId values.

Example:

this.getLinkedElements = function() {
return [
{
"elementId": this._data.targetElementId,
"propertyName": "targetElement",
}
];
}


getLinkedElements should be used to together with the getPropertyDeclsForLinkedElements function in the exporter bridge. getPropertyDeclsForLinkedElements should be called in the exportAsIOSClass/exportAsAndroidClass functions. It generates necessary property/field declarations based on the plugin's implementation of the getLinkedElements function.

Example:

this.exportAsIOSClass = function(className, exporter) {
var head = ""
+"#import <UIKit/UIKit.h>\n"
+"\n"
+"@interface "+className+" : NSObject\n"
+"\n";
var propDecls = exporter.getPropertyDeclsForLinkedElements().toNative();
for (var i = 0; i < propDecls.length; ++i) {
head += propDecls[i];
}
head += ""
+"\n"
+"- (void)scrollVisibleRectDidChangeTo:(CGRect)newRect from:(CGRect)oldRect;\n"
+"\n"
+"@end\n";

var impl = ""
+"#import \""+className+".h\"\n"
+"\n"
+"@implementation "+className+"\n"
+"\n"
+"- (void)scrollVisibleRectDidChangeTo:(CGRect)newRect from:(CGRect)oldRect\n"
+"{\n"
+"}\n"
+"\n"
+"@end\n";

exporter.writeSourceCode(className+".h", head);
exporter.writeSourceCode(className+".m", impl);
}

implementsCustomTouchInteractions

Must be a boolean value to indicate that the element has custom touch interactions.

Animation plugins

(Functions implemented by plugin and called by the Neonto host app)

writeIOSCodeForInit(varName)

Deprecated. Use keyframeAnimationDescription function instead.

writeIOSCodeForPreparation(varName)

Deprecated. Use keyframeAnimationDescription function instead.

writeIOSCodeForAnimation(varName)

Deprecated. Use keyframeAnimationDescription function instead.

writeIOSCodeForCompletion(varName)

Deprecated. Use keyframeAnimationDescription function instead.

keyframeAnimationDescription(reverse)

Should return an object which contains animation keyframes and other attributes. The object should follow the structure:

{
"initialTransform": {
"translateX": <number>,
"translateY": <number>,
"rotate": <number>,
"scaleX": <number>,
"scaleY": <number>
},
"keyframes": [
{
"transform": {
"translateX": <number>,
"translateY": <number>,
"rotate": <number>,
"scaleX": <number>,
"scaleY": <number>
},
"relativeStartTime": <number>,
"relativeDuration": <number>
}
],
"repeatCount": <number>
}


Example:

this.keyframeAnimationDescription = function(reverse) {
var scale1 = (reverse) ? 1.0 : 0.0;
var scale2 = (reverse) ? 0.0 : 1.0;
return {
"initialTransform": {
"scaleX": scale1,
"scaleY": scale1
},
"keyframes": [
{
"relativeStartTime": 0.0,
"relativeDuration": 1.0,
"transform": {
"scaleX": scale2,
"scaleY": scale2
}
}
]
};
}

Image Effect plugins

(Functions implemented by plugin and called by the Neonto host app)

publishedInteractActions

See discussion of equivalent for Element plugins.

renderEditingCanvasPreview(canvas, sourceImage, transformMatrix)

Render a preview of the effect in the host application's editing UI.

The canvas parameter is a Canvas object similar to the HTML5 Canvas API. (See renderIcon() discussion above.)

writeIOSCustomInterfaceCode()

Allows to write additional code such as properties to the interface of the generated class.

Example:

this.writeIOSCustomInterfaceCode = function () {
return ""
+ "@property (nonatomic) float filterIntensity;\n";
}

writeIOSCustomImplementationCode()

Allows to write additional code such as methods to the implementation of the generated class.

Example:

this.writeIOSCustomImplementationCode = function () {
return ""
+ "- (void)setFilterIntensity:(float)filterIntensity\n"
+ "{\n"
+ " _filterIntensity = filterIntensity;\n"
+ " [self setNeedsDisplay];\n"
+ "}\n";
}

writeIOSCodeForInit(varName)

Allows to write additional code to the initialization method of the generated class.

Example:

this.writeIOSCodeForInit = function (viewVarName) {
return ""
+ "_filterIntensity = " + this._data.effectIntensity + ";\n";
}

writeIOSLayoutUpdateCode(varName)

Allows to write additional code to the layout update method of the generated class.

Example:

this.writeIOSLayoutUpdateCode = function () {
return ""
+ "// some code\n";
}

writeIOSCodeForScrolling(scrollViewCode, layerCode)

Allows to write additional code to the method which called when the element is scrolled by the user.

Example:

this.writeIOSCodeForScrolling = function (scrollViewCode, layerCode, horizontal) {
return ""
+ "// some code\n";
}

writeIOSCodeForImageFilter(imageVarName, contextVarName)

Allows to write additional code to the display update method of the generated class.

Example:

this.writeIOSCodeForImageFilter = function (imageVarName, contextVarName) {
return ""
+ "// some code\n";
}

writeIOSCodeForPublishedInteractAction(actionId, exporter, varName, arg)

See discussion of equivalent for Element plugins.

writeIOSTakeValuesFromDataSheetCode(exporter, clipVarName, columnName)

See discussion of equivalent for Element plugins.

writeAndroidInitCode(varName)

Allows to write additional code to the initialization method of the generated class.

Example:

this.writeAndroidInitCode = function (viewVarName) {
return ""
+ "// some code\n";
}

writeAndroidPreDrawCode()

Allows to write additional code to the drawing method of the generated class.

Example:

this.writeAndroidPreDrawCode = function () {
return ""
+ "// some code\n";
}

writeAndroidPostDrawCode()

Allows to write additional code to the drawing method of the generated class.

Example:

this.writeAndroidPostDrawCode = function () {
return ""
+ "// some code\n";
}

writeAndroidTakeValuesFromDataSheetCode(exporter, clipVarName, columnName)

See discussion of equivalent for Element plugins.

Vector Graphics Effect plugins

(Functions implemented by plugin and called by the Neonto host app)

renderEditingCanvasPreview(canvas, sourceShapes, transformMatrix, env)

Render a preview of the effect in the host application's editing UI.

The canvas parameter is a Canvas object similar to the HTML5 Canvas API. (See renderIcon() discussion above.)

getIOSLinkedDataSlotsByPropertyName()

Create properties to the class interface and write needed code to update the values from data slots.

Example:

this.getIOSLinkedDataSlotsByPropertyName = function() {
var map = {};
if (this._data.dataSlotName) {
map['position'] = this._data.dataSlotName;
}
return map;
}

getIOSImports()

Write additional imports to the implementation of the generated class.

Example:

this.getIOSImports = function() {
return [
'"mylib.h"'
];
}

writeIOSDrawRectMethod(className, transformStr, staticPaths, width, height, exporter)

Example:

this.writeIOSDrawRectMethod = function (className, transformStr, pathsInitCode, baseW, baseH, exporter) {
return ""
+ "- (void)drawRect:(CGRect)dirtyRect\n"
+ "{\n"
+ " // custom drawing code\n"
+ "}\n"
+ "\n"
+ "// additional methods\n";
}

getAndroidLinkedDataSlotsBySetterMethodName()

Write needed code to update the values from data slots.

Example:

this.getAndroidLinkedDataSlotsBySetterMethodName = function() {
var map = {};
if (this._data.dataSlotName) {
map['setPosition'] = this._data.dataSlotName;
}
return map;
}

getAndroidImports()

Write additional imports to the implementation of the generated class.

Example:

this.getAndroidImports = function() {
return [
"android.app.Activity"
];
}

writeAndroidOnDrawMethod(className, staticPaths, canvasWidth, canvasHeight, baseWidth, baseHeight, transformStr, exporter)

Example:

this.writeAndroidOnDrawMethod = function (className, pathsInitCode, canvasW, canvasH, baseW, baseH, transform, exporter) {
return ""
+ " @Override\n"
+ " protected void onDraw(Canvas canvas) {\n"
+ " // custom drawing code\n"
+ " }\n"
+ " \n"
+ " // additional methods\n";
}

Service plugins

(Functions implemented by plugin and called by the Neonto host app)

publishedInteractActions

See discussion of equivalent for Element plugins.

pluginAllowsMultipleInstances

Indicates whether there can be more than one instances of the plugin in a project.

Example:

this.pluginAllowsMultipleInstances = true;

getIOSInfoPlistProperties

Must return an object containing keys and values to be written to the exported project's info.plist file.

Example:

this.getIOSInfoPlistProperties = function() {
return {
"NSCameraUsageDescription": {
"type": "string",
"value": "Photos can be used within the app"
}
};
}

getIOSEntitlementsProperties

Must return an object containing keys and values to be written to the exported project's .entitlements file.

Example:

this.getIOSEntitlementsProperties = function() {
return {
"aps-environment": {
"type": "string",
"value": "development"
}
};
}

getIOSAppDelegateImports

Called to write any additional imports to be written to the exported project's AppDelegate class. Must return an array.

Example:

this.getIOSAppDelegateImports = function() {
return ['"MyService.h"'];
}

getIOSAppDelegateProtocols

Called for any additional protocols to be added to the AppDelegate's interface in the exported project. Must return an array.

Example:

this.getIOSAppDelegateProtocols = function() {
return ["MyServiceDelegate"];
}

writeIOSClasses(exporter)

Called to write any additional Objective-C classes.

Example:

this.writeIOSClasses = function(exporter) {
var className = "MyService";
exporter.writeSourceCode(className+".h", "@interface "+className+"\n@end");
exporter.writeSourceCode(className+".m", "#include \""+className+".h\"\n@implementation "+className+"\n@end");
}

getIOSCustomAppDelegateMethodDeclarations(exporter)

Called to write any additional methods to the exported project's AppDelegate class. Must return an array. This function should be used together with writeIOSCodeForAppDelegateMethod function. Together they allow multiple plugins to write same methods without overlapping with each other. This is very useful when writing some common methods such as the methods declared in the UIApplicationDelegate protocol.

Example:

this.getIOSCustomAppDelegateMethodDeclarations = function(exporter) {
return [
" - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken",
" - (void)doSomethingWith:(NSString *)str"
];
}

writeIOSCodeForAppDelegateMethod(methodName, exporter)

Called to write implementation for the methods declared in the getIOSCustomAppDelegateMethodDeclarations function. Values passed as methodName parameters follow the simplified form of the method declarations (without types and variable names). In addition to the custom methods declared in the plugin there are few methods which are called by default: didFinishLaunchingWithOptions, willResignActive, didEnterBackground, willEnterForeground, didReceiveMemoryWarning, didBecomeActive and willTerminate.

Example:

this.writeIOSCodeForAppDelegateMethod = function(methodName, exporter) {
if (methodName == "application:didRegisterForRemoteNotificationsWithDeviceToken:") {
return "// do something";
}
else if (methodName == "doSomethingWith:") {
return "// do something";
}
}

writeIOSCustomAppDelegateInterfaceCode(exporter)

Called to write any additional properties to the interface of the exported project's AppDelegate class.

Example:

this.writeIOSCustomAppDelegateInterfaceCode = function(exporter) {
return "@property (nonatomic) MyService *myService;\n";
}

writeIOSCustomAppDelegateImplementationCode(exporter)

Called to write any additional methods to the implementation of the exported project's AppDelegate class.

this.writeIOSCustomAppDelegateImplementationCode = function(exporter) {
return ""
+"- (void)myServiceMethod:(MYService *)service\n"
+"{\n"
+" // do something\n"
+"}\n";
}

writeIOSCodeForPublishedInteractAction(actionId, exporter, varName, arg)

See discussion of equivalent for Element plugins.

libraryDependenciesInExportedProject_iOS

See discussion of equivalent for Element plugins.

getIOSEmbeddedBinaries

See discussion of equivalent for Element plugins.

getIOSModuleImports(exporter)

See discussion of equivalent for Element plugins.

getAndroidApplicationImports(exporter)

Called to write any additional import to the exported project's Application class. Must return an array.

Example:

this.getAndroidApplicationImports = function(exporter) {
return [
'android.app.AlertDialog'
];
}

getAndroidApplicationInterfaces

Called to write any additional interfaces the exported project's Application class would be implementing. Must return an array.

Example:

this.getAndroidApplicationInterfaces = function() {
return ['Application.ActivityLifecycleCallbacks'];
}

writeAndroidClasses(exporter)

Called to write any additional Java classes.

Example:

this.writeAndroidClasses = function(exporter) {
var className = "MyService";
exporter.writeSourceCode(className+".java", "package "+exporter.getPackageName()+";\npublic class "+className+" {\n}");
}

writeAndroidCodeForApplicationMethod(methodName, exporter)

Called to write additional code to the existing methods in the exported project's Application class. Supported methods are (passed as values to the methodName parameter): onCreate and onTrimMemory.

Example:

this.writeAndroidCodeForApplicationMethod = function(methodName, exporter) {
if (methodName == "onCreate") {
return ""
+ "// do something\n";
}
}

writeAndroidCodeForPublishedInteractAction(actionId, exporter, varName, arg)

See discussion of equivalent for Element plugins.

libraryDependenciesInExportedProject_Android

See discussion of equivalent for Element plugins.

writeAndroidCustomApplicationVariables(exporter)

Called to write any additional fields to the exported project's Application class.

Example:

this.writeAndroidCustomApplicationVariables = function(exporter) {
return "public MyService myService;\n";
}

writeAndroidCustomApplicationMethods(exporter)

Called to write any additional methods to the exported project's Application class.

Example:

this.writeAndroidCustomApplicationMethods = function(exporter) {
return ""
+"private void myServiceMethod(MyService service) {\n"
+" // do something\n"
+"}\n";
}

Web Service plugins

(Functions implemented by plugin and called by the Neonto host app)

publishedInteractActions

See discussion of equivalent for Element plugins.

appDataKeysInExportedProject

Called to create any additional data keys to the exported project. Must return an object containing key names and other attributes as values.

Example:

this.appDataKeysInExportedProject = {
"serviceUrl": {
'type': 'string'
}
};

pluginAllowsMultipleInstances

See discussion of equivalent for Service plugins.

sheetEditorServicePathValues

Called for showing predefined Service path -setting values in Data Sheet Editor (will show the setting as a popup button instead of a text field).

Example:

this.sheetEditorServicePathValues = [
"/example"
];

readDataSheetFromServiceAsync(httpClient, sheetOptions, readDataCallback)

Called to fill out a data sheet using the plugin. HttpClient is described in HttpClient bridge -section. sheetOptions-parameter contains the following fields:

See the GenericJSONSource plugin's source code for usage example.

dataSheetUpdateInterval_iOS

Specifies the interval how frequently the data will be updated.

Example:

this.dataSheetUpdateInterval_iOS = 60.0;

getIOSInfoPlistProperties

See discussion of equivalent for Service plugins.

getIOSEntitlementsProperties

See discussion of equivalent for Service plugins.

getIOSImports(exporter, sheetOptions)

Used to specify additional header files used by the plugin. Must be an array. sheetOptions-parameter is contextual and might not exist in all occasions the getIOSImports method is called thus it should be null checked before using it as seen in the example below. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.getIOSImports = function(exporter, sheetOptions) {
if (sheetOptions != null) {
// sheetOptions can be now used safely
}
  return [
"<CommonCrypto/CommonDigest.h>"
];
}

writeIOSClasses(exporter)

See discussion of equivalent for Service plugins.

writeIOSCodeForPublishedInteractAction(actionId, exporter, varName, arg)

See discussion for Element plugins.

writeIOSCodeForDataSheetLoad(methodDecl, exporter, sheetVar, loadCompleteCode)

Called to write an implementation for updating data sheet content from a web service.

See the GenericJSONSource plugin's source code for usage example.

writeIOSDataSheetClassProperties(exporter, sheetOptions)

Called to write any additional properties to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeIOSDataSheetClassProperties = function(exporter, sheetOptions) {
return ""
+"@property (nonatomic) NSString *someProperty;\n";
}

writeIOSCodeForDataSheetInit(exporter, sheetOptions)

Called to write any additional initialization code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeIOSCodeForDataSheetInit = function(exporter, sheetOptions) {
return ""
+"_someProperty = @\"\";\n";
}

writeIOSCodeForDataSheetFinish(exporter, sheetOptions)

Called to write any additional finishing code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeIOSCodeForDataSheetFinish = function(exporter, sheetOptions) {
return ""
+"// do something\n";
}

writeIOSCodeForDataSheetSave(exporter, servicePath, sheetOptions)

Called to write an implementation for sending data sheet content to a web service. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeIOSCodeForDataSheetSave = function(exporter, servicePath, sheetOptions) {
return ""
+ "- (void)saveRowWithValues:(NSDictionary *)values\n"
+ "{\n"
+ " [super saveRowWithValues:values];\n"
+ " \n"
+ " // code for sending values to web service\n"
+ "}\n"
+ "\n"
+ "- (void)updateRow:(NSInteger)row withValues:(NSDictionary *)values\n"
+ "{\n"
+ " [super updateRow:row withValues:values];\n"
+ " \n"
+ " // code for updating values in web service\n"
+ "}\n"
+ "\n"
+ "- (void)replaceRow:(NSInteger)row with:(NSDictionary *)rowDesc\n"
+ "{\n"
+ " [super replaceRow:row with:rowDesc];\n"
+ " \n"
+ " // code for updating values in web service\n"
+ "}\n"
+ "\n"
+ "- (void)deleteRow:(NSInteger)row\n"
+ "{\n"
+ " [super deleteRow:row];\n"
+ " \n"
+ " // code for updating values in web service\n"
+ "}\n";
}

writeIOSCodeForPresentLogin(actionMethod, exporter, completionCode)

Called to write a custom logic for showing a login screen for a web service.

Example:

this.writeIOSCodeForPresentLogin(actionMethod, exporter, completionCode) {
return ""
+ "- (void)"+actionMethod+"\n"
+ " "+completionCode+"\n"
+ "}\n";
}

writeIOSPrivatePropertiesForLogin

Called to write private properties used by login implementation written in a writeIOSCodeForLogin function.

Example:

this.writeIOSPrivatePropertiesForLogin = function() {
var props = "\n";
props += "@property (nonatomic) NSInteger someProperty;\n";
return props;
}

writeIOSCodeForLogin(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for logging in to a web service.

Example:

this.writeIOSCodeForLogin = function(actionMethodName, exporter,
postSendSuccessCode, postSendFailedCode,
disableUICode, enableUICode,
collectDataCode,
servicePath) {
return ""
+ "- (void)"+actionMethodName+"\n
+ "{\n"
+ "}\n";
}

writeIOSPrivatePropertiesForSend

Called to write private properties used by data sending implementation written in a writeIOSCodeForSend function.

Example:

this.writeIOSPrivatePropertiesForSend = function() {
var props = "\n";
props += "@property (nonatomic) NSInteger someProperty;\n";
return props;
}

writeIOSCodeForSend(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for sending data to a web service.

Example:

this.writeIOSCodeForSend = function(actionMethodName, exporter,
postSendSuccessCode, postSendFailedCode,
disableUICode, enableUICode,
collectDataCode,
servicePath) {
return ""
+ "- (void)"+actionMethodName+"\n
+ "{\n"
+ "}\n";
}

writeIOSCodeForStoredLoginCheck(exporter, applyValuesToUIFuncName)

Called to write an implementation for pre-filling login screen input fields.

Example:

this.writeIOSCodeForStoredLoginCheck = function(exporter, applyValuesToUIFuncName) {
return ""
+ "NSDictionary *values = @{};\n"
+ applyValuesToUIFuncName+"(values);\n";
}

writeIOSCodeForLogout(actionMethod, exporter, returnToLoginCode)

Called to write an implementation for logging out from a web service.

Example:

this.writeIOSCodeForLogout = function(actionMethodName, exporter, returnToLoginCode) {
return ""
+ "- (void)"+actionMethodName+"\n
+ "{\n"
+ " "+returnToLoginCode+"\n"
+ "}\n";
}

getIOSAppDelegateImports

See discussion of equivalent for Service plugins.

getIOSAppDelegateProtocols

See discussion of equivalent for Service plugins.

getIOSCustomAppDelegateMethodDeclarations(exporter)

See discussion of equivalent for Service plugins.

writeIOSCodeForAppDelegateMethod(methodName, exporter)

See discussion of equivalent for Service plugins.

writeIOSCustomAppDelegateInterfaceCode(exporter)

See discussion of equivalent for Service plugins.

writeIOSCustomAppDelegateImplementationCode(exporter)

See discussion of equivalent for Service plugins.

libraryDependenciesInExportedProject_iOS

See discussion of equivalent for Element plugins.

getIOSEmbeddedBinaries

See discussion of equivalent for Element plugins.

getIOSModuleImports(exporter)

See discussion of equivalent for Element plugins.

dataSheetUpdateInterval_Android

Specifies the interval how frequently the data will be updated.

Example:

this.dataSheetUpdateInterval_Android = 60.0;

getAndroidImports

Used to specify additional libraries used by the plugin. Must be an array.

Example:

this.getAndroidImports = function() {
return [
"java.net.URL"
];
}

writeAndroidCodeForResumeAndPause(exporter, methodPrefix)

Called to write any additional code when the app resumes and pauses. Must return an object which can contain the following entries: onResume, onPause, vars.

Example:

this.writeAndroidCodeForResumeAndPause = function(exporter, methodPrefix) {
return {
onResume: "m_resumeT = new Date().getTime();\n",
onPause: "m_resumeT = -1;\n",
vars: "private long m_resumeT = null;\n"
};
}

writeAndroidCodeForDataSheetLoad(methodDecl, exporter, sheetVar, loadCompleteCode)

Called to write an implementation for updating data sheet content from a web service.

See the GenericJSONSource plugin's source code for usage example.

writeAndroidDataSheetClassVariables(exporter, sheetOptions)

Called to write any additional variables to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidDataSheetClassVariables = function(exporter, sheetOptions) {
return ""
+"private String m_someVar;\n";
}

writeAndroidCodeForDataSheetInit(exporter, sheetOptions)

Called to write any additional initialization code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidCodeForDataSheetInit = function(exporter, sheetOptions) {
return ""
+"m_someVar = \"\";\n";
}

writeAndroidCodeForDataSheetFinish(exporter, sheetOptions)

Called to write any additional finishing code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidCodeForDataSheetFinish = function(exporter, sheetOptions) {
return ""
+"// do something\n";
}

writeAndroidCodeForDataSheetSave(exporter, servicePath, sheetOptions)

Called to write an implementation for sending data sheet content to a web service. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidCodeForDataSheetSave = function(exporter, servicePath, sheetOptions) {
return ""
+ "@Override\n"
+ "public void saveRowWithValues(HashMap<String, Object> values) {\n"
+ " super.saveRowWithValues(values);\n"
+ " \n"
+ " // code for sending values to web service\n"
+ "}\n"
+ "\n"
+ "@Override\n"
+ "public void updateRow(int rowIndex, HashMap<String, Object> values) {\n"
+ " super.updateRow(rowIndex, values);\n"
+ " \n"
+ " // code for updating values in web service\n"
+ "}\n"
+ "\n"
+ "@Override\n"
+ "public void deleteRow(int rowIndex) {\n"
+ " super.deleteRow(rowIndex);\n"
+ " \n"
+ " // code for updating values in web service\n"
+ "}\n";
}

writeAndroidCodeForLogin(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for logging in to a web service.

Example:

this.writeAndroidCodeForLogin = function(actionMethodName, exporter,
postSendSuccessCode, postSendFailedCode,
disableUICode, enableUICode,
collectDataCode,
servicePath) {
return ""
+ " public void "+actionMethodName+"(View v) {\n"
+ "}\n";
}

writeAndroidCodeForSend(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for sending data to a web service.

Example:

this.writeAndroidCodeForSend = function(actionMethodName, exporter,
postSendSuccessCode, postSendFailedCode,
disableUICode, enableUICode,
collectDataCode,
servicePath) {
return ""
+ " public void "+actionMethodName+"(View v) {\n"
+ "}\n";
}

writeAndroidCodeForStoredLoginCheck(methodName, exporter, storedLoginValidCode, storedLoginMissingCode, disableUICode, enableUICode, collectDataCode, appDataVar)

Called to write an implementation for checking saved login information for a web service.

Example:

this.writeAndroidCodeForStoredLoginCheck = function(methodName, exporter,
storedLoginValidCode, storedLoginMissingCode,
disableUICode, enableUICode,
collectDataCode,
appDataVar) {
// don't check for stored login in this implementation;
// just proceed to the login screen always.
var code = "";
code += "public void "+methodName+" {\n";
code += " "+storedLoginMissingCode;
code += "}\n";
return code;
}

writeAndroidCodeForLogout(methodName, exporter, logoutSuccessCode, logoutFailedCode, disableUICode, enableUICode, collectDataCode, appDataVar)

Called to write an implementation for logging out from a web service.

Example:

this.writeAndroidCodeForLogout = function(methodName, exporter,
logoutSuccessCode, logoutFailedCode,
disableUICode, enableUICode,
collectDataCode,
appDataVar) {
return logoutSuccessCode;
}

getAndroidApplicationImports(exporter)

See discussion of equivalent for Service plugins.

getAndroidApplicationInterfaces

See discussion of equivalent for Service plugins.

writeAndroidClasses(exporter)

See discussion of equivalent for Service plugins.

writeAndroidCodeForApplicationMethod(methodName, exporter)

See discussion of equivalent for Service plugins.

writeAndroidCodeForPublishedInteractAction(actionId, exporter, varName, arg)

See discussion of equivalent for Element plugins.

writeAndroidCustomApplicationVariables(exporter)

See discussion of equivalent for Service plugins.

writeAndroidCustomApplicationMethods(exporter)

See discussion of equivalent for Service plugins.

libraryDependenciesInExportedProject_Android

See discussion of equivalent for Element plugins.