Chapter 1. Introduction

This chapter provides an introduction to software development with IT Mill Toolkit, including installation of the Toolkit, the Eclipse development environment, and any other necessary or useful utilities. We look into the design philosophy behind the Toolkit and at the changes in IT Mill Toolkit Release 5.

1.1. Overview

IT Mill Toolkit is essentially a Java library that is designed to make creation and maintenance of high quality web-based user interfaces easy. The key idea is that the Toolkit allows you to forget the web and lets you program user interfaces much like you would program any Java desktop application with conventional toolkits such as AWT, Swing, or SWT. But easier.

Figure 1.1. IT Mill Toolkit General Architecture

IT Mill Toolkit General Architecture

While traditional web programming is a fun way to spend your time learning new web technologies and debugging them, you probably want to be productive and concentrate on the application logic. The library takes care of user interface rendering in the browser and AJAX communications between the browser and the server. With Toolkit's approach, you do not need to learn and debug browser technologies, such as HTML or JavaScript.

IT Mill Toolkit makes the best use of AJAX (Asynchronous JavaScript and XML) techniques that enable the creation of web applications as responsive and interactive as desktop applications. While conventional JavaScript-enabled HTML pages can receive new content only with page updates, AJAX-enabled pages can ask the server for updated content using the asynchronous XMLHttpRequest JavaScript request. User interaction with UI components is communicated to the server. The IT Mill Toolkit framework interprets the events and communicates them to your application logic. Any user interface feedback is rendered in the response message to the AJAX request.

Hidden well under the hood, IT Mill Toolkit uses GWT, the Google Web Toolkit, for rendering the user interface in the browser. GWT programs are written in Java, but compiled into JavaScript, thus freeing the developer from learning JavaScript and other browser technologies. GWT is ideal for implementing advanced user interface components (or widgets in GWT terminology) and interaction logic in the browser, while IT Mill Toolkit handles the actual application logic in the server. IT Mill Toolkit is designed to be extensible, and you can indeed use any 3rd-party GWT components easily, in addition to the component repertoire offered in IT Mill Toolkit. The use of GWT also means that all the code you need to write is pure Java.

Because HTML and other browser technologies are invisible to the application logic, you can think of the web browser as only a thin client platform. A thin client displays the user interface and communicates user events to the server at a low level. The control logic of the user interface runs on a Java-based web server, together with your business logic. By contrast, a normal client-server architecture with a dedicated client application would include a lot of application specific communications between the client and the server. Essentially removing the user interface tier from the application architecture makes our approach a very effective one.

The Toolkit library defines a clear separation between user interface presentation and logic and allows you to develop them separately. Our approach to this is themes, which dictate the visual appearance of applications. Themes control the appearance of the user interfaces using CSS and (optional) HTML page templates. As the Toolkit provides excellent default themes, you do not usually need to make much customization, but you can if you need to. For more about themes, see Chapter 6, Themes.

We hope that the description above is enough about architecture for now. You can read more about it later in Chapter 2, Architecture. Let us next look at some of the core ideas behind IT Mill Toolkit.

1.1.1. Goals and Philosophy

Simply put, as its name implies, the Toolkit's ambition is to be the best possible tool when it comes to creating web user interfaces for business applications. It is easy to adopt, as it is designed to support both entry-level and advanced programmers, as well as usability experts and graphical designers.

When designing the Toolkit, we have followed the philosophy inscribed in the following rules.

Right tool for the right purpose

Because our goals are high, the focus must be clear. This toolkit is designed for creating web applications. It is not designed for creating websites or advertisements demos. You should use JSP/JSF and Flash for such purposes.

Simplicity and maintainability

We have chosen to emphasize robustness, simplicity, and maintainability over the possibility to "draw" user interfaces with visual design tools. For serious business applications, you have to program the user interfaces anyway and the visual design tools just get in the way.

XML is not designed for programming

The Web is inherently document centered and very much bound to the declarative presentation of user interfaces. Toolkit's framework frees the programmer from these limitations. It is far more natural to create user interfaces by programming them than by defining them in the various XML dialects.

