Tuesday Mar 13, 2007

Speeding Up Visual Web Component Development

If you're a component developer who doesn't mind working on the bleeding edge and are writing new components for NetBeans Visual Web Projects (WVP), this entry is for you. Writing components for VWP using the tried and true method of building and creating a complib file and then importing it into the IDE produces a long painful edit-deploy-test cycle. I've been there because I am also currently working on adding VWP support for jMaki components. See the NetBeans RFE on this very problem.

I've created a first pass implementation to fix this problem on the NetBeans 6 trunk. Unfortunately, it has some file locking issues on Windows that I haven't figured out, but by restarting the IDE, it should still be somewhat usable. It's also on the bleeding edge so be prepared for some other possible unknown IDE instability, but having used it myself for a week or so leads me to think that it is an improvement. The basic idea is that the component library will exist in one or more NetBeans Library projects. Your test webapp will exist in a separate NetBeans Web project. The test webapp NetBeans Web project will depend upon the component library NetBeans Library project to provide it with the classes it needs for the components. In effect, component libraries are implemented as standalone projects that are shared instead of embedded within a Web project. For more information on component libraries see the main component library page I maintain.

To use this new feature, you first need to run a current version (around 2007-03-02 or later) of the NetBeans 6 trunk. Next, create at least one NetBeans Library project that contains your component library. The project should have an ant target to build a "complib" file and the current implementation assumes it will produce an expanded directory structure at "$(my-project-dir)/build/complib/".

The next step is to create a test webapp NetBeans Web project. As I understand it, in NetBeans 6, there will no longer be a separate "Visual Web" project. Instead there will be a single "Web" project with a "Visual JSF" framework that you can add to it so be sure to select the "Web Project" in the New Projects Wizard and ignore the "Visual Web Project" if such an entry still exists. Proceed to add the "Visual JSF" framework. The following UI is temporary. Open "index.jsp" and select the "Design" view. Select Tools->Shared Component Libraries. Use this dialog to manage any shared libraries that are being used by the currently active project. The dialog recognizes open component library projects that are in the format described above. It also allows you to see which shared libraries the currently active project depends on and also to refresh the palette.

A typical development cycle goes like this:

  • Add a component from the palette to the test webapp.
  • Test the component at design-time and runtime.
  • See something is wrong.
  • Fix the problem in the component library project.
  • Rebuild the component library project.
  • If needed, refresh the palette from the Shared Component Libraries dialog.
  • Retest by building the test webapp.

Note: as I mentioned before, on Windows there are file locking issues that I haven't resolved, but by restarting the IDE or maybe even only closing and re-opening projects and the deployment server, it should still be somewhat usable. I'd appreciate any feedback so please let me know if this is useful to you.

Monday Mar 12, 2007

Component Library Information Update

A developer sent me some email recently asking about how to develop and package custom components for IDEs like NetBeans 5.5 Visual Web Pack (VWP). So I updated some information such as the main component library page that I maintain. However, what this developer wanted was information on writing the components themselves. This is a more difficult task and so there is a separate page I maintain on that topic. Unfortunately, it is not current. But now that VWP has been open sourced, current development is happening on the NetBeans nbusers and nbdev mailing lists. I know there are other people working on this area so I would like to encourage developers to post their questions there, but feel free to contact me if you need specific information from me.

Many months (or was it a year!) ago, I wrote a prototype popup calendar component, that may be of use as a sample. It has been incorporated into the java.net blueprints project. Look under the "bpcatalog/ui" subtree for runtime and design-time sources in the "com.sun.j2ee.blueprints.ui.popupcalendar" package. For example, there is a "PopupCalendarComponent" class and a "PopupCalendarComponentBeanInfo" class. This prototype component uses hand-coded files and illustrates the artifacts that are needed to create the additional meta-data needed for a component. Much of the hand coding is boiler-plate code, however, and keeping the code in sync can be error prone. So another approach is to use a code generator. The newly open sourced Project Woodstock components take this approach. It uses Java 5 Annotations and an annotation processor to generate boiler-plate code.

About

edwingo

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today