TILE API

TILE Public Methods and Events

The following are methods and events that the TILE source code uses to interact with developer plugins. We recommend familiarizing yourself with these before beginning any advanced development.

As a rule of thumb, the TILE source uses the traditional plugin architecture of providing functions to insert, manipulate, and interact with data, while providing events that trigger significant events for your plugins. In other words, if your plugin is trying to initialize something, then use a function. If it’s reacting to a change in the rest of the interface or a change in the core data, then make sure your plugin is listening for this.

Methods

INITIALIZING ENGINE

insertPlugin(plugin {String})
Inserts the source code of plugin with name plugin into TILE.

insertMode(name {String})
Creates a new Mode Object called Mode.

insertModePlugin(name {String}, plugin {String})
Inserts the plugin named plugin into the Mode named name.

registerPlugin(pw {Object})
Takes javascript plugin wrapper pw and initiates its start() function.

activate(name {String})
Start the TILE Engine

ADDING HTML

addToolBarButton(button {Object})
Attaches a button to the interface, based on the criteria passed. Returns a button object.

insertTags(tags {Object array})
Adds tags to the Attach Metadata dialog

insertModeHTML(html {String}, seection {String}, name {String})
Takes a string of HTML and inserts into the TILE interface.

insertModeButtons(html {String}, section {String}, name {String})
Takes a string of HTML and inserts into the toolbar section of a pre-defined area named by section.

INPUT AND OUTPUT

parseJSON(file {String} or file {Object})
Completely resets the JSON session for TILE and either performs an AJAX operation to retrieve JSON from the URL passed in String file, or loads data from an Object

insertData(data {Object})
Takes data and parses it into the TILE JSON session.

updateData(obj {Object})
Takes the passed parameter, finds it in the coredata JSON session, then replaces any old data with new data.

getJSON(page {Boolean})
Gives a deep copy of the core JSON structure that has all current data.

getXML(opt {Boolean})
Gives a deepcopy of the JSON, but in XML format

LINKING DATA

linkWithActiveObj(obj1 {Object})
Takes the passed object (see format below) and either attaches it to the active object in PluginController, or if no active object is set, does nothing.

linkObjects(obj1 {Object}, obj2 {Object})
Link passed objects together. Neither is set to the active object in PluginController. Each will be added to the JSON if either or both are not already included.

EDITING DATA

setActiveObj(obj {Object})
Sets a particular object as an active object in PluginController.

attachMetadataDialog(obj {Object}, handle {String})
Places the Metadata Dialog near the area specified by handle and sets the passed obj as the item to add metadata to.

deleteObj(obj {Object})
Deletes an item or reference from the JSON session

PAGE CHANGING

nextPage()
Progresses the TILE JSON pointer to the next page URL and calls the newPage event

prevPage()
Takes the TILE JSON pointer to the previous page URL and calls the newPage event

changePage(val {Integer})
Changes to the Nth position in the URL stack – based on what value the integer passed is (Does not accept negative integers or integers that go beyond the array of pages)

Events

The following are events that signify significant moments in the TILE source. All events fired will pass an object, represented here as o, that contains:

o.engine – A copy of the engine tool that allows access to the public methods listed above

o.activeItems – An array of objects that are currently active in the interface

newActive – Triggered when an object is set as the active Object to attach other objects. Passes the TILE Object that is set as active.

newJSON – Triggered when parseJSON finishes loading in TILE.engine. Signifies when a new set of data is loaded.

newPage - Triggered whenever the changePage(), nextPage(), and prevPage() have finished loading.

dataAdded - Triggered by the insertData function in TILE – this event fires whenever a new Object is added to the TILE core JSON. Passes the TILE Object that was added.

dataLinked – Triggered when two objects are linked together in TILE core. Passes an array of the two TILE Objects that are linked.

dataUpdated – Triggered when a TILE Object is changed within the TILE core JSON. Passes the TILE Object that has been changed.

dataDeleted – Triggered when a TILE Object is removed from the TILE core JSON. Passes the TILE Object that has been removed.