Re: Allow to register a converter for actions

List for Users of Carlsbad Cubes' Technologies and Products <[email protected]> Mon, 31 Oct 2005 18:00:48 +0200
Newsgroups gmane.comp.embedded.carlsbad-cubes
Organization http://freemail.web.de/
Message-ID <[email protected]>

Hello,

while I see some sense in your code, there are a few things I would
like to point out to consider them.

- Since the last Swixml release, the action fields do not need to be public anymore
- To init construct a (Abstract)Button from an action, there is the initclass-attribute
  along with the possibility to invoke a singleton on the desired class (public
  static Action getInstance())

Your code, allthough it allows converters to construct actions, lacks some of
the flexibilty Swixml allows with the things I mentioned above: you have to know
at *compile time* which actions are available at *runtime*. On the other hand,
the code does not remove nor limit these flexibilty.

Did you consider using initclass along with the singleton for your actions or
is this something you are not able to do, because the components you use
lack constructors accepting a single Action object or you have other
objections?

Yours,

Frank

List for Users of Carlsbad Cubes' Technologies and Products <[email protected]> schrieb am 30.10.05 17:50:03:
> 
> Hi all,
> 
> I had done a little change in Parser.applyAttributes(Object, Factory, 
> List) and i would like to know if it is safe and if potentially it could 
> be included in the source pool eventually.
> The purpose is to allow to register Converters for Action and so allow 
> us to inject any action which match the value of the action attribute 
> from the converter.
> For instance i have (but perhaps this is a bad design) a ActionManager 
> into which i register actions by name (this is a sort of HashMap) and 
> that i use to fetch actions when the parser encounter them.
> This allow to not be mandatory to declare the actions as public fields 
> in the client object of the SwingEngine.
> Attached to this mail are the patch and an example converter. To use it, 
> i add the following lines before parsing the xml ui descriptor:
> ...
>                 swingEngine = new SwingEngine(this);
>                 actionManager = new AndroMDAModuleActionManager( this );
>                 ConverterLibrary.getInstance().register(Action.class,
>                         actionManager);
>                 URL uiDef = ClassLoader.getSystemResource(UI_DESCRIPTOR);
>                 File f = new File(uiDef.getFile());
>                 swingEngine.render(f);
> ...
> (i work on a module for argouml which integrate andromda into it - this 
> explain the name of the classes)
> Thanks for any feedback,
> Best regards,
> 
> -- 
> Cordialement,
> Ludo - http://www.ubik-products.com
> ---
> "L'amour pour principe et l'ordre pour base; le progres pour but" (A.Comte) 
> 
> 
> <hr>
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>