Wednesday Dec 06, 2006

Final release of Visual Web Pack for Netbeans 5.5 is available now

Visual web pack for Netbeans 5.5 (VWP) has been released today. Thanks to all those who downloaded the Technology Preview of VWP and send us your valuable feedback. Hundreds of bugs have been fixed and several enhancements incorporated for the final release.

You can download the final release at

Continue to provide us with your suggestions and enhancement request via Issuezilla for a better future release.

Wednesday Nov 22, 2006

Sun Java Studio Creator or Visual Web Pack

We have Sun Java Studio Creator 2 and now Visual Web Pack for Netbeans 5.5 (Technology Preview) has been released. There are lots of questions.

  1. Why in the first place there was a separate IDE called Sun Java studio Creator?
  2. Why it is released as Visual Web Pack for Netbeans now?
  3. Does that mean, there will not be any more release of Sun Java Studio Creator?

I will try to answer 1 & 2 in this blog. But I don't have an answer for 3. If any one can answer it, that is you, the Creator users. Based on  my answer to questions 1 & 2, Creator users can give answer to 3, if they would like to have separate IDE called Sun Java Studio Creator or better have an unified IDE that includes Creator as Visual Web pack.

Why in the first place there was a separate IDE called Sun Java Studio Creator?

It all started way back in late 2001, few of Sun Senior Engineers pondered, what if we create an IDE that would attract developers new to Java world, especially who would like to move from VB/ASP to Java. Sun already has an IDE called Netbeans. However, at that time Netbeans was meant for developers with advanced Java skills, which of course is no longer true. Netbeans has grown so much over years, it can now cater for wide range of developers, from novice to advanced. 

Developing an IDE from scratch is next to impossible, so must start with an existing IDE and modify. The solution may be to completely overhaul Netbeans. However, being an established Open Source tool, making incompatible changes to Netbeans for the sake of another breed of developers with out the consent of the community sounded impractical. So the idea of a new IDE was born, that would fork Netbeans source base (in a closed repository), and make incompatible changes to it, to make its look and feel similar to that of an IDE familiar to VB/ASP Developers. The new IDE was later called Sun Java Studio Creator. Since VB/ASP developers were the main target audience, developing an IDE for Java Based JSF application was an ideal choice. You can see from the following pictures how Creator was looked different from Netbeans 3.5.1.

Creator 1. Netbeans 3.5.1

Some of the main functionalities that were introduced in Creator and were missing in Netbeans 3.5.1 are

  • Dockable Window System
  • Server Navigator for easy interaction with services like datasources, EJB and web services
  • Palette for drag and drop components
  • Project Navigator
  • Dynamic Help
  • Document outline Pane
  • Single Click Deployment to bundled Application Server
  • Single Click web application debugging.

For an VB/ASP developer these functionalities are very similar to the one available in their favorite IDE.

However, when Netbeans 3.6 and then later Netbeans 4.1 was released, it was a different story - it was a major overhaul over Netbeans 3.5.1. When Creator 2 was released, it reused several of the functionalities from NB 4.1. Even though it used a forked  source base of NB 4.1, very few modifications (less than  5%) were made to the platform. Creator 2 is almost (but not 100%) Netbeans 4.1 IDE + Pack of modules. You can see the similarity between the two IDEs from the following pictures.

Creator 2. Netbeans 4.1

Some of the main differences are

  • Server Navigator
  • Palette for drag and drop (NB 4.1 Palette did not support Drag and drop)
  • Single Click deployment
  • Dynamic Help
  • Single Click web application debugging.

Why it is released as Visual Web Pack for Netbeans now?

One of the greatest strength of Netbeans IDE was that it always kept in pace with the Java Standards and releases. When JDK 1.5 was released, it was supported in Netbeans 5.0. Similarly, when Java EE 5 was released it was supported in the Netbeans 5.5 release. Since Creator was developed over a forked source base of Netbeans, there was a disparity between the two IDEs. Java Studio Creator was built over Netbeans 4.1, which did not support JDK 1.5. However, when Creator 2 was released, during that same time frame Netbeans 5.0 was released, which supported JDK 1.5. Several Creator 2 users were frustrated, because it did not support JDK 1.5.

