J report window example

 

You can test this example by creating a macro using the "Macros" MDACs.

 

// Creating the report box

JNoModalBox box = #Report#createReportBox

                  ("My reports");

 

// Adding the "My information" report line to the root

JTreeItem aReportItem = box.#Report#addReport

                       ("info",

                        "My informations",

                         this);

 

getRootPackage()

{

   // Adding a line linked to the root package

   #Report#linkToReport("info",

                        "Information on '"+Name+"'.") ;

 

   // Adding "My warnings" to the root

   aReportItem = box.#Report#addReport

                ("info",

                 "Notes checking :", 

                  this);   

 

   // Finding all packages which don't have any

     "summary" notes

   OwnedElementPackage.<select

     ( void(getAllNotesOfType("summary")))

   {

      // Adding a warning line under the "Notes

         checking :" line

      #Report#linkToReportUnder("Notes checking :",

                                "warning",

                                Name+" package has no

                                'summary' note.");

   }

  

   // Finding all packages which don't have any

      "description" notes

   OwnedElementPackage.<select

     ( void(getAllNotesOfType("description")))

   {

      // Adding an error line under the aReportLine

         line

      aReportItem.#Report#addReport

         ("error", Name+" package has no description.",

           this);

   }

}

box.show(true);

 

This code will display a J report window like that shown in Figure 28.

 

Figure 28. The J report window you just created

 

If you double-click on one of the leaf nodes, the corresponding package will be selected in the explorer.