JBoss.comEnterprise Documentation

Chapter 3. Editors

3.1. Editors Features
3.1.1. OpenOn
3.1.2. Content Assist
3.1.3. Visual Page Editor
3.1.4. More Editors

In the JSF Tools Reference Guide and Struts Tools Reference Guide you had possibility to read about Graphical Editor for JSF and Struts configuration files, Graphical Editor for Tiles Files, Graphical Editor for Struts Validation Files. All these editors have OpenOn and Content Assist features, which are described in more details in this document. In addition you get to know a Visual Page Editor for combined visual and source editing of Web pages and many other editors for different types of files.

JBoss Developer Studio has powerful editor features that help you easily navigate within your application and make use of content and code assist no matter what project file (jsp, xhtml, xml, css, etc...) you are working on.

Content assist is available when working with

Notice, that code completion for EL variables has icons illustrating what they are from. Currently it's performed for resource bundles, JSF and Seam components.



Also, as you can see, the ranking and sorting are available in EL code completions.

When working with JSF project in JBoss Developer Studio, you can use various Content Assist features while developing:

Here is what you need to do to add project based code assist to a custom component added in JBoss Developer Studio:

Follow these steps to set what is available for code assist:


<AttributeType ...>
       <proposal type="jsfVariables"/>
</AttributeType>

<AttributeType ...>
       <proposal type="bundleProperty"/>
</AttributeType>

<AttributeType ...>
       <proposal type="beanProperty"/>
</AttributeType>

<AttributeType ...>
       <proposal type="beanProperty">
          <param name="type" value="java.lang.Boolean"/>
       </proposal>
</AttributeType>

<AttributeType ...>
       <proposal type="beanMethodBySignature">
          <param name="paramType" value="javax.faces.context.FacesContext"/>
          <param name="paramType" value="javax.faces.component.UIComponent"/>
          <param name="paramType" value="java.lang.Object"/>
          <param name="returnType" value="void"/>
       </proposal>
</AttributeType>

JBoss Developer Studio comes with a powerful and customizable Visual Page Editor (VPE). You can use the Visual Page Editor to develop an application using any technology: JSF, Struts, JSP, HTML and others. Double-click on the necessary file in the Package Explorer view to open it in the Visual Editor or just drag-and-drop it into perspective (the drag-and-drop feature can be also applied to JSP, XHTML or HTML files created locally).

Current VPE version has three tabs: Visual/Source, Source and Preview. To switch between the views you can use tabs at the bottom of the VPE or the shortcuts Ctrl + PageUp/Ctrl + PageDown .


Using the Visual/Source view you can edit your pages in the Source and Visual modes simultaneously having an instant synchronization between them:


The view is designed in the form of a split pane with toggle buttons for quickly moving between Source, Visual or Source/Visual modes as shown on the figure above.

One more way to toggle between the various states of the split pane is using the shortcuts Shift + F6 for maximizing/restoring the Source part and Shift + Alt + F6 for maximizing/restoring the Visual part.

Tip:

When editing large documents hiding the Visual part will speed up the editing.

It should be pointed out that, no matter in what mode you are working, you get a full integration with Properties and Outline views:


It's also possible to use the JBoss Tools Palette to insert any tag from the list of tag libraries to the page you are editing with just a click or drag-and-drop.


You can insert a tag/component from the palette into either the Source or the Visual part by calling a context menu and selecting Insert around, Insert before, Insert after or Replace With, pointing to From Palette, picking the type of the tag and finally choosing the tag you want to insert.

The image below illustrates how you can insert a tag into the Source part.


And this is how a tag is inserted using a context menu in the Visual part.


Visual Page Editor provides the option for displaying non-visual tags in Visual mode of the editor. To enable this option expand the submenu in the top left corner of the Visual part and select Show Non-visual tags.


On the figure you can see non-visual elements with gray dashed borders.


To disable this option again expand the same submenu and select Hide Non-visual tags.


Most web pages use the cascading style sheets (CSS) to control the way they look. With Visual Page Editor you can easily stylise your pages. In this section we are going to introduce you to a powerful mechanism that VPE provides for a complete control over pages styling.

The pages you are working with in VPE can use external stylesheets. VPE allows you to create new style classes in existing stylesheets and/or edit them as well. For these purposes CSS Style Class Dialog is provided (hot keys - CTRL+SHIT+C).

Select the element for which you need to create or edit style class and press button next to styleClass field in Properties view.


It'll pick up the CSS Style Class Dialog which looks like on the figure below.


First, you should specify the CSS file where you are going to put your style class. Do this by pressing the button next to the CSS file field.


To create new CSS class write its name in the Style class field and then configure style settings switching between the tabs: Text/Font, Background, Boxes, Property Sheet. The list of already exisiting classes with names begining with the symbols printed will be displayed on standard "Ctrl+Space" key combination. To add existing styling to the chosen element just point to the necessary one. Each time you select any class it is displayed in the Preview tab. Click on the Apply button will apply the changes without closing the window.


The Edited properties tab gives a preview of the properties which are set for the existing style class. You can easily modify them with the help of this wizard.


If the style class isn't chosen, the tab doesn't show any properties.


The Preview tab is for observing the content of the chosen CSS file. This tab is hidden if no CSS file is chosen.


At the top of the CSS Style Class Dialog you can see a preview box which visualizes the result. To edit the preview you should double click in the box. To leave the focus, use Ctrl + Tab.


The dialog for creating a new CSS class, which is called from New > Other... > JBoss Tools Web > CSS Class, looks the same.


In the left vertical pane of the Visual part there are three buttons: Preferences ( ), Refresh ( ) and Page Design Options ( ) .


You can find useful one more functionality provided by VPE. At the bottom of the Visual/Source view there is a Selection Tag Bar. It allows to see tags tree for a current component selected in Visual or Source mode.


If you want to hide the Selection Tag Bar, use the button in the form of a red cross on the lower right side. To reset it again you should check the proper option in the VPE Preferences.

Besides Visual Page Editor JBDS is supplied with a huge range of various editors for different file types: properties, TLD, web.xml, tiles, and so on.