As I mentioned above, since Netbeans (3.6 and later) has grown as a versatile and ease of use IDE, Creator 2 was more or less a pack of modules over Netbeans 4.1 IDE, but re-branded to be looked as a different IDE. However, it lacks the some of the nice features of latest Netbeans IDE (5.0 and later), which also existed at that time. If Creator existed just as pack, then it would have been far easier to just install it over Netbeans 5.0 and get the nice features of Netbeans 5.0. There fore, rather than fork the Netbeans source base and lag behind another Netbeans IDE release cycle itself, it seemed practical to release Creator as a pack over Netbeans 5.5. Once you install Visual Web pack over Netbeans 5.5 what you get is an IDE similar to Creator, except for the lack of Creator branding. See the picture below.

Having said that, you might ask, is Netbeans 5.5 + visual web pack is exactly similar to Creator?. The answer is - it includes about 90% of Creator 2 functionality, but not 100%. The reason is, some of the features were independently developed at the two code bases. Ex

  • Support for Web services
  • Support for Portal development

Because of these dissimilar development, to avoid the collision, they are currently not supported in the Visual Web Pack for Netbeans 5.5. However, our trip to Prague is to address these dissimilarities between Netbeans and Creator modules, so that Creator users can get a 100% migration path for next release of Visual Web Pack. The picture below shows Creator as a Visual Web Pack for Netbeans 5.5

Netbeans 5.5 + Visual Web Pack

Does that mean, there will not be any more release of Sun Java Studio Creator?

As I mentioned at the start of this blog, it is up to the Creator users to decide. If they request separate IDE called Creator 3, then our management and marketing team might consider the request. But I'm sure, that IDE would be nothing but a very thin re-branded wrapper of Netbeans IDE + Visual Web Pack with bundled JDK & Application Server.

But with that re-branded IDE, Creator user might miss certain features and end up with certain restrictions

  • Ability to run with latest JDK release
  • Lag behind latest Java technologies, while Netbeans keeps up them
  • Bound to single bundled Application server. Where as Netbeans supports multitude of Application Servers such as
    • Tomcat
    • JBoss
    • Websphere
    • Weblogic
  • Necessarily  to switch to another IDE to do stuff not supported by Creator (Ex. Creation of W/S or EJB or use UML)
  • Problem of project exchanging between the two IDEs as faced by Creator users now

Last but not least, Creator will be open sourced. When open sourced, it doesn't make sense to fork another open source IDE base to create yet another new IDE. The ideal choice is to release it as Visual Web Pack for Netbeans.

So, if any one asks my preference, my immediate answer is Netbeans + Visual web Pack. But the ultimate decision is left to the Creator users. Let your comments flow about your preference.

Sunday Oct 29, 2006

Releasing Sun Java Studio Creator as Visual Web Pack for Netbeans 5.5

As I mentioned in my earlier blog, Sun Java Studio Creator is soon to be released as Visual Web Pack (VWP) for Netbeans 5.5. A technology preview of the VWP will be available in early November. I'm really excited about this release, especially because the award winning web development techniques of Creator will be available side by side with other award winning technologies such as

  • Matisse GUI designer for desktop application
  • Enterprise pack for SOA application development
  • Mobility pack for developing application for technology enabled mobile devices
  • Native Language pack for languages such as C/C++
  • Integrated Profiler for performance and memory analyses.

all in a single IDE and certainly would reduce the IDE confusion.

Making the Creator as Visual Web Pack for Netbeans 5.5 has several advantages.

  • Creator user need not have to switch between different IDE's (Creator and Netbeans) to implement other technologies not included in Creator.
  • There will not be a release lag between the two IDE's. Creator 2U1 is based on Netbeans 4.1, where as Netbeans 5.0 has been released already and Netbeans 5.5 will be released soon. Cutting edge technologies released in Netbeans will be immediately available for Creator users.
  • Open sourcing Creator as part of Netbeans open source repository will allow curious and courageous users to stay in tune with bleeding edge technology.
  • Integration to useful third party modules and contributed modules is easy and quick

