JBoss Tools 3 Developer’s Guide

JBoss Tools 3 Developer’s GuideThis book will show you how to develop a set of Java projects using a variety of technologies and scenarios. Everything is described through the “eyes” of JBoss Tools.

After we settle on the project (or scenario) that will be developed, we will configure the proper environment for the current tool (those projects selected will cover between them the main components of a web application in terms of the backstage technology). We
continue by exploring the tool for accomplishing our tasks and developing the project’s components. A cocktail of images, theoretical aspects, source codes, and step-by-step examples will offer you a thoroughgoing for every tool. At the end, the project will be
deployed and tested. In addition, every chapter is “lard” with pure notions about the underlying technology, which will initiate you into, or remind you of, the basic aspects of it.

also read:

This book will show you complete and functional applications, and will familiarize you with the main aspects of every tool. By the end you will have been provided with sufficient information to successfully handle your own projects through JBoss Tools.

What This Book Covers

Chapter 1 is a compressive chapter that will help you discover the features brought by the new JBoss Tools 3.0. The main goal of this chapter is to make an introduction to what will follow in the next chapters and to “wake up” your curiosity. In addition, the reader
can see different possibilities of installing JBoss Tools on different platforms and for different goals.

Chapter 2 teaches you how to use Eclipse and JBoss AS in a symbiotic manner. In this chapter you will see how to use the JBoss AS Tools to configure, start, stop and monitor the JBoss AS directly from Eclipse IDE. Also, you can see how to create and deploy
new projects.

Chapter 3 is a collection of tag-components from different technologies as Ajax, JSF, RichFaces, Seam, and so on. Because the components are built on the drag-and-drop technique, this tool is very easy to use, especially when you need a fast method for
generating tags into JSP pages. This chapter will cover—with description and examples—the most important tags that can be generated through JBoss Palette. Also, the chapter will contain a section about the Palette Options.

Chapter 4 will talk about punctual framework’s tools and I will start with JBoss Tools for Java Server Faces. After I present the Faces Config Editor, which is the main visual component for JSF support, I will follow the framework mains characteristics and I will
discuss—from the JSF Tools perspective—about managed beans, validators, converters, navigation rules, and so on.

Chapter 5 will give you a complete cover of the graphical Struts editors that are used for generating/managing XML documents (configuration, tiles, validators). Also, you will see how to work with code generation and debug support for Struts projects. Everything will be sustained by images (captures) and examples.

Chapter 6 will show you how to accomplish the most important modules of a Seam project, like Action, Form, Entity, and so on through the Seam Tools filter in the first part. Later, in the second part of the chapter, you will work with the visual editors
dedicated to increasing the speed of developing/controlling Seam components.

Chapter 7 will show some advanced skills, like Hibernate and Ant, generation of POJOs, debugging goals and reverse engineering control after a detailed presentation of how to use Hibernate Tools to speed up the configuration and mapping tasks.

Chapter 8 will discuss about the jBPM Tools. You will see how to develop and test a complete jBPM project.

Chapter 9 will detail the main concepts of JBossESB Services, and you will see how to use ESB Tools to develop such a Service.

Chapter 10 will help you create from scratch a WSDL document using WSDL Editor. You will generate a complete web service from a WSDL document and from a Java bean using WS Tools wizards, and you will publish a web service using jUDDI and Web Services Explorer. In addition, you will see how to generate a web service’s client, how to test a web service through Web Services Explorer, how to convert WSDL documents to WSIL documents and how to inspect WSDL web services through WSIL and WSE.

Chapter 11 will work with the Portal Tools. You will see how to use the wizards for creating projects with Portlet Facets, creating the Java Portlet wizard and creating the JSF/Seam Portlet wizard.

JBoss Tools Palette

In this chapter, we will discuss the JBoss Tools Palette, which is a very useful tool designed especially for speeding up the development of JSP, JSF, HTML, XHTML or any other text file that contains tags. In principle, JBoss Tools Palette is a collection of
common tags, exposed through a flexible and easy-to-use interface.

