Developing GUI applications with Java Swing can be as challenging as it is fun. Much of the challenge in it lies in the fact that every change done to Swing code requires a recompilation. Most of today's applications warrant frequent changes to the UI, thereby making the life of a Swing programmer difficult. Would it not be great if writing UI code were as simple as writing XMLs? Such a wishful thought inspired Wolf Paulus to create SwiXML, an open-source software which combines the power and robustness of Java's Swing with XML's ease-of-use.

openInstaller leverages these advantages of SwiXML completely by employing a UI model built internally using SwiXML. Complex logic like defining layouts & positioning the components / widgets inside the panels is already built into openInstaller. This enables install application developers to just focus on other important aspects of an installer without worrying too much about the UI. openInstaller provides them with an interface that is based on the Java Desktop System Configuration Manager specification. Installer developers just use this interface to define their UI pages at a high-level.

For example, to create a UI page like the one shown below,

one would have to define an XML something like what follows..

<apt:template apt:name="appserver"  xmlns:apt="http://www.sun.com/jds/apoc/2004/template"
    xmlns: xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:oor=http://openoffice.org/2001/registry
>
  <apt:category apt:name="Application_Server" apt:label="ApplicationServer" >
    <apt:page apt:name="Configuration_Item" apt:label="Configuration Settings" >
      <apt:section apt:name="appserver" apt:label="Application Server" >
        <apt:property apt:name="AS_ADMIN_USER" apt:label="Administration User"
                    apt:dataPath="AppServer.AS_ADMIN_USER"
                    apt:type="xs:string" >
          <apt:visual>
            <apt:textField apt:columns="15" apt:toolTip="Application Server Administration User."/>
          </apt:visual>
        </apt:property>
        <apt:property apt:name="AS_ADMIN_PASSWORD" apt:label="Administration Password" apt:dataPath="AppServer.AS_ADMIN_PASSWORD" apt:type="xs:string" >
          <apt:visual>
            <apt:password apt:columns="15" apt:toolTip="Application Server Administration Password."/>
          </apt:visual>
        </apt:property>
        <apt:property apt:name="AS_CONFIRM_PASSWORD" apt:label="Confirm Password" apt:dataPath="AppServer.AS_CONFIRM_PASSWORD" apt:type="xs:string" >
          <apt:visual>
            <apt:password apt:columns="15" apt:toolTip="Confirm Administration Password."/>
          </apt:visual>
        </apt:property>
        <apt:property apt:name="AS_ADMIN_PORT" apt:label="Administration Port"
apt:dataPath="AppServer.AS_ADMIN_PORT" apt:type="xs:int" >
          <apt:visual>
            <apt:textField apt:columns="15" apt:toolTip="Application Server Administration Server port."/>
          </apt:visual>
        </apt:property>
        <apt:property apt:name="AS_HTTP_PORT" apt:label="HTTP Port"         apt:dataPath="AppServer.AS_HTTP_PORT" apt:type="xs:int" >
          <apt:visual>
            <apt:textField apt:columns="15" apt:toolTip="Application Server Http Server instance Port."/>
          </apt:visual>
        </apt:property>                
      </apt:section>
    </apt:page>
  </apt:category>
</apt:template>

An <apt:page> can contain multiple <apt:section> elements, each of which would visually correspond to a tab in a tabbed pane. Each <apt:property> element denotes a single configurable visual element on the page. The value of the apt:dataPath attribute represents the configuration variable name that can be used by the product configurator.

The above interface also supports user-input validation by means of built-in constraints as well as custom-validation scripts using Beanshell.

Efforts for developing NetBeans plugins that help in the creation of these UI-definition XMLs using a simple drag-and-drop mechanism are already underway, so openInstaller aficionados have a lot to look forward to in our future releases!

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by jayzspeak