Chapter 6. Red Hat Component Palette

6.1. Using the Palette (Including One-Click Tag Insertion)

6.1.1. Red Hat Palette

The Red Hat Palette contains all your project tag libraries and allows you to:

  • Insert tags into a JSP page with one click

  • Add custom and 3rd party tags. How to add

We will also show how to configure options for the palette.

The palette becomes active when you open any JSP page. If you can't see the palette, select Window/Show View/Other.../Red Hat Developer Studio/Red Hat Palette from the menu bar.

The palette shown lists various tags orginized by groups. You can see JSF, JSTL and Struts tag groups.

Red Hat Palette

Figure 6.1. Red Hat Palette

6.1.2. Inserting Tags into a JSP File

To insert a new tag is very simple. Place the cursor in the JSP page where you want to add a tag and then click the tag in the palette. In the example below, the commandButton tag has been inserted. Notice also that if you place the cursor over any tag, a balloon tip is shown with all the tag attributes.

Inserting Tag

Figure 6.2. Inserting Tag

6.1.3. Palette Options

There are a number of ways you can configure Red Hat Palette options. There are three buttons at the top right corner:

  • Palette Editor

  • Show/Hide

  • Import

Palette Buttons

Figure 6.3. Palette Buttons

6.1.3.1. Palette Editor

This allows you to edit the tags on the palette.

6.1.3.1.1. Show/Hide

Show/Hide is a very useful feature that allows you to control the number of tag groups that are shown on the palette.

Show/Hide Drawers

Figure 6.4. Show/Hide Drawers

6.1.3.1.2. Import

The Import button lets you add a custom or 3rd party tag library to Red Hat Palette. Learn how to import.

6.2. Adding New Component Libraries

6.2.1. Adding Tag Libraries

There are two ways to add any custom or 3rd party tag library to the Red Hat Palette:

  • Drag-and-drop from the Web Projects view

  • The Import button on the Red Hat Palette

Before you can add your custom component library, you need to make sure it is included in your project. Either place the .tld file or the .jar that includes your tag library under the lib folder in your project. Restart Eclipse.

The best way to add any custom library is by using the Custom Capability feature. It is also possible to just copy the Jar file directly under project WEB-INF\lib directory.

6.2.2. Drag-and-Drop

Switch to the Web Projects view and expand the Tag Libraries folder. If the view not active, select Window/Show View/Web Projects from the menu bar.

Web Projects View

Figure 6.5. Web Projects View

Also make sure that the Red Hat Palette is open. Select the tag library that you want to add and simply drag-and-drop it on to the Red Hat Palette.

You will see the following dialog window. As you can see Red Hat Developer Studio takes care of all the details. You just need to set the Group name to which to add this tag library. You can either add this tag library to an existing Group or just create a new one.

Importing Tags From TLD File

Figure 6.6. Importing Tags From TLD File

Once you are finished, you will see the new tag library added to the Red Hat Palette.

Added New Tag Library

Figure 6.7. Added New Tag Library

6.2.3. Import Button

Click on the Import button.

Import Button

Figure 6.8. Import Button

On this screen you can select Browse to locate the tag library that you want to add.

Setting TLD File Attribute

Figure 6.9. Setting TLD File Attribute

Editing TLD

Figure 6.10. Editing TLD

Select the tag library and click on Ok button.