Quick search:


How to specialize a part of a page

First read what is a part of a page.

To specialize a part you need to know where it is generated. The most effective way to find out is to switch debug mode to 'verbose' and then take look at the source of the page in your browser (how to set the debug mode). Each part will be announced with a HTML comment like
<!-- MenuPart in IndexPage(example6 - Index)
followed by some options. If you are familiar with HTML source you can probably see what part you are looking for by reading through the HTML source. Otherwise you may take a look at the Page Composition Menu from where you can open graphical composition diagrams of the default pages.

Once you have found the part announcement in the HTML source, take a look at its options. (If the options are not there, the debug mode is not properly set to 'verbose'). Each is a method call that may have generated the part. The methods are called on the object, whose class name is in the announcement after 'in'. The first method call with a * is the one that actually generated the part. The ones below can be ignored.

To specialize the part you need to create a skin, part class, or method that is higher in the options list. In many cases you can start the specialization with copying the current skin from the includes folder or the current part class from the root classfolder. Then eventually prefix it with the type. Keep in mind that creating or directly modifying part classes in the root classFolder (classes) will specialize all parts that are produced by these classes in all applications!

A special case is the DetailsPart in an EditDetailsPage: see how to specialize the layout of a DetailsPage.

If the highest option, the specific print method is already used, you need to take a look at the class of the page or part the method was called on, so that you can override the method. In order to find the class, take a look in the application classFolder. If its file is there, that's the one. If it isn't, it must be in the root classFolder (classes). Also see how to specialize a page.

If you decide to create a part class, take a look at example 6. How to proceed depends on the superclass you choose for your part class. The printing of all parts starts with the printBody method. The default implementation of the printBody method is to include the skin with the same name as the part. Other skins may be included by explicit calls to includeSkin. It may still be possible to create a custom skin for one of these in your application folder and specialize from there, like we did in example 6.

Except for using the printPart method that produces the part announcements in the HTML source, part classes may also be included and instantiated by calling getPart and later generated by calling the printBody on the instance. In the mean time it can be decorated (settings can be made on it) to further specialize it. See example 8. Calling getPart and printBody does not produce a part announcement.