Hi,
I really found the BeanItemContainer great to use, however, there is something I don’t really understand about this container:
In my application, i want to display the order lines of customer orders. To represent the orders, I have a clean model composed of 3 classes: Order, OrderLine, OrderLineAttribute. One Order contains OrderLines, which contains Attributes.
When getting information about a particular customer, I populate the order and order lines in memory as Order beans. To display my order and order lines, I wrap them in dedicated OrderContainer and OrderLineContainer, which both extend BeanItemContainer. My problem occurs when for example I want to display the associated Account First & Last Name linked to an order in my Order table.
I create a table to display a summary of the orders, and I tight it to my OrderContainer which wraps Order Beans.
My Order Beans do not contain accountFirstName or accountLastName as properties: they contain an account property of type Account. And the associated account bean has properties of firstName & lastName.
My question is: how do I display the associated account firstName & lastName without modifying the Order Bean? I don’t want to polluate my Order bean by adding getAccountFirstname and getAccountLastName method to it, which would return this.account.getFirstName() and this.account.getLastName. Is there any way to add this generated property to the Container directly?
Thanks for your insight on how I should tackle that!
Yannick