By default, JBoss Tools Palette is available in the Web Development perspective that can be displayed from the Window menu by selecting the Open Perspective | Other option. In the following screenshot, you can see the default look of this palette:

Let’s dissect this palette to see how it makes our life easier!

JBoss Tools Palette Toolbar

Note that on the top right corner of the palette, we have a toolbar made of three buttons (as shown in the following screenshot). They are (from left to right):

  • Palette Editor
  • Show/Hide
  • Import

Each of these buttons accomplishes different tasks for offering a high level of flexibility and customizability. Next, we will focus our attention on each one of these buttons.

Palette Editor

Clicking on the Palette Editor icon will display the Palette Editor window (as shown in the following screenshot), which contains groups and subgroups of tags that are currently supported. Also, from this window you can create new groups, subgroups,
icons, and of course, tags—as you will see in a few moments.

As you can see, this window contains two panels: one for listing groups of tag libraries (left side) and another that displays details about the selected tag and allows us to modify the default values (extreme right). Modifying a tag is a very simple operation that can be done like this:

  1. Select from the left panel the tag that you want to modify (for example, the <div> tag from the HTML | Block subgroup, as shown in the previous screenshot).
  2. In the right panel, click on the row from the value column that corresponds to the property that you want to modify (the name column).
  3. Make the desirable modification(s) and click the OK button for confirming it (them).

Creating a set of icons

The Icons node from the left panel allows you to create sets of icons and import new icons for your tags. To start, you have to right-click on this node and select the Create | Create Set option from the contextual menu (as shown in the following screenshot).

This action will open the Add Icon Set window where you have to specify a name for this new set. Once you’re done with the naming, click on the Finish button (as shown in the following screenshot). For example, we have created a set named eHTMLi:

Importing an icon

You can import a new icon in any set of icons by right-clicking on the corresponding set and selecting the Create | Import Icon option from the contextual menu (as shown in the following screenshot):

This action will open the Add Icon window, where you have to specify a name and a path for your icon, and then click on the Finish button (as shown in the following screenshot). Note that the image of the icon should be in GIF format.

Creating a group of tag libraries

As you can see, the JBoss Tools Palette has a consistent default set of groups of tag libraries, like HTML, JSF, JSTL, Struts, XHTML, etc. If these groups are insufficient, then you can create new ones by right-clicking on the Palette node and selecting the Create | Create Group option from the contextual menu (as shown in the following screenshot).

This action will open the Create Group window, where you have to specify a name for the new group, and then click on Finish. For example, we have created a group named mygroup:

Note that you can delete (only groups created by the user) or edit groups (any group) by selecting the Delete or Edit options from the contextual menu that appears when you right-click on the chosen group.

Creating a tag library

Now that we have created a group, it’s time to create a library (or a subgroup). To do this, you have to right-click on the new group and select the Create Group option from the contextual menu (as shown in the following screenshot).

This action will open the Add Palette Group window, where you have to specify a name and an icon for this library, and then click on the Finish button (as shown in the following screenshot). As an example, we have created a library named eHTML with an icon that we had imported in the Importing an icon section discussed earlier in this chapter:

Note that you can delete a tag library (only tag libraries created by the user) by selecting the Delete option from the contextual menu that appears when you right-click on the chosen library.

Creating a new tag

After you have created a tag library, it is time to place your first tag in it. To do this, you have to right-click on the tag library and select the Create | Create Macro option from the contextual menu (as shown in the following screenshot).

This action will open the Add Palette Macro window, where you can configure the new tag. In this window, you have to specify:

  • The tag Name (mandatory)—it is displayed in Tools Palette
  • An Icon (optional)
  • Start Text of the tag (optional)
  • End Text of the tag (optional)
  • Automatically Reformat Tag Body (mandatory).

For example, let’s create a tag for representing the following HTML code, which is a scrollable HTML table with a single column. We have named the tag <mytable>:

