Re: Listener Methods

<[email protected]>
Newsgroups gmane.comp.embedded.carlsbad-cubes
Organization http://freemail.web.de/
Message-ID <[email protected]>
Hello Adam,

I read your code and found it a bit difficult what you where trying to achive.

You use a lot of reflection to invoke a method of an interface you both know.
Why not calling it directly and creating a inner class for this purpose? Sure,
you are able to return Object instead of ListSelectionListener and to
introduce another parameter with the interface-class you want to
implement but IMHO there is a much simpler possiblity.

There already exist methods in the GUI classes for adding listeners,
like JList.addListSelectionListener().

My idea would be to accept a 'mouseListener="myMouseListener"'
attribute in the XML-File. In fact, the addXXXListener method is not
that different from setYYY, so there is only a minor change
concerning swixml (changing the filter which accepts only method
named "set*" having one argument). The result is you are able
to use attributes declaring ListSelectionListeners. Sure, you can not
have all public methods wire to your list selection listener but this
is IMHO hardly the common use. If two or three "callable functions"
are enough to choose from, IMHO (I want to emphasise this really,
perhaps I'm wrong) it is ok to have the same number of inner
classes.

What do you think?

Frank

List for Users of Carlsbad Cubes' Technologies and Products schrieb am 08.03.04 16:54:20:
> 
> Wolf,
> 
> Here is my idea.   I am not very good at describing ideas, so I have 
> attached code that I hope explains.   I really like swixml because it 
> really allows the separation of GUI creation from business logic.    I 
> would like to see it go just a step further than it does now.   I am in 
> total agreement about not putting any code ("scripting") in the GUI 
> definition.   I would like for the framework to do some of the wiring 
> that really has nothing to do with the business logic.   I have created 
> an example and attached it below.
> 
> Main points of interest:
> 
> masterListSelectionChanged() method on the MainWindow class.
> 
> onChange attribute of the "masterList" list element
> 
> 
> The idea would be to have the framework wire listeners to methods on 
> the client.   In the mainwindow.xml the first list element has a 
> onChange attribute that contains the name of a public method on the 
> client (MainWindow).   I would like the framework to wire up the 
> ListSelectionListener.valueChanged method to the 
> masterListSelectionChanged method on the client.
> 
> I have attached some code in the ReflectionUtils class that allows you 
> to wire any interface method to an object method.   I don't think that 
> the ReflectionUtils class is production ready, but it demonstrates the 
> concept.
> 
> I am open to any and all discussion.
> 
> AE
> 
> 
> <hr>
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.