JBoss.comEnterprise Documentation
This chapter will introduce you to the functionality provided by JBoss Tools Palette. The Palette allows you to quickly and easily create your JSP or JSF pages. Now you can do it more faster without additional knowledge.
The JBoss Tools Palette allows you to:
Insert tags into a JSP or JSF page with one click
Add custom and 3rd party tags
The JBoss Tools Palette contains a developer's project tag libraries and provides possibility to add any tag libraries to it. Also you can choose a necessary one from the list of already existed tag libraries:
HTML
JBoss
JSF
JSTL
MyFaces
Oracle ADF Faces
Struts
XHTML
By default JBoss Tools Palette is not displayed. If you want to use it select Window > Show View Other... > JBoss Tools Web > JBoss Tools Palette from the menu bar.
The standard Eclipse Palette is displayed by default in both Web Development and Seam perspectives. Now, the standard Eclipse Palette is featured with all JBoss Tools Palette options and capabilities.
To open the standard Eclipse Palette navigate to Window->Show View->Others->General->Palette.
The differences between the two palettes are as follows:
The standard Eclipse Palette is blank by default; the content of the palette is available only if Visual Page Editor is open and active, while JBoss Tools Palette always contains a predefined set of components.
The Expanded/Collapsed state of components in the standard Eclipse Palette is not global as in JBoss Tools Palette: the state is associated with an instance of Visual Page Editor. It means that the state can be different for various files, and each new file opened in Visual Page Editor will have the default state of Palette with all components collapsed.
To facilitate your work, you can configure the Palette in your own way, by selecting the corresponding icon on the Palette toolbar.
There is a possibility to configure the JBoss Tools Palette:
to edit the palette content by adding, removing or changing the palette elements
to show/hide groups, subgroups
to import groups, subgroups
JBoss Tools Palette contains existing libraries of tags, thus the Palette editor is intended to work with them or create your new one, as well.
To open the editor, click on the
Palette Editor
icon().
The window has two parts. There is a reflected grouped list of components on the left side of the palette editor. Each group is divided into multiple groups, every of which is a tag library. The right side of the palette editor is an editing window where it's possible to change values of group or tag library attributes that you've chosen on the left part of the window.
It can also be done by right click and using Edit… option.
For example, JSF group consists of Core, Facelets, HTML tag libraries and the attributes as name, description and hidden which are available for editing:
The Palette Editor provides the following possibilities when working with existing tags or icons:
to work with a set of icons
Icons is the root folder for the icon sets. The first step is creating the icon set. Right click on the Icons folder and select Create > Create Set...
Set the value of the name in the Add Icons window and click Finish button. A new element will appear in the list.
Also you can delete the set. Right click on the set of icons that you wish to remove and chose the Delete Set option from the pop-up menu or click the Delete keyboard button.
to edit icons in the chosen set
When the set of icons is created, new icons can be imported to it. Choose the required set and select the option Create > Import Icon... from the pop-up menu that appears after you right-click on a folder.
Set the name of the icon and the path and click Finish button.
to work with a group of tag libraries
The first step in work with the editor is creating a group of libraries. It's very easy to do, right mouse button click on the Palette folder and select Create > Create Group…
Set a name of a group in the Create Group window and click OK button. A new element will appear at the end of the list.
You are allowed to edit or delete a group, as well. If you'd like to change attributes of a group, use the right editing window of the palette editor or the Edit... option, like it was mentioned before. In order to remove the group, right click on the group that you wish to remove and choose the Delete option or click the Delete keyboard button.
The removal option is enabled only for custom folders.
to work with a tag library
The group maintains a list of tag libraries. If you'd like to create your own library, click right mouse button on the group and choose Create Group… option.
After setting the attribute name and the path of the icon, click Ok button.
If you do not choose an icon the default one will be assigned.
You are allowed to edit or delete the tag library, as well. If you'd like to change attributes of the library or choose another icon, use the right editing window of the palette editor or the Edit... option. In order to remove the tag library, right click on the library that you wish to remove and chose the Delete option or click the Delete keyboard button.
The removal option is enabled only for custom tag libraries.
to work with a tag element
When the library folder is created, new tags can be added to it. Choose the required library and select the option Create > Create Macro… from the pop-up menu that appears after you right-click on a folder.
In the Add Palette Macro window, you can configure the tag element. Attribute Name is mandatory to fill and it will be the name of the tag element. Other settings are optional. You can choose the icon and set the Start Text and the End Text for your tag element. If your tag text is too long, use the Change... button to see it all. For start text and end text there is a possibility to control the cursor position by using "|" symbol.
After all the attributes are set, click Finish button.
If you do not choose an icon the default one will be assigned.
You are also allowed to edit or delete the tag. If you'd like to change the attributes of the tag or choose another icon for it, use the right editing window of the palette editor or the Edit... option from the pop-up menu. In order to remove the tag, right click on the tag that you wish to remove and chose the Delete option or click the Delete keyboard button.
The removal option is enabled only for custom tags. JBoss Palette tags can not be removed but can be modified.
If you have changed any abject in the tree view and you don't like the final result you can always use the Restore Defaults button. Click on it will restore defaults for the object selected and for its children elements. Please remember that the button will only restore data for objects defined in the default palette. If selected object is created by you, the button will be disabled. Child objects added by you will not be removed.
When updating JBoss Tools the palette content is not updated.
Show/Hide is a very useful feature that allows you to control the number of tag groups that are shown on the palette.
Click
Show/Hide
button(), at the top right side of the JBoss Tools Palette.
In the dialog Show/Hide Drawers check the groups the libraries of which you want to be shown on the palette:
If libraries are not displayed in the palette, check whether they are selected. Click the plus sign to expand the libraries of the group and make sure that a tick is put next to the wanted libraries.
Click OK. The new groups will now be shown on the palette:
The names of the elements are compound. The first part is the group name and the second is the library name.
The Import button lets you add a custom or 3rd party tag library to JBoss Tools Palette. Find out more information on how to add particular tags see the Adding Custom JSF Tags section.
A new tag can be added into any text file including jsp, htm, html and xhtml.
Let's do it. Open your JSP file and place the cursor in a place where you'd like to add a tag and then click that tag in the palette. In the Insert Tag window, that appears, you can set the value of general and advanced attributes of the tag that you chose.
In the example below, the commandButton tag has been inserted.
if you place the cursor over any tag, a balloon hint is shown with all the "tag" attributes.
The cursor position after adding a tag into a file is specified by "|" symbol in the tag template on the right in the Palette Editor window.
Above you can see where the cursor position for HTML > Form > input is set. Thus, after adding this tag into your file the cursor will be in the attribute "type". Then, you can straight use the combination of buttons Ctrl + Space to inquire about a prompting.
There are two ways to add any custom (including custom Facelets libraries) or 3rd party tag library to the JBoss Tools Palette:
Drag-and-drop from the Web Projects view
The Import button on the JBoss Tools Palette
Before you add your custom component library, you need to make sure it is included in your project. You need to either place the ".tld" file or the ".jar" that includes your tag library under the lib folder in your project. Or you can just add ".tld" or ".jar" file to the classpath , and the library will be added to the Tag Library List in Web Projects View.
Switch to the Web Projects view and expand the Tag Libraries folder. If the view is not active, select Window > Show View > Web Projects from the menu bar.
Also make sure that the JBoss Tools Palette is open. Select the tag library that you want to add and simply drag-and-drop it on to the JBoss Tools Palette.
You will see the following dialog window. As you can see JBoss Developer Studio takes care of all the details. Chosen TLD file , name and prefix of the library and Library URL are detected, thus just need to set the Group name to which you wish to place this tag library. You can either add this tag library to an existing Group or just create a new one.
Once you are finished, you will see the new tag library added to the JBoss Tools Palette.
The same you can do with
Import
button().You can see this button at the top right side of the JBoss Tools Palette.
By clicking on the Import button you will see the Import Tag window a similar like in the Drag-and-Drop method. Set the name and prefix of the library and Library URL. Also you need to set the Group name to which you'd like to add your tag library. And like in the previous method you can add it to an existing Group or create a new one. On this Import Tag form you can use Browse... button to locate the tag library that you want to add: