Monday May 07, 2007

Netbeans 6.0 Preview is available for download

Netbeans 6.0 Preview is available for download. Visit Milestone News and Note worthy Page for details on new features in this release.

Some of the feature highlights in this release are

  • New and improved Installer
  • Editor Improvements. (Even though NB 6.0 is just a preview I'm using it for my day to day work mainly because of the fantastic Editor improvements)
  •  JRuby and Ruby on Rails Support
  • Swing UI development improvements
    • Easier Database binding using Bean Binding Technology (JSR 295)
    • Support for Swing Application Framework (JSR 296)
  • Profiler integration in to the IDE
  • Improved Web and Java EE support
    • Built-in visual design for web applications.
    • Visual page flow editing support.
    • Enhanced JavaScript support.
    • Improved web services support.
    • Support for Ajax-enabled JavaServer Faces components (Woodstock Components integration)
  • Integrated Mobility pack
  • Improved support for SOA
  • Integrated UML support
  • Improved Netbeans Rich Client Support API
    •  Visual Library API
    • NetBeans Preferences API
    • Lexer API
    • Logger API
    • All API support Java 5 Generics
  • Java Web Start Support.

Monday Apr 30, 2007

Netbeans tip: Creating an AJAX enabled custom JSF component - Part 2

Finally I got some time to complete  part 2 of the Creating an AJAX enabled custom JSF component.

Part1, mainly covers how to write a simple Ajax enabled JSF component (ImageSlider). In this part, I have given the walk through on how to create the Image Slider Component. The Image Slider component would take one or more images and displays each image with a previous and a next link. Clicking on the next or previous link displays the next or previous image. Since the component has Ajax capability, the Image Slider component displays the next or previous image by fetching them with out submitting the form using Ajax transaction.

In Part2, the walk through explains how to add design time to the ImageSlider component and create a complib archive. Also the walk through explains how the complib is imported in to the Netbeans Visual Web Pack application to add the component to a visual web page by drag and drop.

Friday Apr 27, 2007

Netbeans Tip: Add, Update and delete Database data using JPA and Table Component

In my previous blog Binding Database Table to a Table Component Using JPA, I wrote about the ability to directly bind Netbeans Visual Web Pack Table Component to an array of Entity Beans and fill that array with data from a database using JPA (Java Persistence Architecture)

I have written another walk through that explains how to Add, Update, and Delete rows in a Database Table, Using JPA and Netbeans Visual Web Pack Table Component.

This walk through tutorial is available at this link - Add, Update and delete Database data using JPA and Table Component

Thursday Apr 26, 2007

Netbeans VWP Tip: Binding Database Table to a VWP Table Component Using JPA

One of the NB 6.0 task items for me is to implement the ability to directly bind Netbeans Visual Web Pack Table Component to an array of Objects or List of Objects (POJOs). The idea behind this task is to easily bind the Table Component to a database table using JPA with out any DataProvider support. Since using JPA the database table data can be obtained as List or array of Entity Beans (POJOs), now you can directly bind that array to the table component with out the intermediate step of ObjectListDataProvider or ObjectArrayDataProvider.

The walk through tutorial is available at this link Binding Database Table to a Table Component Using JPA

Tuesday Mar 13, 2007

Netbeans tip: Creating an AJAX enabled custom JSF component - Part 1

Netbeans 5.5 Web Application Project provides lots of necessary plumbing to create a custom JSF component. I will be writing few articles explaining how to write an AJAX enabled JSF component. These articles will be concise version of more elaborate tutorial I am writing with Gail and Paul Anderson for JavaOne 2007 Hands-on Labs.

Part1, mainly covers how to write a simple Ajax enabled JSF component (ImageSlider). In this part, I have given the walk through on how to create the Image Slider Component. The Image Slider component would take one or more images and displays each image with a previous and a next link. Clicking on the next or previous link displays the next or previous image. Since the component has Ajax capability, the Image Slider component displays the next or previous image by fetching them with out submitting the form using Ajax transaction.

Thursday Feb 15, 2007

Creator/Vsual Web Pack sources are available in Netbeans repository

Yes! finally it is there. It was a tremendous effort. Around 14,000 files have been processed for package name change and other alignment before moved from closed source repository to Netbeans repository. The credit goes to major roles played by Chau Nguyen, Jim Bisso and Sanjay Dhamankar.

As my manager puts it, when we were thinking about Christmas Tree, cakes and mistletoe, these guys were thinking about packages, imports and classes. And "dirty words" as pointed out by Jim Bisso himself in the meeting, referring to code sanitizing for public release of the source base.

You can download and build the product using the following instruction

http://wiki.netbeans.org/wiki/view/VisualWebBuildInstructions

Be warned though, the source base is in a high flux condition and several of the functionalities are working. It is expected a month or so before the product will be in a working condition.

You can also find about the schedule, task list and milestones details here.

http://wiki.netbeans.org/wiki/view/VisualWeb

Monday Feb 12, 2007

Sudoku Solver - A Netbeans 5.5 module

My 9 year old son is hooked on to Sudoku. To entertain him, I wrote a small swing application (sudoku-src.zip), which he  uses to create new Sudoku puzzles and solve them on his computer. While discussing about it, Sandip "module" Chitale (he writes modules almost every day), casually mentioned, why not convert it in to a Netbeans module. Thought that was a good idea . While writing some serious code using Netbeans, why not take a break and try to solve a Sudoku puzzle or two. Down load the NBM (sudoku-nb55.nbm) or download the Netbeans Module sources (sudoku-nb55-src.zip) and enjoy.

Create a new Sudoku puzzle and start solving, by double clicking on the cell and entering valid value between 1-9. Based on Sudoku rules, if the value is invalid in that cell, then it would be displayed in red. If the value in the cell is valid, then it would be displayed in green. Finally, you can click on the solve button to let the program solve it for you.

Creating new puzzle in this module is nothing fancy. I have included templates of completed puzzles. New puzzles are created by randomly masking some of the cell values. Naturally, that gives any number of randomly solvable puzzles.

Monday Jan 29, 2007

Netbeans VWP tip: A simple idea to load test your web application response

There are hundreds of sophisticated Web Testing tools available in the market, which you could use for Load testing your web site. Nevertheless, you might want to write some test code to quickly test the response time of your web application during its development time.

Here is a simple tip on how to do this. If you want to test your web application response time during various loads, first you need to simulate the load by simultaneously sending required number of requests for your web application pages to the web server. You could write your own concurrent programming to achieve this. But the easiest and simplest is to use the classes in java.util.concurrent package.

Read here for more details A simple idea to load test your web application response

Friday Jan 12, 2007

Plotting Jonathan's pink dots using Netbeans 5.5 Visual Web Pack

You must be impressed by the Jonathan's pink dots showing the worldwide Solaris growth. It would be equally impressive if we could create the pink dots Google Map mashup using Netbeans - Sun's another successful product. Yes, it is very simple  to create such mashup using Netbeans 5.5 Visual Web Pack AJAX components with as few as 10-20 lines of pure Java code. Also, it is possible to make the mashup much more interactive, like providing a dropdown list to select the dots only in particular country or show the dots only above or below certain threshold value.

Here is how you can do it.

Assume you have some data  like city, country and some reletaded data to plot. Ex:

"Oxford, United Kingdom", 105663 
"Louisville, Kentucky, United States", 85108

In order to plot this using the VWP Google map viewer component, you must first convert the city, country  information to corresponding Latitude and Longitude. This can be easily done by writing a simple web service using Netbeans. Now the converted data would look like

"Oxford, United Kingdom", 105663, 51.75, -1.2599
"Louisville; Kentucky; United States", 85108, 38.24, -85.7699

Once we include the Latitude & Longitude of the cities in the data, it is very easy to plot the data. After following the tutorial Using the AJAX Map Viewer Component , the additional code you need is to place the markers corresponding to different cities. Following are the additional few lines of code I added to the "prerender" method of the page bean.

        int maxCount = 2000;
        markers = new MapMarker[maxCount];
        ServletContext context = (ServletContext) getExternalContext().getContext();
        String realPath = context.getRealPath("/resources/sample_data.txt");
        try{
            BufferedReader in = new BufferedReader(new FileReader(realPath));
            String str;
            while ((str = in.readLine()) != null) {
                String[] data = str.split(",");
                markers[count] =  new MapMarker();
                markers[count].setLatitude(Double.valueOf(data[2]).doubleValue());
                markers[count].setLongitude(Double.valueOf(data[3]).doubleValue());
                markers[count].setMarkup(data[1]);
                if(count++ > maxCount) break;
            }
        }catch (Exception exc) {
            log(exc.getLocalizedMessage();
        }
        

It is possible to show the intensity at a point by using different icons (like various shades and size of dots) for the marker. I used just the default icon for the markers and some dummy data for the locations (I don't have the actual pink dots data). The plots looked like the pictures below

 

 

Friday Jan 05, 2007

Netbeans 5.5 Tip: Create a Webservice client to find Latitude & Longitude of your city

Using Netbeans 5.5 IDE, it is as easy as 1..2..3 to develop a Webservice client to find the Latitude and Longitude of your city. The webservice I used here is from Microsoft Terra Server called TerraService.

Here are the  steps

  • Using Netbeans 5.5 IDE, create a General Java Application project called LocationService
  • Right click on the project select New -> New Webservice Client
  • In the New Webservice Client dialog, select WSDL URL and provide http://terraserver.microsoft.com/TerraService2.asmx?WSDL
  • Also specify "locationsvc" as package name

The TerraService Webservice client will be added to the project as shown below.

Drag and drop the method ConvertPlaceToLonLatPt from the webservice client on to the main() method of Main.java. Necessary code will be added. Modify as shown below to display the location (blue lines are modified by me)

        try { // Call Web Service Operation
            locationsvc.TerraService service = new locationsvc.TerraService();
            locationsvc.TerraServiceSoap port = service.getTerraServiceSoap();
            // TODO initialize WS operation arguments here
            locationsvc.Place place = new locationsvc.Place();
            place.setCity("Menlo Park");
            place.setState("California");
            place.setCountry("United States");
            // TODO process result here
            locationsvc.LonLatPt result = port.convertPlaceToLonLatPt(place);
            System.out.println("City: " + place.getCity() + ", " + place.getState() + ", " + place.getCountry()); 
            System.out.println("Latitude = " + result.getLat() + "  Longitude: " + result.getLon());
        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }

Compile and run the application. Bingo!, the result is the Latitude and Longitude of your city.

run:
City: Menlo Park, California, United States
Latitude = 37.45000076293945  Longitude: -122.16999816894531
BUILD SUCCESSFUL (total time: 3 second

Monday Dec 18, 2006

Netbeans VWP Tip: How to create Muli-Row selectable Table component

This tip shows how to create a multiple row selection capable Table component. A column of Checkbox components is used to select multiple rows in the Table Component. Dynamic row highlighting is set to indicate the selected state of the rows. This tip is very similar to the tip I wrote for Single Selection Table Component.

You can download the working project here .

Steps

  • Create a Java EE 5 project called MultipleSelectionTable.
  • Add a table component from the Palette on to the Webform designer.
  • From the Runtime tab expand the Databases node and drag and drop a table on to the Table Component.
    • Right Click on the Table Component and Select Table Layout.
    • In the "Columns" tab click on the "New" button to add a new column.
    • Using "Up" button move the newly added column to the top of the list.
    • Replace the header text as "Select".
    • Select Checkbox for component type and remove the text in Value Expression Field.
  • Dismiss the Table Layout after clicking OK and refresh the designer using the refresh button in the designer's toolbar
  • Go to JSP page and add the following Java Script to the head section
<webuijsf:head binding="#{Page1.head1}" id="head1">
     <script>
       function initAllRows() {
            var table = document.getElementById("form1:table1");
            table.initAllRows();
         }
     </script>
     <webuijsf:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
</webuijsf:head>

You need to write some logic to hold information about the selected rows. Add the following code to the Sessionbean1.java

    private TableSelectPhaseListener tablePhaseListener = new TableSelectPhaseListener();
    
    public void setSelected(Object object) {
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        if (rowKey != null) {
            tablePhaseListener.setSelected(rowKey, object);
        }
    }
    
    public Object getSelected(){
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        return tablePhaseListener.getSelected(rowKey);
        
    }
    
    public Object getSelectedValue() {
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        return (rowKey != null) ? rowKey.getRowId() : null;
        
    }
    
    public boolean getSelectedState() {
        RowKey rowKey = (RowKey)getValue("#{currentRow.tableRow}");
        return tablePhaseListener.isSelected(rowKey);
    }

Press Alt-Shift-F to fix the imports.

Now do the following to tell the Table Component to keep track of selection.

  • Select the CheckBox (from outline Table -> TableGroup-> TableCoulmn -> CheckBox) and set the properties
    selected="#{Sessionbean1.selected}"
    selectedValue="#{Sessionbean1.selectedValue}"
  • Select the corresponding table column and set the properties
    onClick="setTimeout('initAllRows()', 0)"
    selectId="checkbox1"
  • Select the TableRowGroup and set the property
    selected=#{Sessionbean1.selectedState}

Let us add a button, which on click would display the line number of the rows being selected.

  • Add a Button 
  • Add a Message Group to display the message after clicking the button.
  • Double click on the button and add the following code.
 
  public String button1_action() {
        int selectedRows = getTableRowGroup1().getSelectedRowsCount();
        RowKey[] selectedRowKeys = getTableRowGroup1().getSelectedRowKeys();
        for(int i=0; i< selectedRowKeys.length; i++){
            int rowId = Integer.parseInt(selectedRowKeys[i].getRowId()) + 1;
            info("Row " + rowId  + " is selected");
        }
        return null;
    }    

Deploy the application and in the displayed table component select one or two Checkboxess. The selected rows will be highlighted at  shown below. Click on the button and you should see message (at right) about line number of the rows being selected as below.

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 http://www.netbeans.org/products/visualweb/

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 Nov 05, 2006

Back from Prague after visiting Netbeans

Last week I was in Prague meeting with Netbeans Architects, Lead Engineers and Evangelists to discuss about next release of Visual Web Pack for Netbeans 6.

Prague Visit Nov 2006

Lots of hectic but very fruitful and productive meetings. I get to visit several local restaurant along with fellow Engineers sampling local delicacies.

Also, attended the Netbeans 5.5 release party at the club called Blues Rock Club. Enjoyed the party (lots of food, free flow of Beer, music and all the dancing) except for the smoking inside the club which I haven't experienced in the California clubs.

Sunday Oct 29, 2006

Visual Web Pack Technology Preview released

Much anticipated Netbeans 5.5 with full featured support for Java EE 5 has been released along with Visual Web Pack as Technology preview. You can down Netbeans 5.5 and try Visual web back Technology Preview and send us your comments and suggestions.

The full list of NetBeans IDE Add-ons you can down are

Mobility Pack
Build powerful mobile applications with visual tools.
Visual Web Pack
Drag and drop components to visually construct web applications.
Enterprise Pack (XML Schema, WSDL, BPEL, Secure Web services)
Drag and drop components for Modeling and SOA application development
Profiler
Find bottlenecks and memory leaks in your applications.
C/C++ Pack
Create C/C++ applications from within the NetBeans IDE.

Also interesting to note is the new look and feel of netbeans.org. I like the new look and feel, much polished and better navigation.

Search

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