@@ -1026,16 +1026,103 @@ It contains links to exhaustive documentation on concept, features and usage of
</ul>
</div>
<divclass="paragraph">
<p>For now, you can dismiss the welcome screen. It can be opened anytime by executing <code>Help → Welcome</code></p>
<p>For now, you can dismiss the welcome screen. It can be opened anytime by executing <code>Help → Welcome</code>.
Now you should see the initial layout of Eclipse with <em>Model Explorer</em> and <em>Outline</em> on the left and a big empty editing area to the right with a <em>Properties</em> view below.</p>
</div>
</div>
<divclass="sect2">
<h3id="truemodeling-parameter-catalogs-for-simulation-with-ecore"><aclass="anchor"href="#truemodeling-parameter-catalogs-for-simulation-with-ecore"></a>Modeling Parameter Catalogs for Simulation with Ecore</h3>
<divclass="quoteblock">
<blockquote>
<divclass="paragraph">
<p>Now you should see the initial layout of Eclipse with <em>Model Explorer</em> and <em>Outline</em> on the left and a big empty editing area with <em>Properties</em> view below to the right.</p>
<p>There are two hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.</p>
</div>
</blockquote>
<divclass="attribution">
— Phil Karlton / N.N.
</div>
</div>
<divclass="paragraph">
<p>Since we will use Ecore diagrams for data modeling, create your first Ecore modeling project now:</p>
<p>It takes time and effort to come along with good names for model entities, projects, files, and so on.
Also, specific naming conventions are in place to enhance readability of models and program code.
Since it is not always clear where names provided during modeling are used later, I compiled a list of names important in Ecore projects and added examples and comments to elucidate their meaning and naming conventions.</p>
<p>Classes are written in <ahref="https://en.wikipedia.org/wiki/Camel_case">Camel case notation</a> starting with an upper case letter. Associations and attributes are written the same way, but starting with a lower case letter.</p>
</div>
<divclass="paragraph">
<p>All other names should be derived from the globally unique <em>name space</em> of the project, in our example: <code>example.org/democatalog</code>.
It consists of a global unique domain name and a path to the project, unique within that domain.</p>
</div>
<divclass="paragraph">
<p>Use the names of example <em>Demo Catalog</em> to create your first Ecore modeling project:</p>
</div>
<divclass="olist arabic">
<olclass="arabic">
...
...
@@ -1043,13 +1130,13 @@ It contains links to exhaustive documentation on concept, features and usage of
<p>Execute <code>File → New → Ecore Modeling Project</code> from main menu — not <code>Modeling Project</code>!</p>
</li>
<li>
<p>Name it <code>demo.catalog</code> and click <code>Next ></code></p>
<p>Name the project <code>org.example.democatalog</code> and uncheck <code>Use default location</code> so that the new project is <strong>not</strong> stored in workspace but a different directory you create/choose, then click <code>Next ></code></p>
</li>
<li>
<p>Uncheck <code>Use Default Location</code> so that the new project is <strong>not</strong> stored in workspace, but a different directory you create/choose, then click <code>Next ></code></p>
<p>Provide <code>democatalog</code> as main Java package name, uncheck <code>Use default namespace parameter</code> and provide <code><ahref="http://example.org/democatalog"class="bare">http://example.org/democatalog</a></code> as <em>Ns URI</em> and <code>democat</code> as <em>Ns prefix</em></p>
</li>
<li>
<p>Provide <code>democatalog</code> as main Java package name and click <code>Finish</code>.</p>
<p>Click <code>Finish</code>.</p>
</li>
</ol>
</div>
...
...
@@ -1149,7 +1236,7 @@ Instead of artificial example classes like <em>Foo</em> and <em>Bar</em> it show
<divclass="title">Figure 4. Principle Structure of a Parameter Catalog</div>
</div>
...
...
@@ -1174,7 +1261,8 @@ Compositions are depicted as a link with a diamond shape attached to the contain
</td>
<tdclass="content">
<divclass="paragraph">
<p>Note that class names — despite the fact that they model a set of similar objects — are always written in <em>singular</em>! They are written in <ahref="https://en.wikipedia.org/wiki/Camel_case">Camel case notation</a> starting with an upper case letter. Associations and attributes are written the same way, but starting with a lower case letter. Names for list-like associations and attributes usually are written in plural form.</p>
<p>Note that class names — despite the fact that they model a set of similar objects — are always written in <em>singular</em>!
Names for list-like associations and attributes usually are written in plural form.</p>
</div>
</td>
</tr>
...
...
@@ -1188,7 +1276,8 @@ Instead, we add a <em>super class</em> to define common attributes and associati
</div>
<divclass="paragraph">
<p>In our example above, common to all four energy components are attributes <code>modelName</code> and <code>revisionYear</code>, thus these are modeled by class <code>EnergyComponent</code> that is directly or indirectly a super class of <em>Boiler</em>, <em>CombinedHeatPower</em>, <em>SolarPanel</em>, and <em>Inverter</em>.
Similar, <em>Boiler</em> and <em>CombinedHeatPower</em> share attribute <code>installedThermalPower</code> factored out by class <em>ChemicalEnergyDevice</em>.</p>
Similar, <em>Boiler</em> and <em>CombinedHeatPower</em> share attribute <code>installedThermalPower</code> factored out by class <em>ChemicalDevice</em>.
<em>SolarPanel</em> and <em>Inverter</em> share attribute <code>nominalPower</code> modeled in abstract class <em>ElectricalDevice</em>.</p>
</div>
<divclass="paragraph">
<divclass="title">Associations</div>
...
...
@@ -1407,7 +1496,7 @@ Note that Eclipse synchronizes different editors of the same content automatical
<divclass="title">Figure 8. Example Model (Homework)</div>
</div>
...
...
@@ -1421,10 +1510,10 @@ I would like to tell you that this is done with just one click but, actually, yo
<p>Make sure all files are saved (<code>File → Save All</code>)</p>
</li>
<li>
<p>Execute <code>Generate → Model Code</code> from context menu over <code>democatalog.ecore</code></p>
<p>Execute <code>Generate → Model Code</code> from the context menu of Ecore editor <code>democatalog</code></p>
</li>
<li>
<p>Execute <code>Generate → Edit Code</code> from context menu over <code>democatalog.ecore</code></p>
<p>Execute <code>Generate → Edit Code</code> from the same context menu</p>
</li>
</ol>
</div>
...
...
@@ -1445,7 +1534,7 @@ I would like to tell you that this is done with just one click but, actually, yo
</div>
<divclass="paragraph">
<p>This would create code for a simple user interface, but we use more advanced EMF Forms for that later.
If, by mistake, project <code>demo.catalog.editor</code> was created, just delete it from <em>Model Explorer</em> and do not forget to check <code>Delete project contents on disk</code> in confirmation dialog.</p>
If, by mistake, project <code>org.example.democatalog.editor</code> was created, just delete it from <em>Model Explorer</em> and do not forget to check <code>Delete project contents on disk</code> in confirmation dialog.</p>
</div>
</td>
</tr>
...
...
@@ -1460,10 +1549,10 @@ If, by mistake, project <code>demo.catalog.editor</code> was created, just delet
<p><code>Generate → Model Code</code> creates classes that represent the modeled data in code. These classes are located in three packages under directory <code>src-gen</code> in <code>demo.catalog</code>.</p>
<p><code>Generate → Model Code</code> creates classes that represent the modeled data in code. These classes are located in three packages under directory <code>src-gen</code> in <code>org.example.democatalog</code>.</p>
</div>
<divclass="paragraph">
<p><code>Generate → Edit Code</code> creates a whole new Eclipse project named <code>demo.catalog.edit</code>, again with generated classes under directory <code>src-gen</code>.</p>
<p><code>Generate → Edit Code</code> creates a whole new Eclipse project named <code>org.example.democatalog.edit</code>, again with generated classes under directory <code>src-gen</code>.</p>
</div>
<divclass="paragraph">
<p>You may have a look at some Java classes for curiosity by double clicking at them in <em>Model Explorer</em>. There is no point in trying to understand the code in detail, but observe token <code>@generated</code> present in the comments of all classes, fields and methods. Classes, fields and methods marked with this token are (re)generated whenever above commands are executed.</p>
...
...
@@ -1495,10 +1584,10 @@ To find out what user interface controls and layouts are provided by this framew
<divclass="olist arabic">
<olclass="arabic">
<li>
<p>From context menu over <code>democatalog.ecore</code> execute <code>EMF Forms → Create View Model Project</code></p>
<p>In the <em>Model Explorer</em> execute <code>EMF Forms → Create View Model Project</code> from context menu over <code>democatalog.ecore</code></p>
</li>
<li>
<p>Leave project name <code>demo.catalog.viewmodel</code> as is but uncheck <code>Use default location</code> — as we always do — and browse to the directory containing <code>demo.catalog</code></p>
<p>Leave project name <code>org.example.democatalog.viewmodel</code> as is but uncheck <code>Use default location</code> — as we always do — and browse to the directory containing <code>org.example.democatalog</code></p>
</li>
<li>
<p>Click <code>Next ></code> and select <code>EnergyComponentsCatalog</code> as data element we want to create a user interface for</p>
...
...
@@ -1509,7 +1598,7 @@ To find out what user interface controls and layouts are provided by this framew
</ol>
</div>
<divclass="paragraph">
<p>According to these inputs a new project is created with file <code>EnergyComponentsCatalog.view</code> under directory <code>viewmodels</code>.
<p>According to these inputs a new project is created with file <code>EnergyComponentsCatalog.view</code> under directory <code>viewmodels</code>.
This file opens automatically in a special <em>View Editor</em>.</p>
</div>
<divclass="imageblock thumb">
...
...
@@ -1564,7 +1653,7 @@ You can even create new boilers or other objects in lists provided, with all for
</div>
<divclass="paragraph">
<p>Of course, such automatic approach has its limits.
In our case, to have a long list of lists is not very user-friendly, because one has to scroll up and down to find a specific list.
In our case, a long list of lists is not very user-friendly, because one has to scroll up and down to find a specific list.
Also, no specific object data are shown in the list and data can only be edited in a pop-up form (no inline editing).</p>
</div>
<divclass="paragraph">
...
...
@@ -1716,7 +1805,7 @@ So, saving a form before the focus has shifted from the last edited field won
Alas, instead a list of lists we have got an even bigger list of tables.</p>
</div>
<divclass="paragraph">
<p>High time to introduce a master-detail view that presents categories of object types in a master view and, after one is selected, the according object table as detail.</p>
<p>High time to introduce a master-detail view that presents categories of object types in a master view and, after one is selected, the according object table in the detail view.</p>
</div>
<divclass="openblock float-group">
<divclass="content">
...
...
@@ -1786,8 +1875,8 @@ In fact, this feature gives us a fully functional prototype.
At least during refinement of model and UI, data sets can be created, edited, and tested for usability without the need to built a full blown, deployable application — see parts <em>Accessing and Using Parameter Catalogs</em> and <em>Build (Parameter Catalog) Applications with Eclipse Tycho</em> below.</p>
</div>
<divclass="paragraph">
<p>Be aware that in some cases the view model must adapt to changes in the data model, e.g. a new leaf category and table component has to be created for a new catalog object type.
Other changes are automatically reflected in the generated UI, at least for default forms and other UI elements.
<p>Be aware that in some cases the view model must adapt to changes in data model, e.g. a new leaf category and table component must be created for a new catalog object type.
Other changes are automatically reflected in the generated UI, at least for default forms and default table columns.
To our convenience, view model specifications incompatible with data model are indicated by error badges in the <em>View Editor</em>.</p>
</div>
<divclass="paragraph">
...
...
@@ -1801,15 +1890,15 @@ To our convenience, view model specifications incompatible with data model are i
</div>
<divclass="paragraph">
<p>We created a graphical Ecore data model with a catalog class and five classes/types of objects therein.
Classes have been defined by name, attributes, and relations between, often with cardinalities.
Classes have been defined by name, attributes, and relations between them, often with cardinalities.
Whenever classes shared some attributes or references we factored these out into super classes.
An enumeration introduced a new attribute type from a set of named values.</p>
An enumeration introduced a new attribute type as a set of named values.</p>
</div>
<divclass="paragraph">
<p>From this data model, we issued commands to create matching Java code for representing the data in memory as well as to store and retrieve them on and from disk. Methods to create, read, update and delete data objects (CRUD) were generated, too.</p>
<p>From this data model, we issued commands to create Java code for representing the data in memory as well as to store and retrieve them on and from disk. Methods to create, read, update and delete data objects (CRUD) were generated, too.</p>
</div>
<divclass="paragraph">
<p>Lastly, we thought about a good user interface for this data and used <em>EMF Forms</em> to model and prototype it.</p>
<p>Lastly, we thought about a good user interface for this data and used <em>EMF Forms</em> to model it resulting in a full functional prototype.</p>
</div>
</div>
</div>
...
...
@@ -2077,10 +2166,16 @@ Verify that Maven version 3.6.3 or above is now installed in <code>Window →
<divclass="footnote"id="_footnotedef_7">
<ahref="#_footnoteref_7">7</a>. Please stay away from version 2020-03 and 2020-06 of Eclipse Modeling Tools, since these came with a bug preventing the user from editing data in table cells within the generated UI.