commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <simon.kitch...@xtra.co.nz>
Subject Re: [digester] calling method with a constant param
Date Mon, 27 Nov 2006 21:15:21 GMT
Hi Dimitry,

---- Dmitry Beransky <db01@dembel.org> wrote: 
> <menus>
>    <menu title="Edit" hotKey="E" parentId="parent1">...</menu>
>    <menu title="View" hotKey="V">
> </menus>
> 
> here's what I have so far:
> 
>         digester.addObjectCreate("menus", LinkedList.class);
>         digester.addObjectCreate("*/menu", "javax.swing.JMenu", "class");
>         digester.addSetProperties("*/menu", "title", "text");
>         digester.addCallMethod("*/menu", "setMnemonic", 1, new
> Class[]{char.class});
>         digester.addCallParam("*/menu", 0, "hotKey");
> 
> 
> I'm having problems with the parentId attribute for which I need to
> call putClientProperty("parentId", <id>) on the current menu object,
> where "parentId" is a string literal (property name), and <id> is the
> value of the parentId attribute of the <menu> element.  Any thoughts
> on how to do this?
> 

This should work:
  digester.addCallMethod("menus/menu", "putClientProperty", 2);
  digester.addObjectParam("menus/menu", 0, "parentId"); // pass literal string
  digester.addCallParam("menus/menu", 1, "parentId"); // pass xml attribute

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message