One of the most common causes for errors related to the use of Patterns is when some parts of the objects generated by the pattern are modified manually by the developer, overriding their default values. When this happens, the changes made to the pattern instance are not reflected in the generated objects. To help assess this situation, in version 8.0, warning messages are shown when this situation is detected while applying the pattern instance. K2BTools' patterns use the defaults mechanism provided by GeneXus. Using this mechanism the patterns can produce object whose parts are updated automatically, but can be modified by the developer. Each part (Web Form, Events, etc) of every object generated with K2BTools can be in two conceptually different states: with their default applied, or with their default not applied.
The developer can check the state of the part by looking at the icon shown in the editor. If the icon contains a green circle, the part is in its default state. If the circle is red, the default is not applied.
|
Example |
In this example the "Events" part does not have its default applied, while the rest have their default applied. When an object is created, all parts are in their default states. Their states are maintained that way, unless the developer chooses to manually modifiy the content of one of the parts. Once a part has been manually modified, the part is changed to the "default not applied" state. While a part is in its default state, K2BTools' patterns update their content according to the pattern instance's definition. If the part is not in that state, the content is not altered at all by the patterns. Very frequently, changes are made to an object that are not meant to be permantent. For example, a developer may modify an object to run some tests, and later on wish to take the object to its original state, with the parts in the "default applied" version.
|
Apply default actions |
This can be done by opening the object involved and running the action “Apply Default (All Parts)” within the GeneXus “Edit” menu. If only one of the parts should be recovered, then the developer must open that part, and execute the "Apply Default (<PartName>)" action. |