6 Working with Images in Your ADF Skin

This chapter describes how to work with images in an ADF skin.

This chapter includes the following sections:

6.1 About Working with Images in an ADF Skin

You can reference images in an ADF skin by using a URL to specify the location of the image. You do this when you want to specify an image as a company logo for use in multiple web pages, for example. Other scenarios where you use images include when you want to display an image in conjunction with a warning or error message to capture your end user's attention or you want to render an image to make your application more visually appealing. Figure 6-1 shows an example that illustrates how using images referenced by an ADF skin can change the user interface that an application renders. The page in Figure 6-1 is the same page rendered by the same application using two different ADF skins.

Figure 6-1 ADF Skin Using an Image

ADF Skin File Using an Image

The ADF skin that the web page in the foreground of Figure 6-1 uses does not reference an image while the ADF skin that the web page in the background renders a company logo. It renders the company logo by defining the location of the image as a value for the background-image property in the .AFBrandingBarLogo style class.

Apart from defining images as the values for the background-image property, there are a range of selectors that reference images. These images appear, for example, as icons in ADF Faces components that render at runtime. For more information, see Section 2.1.2, "ADF Skin Selectors and Icon Images."

6.2 Changing an Image for a Component Selector

Many ADF Faces and ADF Data Visualization components reference images using selectors. These images display in the background of the component or render as icons or controls on the component. When you create an ADF skin, the ADF skin that you extend from provides the values for these selectors such as, for example, the relative path to an image, sizes for height, width, and so on.

Figure 6-2 shows a runtime view of the ADF Faces table component rendering a control that sorts the data in a table column in ascending order. The image that renders this control is referenced by the ADF Faces column component's sort-ascending-icon-style selector.

Figure 6-2 Image Referenced by the sort-ascending-icon-style Selector

Image for the sort-ascending-icon-style Selector

Figure 6-3 shows a design-time view where an ADF skin inherits values for the ADF Faces column component's sort-ascending-icon-style selector from the extended ADF skin. The values inherited include the file name for the image used as an icon (sort_asc_ena.png), the height, and the width for the image.

Figure 6-3 Inherited Values for the sort-ascending-icon-style Selector

Inherited Values for sort-ascending-icon-style Selector

Other examples of ADF Faces and ADF Data Visualization components that expose selectors which reference images associated with the component include the following:

  • ADF Faces progressIndicator component exposes the determinate-empty-icon-style selector.

  • ADF Faces panelAccordion component exposes the disclosed-icon-style selector.

  • ADF Data Visualization mapToolbar component exposes the zoomin-enable-icon selector.

If you decide that you want to modify the image that is associated with a component selector, you need to modify the selector in your ADF skin and copy the image into the project for your ADF skin. You can copy images individually using the procedure in Section 6.2.1, "How to Copy an Image into the Project" or you can import multiple images using the Images window, as described in Section 6.3, "Working with the Images Window."

After you import an image into your project, the selector that references the image uses a URL in the source file of the ADF skin to refer to this image. Note that this URL is updated when you deploy your ADF skin (and associated files) in an ADF Library JAR, as described in Section 10.3, "Packaging an ADF Skin into an ADF Library JAR."

Tip:

Associate an image with a global selector alias. If multiple component selectors reference the global selector alias, you only need to make one change if you want to use a different image at a later time (change the image associated with the global selector alias). For more information about global selector aliases, see Section 8.2, "Creating a Global Selector Alias."

6.2.1 How to Copy an Image into the Project

You use a context menu to copy an image that an extended ADF skin references into a directory of the project for your ADF skin. You then make the changes that you want to the image.

To copy an ADF skin image into your project:

  1. In the Selector Tree of the visual editor, select the selector that references the image you want to change.

    For example, select the ADF Faces column component's sort-ascending-icon-style selector to change the sort ascending icon, as shown in Figure 6-1.

    Figure 6-4 Column Component's sort-ascending-icon-style Selector

    Table Column sort-ascending-icon-style selector
  2. In the Property Inspector, expand the Common section and select Copy Image from the Background Image list, as shown in Figure 6-5.

    Figure 6-5 Copy Image Menu to Import an Image into ADF Skin Project

    Copy Image Menu to Import an Image into ADF Skin

    This copies the image into the project for your ADF skin.

6.2.2 What Happens When You Copy an Image into the Project

The image is copied into a subdirectory that is generated in the project of your ADF skin. For example, if you decided to copy the image that the ADF Faces column component's sort-ascending-icon-style selector references, the sort_asc_ena.png file is copied to the following directory:

/public_html/skins/skin1/images/af_column

where af_column refers to the ADF Faces column component.

The relative URL value of the property in the Property Inspector is modified to reference the new location of the image. Figure 6-6 shows an example.

In addition, the Property Inspector indicates that the selector no longer inherits the image from the extended ADF skin by displaying a green icon to the left of the property label. Figure 6-6 shows the Property Inspector after importing the sort_asc_ena.png file into the project for the ADF skin. Note that the ADF skin still inherits the values for the Height and Width properties from the extended ADF skin.

Figure 6-6 Property Inspector After Importing an Image into an ADF Skin

Property Inspector After Importing an Image into a Skin

Finally, CSS syntax appears in the source file of your ADF skin. Example 6-1 shows the CSS syntax that corresponds to the values shown in Figure 6-6.

Example 6-1 CSS Syntax in Source File of ADF Skin After Importing an Image

af|column::sorted-ascending-icon-style
{
  background-image: url("images/af_column/sort_asc_selected.png");
}

6.3 Working with the Images Window

