Configuration file
Your menu applet take just one parameter: menu, which is the URL of
your parameter file. This file contain one or two PList
which are first your menu command and, optionally,
your UI preference.
so your HTML code look like this:
<APPLET CODE=MenuApplet.class MAYSCRIPT ARCHIVE=jmenu.jar WIDTH=100 HEIGHT=200 NAME=aName> <PARAM NAME=menu VALUE="your menu plist url"> your browser doesn't support Java, sorry... ;-) </APPLET>MAYSCRIPT is needed if you want your menu trigger javascript.
PList
PList is an abbraviation for property-list. created, first and long time ago by NeXT.
it is a nested imbrication of dictionary (key-value pair), vector (list of commands), string and binary
data type. Keyword are '(', ',', ')' for bracketing list, '{', '=', ';', '}' for
bracketing key-value pairs, and '<', '>' for bracketing binary data write in hexadecimal format.
String must be quoted if greater than a single word, "like this" and understand escape sequence
(\t,\n,\r) . My parser is a bit tolerant and
you could forget ',' and ';' separator. (or take one instead of the other). You could put as much 'white
character' ( \t\n\r) as you want. Dictionary (key-value) should have string key.
Enough talk, let's see an example:
here are some string: foo foo_bar "foo bar" "it says \"Hello !\"" "a tab\tlater" here is an hexadecimal value (byte[]): <12AF E230E8> here is a list (vector): ( item1 "item 2" , "item 3") here is a dictionary (hashtable): { key1 = ( item_1_of_list_1 , "item 2 of list 1" ) ; "key \\2" = \=\"value2; "key 3" = "value \"number 3\""; key\=4 = <FFDEAD> }note that menu's plist do not take binary value, but only strings, vector and dictionary, and though PList undertsand '\t', '\n', '\r', menu doesn't display them well.
Command configuration
You configure your menu via a list of command, each one is a dictionary with some
menu-specific key:
( { icon = fool.gif name = "foolish action" javascript = "alert('you such a fool !')" } { icon = search.jpg name = search href = http://www.google.com target = right } { name = "my work" child = work/menu.plist } { name = links child = ( { name = "wonderfull" href = http://www.galador.net target = right } { name = weather href = http://www.meteo.fr/meteonet/temps/france/prev/frprev.htm } { name = "fun radio" href = http://www.funradio.fr/home.asp } ) { name = reset applet = settings action = reset } { name = "no frame" javascript = "open(parent.main.document.URL, '_parent')"} )
UI configuration
Optionally you could write some UI configuration in a dictionary,
just after commands, in the same file. The UI configuration take the form of
a dictionary with the following key:
{ bgcolor = 0xFFDEAD selcolor = 0xD0FFAF textcolor = 0x800000 bgimage = g.gif font-style = BOLD }