JBoss.comEnterprise Documentation

Chapter 3. Editors

3.1. Editors Features
3.1.1. OpenOn
3.1.2. Content Assist
3.1.3. Synchronized Source and Visual Editing
3.2. Visual Page Editor
3.2.1. Advanced Settings
3.2.2. Setup notes for Linux
3.2.3. JSP syntax validation
3.2.4. JSP Page Preview
3.3. More Editors
3.3.1. Graphical Properties Editor
3.3.2. Graphical TLD Editor
3.3.3. Graphical Web Application File (web.xml) Editor
3.3.4. CSS Editor
3.3.5. JavaScript Editor
3.3.6. XSD Editor
3.3.7. Support for XML Schema

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

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.

Current VPE version has two tabs: Visual/Source and Preview.

Here is shown a split screen design with instant synchronization between Source and Visual views:


Preview view is read-only, it shows how the page will look like in a browser.


The Visual Page Editor has a split pane with toggle buttons for quickly moving between source, visual or source/visual modes instead of multiple tabs.

You can use Shift + F6 and Alt + Shift + F6 as shortcuts to toggle between the various states of the split pane.

Tip:

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


No matter what view you select, you get a full integration with Properties and Outline views:


The VPE allows you to insert any tags from the palette to the page you are editing with just a click or drag-and-drop.


In the visual part of VPE there is a graphical toolbar, use it to add inline styling to any tag. The toolbar can be hidden by clicking on arrow sign in the upper left corner.


In the left vertical pane there are three buttons: Preferences, Refresh, Page Design Options.


Preferences button provides a quick access to Visual Page Editor preferences.


Clicking on Refresh button you refresh the displaying information.

Page Design Options button leads to page design options.


This dialog let's you set resources which are usually only resolved in runtime. To set a stylesheet, click Add (for CSS File Path section) and add your stylesheet. It works when CSS is defined on your page in the following way:

Code:


<link rel="stylesheet" type="text/css"  
    href="#{facesContext.externalContext.requestContextPath}/style.css"/>

This will work fine in runtime, but the Visual Page Editor doesn't know what requestContextPath in design time is.

The next section (URI), let's you add URI taglibs if you are using includes so that the editor knows where to find the tag libraries.

The first two sections let you define actual runtime folders. Here is an example.

Let's say you have the following project structure:


WebContent/
  pages/
    img/
       a.gif
    header.jsp
  main.jsp

header.jsp content:


My Header
<img src="img/a.gif"/>

main.jsp:


<jsp:include page="pages/header.jsp" />

When you open main.jsp in Visual Page Editor, it will not be able to resolve the image from the header, however, it will work fine in runtime. To fix this in design time, click the Page Design Options button and set Actual Run-Time Relative Folder to <project>WebContent > pages and you will see the image appear.

At the bottom of VPE there is a Selection bar.

By clicking on the component in Visual view or selecting a code snippet in Source mode you see the tags tree. If you want to hide the selection bar, use the "Hide Selection Bar" button on the lower right side.


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.