You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Rice Yeh <ri...@gmail.com> on 2007/03/23 18:27:09 UTC

[cforms] How to get the LibraryManager?

Hi,
  I am writing some code to insert widgets into a form dynamically in the
on-action event of an action widget. But I have the most code written in a
java method first. Since my code is not in a Serviceable class, I don't have
access to a service manager. But I need to access the LibraryManager. I try
to access it through the spring WebApplicationContext, but it says there is
no such bean definition. With the same way, I can access SourceResolver. My
code is like the following:

WebAppContextUtils.*getCurrentWebApplicationContext*().getBean(
org.apache.cocoon.forms.formmodel.library.LibraryManager.*ROLE*);
How can I get the LibraryManager without a ServiceManager?

Rice

Re: [cforms] How to get the LibraryManager?

Posted by Rice Yeh <ri...@gmail.com>.
Hi,
  After studying cocoon-forms's source code a while, I find it is very hard
to create widgets without creating a form widget. To create a widget, one
has to start from a FormManager. All of the classes FormManager, Form,
FormDefintion, FormDefinitionBuilder, Widget, WidgetDefinition,
WidgetDefinitionBuilder, ..etc. are coupled so tight. Even a widget has an
association to its definition. It seems impossible to create a widget
without through its definition. Hence, to dynamically modify a form's
structure is not that easy in cforms. I originally thought it should be
quite easy to do it like in wicket.

Rice

On 3/24/07, Rice Yeh <ri...@gmail.com> wrote:
>
> Hi,
>   I am writing some code to insert widgets into a form dynamically in the
> on-action event of an action widget. But I have the most code written in a
> java method first. Since my code is not in a Serviceable class, I don't have
> access to a service manager. But I need to access the LibraryManager. I try
> to access it through the spring WebApplicationContext, but it says there is
> no such bean definition. With the same way, I can access SourceResolver. My
> code is like the following:
>
> WebAppContextUtils.*getCurrentWebApplicationContext*().getBean(
> org.apache.cocoon.forms.formmodel.library.LibraryManager.*ROLE* );
> How can I get the LibraryManager without a ServiceManager?
>
> Rice
>