If we dont want to add any specific DI implementation, and Dashboard
depends on DashboardPersister, WidgetFactory,
WidgetRegistry then I guess there are two ways we can do here:

1. constructor

Dashboard constructor will take DashboardPersister,
WidgetFactory, WidgetRegistry as parameters. Or we can create
DashboardDependeciesBuilder that takes DashboardPersister, WidgetFactory,
WidgetRegistry as parameter, with one method build(String wicketId) that
creates Dashboard - this way we could add DashboardDepdenciesBuilder to our
CI and use it later on to create Dashboard. Something like this:

@SpringBean
private DashboarDepenciesBuilder ddb;
//...
add(ddb.build("dashboard"));


2. interface implemtation on WicketApplication object

This will suck becasue it will make tests almost imposible,but we could
define interface that clients project's WicketApplication would have to
implement (lets call it for example DashboardDepenciesProvider). Then in
your code you could do something like this:

checkState(WicketApplication.get() instantce of DashboardDepenciesProvider,
"WicketApplication must implements DashboardDepenciesProvider");
DashboardDepenciesProvider ddp =
(DashboardDepenciesProvider)WicketApplication.get();
ddp.getDashboardPersister() // and so on


Paul Szulc

On Tue, Oct 2, 2012 at 10:37 AM, Decebal Suiu <decebal.s...@asf.ro> wrote:

> Hi Paul
>
> Thanks for the feedback. I will split the project in modules asap. In my
> mind are some problems related to modularity that cannot be resolved so
> easy: how can I inject some components (DashboardPersister, WidgetFactory,
> WidgetRegistry) in wicket-dashboard? Now these components are singletons
> defined in DashboardApplication (demo package). In a real application
> (NextReports server for example), you may want to inject these components
> using a DI framework (spring framework in our case) and probably you want
> to
> save the dashboard layout in a database or jcr.
> Other problem is to add custom actions to widget header panel as
> contributors.
>
> Sure, the first step will be to split the project in core, demo, standard
> widgets and after this step to resolve the problems described above.
>
> Best regards,
> Decebal
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Announce-wicket-dashboard-tp4652308p4652595.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to