<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Swing Action configuration&#160;goodness</title>
	<atom:link href="http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/</link>
	<description>Sam Newman's blog</description>
	<pubDate>Sat, 05 Jul 2008 00:46:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Damien Bonvillain</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-215</link>
		<dc:creator>Damien Bonvillain</dc:creator>
		<pubDate>Wed, 25 Feb 2004 19:13:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-215</guid>
		<description>We lose the hierarchical vision with a flat format, but compared with XML as a (twisted) tree-model, there's less fluff. And the structure for a menu is generally 2-levels deep at most. In 1999, YAML didn't exist, but it's interesting to see a specification for this.
</description>
		<content:encoded><![CDATA[<p>We lose the hierarchical vision with a flat format, but compared with <acronym title="eXtensible Markup Language">XML</acronym> as a (twisted) tree-model, there&#8217;s less fluff. And the structure for a menu is generally 2-levels deep at most. In 1999, YAML didn&#8217;t exist, but it&#8217;s interesting to see a specification for this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Newman</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-214</link>
		<dc:creator>Sam Newman</dc:creator>
		<pubDate>Tue, 24 Feb 2004 13:30:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-214</guid>
		<description>More readable? Perhaps, but you are displaying fundamentally hirearchical data in a flat format. A nice compomise might be to use something like YAML (http://www.yaml.org/), which I would consider if there was a mature parser out there. YAML looks like this:

invoice: 34843
date   : 2001-01-23
bill-to: &#38;id001
    given  : Chris
    family : Dumars
    address:
        lines: &#124;
            458 Walkman Dr.
            Suite #292
        city    : Royal Oak
        state   : MI
        postal  : 48046

Whitespace is used to define grouping as opposed to wrapping everything with tags.</description>
		<content:encoded><![CDATA[<p>More readable? Perhaps, but you are displaying fundamentally hirearchical data in a flat format. A nice compomise might be to use something like YAML (http://www.yaml.org/), which I would consider if there was a mature parser out there. YAML looks like this:</p>
<p>invoice: 34843<br />
date   : 2001-01-23<br />
bill-to: &#038;id001</p>
<p>    given  : Chris<br />
    family : Dumars<br />
    address:<br />
        lines: |<br />
            458 Walkman Dr.<br />
            Suite #292<br />
        city    : Royal Oak<br />
        state   : MI<br />
        postal  : 48046</p>
<p>Whitespace is used to define grouping as opposed to wrapping everything with tags.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damien Bonvillain</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-213</link>
		<dc:creator>Damien Bonvillain</dc:creator>
		<pubDate>Tue, 24 Feb 2004 12:40:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-213</guid>
		<description>Doing all this with property files is doable (and perhaps more readable), but the handling  should take care of rebuilding a tree. I've a project from 1999 which does this. Here is a sample of one of the property files :

# Toolbar définition
toolbar= rt - il routage
rtLabel=Routage
rtTooltip=Modifie le routage
ilLabel=Ilot
routageTooltip=Ajouter une gamme
routageImage=new1.gif

# Statusbar definition
statebar=un deux trois quatre cinq six sept
unLabel= Route
deuxLabel=Modif
troisLabel=Erreur
quatreLabel=(x,y)
cinqLabel=nb_mac
sixLabel=nb_seg
septLabel=v_flux

# Actions behaviour
modifiers= creer efface_mac
creerTooltip=Créer une machine
creerNec=RIEN NO_MAC NO_FLUX
creerRej=DROIT CTRL
creerNecAide=RIEN NO_MAC NO_FLUX
creerRejAide=CTRL
efface_macTooltip=Effacer la machine
efface_macNec=RIEN DROIT CTRL
efface_macRej=NO_MAC 
efface_macNecAide=RIEN CTRL
efface_macRejAide=NO_MAC 

The last section is conditions for an Action to be applicable, described as a set of necessary (Nec) conditions, and a set of vetoed conditions (Rej). Conditions refer to the UI (CTRL, DROIT refer to the mouse) or to the domain model (NO_MAC, NO_FLUX, RIEN).</description>
		<content:encoded><![CDATA[<p>Doing all this with property files is doable (and perhaps more readable), but the handling  should take care of rebuilding a tree. I&#8217;ve a project from 1999 which does this. Here is a sample of one of the property files :</p>
<ol>
<li>Toolbar définition<br />
toolbar= rt &#8211; il routage<br />
rtLabel=Routage<br />
rtTooltip=Modifie le routage<br />
ilLabel=Ilot<br />
routageTooltip=Ajouter une gamme<br />
routageImage=new1.gif</p>
</li>
<li>Statusbar definition<br />
statebar=un deux trois quatre cinq six sept<br />
unLabel= Route<br />
deuxLabel=Modif<br />
troisLabel=Erreur<br />
quatreLabel=(x,y)<br />
cinqLabel=nb_mac<br />
sixLabel=nb_seg<br />
septLabel=v_flux</p>
</li>
<li>Actions behaviour<br />
modifiers= creer efface_mac<br />
creerTooltip=Créer une machine<br />
creerNec=RIEN NO_MAC NO_FLUX<br />
creerRej=DROIT CTRL<br />
creerNecAide=RIEN NO_MAC NO_FLUX<br />
creerRejAide=CTRL<br />
efface_macTooltip=Effacer la machine<br />
efface_macNec=RIEN DROIT CTRL<br />
efface_macRej=NO_MAC <br />
efface_macNecAide=RIEN CTRL<br />
efface_macRejAide=NO_MAC </p>
<p>The last section is conditions for an Action to be applicable, described as a set of necessary (Nec) conditions, and a set of vetoed conditions (Rej). Conditions refer to the UI (CTRL, DROIT refer to the mouse) or to the domain model (NO_MAC, NO_FLUX, RIEN).</p>
</li>
</ol>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-212</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Mon, 23 Feb 2004 18:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-212</guid>
		<description>I'm not sure I agree. I'm not just setting the display name of the action here - I'm also defining an icon, keyboard shortcut, mnemonic, and logical grouping (e.g. menu x has these actions). You can do all that with property files? Property files work greate for flat simple string data - but for more compelx datatypes and hirearchical structure, XML is a better choice IMHO.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure I agree. I&#8217;m not just setting the display name of the action here &#8211; I&#8217;m also defining an icon, keyboard shortcut, mnemonic, and logical grouping (e.g. menu x has these actions). You can do all that with property files? Property files work greate for flat simple string data &#8211; but for more compelx datatypes and hirearchical structure, <acronym title="eXtensible Markup Language">XML</acronym> is a better choice IMHO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Weber</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-211</link>
		<dc:creator>Neil Weber</dc:creator>
		<pubDate>Mon, 23 Feb 2004 17:44:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-211</guid>
		<description>I use standard .properties files for this same stuff.  Then just use ResourceBundle to locate the locale-appropriate .properties file.  Using XML here is way overkill.

It's always surprised me that Swing doesn't have built in support for ResourceBundles.  Making every developer create their own i18n solution is just wrong.</description>
		<content:encoded><![CDATA[<p>I use standard .properties files for this same stuff.  Then just use ResourceBundle to locate the locale-appropriate .properties file.  Using <acronym title="eXtensible Markup Language">XML</acronym> here is way overkill.</p>
<p>It&#8217;s always surprised me that Swing doesn&#8217;t have built in support for ResourceBundles.  Making every developer create their own i18n solution is just wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Newman</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-210</link>
		<dc:creator>Sam Newman</dc:creator>
		<pubDate>Mon, 23 Feb 2004 15:40:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-210</guid>
		<description>Do you have to configure your actions multiple times under each namespace?</description>
		<content:encoded><![CDATA[<p>Do you have to configure your actions multiple times under each namespace?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Carreira</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-209</link>
		<dc:creator>Jason Carreira</dc:creator>
		<pubDate>Mon, 23 Feb 2004 15:31:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-209</guid>
		<description>I think your different roles / functions are the answer to how to use XWork namespaces... We use them in WebWork to map paths, which can be used for declarative security.</description>
		<content:encoded><![CDATA[<p>I think your different roles / functions are the answer to how to use XWork namespaces&#8230; We use them in WebWork to map paths, which can be used for declarative security.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Newman</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-208</link>
		<dc:creator>Sam Newman</dc:creator>
		<pubDate>Mon, 23 Feb 2004 12:58:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-208</guid>
		<description>Firstly, for internationalisation issues. The names of actions will change from language to language - as will things such as keyboard mnemonics and keyboard shortcuts (what if a keyboard map is different). Secondly, flexibility. Users with different roles for example might get different config files which hide those actions it makes no sense to give them (e.g. hide admin options from non-admin users). It also lets you customise an interface to a users own requirements - you can allow them to change their keyboard shortcuts, position on menus etc., the result of which will be a user specific xml file stored in their profile.
I'd admit you loose complie-time checking capabilities, but here I think its a justified tradeoff.</description>
		<content:encoded><![CDATA[<p>Firstly, for internationalisation issues. The names of actions will change from language to language &#8211; as will things such as keyboard mnemonics and keyboard shortcuts (what if a keyboard map is different). Secondly, flexibility. Users with different roles for example might get different config files which hide those actions it makes no sense to give them (e.g. hide admin options from non-admin users). It also lets you customise an interface to a users own requirements &#8211; you can allow them to change their keyboard shortcuts, position on menus etc., the result of which will be a user specific <acronym title="eXtensible Markup Language">XML</acronym> file stored in their profile.<br />
I&#8217;d admit you loose complie-time checking capabilities, but here I think its a justified tradeoff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Mihalache</title>
		<link>http://www.magpiebrain.com/blog/2004/02/23/swing-action-configuration-goodness/#comment-207</link>
		<dc:creator>Gabriel Mihalache</dc:creator>
		<pubDate>Mon, 23 Feb 2004 12:34:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.magpiebrain.com/2004/02/23/swing-action-configuration-goodness/#comment-207</guid>
		<description>WHY would you want to use XML for this? No only do you loose strong typing, but you'll also have to work to keep the XML file synchronized with the Java classes.</description>
		<content:encoded><![CDATA[<p>WHY would you want to use <acronym title="eXtensible Markup Language">XML</acronym> for this? No only do you loose strong typing, but you&#8217;ll also have to work to keep the <acronym title="eXtensible Markup Language">XML</acronym> file synchronized with the Java classes.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
