Welcome to the world of rich client development on the NetBeans Platform.
Though the Internet boom pushed much programming effort to the server side, the demand for quality desktop software remains and is arguably increasing. Some of the reasons include
- Web pages, which are generally the interfaces for server-driven applications, often are insufficient for the needs of the end user.
- Not every application requires a constant Internet connection, and some applications need to function offline.
In this book, we will focus on using the NetBeans Platform as a framework for creating rich client applications that can be written once and then run on any operating system. The NetBeans Platform is the foundation of the NetBeans IDE, which helpshundreds of thousands of programmers develop applications of all sizes and complexity. As such, the platform is a very powerful and robust base that you can use for your own applications, whether they are commercial applications or in-house solutions. In addition, we will show you what you need to know to create modules to plug into the NetBeans IDE itself.
Rich Client Applications
What do we mean by the term rich client application? A rich client application is simply a piece of software where a good portion, if not all, of the application's features work on the user's local system. This is in contrast with a Web application, where the features are entirely dependent on code that is run from a remote server and (usually) accessed by the user through a Web browser. More or less, the term rich client is a fancy new moniker for "desktop application." For example, NetBeans IDE itself is a rich client application.
What Is NetBeans?
NetBeans is best known as a popular and award-winning integrated development environment (IDE) for developing Java applications. At the IDE's core is the NetBeans Platform, a modular and extensible application framework. The IDE is a well-orchestrated combination of the platform and a vast array of modules.
At a very early stage in the history of the IDE, the IDE's architecture was modularized to make development of the IDE more flexible. The IDE's modular
- It simplifies the creation of new features.
- It makes it easy for users to add and remove features.
- It makes it easy to update existing features in a user's installation without disrupting the rest of the application.
The modularity of the NetBeans Platform has made it very attractive to software developers around the world, who have created a large number of different applications on top of it. The NetBeans IDE is the most well-known of those, but the NetBeans Platform has been used as the basis for applications in many domains, from speech processing to geological mapping to stock trading.
There are many reasons to build NetBeans Platform-based applications, not the least of which is the fact that NetBeans-based applications are truly cross-platform. It is possible to develop cross-platform rich client applications in a variety of ways. For example, you can use Swing components and write all of the plumbing of a desktop application yourself. Using the NetBeans Platform, however, gives you powerful building blocks and back-end infrastructure that your applications need, so that you do not have to code those parts yourself. This can save you a significant amount of time. You add the Swing components to the NetBeans Platform that are needed for your application logic, and optionally use other libraries such as JGraph, JFreeChart, etc. So, overall, NetBeans has a great deal to offer when it comes to rapid development of robust and scalable applications. You can focus on the essentials that are specific to your application. Put another way, the NetBeans Platform isto Swing development what JavaServer Faces technology and Struts are to Web development.
The following are some of most important benefits of the NetBeans Platform:
- NetBeans is free and its code is freely reusable, whether you are developing commercial or noncommercial software.
- NetBeans is a mature and feature-rich application framework. The components of the NetBeans Platform have been developed to serve the needs of the NetBeans IDE, an application that is used by hundreds of thousands of demanding software engineers---yet they are optimized for the production ofany sort of desktop application, not just IDEs or IDE-like applications. With the NetBeans Platform, you have a great basis for a production-quality application.
- NetBeans is truly a "write once, run anywhere" platform. NetBeans is based on Swing, the pure-Java visual toolkit which is part of every desktop Java installation.
- NetBeans technology is standards-based and open source, which means that you will never be a victim of proprietary lock-in when developing on the platform.
- Plugins for NetBeans IDE have a massive potential audience. If you are looking to showcase your own technologies, creating a plugin module for NetBeans IDE and making it available through the NetBeans Plugin Portal (http://plugins.netbeans.org/PluginPortal) is a great way to reach a wide audience of developers.
- NetBeans has a vibrant developer community. The NetBeans Platform benefits from a strong community of developers who are eager to share their experiences. If you have questions about a particular problem, chances are that someone will have had the same issue and will be able to help you.
What Does the Platform Provide for Me as an Application Developer?
When you develop on the NetBeans Platform, you get a rich set of base features, extensive APIs with which you can create your own features, and a powerful set of tools to help you in development.
The following are some of the most important things that you get when you start programming on the NetBeans Platform:
- A Window System that greatly simplifies the manipulation of multiple components within a single frame.
- An Actions system that makes it easy to declaratively install and uninstall menu items, toolbar items, keyboard shortcuts, etc.
- The Auto Update mechanism, which provides a way to dynamically update a user's installation of your application.
- The whole range of NetBeans IDE features that simplify application development, such as code completion and an advanced GUI builder (formerly code-named Matisse), in which you can visually design your user interfaces by dragging, dropping, and rearranging components.In addition, you get special module-development features such as module templates and the ability to test modules on the fly by installing or reloading them into the currently running IDE.
- The architecture of your application is likely to become more robust when using the modular coding techniques encouraged by the NetBeans Platform.
Why This Book?
With the increasing popularity of the IDE and the recognition of the platform's convenience for creating the basics of any application, a book is sorely needed. Much information about the NetBeans Platform is already available, but there is no single up-to-date source that demonstrates how to make use of the whole platform. This book pulls together years' worth of accumulated wisdom, best practices, and practical information,and presents it all in one place.
This book will get you started quickly with module development and guide you through the most important APIs. Along the way, you will learn some of the programming practices that have made NetBeans such reliable and scalable software.
How to Use This Book
This book is divided into twenty-two chapters, two use cases, and three appendices.
- Chapter 1 gets you set up and shows the basic process of creating a module.
- Chapters 2 and 3 discuss the benefits of modularity and provide an overview of the modular structure of the NetBeans Platform.
- Chapters 4 and 5 explain the concepts behind the way NetBeans modules work together and show you the platform's mechanisms for making modular applications cohesive.
- Chapter 6 introduces you to the Filesystems API, which is the NetBeans Platform's base construct for handling both user data and system configuration data.
- Chapter 7 consolidates information from previous chapters and shows you how to create a simple Navigator component for the platform.
- Chapter 8 explains and demonstrates the NetBeans building blocks and features for creating mature multiwindow applications.
- Chapter 9 shows you the Nodes and Explorer APIs, which give you rich ways to present data structures to users.
- Chapter 10 highlights the Datasystems API, which gives you ways to easily programmatically manipulate files of a given type.
- Chapter 11 shows off the IDE's GUI Builder and how it simplifies developing user interfaces for NetBeans Platform applications.
- Chapter 12 builds upon the previous chapters and shows you how to provide multiple types of representations of a file's contents.
- Chpaters 13 and 14 show you ways to add editing features for a file type.
- Chapter 15 explains how to create a palette of objects and provides an example for enabling drag-and-drop of code snippets from the palette to a text editor.
- Chapters 16 and 17 show how to develop more editing features.
- Chapter 18 shows you how to add user-configurable options to your application.
- Chapter 19, using Wicket as an example, shows how you can create IDE support for a Web application framework.
- Chapter 20 shows how you can use Web services with a NetBeans Platform application.
- Chapter 21 demonstrates how to integrate help documentation into your ...