Hi.

Aleksei,
This is very interesting what you've done.
> The source code would definitely be more enlightening.

As far as I understood my management, we won't be releaseing it open source. But of course I can share parts of the code.

> How do you do these expanding/contracting panels?

They are actually not substracting/contracting. It's dynamic adding/removing of children.

That's how it works. [+] and [-] buttons are AjaxCommandLinks with normal images inside of them (see ajax4jsf library for the ajax components). They have bound action handlers which know "their" panels.

When the link is clicked, ajax4jsf sends the request to the server and action handler is invoked. The action handler (let's take [+] for instance) then knows that he has to add new controls to his panel. These new controls are built in the runtime and after that added to the corresponding panel.

The [+] AjaxCommandLink has its reRender attribute set to its panel id. So after the action handler is invoked on the server side, the panel just gets re-rendered within the page and it showes new controls after that.

AJAX with ajax4jsf has actually minimal impact on the processing. ajax4jsf is really very non-intrusive. I can change all AjaxCommandLinks back to HtmlCommandLinks and it will work just as well - with the exception that the whole page will be reloaded on each button click.

The "tricky" part here is component creation. Well, it's also not tricky. You just have to do what tags do - instantiate the components, add value/method bindings, add children components or facets. Not too complex.

I am currently trying to extract business non-specific and non-critical things into an open-source hifaces.dev.java.net project.

Bye.
/lexi

Reply via email to