0

The ScreenRender is initialised with ScreenRenderImpl in ScreenFacadeImpl.makeRender, while ScreenFacade is initialised in ExcecutionContextFactoryImpl. In some cases, I would like to add more functions in ScreenRender that can be invoked in Macro templates. Instead of overriding the ExecutionContextFactoryImpl and down to ScreenRenderImpl as well s MoquiContextListener, is there a way to simply inject a sub class of ScreenRenderImpl when ScreenFacade.makeRender?

A real case to get support of sri in macro template is:

I am trying to populate the options of select via list-options or entity-options or via manual option which return by sri.getFieldOptions(). But it is kind of bound to form fields. I want to use in non-form context. So I kind of want to extend ScreenRender to have a function like sri.getOptions().

Jimmy Shen
  • 240
  • 1
  • 12
  • I don't think extending ScreenRenderImpl is a good way to do this. If you change the SRI code in a forked repo for your use you can send me a diff/patch of the changes and I'll review them for inclusion in the project. In general you can also create other classes or methods that take the sri as a parameter. – David E. Jones Apr 10 '14 at 06:27
  • Sure, with forking and maintain another version for own use, the purpose could be served. If the code is integrated into the your tree, everyone could use it then. However there would be some cases that the code might be too specific to be integrate to your tree, then it would be a pain to maintain a copy of ScreenRender code since code is updated in one file/place. Writing a sub class of ScreenRenderImpl separate code change . – Jimmy Shen Apr 10 '14 at 08:25
  • If create other class taking sri as parameter, then how to do it? I noticed that sri has reference back to ec, but ec does not have one to sri other than makeRender to get a new instance of sri. So if let other class to get sri reference by calling ec.makeRender, it seems it doubles sri instances and would impact the performance. – Jimmy Shen Apr 10 '14 at 08:29
  • By the way, no matter what approach to extend SRI functions, I will still contribute the general functions back. – Jimmy Shen Apr 10 '14 at 08:31

0 Answers0