Versions Compared

Key

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

...

A widget must implement the 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 onParentResize(Number,Number).  The first 3 functions are for data transfer while the last is used for resizing the content you create.

...

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

...

  • 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.

Performing a local query

This is also a somewhat more advanced use of the IWidgetContext API requiring some familiarity with the JSON query API.

Anchor
CodeAnnex
CodeAnnex

...