Starting my blog again at Sun
After a brief stint at a startup, I joined back at Sun a month ago (the same day when Oracle agreed to buy Sun). Immediately after joining, I got busy in the project called Project Vector (recently blogged by Jonathan Schwartz) and didn't find time to blog. I'm excited to be in the JavaFX team and planning to write JavaFX tidbits in my blog.
Also, I'll continue to cover Java Server Faces, which I think is the best Web UI framework in the market. I talked to Ed Burns (JSF spec lead) today at Community ONE, and glad to know from him that JSR 314: JavaServer Faces 2.0 has been approved. I'm going to read the final draft of the JSF 2.0 and voice my opinion.
During my startup days, I had the great opportunity to learn Eclipse and developed several eclipse plugins. I have become a fan of Eclipse PDE (Plugin Development Environment). I was wondering why so many startups choose Eclipse as their choice of development tool. Now I get it. However, Eclipse Java EE Web development tool, which is huge and awkward., is no way near to Netbeans Java EE development tool in terms of elegance and ease of development.
I'm glad to be back and start blogging.
Posted at 04:18PM Jun 01, 2009 | Permanent link to this entry | Comments [8]
My last blog as a Sun Employee
Yes, it is true. This is my last blog as a Sun Microsystems Employee. After working at Sun for 8 years, I've decided to take an opportunity outside of Sun. I joined Sun after switching my career from a Scientist to a Software Engineer, with little commercial software development experience, but leaving with great satisfaction and lots of experience.
During my tenure as a Software Engineer at Sun, I learned, re-learned
and finally perfected the art of Commercial Software Development. It could not have
happened with out working side by side with great minds and contributing to the
Netbeans Visual Web development tool. The knowledge I gained was not just
limited to software development, but working with great QA, Doc,
Sustaining, Marketing and Release Engineers widened my horizon. Last but
not the least is the management, the best I ever worked with.
It was a tough decision to make, but in the end the temptation to take another
challenging opportunity won. The company I'm going to join is
Aptana. Aptana provided End-To-End Ajax
solution for Web developers using JavaScript, PHP, Ruby and Python. I will be
contributing mainly to the Aptana Studio
product line.
I may not continue the work on the Generic Web Page Designer for Netbeans, I proposed, but similar designer could show up in the Aptana Studio, you never know!.
Thanks for reading my blog at Sun Microsystems. I will continue my blog in my
own personal website
blog.winstonprakash.com in the future. Hope to see you there. Signing off from Sun Microsystems blog posting.
Posted at 10:29AM Sep 08, 2008 | Permanent link to this entry | Comments [10]
Generic Web Page Designer for Netbeans, anyone?
Visual JSF designer in Netbeans provides a way to design a web page visually. Unfortunately, Visual JSF web page designing is limited to JSP based JSF web pages created by Visual JSF framework. However, Netbeans users might want to design web pages created by various frameworks. Such pages include HTML, PHP, JSP, RHTML (Ruby on Rails), XML (facelet) etc. So I thought it is worth a time to explore the concept of a generic Web Page Designer, with out any restrictions of any particular framework. If you are interested, you can read my proposal for a generic Web Page Designer at http://wiki.netbeans.org/WebPageDesigner The proposal includes Web Page Designer Concept Overview and Web Page Designer Design Concepts.
Enlarge |
I also spent some time to create a prototype of a HTML designer. This designer will be the foundational designer for all other page designers (like PHP, JSP etc). Other page designers would be extended from this designer. This is obvious because HTML is a subset in all page types.
This HTML designer embeds Mozilla Layout Engine (XULRunner) for rendering the web pages. Therefore, unlike Visual JSF designer, user would get hi-fidelity rendering of the web pages. Details on embedding Mozilla in Netbeans is available here.
I've used
JAVA-XPCOM API to interact with underlying XULRunner to facilitate page
design. Unlike other Mozilla based Web Page authoring tools like
NVU, in this designer I'm not
exposing the Mozilla Composer, but directly manipulating the Mozilla DOM for visual
editing. The advantage is, I can execute JavaScript on demand using XurRunner
API. This helps me to render JavaScript based Web 2.0 AJAX widgets (Yahoo, jMaki, Google etc) in the designer. This unique feature I've not seen available in any of the
popular WYSIWYG HTML designers, I could lay my hand on, like DreamWeaver or Microsoft
expression. Another interesting feature I implemented, is the direct manipulations of CSS style of a HTML element selected in the designer using the Style Builder view docked in the bottom. Any modification of a CSS property in the Style Builder is immediately reflected in the designer.
Oh!, but one bigger question still bothers me - Are Netbeans users really interested in a Web Page Designer or am I just wasting my time?
Posted at 03:45PM Jul 11, 2008 | Permanent link to this entry | Comments [93]
Assemble your Widgets and create a Social Web Application using Zembly
Earlier, using tools like Netbeans and Visual Web, you could easily whip up an Ajax enabled Web Application. Now, Sun Microsystems introduces another interesting Web Development Environment, Zembly, a hosted environment designed to build Social Web Applications from the web itself. Nothing to download, every thing is on the web.
With Zembly, you can quickly and easily develop applications for Facebook, Meebo, OpenSocial, iPhone (to name a few) and other Social Web Applications. It makes it a snap to create embeddable widgets for google, flickr, yahoo (again to name a few) gadgets, that can be distributed to millions of users on the web.