Visual web pack being part of Netbeans 5.5 has the following advantage

  • Supports  both Java EE5 and J2EE 1.4 based web application development
  • Support for simplified POJO based Java Persistence and EJB3 development
  • Support for simplified Web Services development using JAX-WS
  • Supports both JSF 1.1 (Creator 2U1 components) and new JSF 1.2 components
  • Supports Glassfish (Java EE 5) and J2EE 1.4 containers such as Tomcat, JBOSS etc

Tuesday Oct 24, 2006

Creator Tip: How to create a Collapsible Group Table?

Another interesting feature of the Sun Java Studio Creator Table component, which many users might not be aware of, is the ability to collapse the Table Row Group. Interestingly the collapsing does not involve round trip to the server, so it is fast and convenient. I've created a small project for this tip which you can download from here.


  • Add a Table Component to the design surface
  • Drag and drop a Table Row Group (child of Table in the palette) on to the Table Component
    Now you should see two groups of table rows in the table (see picture below)
  • Drag and drop the Person table from Servers Tab  (Data Sources -> Travel -> Tables -> Person on to the first Table Row Group
    Make sure the first Table Row group is highlighted to accept the drop, not the Table. A dialog pops up to ask if the drop should go to the table1 or tableRowgroup1. Select  tableRowgroup1
  • Drag and drop the Trip table from Servers Tab  (Data Sources -> Travel -> Tables -> Trip on to the second Table Row Group.
    Make sure the second Table Row group is highlighted to accept the drop. A dialog pops up to ask if the drop should go to the table1 or tableRowgroup2. Select  tableRowgroup2
  • Select tableRowgroup1 from Outline window and in the property sheet, enter the text"Person Row Group" to the property headerText and select the checkbox for the property groupToggleButton.
  • Similarly, select tableRowgroup2 from Outline window and in the property sheet, enter the text  "Trip Row Group" to the property headerText and select the checkbox for the property groupToggleButton.
  • Select and right click on tableRowgroup1 from Outline window and select Table Layout menu item. In the options panel of the dialog select pagination checkbox and set number of rows to 3.
  • Similarly, select and right click on tableRowgroup2 from Outline window and select TableLayout menu item. In the options panel of the dialog select pagination checkbox and set number of rows to 7.

Deploy and the page in the browser would look like the image below.

Now click on the down arrow in the Trip Row group, you would see the row group collapsing immediately as shown in the image below.

Monday Oct 09, 2006

Creator Tip: Specifying the sources for the debugger to step through

Few Sun Java Studio Creator 2U1 users raised the issue that while they are stepping through their code in the debugger, suddenly they are taken to code which are not written by them. For example, while trying to debug a Cached Data Provider related issue, they are taken to the actual Data Provider code that are not written by them, but comes bundled with Sun Java Studio Creator IDE.

The reason is, the sources related to Data Provider, Application Model and Web UI components are also bundled with Creator IDE. They are available in the directory <creator-install>/rave2.0/docs. Since they are added to the IDE library references for code completion, they also become part of debugger source level debugging.   

However, you can tell the debugger not to step in to these bundled source, by deselecting them from the list of source jars/zips maintained by the debugger. To do this, invoke the window that displays the list of source jars/zips from View Menu -> debugging -> sources or use the keyboard shortcut  Alt+shift+8.

In the Source Root / Filter Window deselect the source root which you do not want to step through. For example deselect the if you don not want to step through the bundled Data Provider source.

Table with drop down in the Title Bar

On the other hand you might want to step through source code of some external Library you have added to the project. To accomplish this, first you need to add a Library reference. Then add the source jar to the library reference. After invoking the Library Manager from Tools menu, create a New Library. Click on the Sources tab of the added new library reference and add your source jar to it by clicking on the Add Jar/Folder button. The added source jar will automatically appear in the Source Root / Filter window (shown above) which you can select for stepping through the code.

Table with drop down in the Title Bar

Monday Sep 25, 2006

Creator Tip: Table component with a custom title bar

Another feature of the Sun Java Studio Creator 2U1 Table Component, that may be of interest is to have a custom title bar. This is also done very similar to the technique I explained in my blog on How to add the button panel to the table header.

Here is an example. Suppose you are running some process and periodically post the information about the process to a web page, where user can view output information of the process in a table. Suppose, if part of the process failed, you may want to display some message in the table title bar stating the process failed along with some error icon, which looks something similar to the below image.

Table with Custom Title Bar

Here are the steps to do this:

  • First drag and drop a Group Panel component on to the designer.
  • Drag and drop a image component and a static text on to the Group Panel component.
  • Add a facet with name "title" to the table component as shown below.
  • Go to the JSP page and manually move the tag related to Group Panel Component (and its children)
    inside the "title" facet. Remove the style information related to the position of the Group Panel  using Style Builder.
  • Set the image for the Image Component and desired text for the table title to the StaticText component.
  • Modify the style of the StaticText as desired (I've set some style related to padding also) 

Here is the "title" facet code I used to make the above table title bar with red error icon and red colored text.

<f:facet name="title">
    <ui:panelGroup binding="#{Page1.groupPanel1}" id="groupPanel1" style="text-align: left">
       <ui:image align="middle" binding="#{Page1.image1}" icon="ALERT_FAILED_LARGE" id="image1"/>
       <ui:staticText binding="#{Page1.staticText1}" id="staticText1"
           style="color: #da3333; padding-left: 5px; padding-top: 10px; vertical-align: middle"
           text="Process failed"/>

Also, it is possible to add a DropDown Component to the Table Component title bar as shown below.

Table with drop down in the Title Bar

Here is the "title" facet code I used to put the DropDown Component in the title bar.

<f:facet name="title">
    <ui:panelLayout binding="#{Page1.layoutPanel1}" id="layoutPanel1" 
        panelLayout="flow" style="text-align: right">
          <ui:dropDown binding="#{Page1.dropDown2}" id="dropDown2" 
            style="text-align: right; width: 150px"/>

Wednesday Sep 20, 2006

HotFix3 for Sun Java Studio Creator 2U1 released

Good news. HotFix3 for Sun Java Studio Creator 2U1 has been released. Apart from other fixes, this patch contains three main fixes.

If you have updated to HotFix2, then this patch is a must. So get it!

Friday Sep 15, 2006

Adding multiple buttons to Table Component header

After reading my previous blog on Adding a button panel to the table component header, several Sun Java Studio Creator users asked me the question, how to add more than one button to Table component header?. Unfortunately the facet we used to set the button to the header panel does not seem to take more than one component. So, as suggested in the comment section, one way is to use some layout component and put more than one button in it. I tried with various layout components such as Grid, group Layout component etc. The best suitable one seems to be Group Layout Component. 


  • First drag and drop a layout component on to the designer.
  • Drag and drop the needed buttons on to the layout component and set the disabled=true on the buttons
  • Go to the JSP page and manually move the tag related to Group Layout component inside the facets with names "actionsTop" or "actionsBottom". Remove the style attribute in the Group Layout component, else it may be positioned outside the Table header.
  • Add the Java Script code for confirmation dialog to onClick property of each button component as shown in the code below. 
<!-- Actions (Top) -->
<f:facet name="actionsTop">
   <ui:panelGroup binding="#{Page1.groupPanel1}" id="groupPanel1">
      <ui:button action="#{Page1.button1_action}" binding="#{Page1.button1}" disabled="true" 
           onClick="if (confirmDeleteSelectedRows() == false) return false;" 
           id="button1" text="Delete"/>
      <ui:button action="#{Page2.button1_action}" binding="#{Page2.button1}" disabled="true" 
           onClick="if (confirmDeleteSelectedRows() == false) return false;" 
           id="button1" text="Delete"/>
      <ui:button action="#{Page3.button1_action}" binding="#{Page3.button1}" disabled="true" 
           onClick="if (confirmDeleteSelectedRows() == false) return false;" 
           id="button1" text="Delete"/>
      <ui:button action="#{Page4.button1_action}" binding="#{Page4.button1}" disabled="true" 
           onClick="if (confirmDeleteSelectedRows() == false) return false;" 
           id="button1" text="Delete"/>
  • Aslo make sure to add the Java Script code necessary to disableActions() function
function disableActions() {
  // Disable table actions by default.
  var table = document.getElementById("form1:table1");
  var selections = table.getAllSelectedRowsCount();
  var disabled = (selections &gt; 0) ? false : true;
  // Set disabled state for top actions.
  // Set disabled state for bottom actions.

Deploy the application and you should see Table component with multiple buttons in the header as below. Initially buttons will be disabled. On selecting a row using checkbox the buttons will be enabled.

Table with multi button panel header

Sunday Sep 10, 2006

Creator Tip: Adding a button panel to the table component header

Sun Java Studio Creator Table component has more capabilities than being exposed by the Table Layout dialog. One of the features is the ability to add a button panel to the  header or the footer of the table component. This tip shows how to achieve this simple task. I have created a sample project, which extends the Multi row selectable Table Component tip project and adds button panels to the header and footer of the table component. User can select one or more rows from the table and then click the delete button in the header or footer to delete the rows. This sample project can be downloaded from here.

Also, I have included Java Script to the Table Component to pop up a confirmation dialog asking if the rows should be deleted. Also the dialog would warn that the action can not be undone. Also the Java Script would dynamically enable or disable the buttons based on the selection of the rows.


  • First you should follow the steps in the Single or Multi selectable row Table component tip blogs.  
  • Drag and drop two buttons on to the web form designer and set the property disabled=true on both the buttons.
  • Go to the JSP page and manually edit the table tag and add two facets with names "actionsTop" and "actionsBottom" just above the end element (</table>) of the table tag. Note the names of the facet should exactly match.
  • Move the code related to the buttons inside the facets. Remove the positioning information from the buttons style property. The code would look like the following.
<!-- Actions (Top) --><f:facet name="actionsTop">
   <ui:button action="#{Page1.button1_action}" 
      binding="#{Page1.button1}" disabled="true" id="button1"
      onClick="if (confirmDeleteSelectedRows() == false) return false" 
<!-- Actions (Bottom) -->
<f:facet name="actionsBottom">
   <ui:button action="#{Page1.button2_action}" 
      binding="#{Page1.button2}" disabled="true" id="button2"
      onClick="if (confirmDeleteSelectedRows() == false) return false" 
  • Add the confirmDeleteSelectedRows() and disableActions() functionas to the existing Table Java Script
function confirmDeleteSelectedRows() {
   var table = document.getElementById("form1:table1");
   return table.confirmDeleteSelectedRows();

function disableActions() {
   // Disable table actions by default.
   var table = document.getElementById("form1:table1");
   var selections = table.getAllSelectedRowsCount();  
   var disabled = (selections &gt; 0) ? false : true;
   // Set disabled state for top actions.
   // Set disabled state for bottom actions.
  • Double click the buttons and add the code to delete the table rows.
public String button1_action() {
   int selectedRows = getTableRowGroup1().getSelectedRowsCount();
   RowKey[] selectedRowKeys = getTableRowGroup1().getSelectedRowKeys();
   for(int i=0; i< selectedRowKeys.length; i++){
       if (tripDataProvider.canRemoveRow(selectedRowKeys[i])){
           info("Row " + selectedRowKeys[i].getRowId() + " Removed");
           info("Can not remove row " + selectedRowKeys[i].getRowId());
   if(selectedRowKeys.length < 1){
       info("No rows selected for deletion");
   return null;

That is it. We are done. Deploy the application. Initially the buttons will be disabled. Select a row and the buttons will be enabled. Click on the button and the confirmation dialog (shown below) should popup.

Table with button panel header
Confirmation dialog

Wednesday Sep 06, 2006

Sun Java Studio Creator Web based training

A web based training course is now available for Sun Java Studio Creator users.

Title: Creating Web-Tier Applications Using the Visual Development Environment (WJO-1106)
Release Date:

Course Description - This course explains how to develop web applications using Sun Java(TM) Studio Creator 2 tool. In this course, students learn about the various components in the visual interface of the Sun Java Studio Creator 2 tool. This course also explains how to create, navigate, deploy, and secure web applications using Sun Java Studio Creator 2 tool.

Who Can Benefit - Architects, domain experts, Java and web applications developers. This course is designed for those who want to use the Sun Java Studio Creator 2 as a RAD tool to develop web applications without going into technical details.

Prerequisites - To success fully complete this course, you should be able to demonstrate familiarity with the basics of Java technology and web architecture.

For more details visit

Tuesday Sep 05, 2006

Redploying to Tomcat Server from Java Studio Creator

The Web Application Created using Sun Java Studio Creator can be deployed to other Web Servers such as Tomcat Web Server. See the Online Help for more details.

However, some customers noticed that every time they deploy the Web Application that has been exported as War file, they have to restart the Tomcat Server when the war file is being redeployed again. The reason is the War wouldn't get redeployed because some jars get locked. I think most probably this problem may occur on Windows.

Thanks to Haroon A. of Motorola, now we have a solution to fix this problem. The following is from his posting.

The problem is Tomcat locks up some jar files in the web-inf/lib directory, and so the undeploy can't happen. Therefore Tomcat has to be shutdown, and directory deleted before another version of the WAR file can be deployed.

Here is how I solved this problem:

I found that I have to add a file META-INF/context.xml with the following contents:

<Context antiJARLocking="true" antiResourceLocking="true">
And everything (undeploy / deploy / hot-deploy) worked fine after that!

Monday Aug 28, 2006

Deploying Java Studio Creator 2U1 developed application to Glassfish

As Glassfish, the open sourced Java EE 5 Sun Application Server PE 9, is becoming popular, Java Studio Creator users are increasingly interested in deploying their web application to Glassfish. In the forth coming release of Creator, Glassfish will be directly supported. However, it may be possible to deploy the web application created using Sun Java Studio Creator 2U1. So I was looking at what it takes to deploy the Creator 2U1 application to Glassfish. As Marco pointed out, you can simply deploy the exported war file from Creator using Glassfish admin console. It works!

However, you have another option. That is to use latest and greatest JSF 1.2 built inside Glassfish, rather than the older version of JSF 1.1 bundled inside the exported war file. Note, JSF 1.2 is fully backward compatible. So the JSF application built with Creator 2U1 will work with the JSF 1.2 runtime bundled with Glassfish with out any modification.

In order to use the JSF 1.2 runtime do the following

  • Export the war file using Project Navigator context menu item - Export War File
    • Select J2EE 1.4 as the target container (doesn't matter even though Glassfish is a Java EE 5 container)
  • Unzip the war file and remove the following jars from the folder WEB-INF/lib
    • jsf-imp.jar
    • jsf-api.jar
    • commons-logging-1.0.4.jar
    • commons-digester.jar
    • commons-collections.jar
    • commons-beanutils.jar
  • Zip the unzipped contents back as a war file and deploy it using Glassfish admin console

Note, you have to set up your datasources manually if any data connections are used in the Creator developed application. Also don't forget to manually copy the JDBC driver jars to the Glassfish lib directory. Read Chapter 2 of Glassfish Administration Guide to find details on how to set up the JDBC resources.

Suggestion: Use the Glassfish release V1 UR1 Build 08 or later, as the latest version of JSF 1.2 with many bug fixes are integrated in to this build.

Friday Aug 25, 2006

Java Studio Creator 2 performance patch is released - a must for evey Creator user.

Performance .. performance .. performance. We heard it and we heard it enough. "Enough is enough" said our Engineering manager, Mark Dey and thus born the Performance tiger team. The primary and only focus of this team is to improve the performance of Sun Java Studio Creator. The team members dropped what ever they are working on for the forth coming releaser, code name shortfin - bundling Creator as a pack for Netbeans 5.5 and jumped on to the band wagon to work on the performance of the current release - Java Studio Creator 2 U1. I had the privilege of leading this team. The patch would not have happened with out the salient efforts of the team engineers Sandip Chitale, Peter Zavadsky, Devananda Jayaram and Marco Walther. These guys are phenomenal.

Having said that, it is the QA team lead by Sakthivel Gopal that made the patch perfect for release. I must mention the excellent contribution from our QA engineers Krystyna Polomski, Sherry Zhou, Lark Fitzgerald, Chary Kanaparthi, Sandeep Jangity, Moumita Nandi and our Russian QA engineers Oleg Khokhlov & Alexey Butenko. With out this team it would be next to impossible to pin point the potential areas otherwise this patch would have broken.

Last but not least, I must mention the over all co-ordination by one of our Project Leads Chau Nguyen to bring these teams together, Mario Ramon to put together the patch processing and Ashvini Mangalvedhekar for taking care of release engineering efforts.

It was a great ride for the past four weeks with lot of ups and downs. But in the end, it was worth a ride when we put together the final results of these efforts (further details).

So, download and enjoy the patch. Note, we are not done yet. This team will continue to keep an eye on performance and memory issues. Above all, it is your, Creator users, inputs that are most valuable for us. So let them keep coming and you can send your comments to the e-mail address

Saturday Aug 05, 2006

Testing if Object List Data Provider is transactional?

A question came up in the forum about ObjectListDataProvider, asking if ObjectListDataProvider is transactional?.

According to the Java Doc of ObjectListDataProvider:

This class implements TransactionalDataProvider semantics, meaning that all updates to existing fields, as well as inserted and deleted rows, are cached until commitChanges() is called. Once that call is made, any RowKey you have retrieved from this instance is invalid, and must be reacquired. 

So, I decided to test this and created a test project which can be downloaded from here.

This project is an extension of the sample project I put in my previous blog So the work around steps explained in that blog must be followed.

In this project, I additionally added two components and modified the Table component as follows

  • A Button component to submit the page.
  • A MessageGroup component to display data from the ObjectListDataProvider.
  • The component type of the last name column has been changed to TextField.

When the button is clicked and the page is submitted, the button event listener does the following

  • Adds a new Name object to the ObjectListDataProvider
  • Commits the changes to the ObjectListDataProvider.
  • Retrieves the data from the ObjectListDataProvider and adds it to the context as information message, which will be displayed by the MessageGroup when the page gets rendered in the browser. 

The code in the button action handler looks like this.

   public String button1_action() {
        Name addedName = new Name("Gabriel", "Galvao");
        List myList = getSessionBean1().getNameListDataProvider().getList();
        for(int i=0; i< myList.size(); i++){
            info("Full Name: " + ((Name)myList.get(i)).getFirst() + "  " + ((Name)myList.get(i)).getLast());
        return null;

Following images show the results before and after the page is submitted. Before submitting the page, I changed the last name of Jeff Hudson to Jeff Jackson which is correctly displayed in the MessageGroup along with the added name Gabriel Galvao after the page is submitted. So, as we see through this sample ObjectListDataProvider is indeed transactional.

Sunday Jul 16, 2006

What is this Data Provider in Sun Java Studio Creator anyway?

Before defining Sun Java Studio Creator Data provider framework, we need to take a look at the definitions of Data Source and Data Binding.

Data Source can be defined as a piece of software that represents information stored in physical media such as Database.

Data Binding associates underlying data to the User Interface (UI) elements. The data holds the information and UI elements render the information in a user perceivable form. Data binding can be read only - information from the Data Source flows only to the UI elements. Alternatively, Data Binding can be read and write. In read/write mode, data binding facilitates information flow in both direction - from the Data Source to the UI element, as well as from the UI element  to the Data Source.

Creator Data Provider is a simplified Data Access architecture for Data Binding, offered with better maintainability in mind. Data provider is an abstraction over Data Source to provide a flexible and uniform data binding mechanism. Traditionally, Data Sources are linked to database connection using via technologies such as JDBC Rowset. However, in real world the source of the data can be in other forms, such Java Collection Objects (List, Map etc) or can be an array of POJOs (Plain Old Java Objects) as supported by technologies such as Hibernate and EJB3. Data Binding to these different sources of data is a hoard of different techniques. When these different Data Sources are wrapped by the Data Provider layer, a uniform binding mechanism can be realized. So effectively Data Provider is a bridge between Data Source and UI element to provide a single mechanism for data binding. UI elements access the data from these Data Sources through specific Data Provider API with out the need to understand the Data Source specific data access format.

Even though Creator directly supports the built in Data Provider Data Binding framework, there are other frameworks that can be potentially used for Data Binding in a Creator Application. To name a few

In my next blog, I'll try to give more details about the Data Provider framework itself.


« July 2016