Luxor Network: Luxor - Luxilla - Petra - Installer DeLux - Luxor Contrib - Luxor Forum - The Memphis Sun
Luxor XUL Logo
Making Building Classic Desktop-Style UIs As Easy As Building Web Pages
Overview . Tag Reference . Cheat Sheet . CSS Reference . API Reference . FAQ . History . Upcoming . Gallery . Notes . Powered By Luxor . Contribute . Mailing Lists & Forums . Premium Support . Credits . Glossary . Site Search . The Memphis Sun . Download . Download Luxilla . Download Plugins . Download Contrib . Source . Javadoc . Team . Who's Who . Donate . Luxor @ Sourceforge

XulManager API Quick Reference

Intro

This page presents a quick reference to the XulManager API. The XulManager class provides centralized access to your menus, toolbars, portals, templates, icons, and more stored in your app's chrome.

Xul Manager API Overview

Method Description
String getPortal( String id )
String getPortal( Map data, String id )
returns a portal (that is, a HTML page) as a String
String getTemplate( String name )
String getTemplate( Map data, String name )
String getHTML( String name )
String getHTML( Map data, String name )
returns a processed Apache Velocity template as a String; getHTML() is a convenience method that automatically prepends html/ to the passed in name; otherwise it's completely identical to getTemplate()
String getPre( String key ) return a preformatted text possibly stretching over multiple lines
JPopupMenu lookupPopup( String key ) creates a popup menu defined in XUL
JComponent createJComponentFromBox( String key ) returns a top-level XUL box (that is, a JPanel in Swing); a top-level XUL box is a child of xul and not nested inside another box
XulAction lookupAction( String key ) returns a reference to an action (aka command)
JMenu lookupMenu( String key ) returns a reference to a registered menu
XulPortlet lookupPortlet( String id ) returns a reference to a registered portlet
ImageIcon[] lookupAnim( String key ) returns a set of icons that make up an animation (e.g. for an activity indicator)
ImageIcon lookupIcon( String key ) returns an icon
JMenuBar createMenuBar( String key ) creates a menu bar from a XUL definition
JToolBar createToolBar( String key ) creates a tool bar from a XUL definition

Data API

Method Description
HistoryModel lookupHistory( String key ) returns a reference to a HistoryModel that is usually stored in a profile; HistoryModel's store the user's input for auto-completion
XulMap createMap( String key ) returns a name/value pair table that allows lookup for keys as well as for values (aka reverse lookup)
String[] createList( String key ) returns a String table defined in the app's chrome

Resource registration API

Method Description
addAction( String key, XulAction value ) register an action/command
addBrowser( String target, BrowserService browser ) register a browser target
addServlet( String key, XulServlet value ) register a servlet
addMenu( String key, JMenu menu ) register a menu hard-coded in Java
addPortlet( String id, XulPortlet portlet ) register a portlet

Low-level resource getters.

Method Description
BufferedImage getResourceAsImage( String name ) returns an image (.gif, .jpg, .png) stored in the app's chrome
ImageIcon getResourceAsImageIcon( String name ) returns an icon stored in the app's chrome
String getResourceAsString( String name ) returns a text file stored in the app's chrome as a String
Properties getResourceAsProperties( String name ) returns a properties file stored in the app's chrome as a property table
org.jdom.Document getResourceAsXmlDocument( String name ) returns an XML document stored in the app's chrome as a parsed JDOM document
InputStream getResourceAsStream( String name ) returns a reference to the resources's InputStream
URL getResourceAsUrl( String name ) returns the resources's URL stored in the app's chrome

Config Data API. Returns strings, ints, string tables and more stored in Java properties files or in XML config files in the app's chrome locale directory tree. Luxor loads the config data automatically when you create the chrome resource loader (e.g. new XulJarResourceLoader( MyChromeAnchor.class )).

Method Description
String getString( String key )
String getString( String key, String defaultValue )
returns a String stored in the app's locale-dependent chrome
String[] getStringArray( String key ) returns a string array stored in the app's locale-dependent chrome
int getInt( String key, int defaultValue ) returns an int stored in the app's locale-dependent chrome
getPortal

returns a portal (that is, a HTML page) as a string; a portal is dynamic web page made up of portlets and static XHTML snippets. Note, that you need store your portal definitions in the chrome startup tree.

Syntax:

String getPortal( String id )
String getPortal( Map data, String id )

Arguments:

id, required
The portal's id as specified in the portal's tag id attribute.
map, optional
The data stored in a lookup table that Luxor passes on to the portlets making up the portal.

Prerequisites:

Examples:

String html = xul.getPortal( "ABOUT" );

String html = xul.getPortal( Chrome.Portal.SYSTEM_INFO ); // "SYSTEM_INFO"
getTemplate

returns a processed Apache Velocity template as a string; getHTML() is a convenience method that automatically prepends html/ to the passed in name; otherwise it's completely identical to getTemplate()

Syntax:

String getTemplate( String name )
String getTemplate( Map data, String name )
String getHTML( String name )
String getHTML( Map data, String name )

Arguments:

name, required
Internal path to find the template in the app's chrome.
data, optional
The data stored in a lookup table that Luxor passes on to the template.

Prerequisites:

Examples:

HashMap data = new HashMap();

data.put( "osName",    System.getProperty( "os.name", "n/a" ) );
data.put( "osArch",    System.getProperty( "os.arch", "n/a" ) );
data.put( "osVersion", System.getProperty( "os.version", "n/a" ) );

XulManager xul = XulManager.getXulManager();
String html = xul.getTemplate( data, "portlet/system-properties.html" ); 
More Quick Links: Batik SVG · Velocity · Python · Jython · Groovy · JDOM · dom4j · Jaxen · XDoclet · Eclipse SWT · wx4j · Java Gnome · KDE/Qt Java · Kaffe · gcj · SableVM · IKVM · Mono · DotGNU · Gtk# · Qt# · Parrot · Mozilla · Relax NG
Hosted by SourceForge SourceForge Logo For questions related to the use of Luxor, please consult our web pages. If that fails, the luxor-xul-user mailinglist might help.
Please send comments on our web pages and the development of Luxor to our public luxor-xul-develop mailinglist.
Maintained by Luxor Team
Copyright © 2001, 2002, 2003, 2004, 2005 Luxor Foundation