I solved the problem by requiring a interface instead of the object. But that 
means that, every where my component are used the user needs to implement the 
interface. That doesnt seem to be a really nice solution.

The thing I need are for you guys(developers of wicket) to extend the 
propertymodel class so that it can take parameters also instead of just calling 
setters and getters... :)

-regards Nino

-----Original Message-----
From:   [EMAIL PROTECTED] on behalf of Nino Wael
Sent:   Thu 06-07-2006 14:01
To:     wicket-user@lists.sourceforge.net
Subject:        Creating a component / dynamic casting / implicit casting


Im currently working on a component that consists of a dropdown list and two 
listbox's, lb1 and lb2. This is pretty simple to do. My issue isnt really a 
wicket one, but I guess it has relevance since this is something I need to 
solve to create my component.

The hard part is that the contents of lb1 depends of the contents of the 
dropdown. So I looked towards java.lang.reflect(Reflection), wich lets me 
define a certain method to use.

my constructor looks something like this

dualForm_form(String id, ItemContainer drop, List DropList, ItemContainer 
myCont,       Class myProvider, String sMethod)

The things that regards reflect are these:
 myProvider, which is the class that I need to call
 sMethod, which is the name of the method that I need to call
To keep stuff simple lets just assume that method bla only takes one parameter, 
the one which is provided by the onselectionchange method of my dropdown.

The above things are fine. But I also need to provide an instanciated object of 
the Class myProvider. I thought that I would use the class Object to carry the 
object. But calling reflect gives an error that the method defined in sMethed 
does not exist, I guess this is because reflection is looking in the object 
Class and not the true class which carries the method? What should I do instead?

As said earlier, this has nothing to do with wicket, but is very interresting 
when creating components that needs to update themselfes.

-Regards Nino


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Wicket-user mailing list

Reply via email to