User Tools

Site Tools


jrodos:technical_notes:model_user_interface

Model User Interface

Model UI is a set of windows (tabs) designed to collect user input. This set of windows (tabs) are as independent from JRodos system as possible. The only system-related calls are database calls and calls to put or get information from map. Special class extends AbstractModelInterface should be developed for collecting information from UI, preparing it for transfering to Computational Engine, obtaing information from Engine and displaying it in the windows (tabs).

All information, collected from input windows (tabs) should be organized hierarchically. The structure is presented in form of xml-file (input.xml) which is stored in <JRodos>/Manager/plugins/Model.

Structure of input xml file

Example of input xml in presented below.

<?xml version="1.0" encoding="UTF-8"?>

<input-data>
  <UI-input>
    <item name="Action" description="" dataType="java.lang.String">ERMIN_NO_CM</item>
    <folder name="AOI" description="" dataType="com.env.jrodos.core.dataitem.ComplexDataItem">
      <item name="Ermin grid" description="" dataType="com.env.jrodos.core.series.CommonSeries">0</item>
      <item name="Resolution" description="" dataType="java.lang.Double">500.0</item>
      <item name="Active" description="" dataType="com.env.jrodos.core.series.GridSeries" commonSeries="UI-input=;=AOI=;=Ermin grid">1</item>
    </folder>
    <folder name="Init" description="" dataType="com.env.jrodos.core.dataitem.ComplexDataItem">
      <item name="Notime" description="" dataType="java.lang.Integer">4</item>
      <item name="Otime" description="" dataType="java.lang.Double[]">2</item>
    </folder>
    <folder name="Measure" description="" dataType="com.env.jrodos.core.dataitem.ComplexDataItem">
      <item name="Measure zones" description="" dataType="com.env.jrodos.core.series.GridSeries" commonSeries="UI-input=;=AOI=;=Ermin grid">5</item>
      <item name="Measure data" description="" dataType="com.env.jrodos.core.series.Series">6</item>
    </folder>
  </UI-input>
</input-data>

Two upper nodes (input-data and UI-input) are obligation node. Two types of node can be used: folder and item. Each node should contain name, dataType attributes and optionally unit, substance, description etc. Attribute name should be unique inside <folder> tag and doesn't contain some charachters 1). Attribute dataType and field dataType of any DataItem instance are the same.

Folder node

Folder node represents container for other data and corresponds to ComplexDataItem. Its dataType should be “com.env.jrodos.core.dataitem.ComplexDataItem”.

Item node

Item node represents some data (scalar, grid, array, series) and corresponds to data item other then ComplexDataItem. Its dataType defines dataItem. Possible dataType values:

  • “java.lang.String”, “java.lang.Integer”, … represents scalar value and corresponds to SimpleDataItem.
  • “java.lang.String[]”, “java.lang.Integer[]”, … represents array (dimension doesn't matter) and corresponds to SimpleDataItem
  • “java.lang.Date” represents DateTime instance.
  • “com.env.jrodos.core.series.Series”, “com.env.jrodos.core.series.CommonSeries”, corresponds to Series, CommonSeries respectively.
  • “com.env.jrodos.core.series.GridSeries” corresponds to GridSeries. Item with such dataType should contain commonSeries attribute – path to CommonSeries, the base of GridSeries (CommonSeries represents grid, GridSeries – values on this grid). This path consists of nodes, separated by =;= from the root to CommonSeries item. Commonseries is obligatory presented in the xml tree.

Item nodes should contain Text (value inside tags <item …> and </item>). Semantic of this Text depends on dataType and will be defined below.

Transfering data from UI to Computational Engine and backward

To transfer data from UI to Computational Engine xml-file with the structure of input.xml (full or part) should be created. It's not obligation to create and fill with data the whole input xml nodes but hierarchical structure should be preserved.

Example of proper transfer xml-file:

<?xml version="1.0" encoding="UTF-8"?>

<input-data>
  <UI-input>
    <folder name="AOI" description="" dataType="com.env.jrodos.core.dataitem.ComplexDataItem">
      <item name="Ermin grid" description="" dataType="com.env.jrodos.core.series.CommonSeries">0</item>
    </folder>
    <folder name="Measure" description="" dataType="com.env.jrodos.core.dataitem.ComplexDataItem">
      <item name="Measure zones" description="" dataType="com.env.jrodos.core.series.GridSeries" commonSeries="UI-input=;=AOI=;=Ermin grid">5</item>
      <item name="Measure data" description="" dataType="com.env.jrodos.core.series.Series">6</item>
    </folder>
  </UI-input>
</input-data>

As usual all fields of input xml are presented in transfer xml file.

Data is transfered in the following way.

  • Scalar data (with dataType “java.lang.String”, “java.lang.Integer”, …) is transfered inside xml as Text of respective item.
Element resolutionElement; // corresponds to <item name="Resolution" ...>...</item>
...
element.setText(String.valueOf(aoiPanel.getResolution()));
  • Other data is serialized and transfered as byte array in hugeData array (hugeData is Object[] field in AbstracUserInterface) Text of respective item contains index of serialized data in hugeData array.
Element otimeElement; // corresponds to <item name="Otime" ...>...</item>
...
hugeData[2] = getNuclides(); // getNuclides() returns double[]
otimeElement.setText("2");

For GridSeries it's neccesary to use getPureGridSeriesData() function for serialization, for all other Series instances (Series, CommonSeries, TimeSeries) please use getData() function.

Element ermingridElement; //corresponds to <item name="Ermin grid"...></item>
Element activeElement; //corresponds to <item name="Active"...></item>
 
...
hugeData[0] = getErminGrid().getData();// getErminGrid() returns CommonSeries
otimeElement.setText("0");
hugeData[1] = getActive().getPureGridSeriesData(); // getActive() returns GridSeries
otimeElement.setText("1");
1) = ;
jrodos/technical_notes/model_user_interface.txt · Last modified: 2015/03/24 15:32 (external edit)