Developing the Forms generator

From OpenPetra Wiki
Jump to navigation Jump to search

summary

This page is for developers that need to extend or maintain the forms generator.

The forms generator can currently be used for generating winforms from yaml files.

The forms generator is also able to analyse the server and create links to webconnectors or uiconnectors. Controls are also linked to the correct columns in a dataset, using the definition of the tables from petra.xml and the typed dataset definitions.

At some point, we thought we might support parsing changes with the graphical UI Designer for Winforms, and then update the yaml file, but this is too complicated, and there really should not be a need anymore to use the UI Designer, since the editing of the yaml file is so much easier.

Template system

Parsing existing c# code

Parsing the YAML definition

We use the Ict.Common.IO.TYml2Xml class to parse the yml file and to transform it to an XmlDocument. This helps us the easily walk through the document using the Xml Methods for nodes etc. The advantage of using YAML is for the writer of the yaml document, since that is easier to read and less tags to write than an XML document.

The class Ict.Tools.CodeGeneration.TParseYAMLFormsDefinition knows how forms are defined, and reads most data into the TCodeStorage. But for each control a link is kept to the XmlNode of the definition of that control, which allows us to go back to that when writing the control and use more settings than which are stored in TCodeStorage.

Layout of the form

one generator for each control type

data binding

events / action handling

Existing generators

Winforms generator

Winforms generator for Reports

The only difference are the controls, because they have to save and load the parameters used for the reports.

Ext.Js AJAX generator