Hi

 

I have some components that migth be interesting for others to have. The best 
one I'll describe below:

 

Currently called dropdownpalette, and it's a combination of Igor's 
palette(although rewritten a bit, I belive that Igor have fixed the original 
palette so we should use that one) and a dropdown. 

 

The component works by having three models and a list plus a bit more.  When 
you chose something in the dropdown the palettes left side listbox are updated 
with values and the right side are cleared. Since the update are done with 
ajax, as base the left listbox are updated but you can specify additional 
"slavecompnents" that will be rerendered and updated after selection of a 
specific dropdown item.

 

I've used reflection on this, you must provide a method, a provider and a 
parameter list, when creating the component. Snipplet:

 

Creating the parameters:

 

                                            List params = new ArrayList();

                                            Object[] param = new Object[2];

                                            param[0] = IDataItem.class;

                                            param[1] = dataitemmodel;

                                            params.add(param);

 

                                            param = new Object[2];

                                            param[0] = Object.class;

                                            param[1] = object model;

                                            params.add(param);

 

                                            param = new Object[2];

                                            param[0] = Cube.class;

                                            param[1] = cubemodel;

                                            params.add(param);

 

>From the above you can see that  all parameters actually are Imodels but we 
>also specify which kind of class the object retrieved from the model should be 
>cast into.

 

(pseudo creation of component)

                                            DropDownPalette ddp = new 
DropDownPalette(

                                                                                
       id, dropdownmodel, dropdown items,

                                                                                
       paletteleftmodel, paletterightmodel, dbprovider,

                                                                                
       "getAreas", params,  slaveComponents) 

                                            Form.add(ddp);

 

So the string "getAreas" specify that dbprovide will be called when choosing a 
new thing in the dropdown, the method are called with the params list as 
parameters.

 

So I guess this is a pretty generic component, although there are some setup 
with the parameter list the component should be easy to use, I think at least 
the reflection part should be useful if you have a bunch of components that 
almost does the same thing you should be able to create one component that fits 
all.

 

Regards Nino

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to