Master Page object

Unofficial Content
This documentation is valid for:

Having a consistent look and feel is a must for Web Applications. Creating and maintaining every Web application page in a way that ensures consistency with the rest of the site takes a lot of programming time. This is even more time consuming when a change to the standard Web page layout is required.

Master Pages provide a way of centralizing layout and behavior on a single object and reusing it in any other object without having to program. This means that changing application layout or behavior is as easy as changing one object. That's all you need to don. No need to generate or recompile the objects referenced to the Master Page object.

But, what are Master Pages?

Master Pages are Web Panel objects that have the Type property set to Master Page. You may have as many Master Pages as you want in your Knowledge Base. Once there is at least one Master Page in your KB you may reference it in any Web Panel or Transaction object. In this way, the referenced object inherits all the layout and behavior of its Master Page. Reference is done by setting the Master Page property in the referenced object to the Master Page value.

At the Environment level, there is a Default Master Page property. When you enter a <Master_Page> name in this property, all the objects created will take this value by default.

Master Page Sample

As illustrated in the figure above, a Web Panel is defined to function as a master page, that is, as the page that will contain the site's generic layout and behavior. In the example page, we can see that there is a Web Component to load the Header that we wish to have on all the pages in the site, another for the menu, and then we have a “blank” space were we want to have each specific page of the site loaded. The Master Pages have a control named "Content Placeholder" (this will be the only mandatory control in the Master Page). This control defines where on the Master Page the content of the referencing Web Panel or Transaction will be placed. On the Master Page you can also include Rules, Events, Conditions and any other component of a common web page, with the purpose of adding to the behavior.

A Master Page is defined, specified and generated independently. So if you want to modify the layout (for example, adding a new footer or a side bar menu), all you need to do is modify/generate the Master Page and not any object referencing it.

Some of the benefits are:

  • Less Coding
  • Easy to design Web Panel forms
  • Some aspects as security or auditing can be implemented in the Master Web Panel
  • Better Performance (less HTML code)
  • Incremental Development (just changing the Master Web Panel changes the whole application)

Considerations

Events sequence

When executing a Web Panel or Transaction associated to a Master Page, events are triggered in the following sequence:

  • Event Start of the Master Page
  • Event Start of the Web Panel
  • Event Refresh and Load of the Master Page (here, the Master Page is drawn until reaching the Content Placeholder)
  • Event Refresh and Load of the Web Panel
  • .......

Referencing object information

When programming the Master Page, you may need information about the contained object. The information is available through properties of the Content Placeholder control. These properties are:

  • Pgmname: Program name
  • Pgmdesc: Program description

How to define a Web Panel as a Master Web Panel

Now, the Web component Property of Web Panels was changed for the Property Type which have the following values:

  • Component
  • Master Page
  • Web Page (default value)

You can define a Web Panel as a Master Web Panel, selecting the Master Page value.
Master Pages only can be assigned to Web Panels or Transactions, with the Type Property set to Web Page (not Component).

Restrictions

A Master Web Panel is a regular Web Panel (it can even have webcomponents), but needs to comply with the following restrictions:

  • Only one Content Placeholder (At save time, Error: Only one Content Placeholder control is allowed).
  • No Parm rule (At specification time, spc0092 Master Pages do not support the parm() rule).
  • Can not be Main (If you choose the Master Page Type property for a Web Panel, the Main property disappear).

Other restrictions:

  • You can't call a Master Page from other object like a simple Web Panel (At specification time, spc0008 Events(6): Call to program Master Web Panel that cannot be generated.)
  • If a Web Panel used to be a master page and now is not any more, the objects which have it as Master Pages send specification error (At specification time, spc0093 The Master Page property references an object that is not a Master Page.)

See also

Master Page property



Subcribe to this category's changes
Sub CategoriesAdd a new subcategory in this category
PagesAdd a new page in this category