Zembly allows you to author Social Web Applications and Widgets using advanced editors running directly in your browser. The editors provides support for code completion , full syntax highlighting for JavaScript, XML, CSS, HTML etc
Zembly is released as a private Beta and access is permitted for invitatees only. If you are interested to take it for a test drive, request an invitation using the following widget. Did I say, the following widget was created using Zembly!
Posted at 05:12PM Jun 07, 2008 | Permanent link to this entry | Comments [3]
VW tip: Automatically setting focus to next form element
Assume, you have three text field as shown below and user needs to type three number in each field.
After typing 3 numbers in the first field, to type in the next field, user first clicks on the second field to get the keyboard focus in that field and then types the numbers. However, it is possible to write a small JavaScript snippet to make the focus automatically jump to next field for the user. Known as form field AutoTab.
Using Netbeans Visual Web, first I created the following fields
Next step is to create the necessary JavaScript. Added the following to the <head> section in the JSP.
<script type="text/javascript">
function autotab(tabFrom, tabToId){
var length = tabFrom.value.length;
var maxLength = tabFrom.getAttribute("maxlength");
if (length == maxLength){
var tabTo = document.getElementById(tabToId);
tabTo.focus();
}
}
</script>
The script takes two parameters.
Next step is to call this JavaScript from a suitable event in the TextField. To do this, selected the TextField in the designer and from the property sheet scrolled down to JavaScript event list and entered the following code to the "onKeyUp" event.
autotab(this, 'form1:textField2_field')
In the above snippet, "this" refers to the field from which the focus should jump and "form1:textField2_field" is the id of the field to which the focus should jump to.
Note: The id of a JSF component specified in the JSP is not same as the id of the HTML dynamically generated in the browser. So it is important to use tools like firebug to find the correct id.
Deployed the application and typed three numbers. When I typed the third number, the focus automatically automatically jumped to the next field.
Posted at 10:55AM May 25, 2008 | Permanent link to this entry | Comments [0]
Visual Web FAQ revised for NB 6.1
The contents of the Netbeans Visual Web FAQ has been revised for the Netbeans 6.1 release.
http://wiki.netbeans.org/NetBeansVWPUserFAQ
This FAQ is not created by development team or doc team, but a collection from articles contributed by various developers and users from blogs, forum etc. Any interested contributer can add to this FAQ. Details at http://wiki.netbeans.org/HowToAddFAQEntries
The main topics covered in this FAQ are
Posted at 09:30AM May 17, 2008 | Permanent link to this entry | Comments [0]
VW user tip2: User Friendly Error Messages For Woodstock AutoValidation
One of the powerful features of Woodstock TextField components bundled with Netbeans Visual Web is, client side auto validation. However, it is kind of tricky, if you want to change the default messages it displays. David Heffelfinger sent me this neat tip on how to achieve this.
For other user tips, visit Netbeans Visualweb user tips and code snippets
A while back I was experimenting with Woodstock. One of the things I
liked about it was the "ajaxified" auto validation of text fields and
text areas. Unfortunately when I tried it out I was disappointed that
neither <h:message> nor <webuijsf:message> would "catch"
validation errors when auto validation "kicked in". Reading about it I
noticed that we can use an alert component to display validation
errors, via the "notify" attribute.
Unfortunately by default both the "Header" and the "body" of the alert display the same message, not exactly user friendly.
After some research I found a solution, we need to override the "detail" and "summary" error messages via a resource bundle.
I blogged about this at http://www.jroller.com/heffel/entry/user_friendly_error_messages_for
Posted at 09:39AM Apr 26, 2008 | Permanent link to this entry | Comments [4]
VW user tip1: A workaround for validation messages translation issues
This useful tip was sent to me by Jorge Campins. In this tip Jorge gives a solution to fix the problem related to intermixing of translated messages (Spanish, applies to other languages also) and English, which he jokingly calls as "Spanglish". Especially, this is a case with standard components and its Converters and Validators.
For other user tips, visit Netbeans Visualweb user tips and code snippets
We wouldn’t know about other languages, but if you are developing with NetBeans 6 there are some translation issues you should solve before releasing your applications to Spanish speaking end-users. Here we specifically address those issues at JSF core components such as Converters and Validators. These issues include not translated, partially translated and wrongfully translated messages; also visual component ids appearing as part of the message, which is very helpful for the programmer but very confusing for the end-user. Fortunately, we were able to deal with all these in an easy way, based on the approach suggested by Dr. Winston Prakash. All we had to do was to build a translation routine and execute it at the prerender event. It was particularly easy for us because we already had all our pages calling some helper methods at prerender, so we didn’t had to modify every page to call the new translator routine. The following is an example of a translation routine based on the one we built:
public static void fixFacesMessages() {
FacesContext facesContext = FacesContext.getCurrentInstance();
UIViewRoot uivr = facesContext.getViewRoot();
Iterator messageClientIds = facesContext.getClientIdsWithMessages();
while (messageClientIds.hasNext()) {
String clientId = messageClientIds.next();
if (clientId != null) {
UIComponent uic = uivr == null ? null : uivr.findComponent(clientId);
Iterator messages = facesContext.getMessages(clientId);
while (messages.hasNext()) {
FacesMessage facesMessage = messages.next();
// Get the messages
String detail = facesMessage.getDetail();
String summary = facesMessage.getSummary();
// translate
String detalle = getMensaje(uic, detail);
String resumen = getMensaje(uic, summary);
// Set your own message
facesMessage.setDetail(detalle);
facesMessage.setSummary(resumen);
}
}
}
}
private static String getMensaje(UIComponent uic, String message) {
FacesContext facesContext = FacesContext.getCurrentInstance();
String mensaje = StringUtils.trimToEmpty(message);
/**/
if (uic != null) {
mensaje = trimPrefix(mensaje, uic.getClientId(facesContext));
mensaje = trimPrefix(mensaje, uic.getId());
}
mensaje = trimPrefix(mensaje, ": ");
mensaje = trimPrefix(mensaje, "Validation Error: ");
mensaje = trimPrefix(mensaje, "Error de Validación: ");
/**/
mensaje = trimSuffix(mensaje, "Example:");
mensaje = trimSuffix(mensaje, "Ejemplo:");
/**/
mensaje = mensaje.replace(
"is not a number",
"debe ser un número");
mensaje = mensaje.replace(
"must be a number consisting of one or more digits",
"debe ser un número");
mensaje = mensaje.replace(
"must be a number between",
"debe ser un número entre");
mensaje = mensaje.replace(
"Specified attribute is not between the expected values of",
"El valor debe estar comprendido entre");
mensaje = mensaje.replace(
" and ",
" y ");
/*
* We always use the maxLength property of the TextField component to avoid
* length errors on string fields, so only TextArea components need a Length
* validator. Therefore, only if the component is a TextArea we need to
* change the subject of the sentence.
*/
String sujeto = uic instanceof TextArea
? "La longitud del valor"
: "El valor";
mensaje = mensaje.replace(
"Valor es más grande de valor de máximo permitido:",
sujeto + " debe ser menor o igual que");
mensaje = mensaje.replace(
"Valor is menos de valor de mínimo permitido:",
sujeto + " debe ser mayor o igual que");
/**/
return mensaje;
}
public static String trimPrefix(String message, String prefix) {
String mensaje = StringUtils.trimToEmpty(message);
int i = mensaje.indexOf(prefix);
if (i >= 0) {
mensaje = mensaje.substring(i + prefix.length());
}
return mensaje;
}
public static String trimSuffix(String message, String suffix) {
String mensaje = StringUtils.trimToEmpty(message);
int i = mensaje.indexOf(suffix);
if (i > 0) {
mensaje = mensaje.substring(0, i);
}
return mensaje;
}
Posted at 08:07AM Apr 19, 2008 | Permanent link to this entry | Comments [4]
Netbeans Visualweb user tips and code snippets
I'm planning to post useful programming tidbits provided by Netbeans Visual Web users in my blog. If you have any interesting tips, code snippets or ideas for enhancements and want to share them with others and get their comments, send me an e-mail at wjprakashATnetbeansDOTorg. I''l post them in my blog.
Posted at 07:55PM Apr 13, 2008 | Permanent link to this entry | Comments [2]
Netbeans 6.1 release candidate 1 available for download
Netbeans.org announces the availability of Netbeans 6.1 release candidate 1, which can be downloaded from here.
Some of the highlights of this release, as listed here, are
The main highlights for VisualWeb are
Posted at 12:19PM Apr 11, 2008 | Permanent link to this entry | Comments [0]
Updated plugin - Visual Web Woodstock Component Theme Builder
I have updated Visual Web Woodstock Component Theme Builder to work with Netbeans releases. The updated plugins available are for
For details on how to install and use the plugin read my previous blog
Creating Netbeans 6.0 Visual Web Components Custom Theme Using Theme Builder
As I mentioned in that blog, you can directly add the jar created using Theme Builder project to any Visual Web Application. Interestingly, if you change CSS or messages in the Theme Builder project, just build the project to create the jar and refresh the page in the Web application that uses that jar. The changes should be reflected immediately in that page.
Note: I noticed that the project build might fail if there are spaces in the project path. Try to create the project with out spaces in the path.
Posted at 05:00PM Apr 04, 2008 | Permanent link to this entry | Comments [22]
How to fix the Netbeans 6.1 beta errors while opening Visual Web project
There are couple of complaints stating that Netbeans 6.0 Visual project could not be successfully imported in to Netbeans 6.1 beta release. It turned out that Netbeans 6.1 includes new release of Project Woodstock components and its Theme. While opening the Netbeans 6.0 project, it somehow remembers the settings from the old IDE and while deploying the project, following runtime error occurs.
WEBUITHEME001: No theme name or version specified and no default theme resource available
When Netbeans 6.0.1 project, is created, <project-dir>/nbproject/private/private.properties contains the absolute path information about the Woodstock Components and its theme jars which points to the Netbeans 6.0.1 installation location.
When the project is opened using Netbeans 6.1 beta, the absolute path information in the private.properties should be adjusted to the new Netbeans 6.0.1 installation location. Some how this does not happens. An issue (#129316) has been filed against this bug.
One of the solution is to delete the <project-dir>/nbproject/private directory and allow it to be recreated when it the project is opened using Netbeans 6.1 beta. However, this does not seem to solve the problem. Building the project throws the following error.
$projdir\nbproject\build-impl.xml:501: Warning: Could not find file
$projdir\${libs.woodstock-components.classpath.libfile.7} to copy.
One of Visual Web engineers, Po-ting Wu, went through the scenario and found out the following work around.
${libs.woodstock-components.classpath.libfile.6}
${libs.woodstock-components.classpath.libfile.7}
For more details go to the Netbeans issue #129499
Posted at 09:35AM Mar 08, 2008 | Permanent link to this entry | Comments [14]
Understanding Netbeans Visual JSF Web Application
Advanced users might have already figured out how Visual JSF Web Application works under the hood. I have written this article mainly for users new to Visual Web. It is important understand how Visual JSF applications works both at designtime and runtime to write well behaving and scalable application. Read more at
Understanding Netbeans Visual JSF Web Application
Posted at 06:47AM Feb 19, 2008 | Permanent link to this entry | Comments [8]
Creating your own Visual Web Page Layout Plugin
In two of my earlier blogs, I explained
Now I've written another article that provides step by step tutorial on how to create your own Page Layout plugin to make your own Page Layout appear in the New Visual Web Page Wizard. Read the complete article at
How to create your own Visual Web Page Layout Plugin
Posted at 02:03PM Jan 27, 2008 | Permanent link to this entry | Comments [6]
No more mandatory component binding in Visual Web
Netbeans Visual Web Designer (NB 6.0 and before) mandates that each JSF component tag in the JSP must have a binding attribute which is bound to a property in the backing page bean via Expression Language binding. This ends up generation of getter and setters for each of the component in the page bean. Even though, this is convenient to set properties directly to the JSF component used in the page, this is very annoying because 95% of the components declared in the page Java source are not used and unnecessarily bloats the backing page bean.
For Netbeans 6.1 release this is going to change. Following changes have been implemented already and available in the Netbeans 6.1 nightly builds.
Here are some test results after the implementation
Posted at 09:50PM Jan 14, 2008 | Permanent link to this entry | Comments [12]