Browse DevX
Sign up for e-mail newsletters from DevX


Sun's 'Creator' Is a True Contender : Page 3

Sun gave itself a mighty challenge when it set out to create a Java IDE that lets you build Web applications visually with all the ease and convenience of Visual Studio or ColdFusion. Despite some issues with this early access version, Java Studio Creator might actually live up to its billing.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Building Web Pages Visually
In Creator, you build projects, which contain the HTML files, code files, class files, and other files that make up the project. Typically, you don't need to see all the files, and Creator hides them from you in the Project Navigator in the default Logical View. When you create a new project, Creator gives you a blank "template" .jsp page, and replaces the Welcome screen with the design view of that page. This visual design surface functions as a "canvas" onto which you drag components from the Palette.

For example, the first sample application builds a simple login screen simulation, containing a text field to hold a username, an outputText field to hold the server's response, and a button that submits the form to the server (see Figure 6). After dropping each control onto the page, you can click on it to move or resize it using a standard set of resizing handles. To select multiple controls, you hold the Shift or Ctrl key down while clicking each control. Alternatively, you can click on the page design surface and drag a nicely shaded rectangle around the controls you want to select using the mouse.

Figure 6. Central Editing Area: This view of the central editing area shows the design surface for the Page1.jsp file. The tabs at the top of the window switch from file to file, changing the editor appropriately for each file type.
Unfortunately, some convenient design features are missing. For example, you can't move controls around using the keyboard; you can't select multiple controls and then align or size them all at one time; and you can't copy and paste controls you've already placed on the page. None of these are terribly serious omissions, and at least one (copy/paste controls) is already being worked on. The documentation discusses copying and pasting controls even though this build didn't enable that feature.

Using the Properties Window
Whenever you select one or more controls the Property panel reflects the properties of the selected control(s), which you can then change. For simple properties, such as text, numbers, and pick lists, you can change the property right in the property window. By default, when you click a control that accepts a Value property, such as a text field, the documentation states that the Value property will be the default, and you can simply start typing to set the property value. That's a convenient feature, but it didn't always work in this early access version.

More complex properties, such as CSS settings for a grid control or the list of items for a List control, use a button that, when clicked, displays an appropriate property editor.

Working with the Code Editor
Double-clicking on a control takes you to the code editor and automatically inserts a "stub" for the most commonly coded event for that control. For example, when you double-click on a text field, you'll see something like this:

public void textField1_valueChangeListener( javax.faces.event.ValueChangeEvent vce) { // Add your event code here... }

Some control event handlers return a value—even if the value is null. For example, when you double-click on a button, you get this event-handler stub for the button's action() event:

public String button1_action() { // Add your event code here... return null; }

This early access version sometimes has problems with inserting the stub code or positioning the cursor in stub code it creates, but the code itself was fine. The IDE checks for code syntax errors whenever your cursor leaves an altered line, and marks problems with syntax highlighting—a wavy red underline and a small asterisk-type icon to the left of the line containing the problem (see Figure 7).

Figure 7. Code Syntax Highlighting: The figure shows a line of "bad code" in the editor, after the syntax checker has marked it with a red wavy underline.
The code editor also features "code folding," which lets you "roll up" code you don't want to see into a single line. You expand or contract code by clicking the plus (+) or minus (-) symbol next to the folded or unfolded code. The editor also features the Sun equivalent of Visual Studio's Intellisense, a must-have feature for any modern code editor, but it was both incomplete and buggy in this early access version. One nice feature is that you can see the documentation for any class or keyword in a popup window by placing your cursor in the desired word and pressing Ctrl-Shift-Space.

You can get to the code editor by double-clicking on a control or the design surface as described earlier, or by right-clicking and selecting to "View

Java Class" from the popup menu—an item that conveniently appears first in the menu, whether you right click a control or the design surface.

Page Navigation Feature
One of Creator's unusual features is Page Navigation, which uses a drag-drop visual design metaphor that lets you quickly create and define ways for users to navigate through the application's pages. To define the navigation, you draw arrows from page to page showing the navigational paths through the app, providing a name for each path, and then attach the return value from a button action handler to specific navigational paths (see Figure 8). The Page Navigation feature is convenient for beginners and for small quick projects, but becomes progressively less useful as your expertise increases and as the number of pages in your application grows.

Figure 8: Page Navigation Feature: This feature lets you define navigational paths through the application, and connect each path to an action.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date