<div style="overflow: auto; width: 270px; height: 375px; padding: 0px; margin: 0px;">
<table cellspacing="0" cellpadding="2"><colgroup><col width="270" /></colgroup>
<tbody>
<tr>
<td valign="top" nowrap="nowrap" width="270"></td>
</tr>
</tbody>
</table>
</div>

For this, we fill up the Add Palette Macro as seen in the previous screenshot.

Note that you can delete a tag (only tags created by the user) by selecting the Delete option from the contextual menu that appears when you right-click on the chosen tag.

As you can see in the previous screenshot, there is no section for describing your tag definition, syntax, attributes, etc. For that you can click on the tag name and modify the description row from the right panel of the Palette Editor or you can right-click on the tag name and select the Edit option from the contextual menu. This will open the Edit window that contains a Description section as you can see in the following screenshot:


In this section, we can write a tag description in HTML format. For example, for the <mytable> tag, we have created the following description:


<table width="300">
<tbody>
<tr>
<td><span style="color: olive;">
<strong>Name:</strong> </span> 
Scrollable table 

<span style="color: olive;"> <strong>Syntax:</strong> </span> 

 </td>
</tr>
</tbody>
</table>
<span style="color: olive;"><strong>Atributes:</strong></span>
CSS and table specific attributes

Now, closing t he Palette Editor by clicking the OK button will automatically add the new group, the tag library, and the tag into the JBoss Tools Palette as shown in the following figure (note the description that appears on mouse over).

Show/Hide

As the name sug gests, this feature allows us to customize the number of groups displayed in the palette. By default, the palette shows only five groups, but we can add or remove groups by clicking on this button, which displays the window as shown in the following screenshot.

In this window, select the groups and/or tag libraries that you want to see in the palette and deselect the on es that you want to remove from the palette.

Importing third-party tag libraries

A great facility of JBoss Tools Palette is the ability to import third party tag libraries. This can be done using the Import button, which opens the Import Tags from TLD file window as shown in the following screenshot.

Now, it is mandatory to set the TLD file, and a name for the new tag library. Optionally, we can specify a default prefix, a library URI, and a group that will host the tag library (this can be an existing group or a new one). For example, in the following screenshot you can see how we have imported the sql.tld library into a JSF project (for now, all you can do is imagine this case, but keeping this in mind
will help you in the following chapters, where we will create real projects):

Using tags in text files

In this section, w e will discuss inserting tags from the Palette into our text files. This is a very simple task that consists of the following steps:

  1. Navigate through the Palette until you see the tag that will be inserted.
  2. Click on this tag as you click on any button.
  3. If the tag has attributes, then you will see the Insert Tag window that allows you to customize the values of these attributes (the following screenshot represents the Insert Tag window for the <table> tag that can be found in HTML group, Table tag library). Note that if the selected tag doesn’t have any attributes to be set, then this step will be skipped and the tag will be
    inserted into your page.
  4. After you have set the values of the attributes, simply click the Finish button. This action will automatically insert the chosen tag into your page. For example, in the following screenshot you can see the effect of inserting the <mytable> tag, created in the Create a new tag section, into an empty HTML page.
  5.  If you followed Chap ter 2, then now you should have an empty project named test. Expand the test | WebContent node, right-click on it, and select New | Other option. In the New window, expand Web node and select HTML leaf. Type example
    (without the .html extension) in the File name field and click on the Finish button. Now, you have the shown example.html page and you can try to add our tag to it. Also, you can play with other tags to get used to them! In the following chapters
    this will be no more a task, it will simply be routine.

Summary

In this chapter, you have learnt how to use and customize the JBoss Tools Palette for speeding up the development process of different kinds of pages, like JSP, HTML, XHTML, etc. This will be an important skill to possess in the following chapters when we will develop projects that contain many such pages.

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Comments

  1. Images are not available. Can you re-upload them? Thanks in advance.

    •  HI John,

      I have fixed the issue. Now all the images have been uploaded. Its missed while moving to the new blog.

      Thank you for pointing the problem.

Speak Your Mind

*