Creating a Custom Style Sheet

Note: You do not have to import the style sheet of the parent look and feel you are extending. The styles defined in a custom style sheet are automatically merged on top of the parent style sheet at runtime.

To create a custom style sheet:

  1. Use a text editor to create a file with the file extension .xss . You can use any name for the file but it must have the .xss extension, e.g., mycompany-desktop.xss. Insert <?xml version='1.0'?> at the top of the document. Save the file.
  2. Copy this file into the default location for UIX style sheets of your project:

    <jdev_install>/jdev/mywork/<Workspace_dir> /<Project_dir>/public_html/cabo/styles.

    Note that the style sheet can also be placed under the web application's context root, or on the web application's class path (if you prefer to package the custom look and feel in a JAR file).

  3. In the Application Navigator, select the project that will contain the custom style sheet.
  4. From the main menu, choose File | O pen to open the custom style sheet file in the Code Editor.

    The XML document appears in the Code Editor.

  5. Insert the root element <styleSheetDocument> using the http://xmlns.oracle.com/uix/ui/style namespace. Then specify the following attributes:
  6. Insert the <styleSheet> section, specifying the following attributes:
  7. In the <styleSheet> section, insert the <style> element specifying the following attributes and child elements:
  8. Repeat step 7 to add the desired number of <style> elements.
  9. Repeat steps 6 and 7 to add the desired number of <styleSheet> sections.

For more details about the above elements used in defining style sheet documents, see "UIX Styles" of the UIX Element Reference. For complete information about using UIX styles, and customizing and personalizing look and feels, refer to the ADF UIX Developer's Guide.

Examples

The following example shows an XML style sheet document that adds two custom styles to all user environments, and one custom style that is applied only to user environments where the language reading direction is from right to left.


Example 1:

<?xml version="1.0" encoding="windows-1252"?>

<styleSheetDocument xmlns="http://xmlns.oracle.com/uix/style"
                    version="2.0">

  <styleSheet>

    <!-- Make globalHeader links center-aligned -->
    <style selector=".OraGlobalHeaderBody">
      <property name="text-align">center</property>
    </style>

    <!-- Adjust the header padding and text size/weight -->
    <style selector=".OraContentContainerHeader">
      <includeStyle name="MediumFont"/>
      <property name="font-weight">bold</property>
      <property name="padding-top">2px</property>
    </style>

</styleSheet>

  <styleSheet direction="rtl">

    <style selector=".p_OraSideBar">
      <property name="margin">0px 0px 0px 5px</property>
    </style>

  </styleSheet>

</styleSheetDocument>    

The following shows a custom style sheet that modifies the default font size:


Example 2:

<?xml version="1.0" encoding="windows-1252"?>

<styleSheetDocument xmlns="http://xmlns.oracle.com/uix/style">
  
  <!-- A custom style sheet which overrides DefaultFont -->
  
  <styleSheet>
    <style name="DefaultFont">
      <property name="font-family">Courier</property>
      <property name="font-size">14pt</property>
    </style>
  </styleSheet>
  
</styleSheetDocument>    

About Custom Style Sheets

Creating Custom Look and Feels
Working with ADF UIX Pages
Working with Web Application Design Tools

 

Copyright © 1997, 2004, Oracle. All rights reserved.