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

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

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.

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:

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

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

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

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

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

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

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

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.

(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

(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

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.

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