Wednesday, February 21, 2007

Wicked wicket framework
---------------------------
I had earlier blogged about my foray into web 2.o and how I ended up trying wicket. I still am quite impressed with Wicket though I no longer work with it. Wicket interested me because it had a TreeTable component which I wanted to adapt to display XML. The exisiting TreeTable in Wicket displayed static, hierarchical data that could display only 5 columns. This was because the Wicket used a model bean which is a plain old java bean that looked like this:

public class ModelBean {

public ModelBean() {
}

public String getColumn_1_Value() {
}

public String getColumn_2_Value() {
}


:
:
:
}

What I envisaged would solve the problem was:

public class MyModelBean {

public MyModelBean() {...


public String getColumnValue(int columnNumber) {
if(columnNumber == 0)
return name;
else if(columnNumber == 1)
return size;
else if(columnNumber == 2)
return type;
else if(columnNumber == 3)
return lastModified;
}


This way the treetable would be able to display any kind of hierarchical data. However, in the end it proved to be easier said than done. Wicket uses PropertyResolver to resolve a compound expression of the form

userObject.value

which then got evaluated to

getUserObject().getValue()
}


using reflection. i.e 2 calls were being made on the PropertyResolver. The first one would ofcource return the userObject associated with the ModelBean and the getValue would then be called on the userObject. My new version would then pass the columnNumber as the argument to getValue. Further, key classes and methods inside wiket were marked private which hindered direct subclassing and workarounds had to be devised. Further there were so many execution paths since Wicket supports indexing of arrays, hashmaps besides javabean types that finding the places that needed changing was difficult to say the least. But as they say, Alls well that ends well and the code is now in the Apache incubator as Wicket has formally been inducted into Apache.
The work is by no means complete. The treetable editing functionality is not complete as yet. The treenodes are not editable. The swing version that I have developed is able to edit the treenodes. If time permits I would like to take that up as well. The only thing that is stopping me is the stack up inside my head has been cleared to make room for other stuff. Restarting work would mean once again going back and starting from the beginning

At times I did end up comparing wicket's syntax with that of JSF. JSF uses EL (expression language) for their expression support. JSF too uses PRopertyResolvers and with JSF our job is made slightly more difficult by ther being 2 different EL syntaxes, the JSTL syntax and JSF syntax which ofcourse is the topic of another blog altogether

8 comments:

Matej Knopp said...

Huh?

The model bean you describe is only simple one that serves as an example. You can have your own TreeNode with any bean as model. Also you don't need to use PropertyColumn, you can make your own (even editable, see the example) Columns.

prakash visvanathan said...

Hi Matej,
Thanks. I will check out the example. Is it part of wicket distribution. If so which one, 1.2, 1.3?

Also have you been able to compile my code yet?

cheers,
prakash

Anonymous said...

[url=http://www.ganar-dinero-ya.com][img]http://www.ganar-dinero-ya.com/ganardinero.jpg[/img][/url]
[b]Estas necesitando informacion sobre como ganar dinero[/b]
Nosotros hemos hallado la mejor pagina web en internet de como trabajar en casa. Como nos ha sido de utilidad a nosotros, tambien les puede ser de utilidad a ustedes. No son solo metodos de ganar dinero con su pagina web, hay todo tipo de metodos para ganar dinero en internet...
[b][url=http://www.ganar-dinero-ya.com][img]http://www.ganar-dinero-ya.com/dinero.jpg[/img][/url]Te recomendamos entrar a [url=http://www.ganar-dinero-ya.com/]Ganar-dinero-ya.com[/url][url=http://www.ganar-dinero-ya.com][img]http://www.ganar-dinero-ya.com/dinero.jpg[/img][/url][/b]

Anonymous said...

good day people. I'm actually into shoes and I had been looking for the sake of that particular make. The prices due to the fact that the sneakers are around 250 bucks on every page. But finally I set this locate selling them someone is concerned half price. I really like those [url=http://www.shoesempire.com]prada sneakers[/url]. I will probably order those. what do you think?

Anonymous said...

Hello. And Bye.

Anonymous said...

good day dudes. I'm really into shoes and I have been digging as far as something that exact brand. The prices for the shoes are about 240 bucks on every page. But definitively I bring about this site selling them someone is concerned half price. I in reality like those [url=http://www.shoesempire.com]gucci sneakers[/url]. I will absolutely order those. what do you think?

Anonymous said...

easy backup wizard -
easy member pro -
easy tv soft -
eatstopeat -
eat stop eat -
error fix -
error killer -
evidence nuker -
fap turbo -
fatburningfurnace -
fat burning furnace -
fatloss4idiots -
fat loss 4 idiots -
final uninstaller -
fitnessmodelprogram -
fitness model program -
flatten your abs -
gamers testing ground -
gov auction -
governmentregistry -
government registry -
gov records -
herbal hair solution -
homebre ware -
home job group -
homemadeenergy -
home made energy -
inteli gator -
joanas world -
joyful tomato -
kidney stone remedy -
learn digital photography now -
learn elements now -
linden method -

Anonymous said...

bloggers pay check -
blogging in action -
body building revealed -
burnthefat -
burn the fat -
carb rotation diet -
cheat your way thin -
chopper tattoo -
cleanup the profits -
cold sore freedom in 3 days -
commission blueprint -
conversationalhypnosis -
conversational hypnosis -
cure for bruxism -
declutter fast -
driver checker -
earth4energy -
earth 4 energy -
easy member pro -
easy tv soft -
eatstopeat -
eat stop eat -
fap turbo -
fatburningfurnace -
fat burning furnace -
fatloss4idiots -
final sync -
final uninstaller -
fitness model program -
fit yummy yummy -
flatten your abs -
forex ambush -
governmentregistry -
government registry -