The Images window helps you manage the images that you want to use with an ADF skin that extends from the Fusion Simple family of ADF skins. You access it by clicking the Images tab of an open ADF skin.

Note:

Your ADF skin must extend the Fusion Simple family of ADF skins if you want to use the functionality in the Images window. You cannot use the Images window if you extend ADF skins from other skin families.

Figure 6-7 shows the Images window that appears when you first click the Images tab in your ADF skin. The Generate Images Using list displays the following options:

  • Current Skin Aliases: Select to start with a colorized version using the global selector aliases that appear in the Color category of the current ADF skin. Choosing this option displays the Alias Color list where you can modify the values of these global selector aliases.

  • Desaturated Fusion Simple Colors: Select to start with a desaturated version of the set of images for the Fusion Simple skin.

  • Fusion Simple Colors: Select to start with a set of images for the Fusion Simple skin.

    Tip:

    Selecting Desaturated Fusion Simple Colors from the Generate Images Using list and clicking Apply to Skin is a useful method to retrieve all the current images if you want to modify them manually in another tool.

The Generated Images list displays the available images that you can apply to your ADF skin by clicking the Apply to Skin button. When you click the Apply to Skin button, the selected images in the Generated Images list are imported into an images directory that is a subdirectory of the directory in your project where you store your ADF skin.

Figure 6-7 Images Window for an ADF Skin

Images Window for an ADF Skin

The Alias Colors list that appears when you select Current Skin Aliases in the Generate Images Using list displays the color aliases that impact the color of layout and icon images. These color aliases are a subset of the available color aliases. Changing the color aliases in this subset can have a significant impact on the appearance of your application. Figure 6-8 shows a page from an application where the parts of a page that use these color aliases are labeled. For example, Bookmarkable Link uses the .AFLightVisitedLinkForeground color alias after a user clicks the link.

Figure 6-8 Application Page Using Color Aliases

Application Page Using Color Aliases

Figure 6-9 shows another example where the usage of color aliases is labeled.

Figure 6-9 ADF Faces Table Component Using Color Aliases

ADF Faces Table Component Using Color Aliases

For more information about the Color category of global selector aliases, see Section 8.1, "About Global Selector Aliases."

The Oracle Technology Network (OTN) web site provides an online demonstration that shows you how to change the color aliases in the Color Alias list as part of the process of developing an ADF skin. For more information, navigate to http://www.oracle.com/technetwork/developer-tools/adf/overview/index.html.

6.3.1 How to Generate Images Using the Images Window

You generate images using the Images window by choosing one of the supported methods and using it to apply changes to your ADF skin.

To generate images using the Images window:

  1. Create an ADF skin that extends the Fusion Simple family of ADF skins.

    For more information about creating an ADF skin, see Section 4.4, "Creating an ADF Skin File." For more information about the Fusion Simple family of ADF skins, see Section 11.4, "ADF Skins Provided by Oracle ADF."

  2. Click the Images tab for the newly-created ADF skin.

  3. Choose the method that you want to use to generate the images from the Generate Images Using list.

  4. Choose the appropriate option for the image types that you want to include:

    • Layout Slices: select this checkbox to include this type of image in your ADF skin.

    • Icons: select this checkbox to include this type of image in your ADF skin.

  5. (Optional) If you selected Current Skin Aliases from the Generate Images Using list, modify the values for the entries in the Alias Color list by entering a Hex code directly in the input field for the global selector alias that you want to modify. Alternatively, invoke a color picker by clicking the dropdown list beside the input field. You can also invoke the Select Custom Color dialog by clicking the Custom button in the color picker or reset the value of the global selector alias using the Default button. Figure 6-10 shows these buttons and the dropdown list that initially displays the buttons.

    Figure 6-10 Color Picker for Color Aliases

    Color Picker for Color Aliases
  6. (Optional) If you selected Current Skin Aliases from the Generate Images Using list, you can click the Exclude Color icon to inhibit the usage of a color alias when you generate images. The Exclude Color icon appears when you move your mouse over a color alias, as shown in Figure 6-11.

    Figure 6-11 Exclude Color Icon for Color Aliases

    Exclude Color Icon for Color Aliases
  7. In the Generated Images list, select the images that you want to apply to the ADF skin. Use the checkboxes on the Generated Images list to select or deselect all the images or to select one or more images. By default, the selected images are those that have been modified as a result of changes to the color aliases.

    Note:

    Scroll to the bottom of the Generated Images list to verify that all the images that you want to apply to the skin are selected.
  8. Click Apply to Skin.

6.3.2 What Happens When You Generate Images Using the Images Window

The image files that you selected in the Generated Images list are imported into the project. Entries appear for each image that you generate in the source file of the ADF skin. Entries also appear for each global selector alias that you modify in the Alias Colors list if you chose to generate the images using the Current Skin Aliases option. Example 6-2 shows some entries that appear in the source file of an ADF skin where images were generated using the Current Skin Aliases option with values modified for the AFDarkestNeutralBackground and AFVeryLightBackground global selector aliases.

Example 6-2 Entries in the Source File of an ADF Skin after Generating Images

af|panelWindow::footer-end
{
  background-image: url(images/generated/adf/images/fusion/dialog-footer-small-right.png); 
}
...
 
af|train::stop-icon-unvisited:hover, af|train-vertical::stop-icon-unvisited:hover
{
  background-image: url(images/generated/adf/images/fusion/train_unvisited_ovr.png); 
}
...
 
.AFDarkestNeutralBackground:alias
{
  background-color: #00ff00; 
}
.AFVeryLightBackground:alias
{
  background-color: #00ff00; 
}