Applying style classes

After you create or import style sheets to the application, apply style classes to design elements or compute the class value based on a formula.

About this task

To apply style classes, select the design element in the XPages editor, and click the Style tab in the Properties view. A design element is a tool that is used to build and modify applications graphically. Design elements include XPages, Custom Controls, Themes, Style Sheets, Script Libraries, Images and more.

If you apply new style classes using the steps below, any custom style properties that you have set for font, background, and margins will be overridden. To confirm that you have not added any custom settings for the design element, a message that says No custom formatting has been added appears at the top of the panel. To remove custom style settings, click Clear. If you want to clear the custom formatting but save it as a style class to use later, click Export. See the topics at the end of this topic for more information.

Procedure

  1. To apply style classes from a style sheet that you have recently used in the application, expand the Recently used styles category and select a class. After you select a class, it appears in the Class field.
  2. To apply style classes from style sheets that you have created or imported and then added to the XPage, expand the Style sheets on page category and select a class. After you select a class, it appears in the Class field.
  3. To compute the style class, click the diamond beside the Class field and write a script that returns a string. For example, here is a formula that uses one class or another depending on the user name:
    if(session.getCommonUserName() == "anonymous") 	
     return "CaptionFigColumn"; 
    
    else 
     return "Note"
  4. Click File > Save to save your changes.