Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Infinit.e Webpage handles all interactions with the window such as moving, dragging, changing size, hiding/showing, and data transfer.  You are responsible for handling the content inside the widget.

A widget must implement the comthe com.ikanow.infinit.e.widget.library.widget.IWidget interface which is included in the infinit.e.widget.library.swc library.  This involves implementing the following functions: onInit(IWidgetContext), onReceiveNewQuery(), onReceiveNewFilter(), and reScaleonParentResize(Number,Number).  The first 3 functions are for data transfer while the last is used for resizing the content you create.

...

Overview of function to implement

The IWidget interface requires you to implement a number methods, which will be called from the framework.  We will go over each method in detail below.

Note that all these methods are stubbed out to do nothing by the plug-in, therefore only required functionality need be implemented. (All the functions must be present for the module to compile).

Mandatory
  • onInit(context:IWidgetContext) - This function is called when your widget has completed loading into the Infinit.e Framework.  The current data context object is passed to the widget which you will want to store locally.  This IWidgetContext object contains methods to access the current result sets from the query, filter, and other associated information.  This method has been stubbed out if you are using the Infinit.e Eclipse Plugin and no further action needs taken.
  • onReceiveNewQuery() - This function is called by the framework when new data has been loaded into the IWidgetContext object.  This is your notice that the dataset has changed and you can display new content in your widget.  Some sample code has been stubbed out in the Infinit.e Eclipse Plugin that shows how you can get the query result set from the context object (passed to you on the onInit() function) and then that data can be iterated over to access various fields in the document set.  An example is explained below on using query or filter data. TODO

...

  • supportedExportFormats() - This function lets develoeprs developers return an array collection of strings that appears in the widget's context menu. If one of these is selected by the user, onGenerateExportData (see below) is called back with the "format" parameter set to whichever string was selected.

...

Future documentation will cover these capabilities in more detail, in the meantime:

  • TODO link the The API documentation is maintained here.
  • The sections below provide examples on using this API in order to perform common tasks.
  • The source code of the demonstration widgets can be obtained as a source of further examples.

...

Next we will loop through the result set we get from the IWidgetContext object we saved in the onInit function and add the documents titles to our ArrayCollection.  At the same time we will loop through the document entities adding them to our entity ArrayCollection so we can show their names also:  Add this code below the code we just added in the previous step:

...

See here for more details about the different views of the data provided by the IWidgetContext class.

You can download the full code example here or see the widget code below.

...

This is a somewhat more advanced use of the IWidgetContext API, and requires some familiarity with the JSON query API.

...