Calculate Class HierarchyCalculate Class HierarchyRE: Calculate Class HierarchySabin Popescuhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=224862013-07-26T10:40:07Z2013-07-18T11:06:37ZThe solution below is slightly easier to implement, but it is limited to returning only a list of concrete classes (without abstract classes) that are superclasses of a selected instance, without any hierarchy.<br /><strong><br /></strong>1. Add a context menu item named "Get all parent classes..." for the context "drawingarea.mobject" that triggers the script in the file "getAllParentClasses_Lib.asc" . (see attached file ExtCoupl_ClassHierarcyCalc.asc)<br /><br /><div class="code"><span class="code-lines">1</span>ON_EVENT "AppInitialized" {<br /><span class="code-lines">2</span>...<br /><span class="code-lines">3</span>CC "Application" INSERT_CONTEXT_MENU_ITEM context: "drawingarea.mobject" item: "Get all parent classes..."<br /><span class="code-lines">4</span>CC "Application" SET_CMI_SELECT_HDL context: "drawingarea.mobject" item: "Get all parent classes..." { <br /><span class="code-lines">5</span>EXECUTE file: ("db:\\getAllParentClasses_Lib.asc")<br /><span class="code-lines">6</span>}<br /><span class="code-lines">7</span>...<br /><span class="code-lines">8</span>}<br /></div><br /><br />2. Import the file "getAllParentClasses_Lib.asc" into the application library.<br /><br />3. Right-click on any object and click the context menu item "Get all parent classes..." to trigger the script and get a list of all concrete superclasses of the selected object.<br /><br />4. The file "getAllParentClasses_MT.asc" only returns the concrete superclasses of the current object that are included in the current model type.Sabin Popescu2013-07-18T11:06:37ZRE: Calculate Class HierarchyWilfrid Utzhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=224222013-07-26T10:39:56Z2013-07-18T10:26:54ZThe underlying class hierarchy can be calculated from any instance created by following the steps below and using the resources attached to this message:<br /><br /><strong>Library Prerequesites:</strong><br />- Class Hierarchy Calculation Module is available in the library and loaded<br />- Instance Attributes have been defined to hold the results of the calculation<br />- Trigger is defined according to the needs<br /><br /><strong>For the following example snipplet the following is assumed:</strong><br />- The trigger for the calculation is the user, clicking on a button in the notebook of the instance<br />- The attributes "Class hierarchy (ID)" and "Class hierarchy (Name)" are available in the instance to store the return values of the procedure<br />- The PROCEDURE of the Calculation module is loaded during application startup <br /><br /><strong>Steps:</strong><br />1. Add 3 attributes to the root object of the library "__D-contruct__" (this makes sure that it is available for all classes)<br />a. Attribute name: "Class hierarchy (ID)" TYPE: STRING; this attribute is set after calculation with class ID tree of parent classes<br />b. Attribute name: "Class hierarchy (Name)" TYPE: STRING; this attribute is set after calculation with class name tree of parent classes<br />c. Attribute name: "Calculate class hierarchy" TYPE: PROGRAMCALL; this attribute shows the button in the notebook to trigger the calculation of the class hierarchy<br /><br />2. Define the AdoScript to be run on PROGRAMMCALL: see attached file triggerClassHierarchyCalculation.asc: add the content of the file to the facets of the attribute<br /><br />3. Add attributes to the AttrRep of classes<br /><div class="code"><span class="code-lines">1</span>CHAPTER "ClassHierarchy"<br /><span class="code-lines">2</span>ATTR "Class hierarchy (ID)"<br /><span class="code-lines">3</span>ATTR "Class hierarchy (Name)"<br /><span class="code-lines">4</span>ATTR "Calculate class hierarchy" no-param push-button<br /></div><br /><br />4. Add file using library file management function "class_hierarchy.bin"<br /><br />5. Load file "class_hierarchy.bin" ON_EVENT "AppInitialized"<br /><br /><div class="code"><span class="code-lines">1</span>ON_EVENT "AppInitialized" {<br /><span class="code-lines">2</span>...<br /><span class="code-lines">3</span>EXECUTE file: ("db:\\class_hierarchy.bin") <br /><span class="code-lines">4</span>...<br /><span class="code-lines">5</span>}<br /></div><br />6. Test for the class, using the notebook button for calculation. Remove the INFOBOX commands to remove the UI interaction.<br /><br />.Wilfrid Utz2013-07-18T10:26:54ZCalculate Class Hierarchyhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=224092014-03-27T11:12:46Z2013-07-18T10:25:22ZIs it possible to calculate the underlying class hierarchy in ADOxx from an instance modelled?2013-07-18T10:25:22Z