Tools should not limit your work

There should not be any limits on what you can do with the framework: if for some reason the user interface components do not support what you need to achieve, it must be easy to add new ones to your application. When you need to create new components, the role of the framework is critical: it makes it easy to create re-usable components that are easy to maintain.

1.1.2. Background

The library was not written overnight. After working with web user interfaces since the beginning of the Web, a group of developers got together in 2000 to form IT Mill. The team had a desire to develop a new programming paradigm that would support the creation of real user interfaces for real applications using a real programming language.

The library was originally called Millstone Library. The first version was used in a large production application that IT Mill designed and implemented for an international pharmaceutical company. IT Mill made the application already in the year 2001 and it is still in use. Since then, the company has produced dozens of large business applications with the library and it has proven its ability to solve hard problems easily.

The next generation of the library, IT Mill Toolkit Release 4, was released in 2006. It introduced an entirely new AJAX-based presentation engine. This allowed the development of AJAX applications without the need to worry about communications between the client and the server.

The latest generation, IT Mill Toolkit Release 5, takes a significant step further into AJAX. The client-side rendering of the user interface has been rewritten using GWT, the Google Web Toolkit. This allows the use of Java for developing all aspects of the framework. It also allows easy integration of existing GWT components with IT Mill Toolkit.

IT Mill Toolkit Release 5 was released under the Apache open source license and the development of the toolkit .

1.1.3. Changes in IT Mill Toolkit Release 5

Release 5 of IT Mill Toolkit introduces a number of changes in the API, the client-side customization layer, and themes. See the Release Notes in the installation package of IT Mill Toolkit for a more detailed listing of changes.

We have decided to introduce some important API improvements in Release 5. Many of the user interface components in Release 4 and before were available as styles for a basic set of components. For example, the Select class allowed selection of items from a list. Normally, it would show as a dropdown list, but setting setStyle("optiongroup") would change it to a radio button group. In Release 5, we have obsoleted the setStyle() method and provided distinct classes for such variations. For example, we now have OptionGroup that inherits the AbstractSelect component. In a similar fashion, the Button component had a switchMode attribute, set with setSwitchMode(), that would turn the button into a check box. Release 5 introduces a separate CheckBox component. The setStyle() method actually had a dual function, as it was also used to set the HTML element class attribute for the components to allow styling in CSS. This functionality has been changed to addStyle() and removeStyle() methods.

The OrderedLayout is replaced (since the first stable version 5.3.0) with specific VerticalLayout and HorizontalLayout classes.

Release 5 introduces expansion ratio for applicable layout components. It allows you to one or more components as expanding and set their relative expansion sizes. The components will stretch to expand the layout to maximum size inside its container. The release also introduces a number of new user interface components: SplitPanel, Slider, Notification to display a popup notification window, and RichTextEditor to allow editing formatted text.

The Client-Side Engine of IT Mill Toolkit has been entirely rewritten with Google Web Toolkit. This does not, by itself, cause any changes in the API of IT Mill Toolkit, because GWT is a browser technology that is well hidden behind the IT Mill Toolkit API. Transition from JavaScript to GWT makes the development and integration of custom components and customization of existing components much easier than before. It does, however, require reimplementation of any existing custom client-side code with GWT. See Chapter 2, Architecture for more information on the impact of GWT on the architecture and Chapter 8, Developing Custom Components for details regarding creation or integration of custom client-side components with GWT.

IT Mill Toolkit Release 5 introduces an entirely new architecture for themes. Themes control the appearance of web applications with CSS and can include images, HTML templates for custom layouts, and other related resources. The old themeing architecture in Release 4 required use of some JavaScript even in the simplest themes, and definition of a theme XML descriptor. In Release 5, you simply include the CSS file for the theme and any necessary graphics and HTML templates for custom layouts. For more details on the revised theme architecture, see Chapter 6, Themes. Old CSS files are not compatible with Release 5, as the HTML class style names of components have changed. As GWT implements many components with somewhat different HTML elements than what IT Mill Toolkit Release 4 used, styles may need to be updated also in that respect.