decide consulting
 

conclusion©


Generating UI Components

Introduction

Decide's Conclusion has the ability to generate components based on other components. The resulting code blocks can represent either a new Windows form or a new web page based on which screen is used - the Winform generation screen or the web page generation screen. Both screens work in a similar fashion although their templates will differ and therefore their "Fields" customization grids may prompt the user to make different customizations. Generated code can be in any language that Conclusion "templates" support, currently C# and Visual Basic. There are four steps for accomplishing this:

  1. Choose the source data layer for which the UI components will be created.
  2. Choose the types of UI components that will created for each chosen data layer by selecting UI templates.
  3. Customize the Fields that will be involved in the user interface.
  4. Generate, review, and save the UI component code files.

Generation Screens

Throughout Conclusion the code generation screens all take the same format. They can be accessed from the Main Menu's Generate menu. A menu will pop up with three tabs. The first tab allows users to choose from a list box on the left to select the source of code generation and to select templates from a box on the right. Under the Source checkboxes there will be buttons:

  • ALL: Automatically selects all items
  • None: Automatically unchecks all items
  • Delete: Allows deletion of checked items from the list (not available on stored proc screen)
  • ADD Component: Allows new external data layers to be added.
The generation window's data source list contains data layers recorded in the Conclusion database. The template window contains Conclusion templates - one for each type of UI component (a windows or web form) that can be generated for each selected data layer.

Adding Components

The UI generation windows have an additional "Add Component" button below the source list for allowing new external data layers to be added to the list. Any .net assembly can be used as a data layer assuming it has methods that provide data operations that are useful as a basis for a Winform or web page. Using the Web Services generation screen users can create DLLs that can become data layers by registering them to Conclusion through this ADD Component process.

Once the user clicks the button they are prompted for the path to a DLL file. Once a DLL is chosen, Conclusion analyzes the DLL to find all the relevant methods that may be used as a source for code generation. A "Gather Method Data" window pops up to allow users to review/customize this information.

The previous screen shows a DLL that represents a data layer that accesses the TestCRUD web service. Web service DLLs automatically have several methods that are not useful to Conclusion and they can be excluded by clicking the "Exclude Web Service Extras" button to deselect them.

The "Parameter Prefix" textbox in the lower left is also important. When the method in the data layer component gets invoked, it returns a DataSet or DataTable with particular column names. In order for Conclusion to "generate" the code in the UI components for calling these methods, it needs to know which returned columns match up with which method parameters.

***IMPORTANT*** Method parameters need to be named by the same name as the data columns or be the same name with some particular prefix so that they can be matched up. Conclusion generates method parameters in this format "@_{col name}". All data layers used by Conclusion must conform to the {Prefix}{col name} format. On the Gather Method Data screen users must configure the prefix used by the method parameters.

The "Classification" column allows users to configure what CRUD data operation the method handles. Conclusion "guesses" at the method type based on its name so the user should review all of these and make changes where needed. All methods included in Conclusion must be configured with this classification or else the user will be prompted to make a change because methods of an Unknown classification cannot be used by Conclusion. When the user clicks OK, the generation window's data layer list is ammended with all the new methods from the DLL.

Merging Data Layer Components to Templates

A Windows form or web page has various needs in terms of data operations and those needs are reflected in their templates. A Winform Edit Details page template, for example, has a need to "Get" one record of data, "Save" one record of data, and possibly delete or add a record of data. When generating UI components care should be taken by users to select data layer components that offer those data operation. Specifically, Conclusion's generation process matches up particular parts of the template with methods of that "Method Type". For example, an Edit page template may configured say "the 'SELECT' method code goes here" and then, for each data layer method selected, the "SELECT" method from its parent data layer component is used as the basis for generating that part of the UI component code.

Since understanding the relationships between templates and Method Types is so important to successfully generating good UI components, Conclusion aids the user by offering a filter to the data layer list. The list can be filtered to all SELECT methods, for example and then the user would choose the desired templates that have the need for SELECT operations.Once selections have been made the user can click the Next button to bring up the Methods tab for customizing UI generation output.

The first time the Next button is clicked for a selected method, the user may see the Gather Data screen. This screen allows Conclusion to actually run the method to see what data is returned so the data that a method returns can be registered with Conclusion.

Customizing Output

Within Conclusion it is possible to customize what fields are involved in the generated UI components. The Fields tab of generation window will have one tab for each selected template. On that tab will be a grid where users can configure which fields should be involved. They can also configure the source of the data for drop downs by making a selection from the lists in the dropdown column. These data sources come from the source data layer methods which are marked with a Method Type of "LIST".

The previous picture shows an example of how to configure fields. Once the fields have been customized (if needed) the user can click the Generate button to generate the stored procedure scripts. The Code tab will pop up.

The Code Window

The code window shows all the generated code for all the selected items and templates. After generation they still only exist in memory but users can click the Create Files but to write the code to individual files in the Conclusion Results folders. The results folders are configured in Project Setup screen from the Main Menu's File menu.


Conclusion Ver 1.4 - WGU 3/10/2005