Gerald Bauer
JUG Austria Talk, October 2001
100 % Java, Open Source
Closed-Source Payware
Industry Strength Über-Browser
100 % Java, Open Source
100 % Java, Open Source
100 % Java, Open Source
100 % Java, Open Source
Industry-Strength Über XUL Engine
100 % Java, Open Source
| Component | Provider |
|---|---|
| HTML Browser | JEditorPane |
| HTTP Server | Homegrown (similar to Rachel's Open-Source, Ultra-Light Weight, Multi-Threaded HTTP Server) |
| Template Engine | Apache Velocity |
| Portal Engine | Homegrown |
| XUL Engine | Homegrown - Open-Source Luxor |
| Download/Upload Manager | Homegrown |
| Themes, Skins, Look & Feels | CSS, Skin L&F, Oyoaha L&F, Kunststoff L&F |
| Zero-Admin | Web Start |
make cross-platform user interfaces as easy to built as web pages
-> no hard-coded, platform-specific user interfaces (e.g. MFC, WinForms, Swing, Qt, etc.)
-> the answer is not yet another GUI API/toolkit/framework
<xul>
<toolbar id="MAIN_TOOLBAR">
<button action="new" caption="New"
icon="NEW_ICON" tooltip="Create new package"
mnemonic="N" />
<button action="open" caption="Open"
icon="OPEN_ICON" tooltip="Open existing Jnlp file"
mnemonic="O" />
<button action="save" caption="Save"
icon="SAVE_ICON" tooltip="Save Jnlp file"
mnemonic="S" />
<button action="test" caption="Test"
icon="TEST_ICON" tooltip="Test Jnlp Package"
mnemonic="T" />
<separator/>
<button action="addInformation" caption="Info"
icon="ADD_INFORMATION_ICON" tooltip="Add Information Section"
mnemonic="I" />
<button action="addIcon" caption="Icon"
icon="ADD_ICON_ICON" tooltip="Add Icon"
mnemonic="C" />
<button action="addResources" caption="Resources"
icon="ADD_RESOURCES_ICON" tooltip="Add Resources Section"
mnemonic="R" />
<button action="addJar" caption="Jar"
icon="ADD_JAR_ICON" tooltip="Add Java Archive"
mnemonic="J" />
<button action="addNativeLib" caption="Native Lib"
icon="ADD_NATIVE_LIB_ICON" tooltip="Add Native Library"
mnemonic="L" />
<button action="addExtension" caption="Extension"
icon="ADD_EXTENSION_ICON" tooltip="Add Extension"
mnemonic="E" />
</toolbar>
</xul>
|
The Good
The Ugly
And many more
Example:
<XwingML>
<JFrame name="MainFrame" title="Bluestone XMLEdit" image="icon.gif" x="10%" y="10%" width="80%" height="80%">
<JMenuBar>
<JMenu text="File" mnemonic="F">
<JMenuItem icon="open.gif" text="Open..." mnemonic="O" accelerator="VK_O,CTRL_MASK" actionListener="OpenFile"/>
<JMenuItem icon="save.gif" text="Save" mnemonic="S" accelerator="VK_S,CTRL_MASK" actionCommand="save" actionListener="SaveFile"/>
...
<JTabbedPane>
<Tab title="XML">
<JScrollPane>
<JTextArea name="EditorArea" tabSize="3" fontName="Monospaced" fontSize="14"/>
</JScrollPane>
</Tab>
<Tab title="DOM">
<JScrollPane>
<JTree name="DocumentTree" className="DOMTree">
</JTree>
</JScrollPane>
</Tab>
</JTabbedPane>
</JSplitPane>
</JFrame>
</XwingML>
|
Break UI into Four Parts
Main Pieces of Luxor
<action>
|
<key>
|
<panel>
|
|
|
<icon id="NEW_ICON" ref="images/20x20/newsheet.gif" /> <icon id="OPEN_ICON" ref="images/20x20/openproject.gif" /> <icon id="SAVE_ICON" ref="images/20x20/saveproject.gif" /> <icon id="EXIT_ICON" ref="images/20x20/exit.gif" /> <keyset> <key id="new" modifiers="control" key="N" /> <key id="open" modifiers="control" key="O" /> <key id="open-url" modifiers="control" key="U" /> <key id="save" modifiers="control" key="S" /> </keyset> |
Register Action Items with XulManager
public class CmdExit extends XulAction
{
GUI _gui;
public CmdExit( GUI gui )
{
super( ActionKeys.EXIT );
_gui = gui;
}
public void execute()
{
_gui.exit();
}
}
|
Create MenuBar
JMenuBar menuBar = xul.createMenuBar( MenuBarKeys.MAIN_MENUBAR ); |
XML Version
<menuitem action="new" label="New..." accesskey="N"
key="new" icon="NEW_ICON" />
|
Java Version
JMenuItem mi = new JMenuItem( "New..." ); mi.addActionListener( cmdNew ); mi.setMnemonic( 'N' ); mi.setAccelerator( KeyStroke.getKeyStroke( "control N" ) ); mi.setIcon( new ImageIcon( "images/newApplication.gif" ) ); |
|
|
Target Attribute - Display in Internal or External Browser
|
|
XulManager xul = XulManager.getXulManager(); // step 1: create map XulMap archMap = xul.createMap( "ARCH" ); // step 2: populate combobox using values JComboBox arch = new JComboBox( archMap.getValues() ); // example on how to get key from value String key = archMap.lookupByValue( (String) arch.getSelectedItem() ); |
|
|
<border title="Information"/> <choice id="LOCALE_INPUT" map="LOCALE" prepend="true" /> <text id="TITLE_INPUT" history="info.title" /> <text id="VENDOR_INPUT" history="info.vendor" /> <text id="HOMEPAGE_INPUT" history="info.homepage" /> <checkbox id="OFFLINE_ALLOWED_INPUT" caption="Offline allowed" /> <label id="LOCALE_LABEL" caption="Locale:" /> <label id="TITLE_LABEL" caption="Title:" /> <label id="VENDOR_LABEL" caption="Vendor:" /> <label id="HOMEPAGE_LABEL" caption="Homepage:" /> </panel> |
public class JnlpInformationPanel extends AbstractDetailPanel
{
XInput _title;
XInput _vendor;
XInput _homepage;
XInput _offlineAllowed;
XInput _locale;
public JnlpInformationPanel( GUI gui, JnlpEditorPanel control )
{
super( gui, control, PanelKeys.INFORMATION );
}
public void init()
{
_locale = new XInput( this, "LOCALE_INPUT" );
_title = new XInput( this, "TITLE_INPUT" );
_vendor = new XInput( this, "VENDOR_INPUT" );
_homepage = new XInput( this, "HOMEPAGE_INPUT" );
_offlineAllowed = new XInput( this, "OFFLINE_ALLOWED_INPUT" );
}
}
|
public void populate( JnlpUiTreeNode node )
{
JnlpInformation data = (JnlpInformation) node.getNodeData();
_locale.setText( data.getLocale() );
_title.setText( data.getTitle() );
_vendor.setText( data.getVendor() );
_homepage.setText( data.getHomepage() );
_offlineAllowed.setChecked( data.getOfflineAllowed() );
_descriptionPanel.populate( node );
}
public void saveChanges( JnlpUiTreeNode node )
{
JnlpInformation data = (JnlpInformation) node.getNodeData();
data.setLocale( _locale.getText() );
data.setTitle( _title.getText() );
data.setVendor( _vendor.getText() );
data.setHomepage( _homepage.getText() );
data.setOfflineAllowed ( _offlineAllowed.isChecked() );
_descriptionPanel.saveChanges( node );
}
|
user.name, os.name)profile.vendor, today) Create Breadcrumbs
<table><tr><td>
Look in:
#foreach( $entry in $entries )
<a href="http://localhost:5050/venus?action=$action&dir=$entry.getAbsolutePath()">
$entry.getName()
</a>
#end
<b>$current.getName()</b>
</tr></td></table>
|
Create Icon Listing; Layout Table in Columns
#set ($columns = 3)
<table>
#foreach( $rows in $files.getTableRows( $columns ) )
<tr>
#foreach( $file in $rows )
<td>
#if( $file.getLengthInt() < 3000 )
<img src="$file.url">
#else
(no preview)
#end
<font size=+1>
<a href="http://localhost:5050/venus?action=$action&file=$file.getAbsolutePath()">
$file.getName()
</a>
</font>
</td>
#end
</tr>
#end
</table>
|
HashMap args = new HashMap(); args.put( "files", new ColumnList( icons ) ); args.put( "action", action ); XulManager xul = XulManager.getXulManager(); String html = xul.getHTML( args, "portlet/iconFileList.html" ); |
Conclusion: Applets Are Pretty Much Dead, Applets = No Future
<jnlp href="rachel.jnlp" codebase="http://www.jenomics.de/vamp">
<information>
<title>Rachel Example Application</title>
<vendor>Gerald Bauer</vendor>
<homepage href="http://www.vamphq.com/resources.html"/>
<description>An open-source resource loading toolkit for Java Web Start that makes resource loading easy again.</description>
<icon href="rachel.gif"/>
<offline-allowed />
</information>
<resources>
<j2se version="1.3" />
<jar href="lib/hello.jar" />
<jar href="lib/crossref.jar" />
<jar href="lib/javadoc.jar" />
<jar href="lib/themes.jar" />
<jar href="lib/rachel.jar" />
<jar href="lib/log4j.jar" />
<jar href="lib/skinlf-0.31.jar" />
</resources>
<security>
<all-permissions />
</security>
<application-desc main-class="HelloRachel" />
</jnlp>
|
| Tag | Description |
|---|---|
| Root Tags | |
jnlp
|
The jnlp file's one and only root . |
| Top Level Structural Tags | |
applet-desc
[ param ]
|
Describes how to startup a Java applet. Contains information about main class, parameters, size and more. |
application-desc
[ argument ]
|
Describes how to startup a Java application. Contains information about the main class and arguments. |
component-desc
|
Specifies a component extension. |
information
|
Contains various descriptive information about the application such as title, vendor and homepage. |
installer-desc
|
Specifies an installer extension. |
resources
|
Contains an ordered set of resources that make up an application. |
security
|
Describes the application's security requirements. |
| Information Tags | |
description
|
Describes the application in a single line, in a paragraph or in a couple of words for a tooltip. |
homepage
|
Contains a web address to the application's homepage. |
icon
|
Describes an icon/image for the application. |
offline-allowed
|
Indicates if the application can be started offline (that is, without a connection to the originating server). |
vendor
|
Contains the vendor's name. |
title
|
Contains the application's name. |
| Resources Tags | |
extension
[ ext-download ]
|
Describes a component or installer extension that is required to run the app. |
j2se
|
Describes a supported JRE version that the application can run on. |
jar
|
Describes a jar file. |
nativelib
|
Describes a jar containing native libraries (e.g. .dll, .so).
|
package
|
Defines a relationship between a Java package or class name and a part. |
property
|
Describes a name/value pair that is available to the application as a system property. |
| Security Tags | |
all-permissions |
Indicates that the application needs full access to the local system and network. |
j2ee-application-client-permissions |
Indicates that the application needs the set of permissions defined for J2EE client apps. |
|
URL + Version = Unique ID
|
Alive and kicking
Dead or neglected
FAQs - Answers, Answers, Answers