Objects: Transactions, Web Panels
Language: Java, .NET
Interfaces: Web
Having a consistent look and feel is a must for Web Applications. Creating and maintaining every Web application page assuring consistency with the rest of the site takes lots of programming time. Not to mention if a change to the standard Web page layout is required.
Master Pages provide a way to centralize layout and behavior on a single object and reuse it in any other object without programming. This means that changing application layout or behaviour is as easy as changing one object and you are done. No need to generate or recompile those objects referencing the Master Page object.
Master Pages are Web Panels having 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. In this way, the referencing object inherits all layout and behaviour of its Master Page. Reference is done by setting the Master Page property in the referencing object with the Master Page value.
Master Pages have a new control named "Content Placeholder". This control defines where, on the Master Page, will be placed the content of the referencing Web Panel or Transaction.
A Master Page is defined, specified and generated independently. So if you want to modify the layout (for ex. adding a new footer or a side bar menu) it's just necessary to 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)
You can define a Web Panel and set the Type property to 'Master Page'.
An example of a Master Page design follows:
In this case a Master Web Panel is used to define all the components that surround all the Web Panels of the site. In backoffice applications it's typical to have a Header at the top, a Footer at the bottom, and a Side Bar Menu at the left.
Here, each section are implemented as Web Components (WCHeader, WCNav and WCFooter), and in the middle of the screen you have the Content Placeholder control.
In the Content Placeholder the Web Panel or Transaction, which has this Web Panel as Master Page (indicating that in the Master Page property of the object, that has the default value "none"), will be displayed.
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.)
Comments & Collaboration
Interesting links
XV GX Int.meeting. GeneXus Yi: General presentation of version