IJC Plugin for Canvas Widget

    Sources for building of the demo plugin are available in the ijc-api-examples.zip\ijc-api-examples\sources\Canvas - the plugin can be built from those sources or it is also available here: ijc-api-examples\plugins\com-chemaxon-ijc-canvas-examples-demo.nbm. In the following examples, the use of the Canvas widget is described in a grid view or a table widget – using custom drawing in a Boolean field, displaying mass spectrum in a text field and displaying clocks in a datetime field. First, the api-examples need to be downloaded from IJC Download pages. This zip package contains the built-in demo modules and the code source for building plugins. The demo plugin can be installed from Main menu > Tools > Plugins. Once the plugin is installed, it can be used by Canvas widget or by Canvas Cell Renderer both in a grid view or a table widget. The Demo-plugin contains various Table Cell renderers:

    com.chemaxon.ijc.canvas.examples.demo.BooleanCell - for a Boolean field;

    com.chemaxon.ijc.canvas.examples.demo.ClockCell - for a datetime field;

    com.chemaxon.ijc.canvas.examples.demo.MassSpectrumCell - for displaying mass spectrum in a text field. This can be used for a text field with an appropriate format: [[x1, y1], [x2, y2], ...[xn, yn]] where x and y are coordinates – outputs obtained from a measuring instrument (x for peak position and y for peak size).

    For using the plugin, the exact Handler class name needs to be entered in the Visual properties section of the widget customizer.

    Example 1: Using custom drawing in a Boolean field

    • create a Boolean field in your grid view or table widget;
    • open Customize widget settings by right clicking and choosing Canvas renderer;
    • enter com.chemaxon.ijc.canvas.examples.demo.BooleanCell into Handler class and click close;
    • the Boolean field value is graphically displayed as an image in the Boolean field;
    • various graphic elements (e.g. a green check mark for “true”, a red “x” for “false”) can be used for displaying the Boolean field value. Their shape, color and size can be easily changed by using a JSON map in the Config field.

    Example 2: Mass spectrum

    • create a text field and fill in your values [[x1, y1], [x2, y2], ... [xn, yn]] where “x” is the peak position and “y” is the size of the peak;
    • open Customize widget settings by right clicking and choosing Canvas renderer;
    • enter com.chemaxon.ijc.canvas.examples.demo.MassSpectrumCell into Handler class and click close;
    • the desired mass spectrum now appears in your text field.

    Example 3: Clocks

    • this Handler class can be used for Date fields and it displays clocks instead of the datetime value;
    • open Customize widget settings by right clicking and choosing Canvas renderer;
    • enter com.chemaxon.ijc.canvas.examples.demo.ClockCell into Handler class and click close;
    • datetime is now displayed as clocks.