This content has been marked as final.
Show 4 replies
-
1. Re: Programmatic component creation
dhinojosa Feb 21, 2010 2:48 AM (in response to cyberoblivion)I'll bite...Seems unnecessary to do such a thing considering a component is lazily instantiated when called from a page, i.e.#{myComponent.myProperty}. What is your goal?
-
2. Re: Programmatic component creation
cyberoblivion Feb 23, 2010 4:49 PM (in response to cyberoblivion)I guess the idea is to dynamically set what #{myComponent} resolves to at runtime based on application configuration data from a database rather than a static components.xml file or annotations on pojos. -
3. Re: Programmatic component creation
samdoyle Feb 23, 2010 10:55 PM (in response to cyberoblivion)Have a component that is @In @Out set it to the value?
Have an accessor method which retrieves the component you need when needed? e.g. #{componentCreator.getComponent(whatever)} -
4. Re: Programmatic component creation
dhinojosa Feb 23, 2010 11:29 PM (in response to cyberoblivion)I was going to go along with Samuel's answer except that I am not a fan of @Out, but to each their own.
My solution, if interested, would be:
@Name("componentCreator") public void Parent { private Map<String, Object> children; @In("componentChildMap") public void setChildren(Map<String, Object> children) { this.children = children; } public void makeBabies() { this.children.add(....) this.children.remove(...) } }
where you can get the components you need by:
#{componentChildMap.get['blah'].someProperty}