JBoss.org Community 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 previous chapters 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, they are described more detail in this chapter. 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:

Here is how you 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>


         <tld
            jsf="true"
            name="Jenia Faces"
            schema-location="schemas/tld/myJSF.xml"
            uri="http://www.jenia.org/jsf/dataTools"/>
    

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 four tabs: Visual/Source, Visual, Source and Preview.

Split screen design with instant synchronization between source and visual views:


You can also switch to pure Visual design:


Or work just in Source view. Note that selection bar is now available not only in Visual mode but also in Source one:


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


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


Use the graphical toolbar to add inline styling to any tag.


With just a click or drag-and-drop insert any tags from the palette on to the page you are editing.


There are three buttons on the Visual Page Editor left side:


  • Preferences

Provides quick access to Visual Page Editor preferences.


  • Refresh

Refresh displaying information with this button.

  • Page Design Options

This 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.

  • Hide Selection bar

By clicking on the component in Visual view or selecting a code snippet in Source mode you can 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.