NB. For an alternative to XUL see SwingML.
Goal 1. The Layout of an application's GUI can be definied fully in XUL, ie. using XUL files only. No need for any Java coding for defining the layout of the windows and all their widgets.
Goal 2. No XBL. The binding of actions to the control widgets is done via the
'id' attribute of the XUL widgets. The actions themselves are coded in Java and they are the only
Java coding to be done for an application to build. A control widget is a widget which can have an
'oncommand' attribute. For control widgets the 'id' attribute is mandatory, for non-control
widgets it is optional.
NB. Goal 1 and 2 ensure one can build a fully functional GUI including the bindings with the application logic, without having to subclass any of XUL4J's widget classes. Thus no knowledge of XUL4J is required to build a GUI application.
Goal 3. XUL4J encapsulates all Java Swing classes. When a developer whishes to manipulate
GUI components in his Java code he can do so by manipulating XUL4J classes only.
No direct access to any Java Swing class is required, ie. only XUL4J classes will have to be imported,
not a single Java Swing class.
NB. Goal 1 ensures the need for accessing GUI components in the Java code directly will be rare.
Goal 4. XUL4J requires only a XML parser library of free choice. No need for other libraries. This makes using the XUL4J jar easy to use an light weigthed. When for example using Xerces from Apache.org as an XML library, one will have to include in the class path only the following jars: xerces.jar;xul4j.jar.
For for more on these design goals see the XUL4J package documentation.
XUL4J should support this improvements.
Example, reusing a menubar and a button definition.
<!-- OK button. --> <xul version="1.0"> <button label="OK" id="90001"> </xul>File 'main.xul':
<!-- Applications main window. --> <xul version="1.0"> <window title="Main" id="10000"> <menubar id="11000"> <menu label="File" id="11100"> <menupopup id="11101"> <menuitem label="New" id="11111"/> <menuitem label="Open..." id="11112"/> <menuitem label="Close..." id="11113"/> <menuseparator/> <menuitem label="Close..." id="11121"/> </menupopup> </menu> </menubar> <box id="12000"> ... <button href="btnOk.xul"/> ... </box> </window> </xul>File 'another.xul':
<!-- Another window of the application. --> <xul version="1.0"> <window title="Main" id="20000"> <menubar href="main.xul" id="21000"/> <box id="22000"> ... <button href="btnOk.xul" id="22502"/> ... </box> </window> </xul>