I always find using PropertyChangeSupport and ProperyChangeListener is a lot of work and kinda pollutes your code. But it is a solution. Maybe a combination of ProperyChangeListener and AOP could be made to reduce the required boilerplate code.

Matthijs

Johan Compagner wrote:
thats just a listener interface for example PropertyChangeListener (but you
can make it more specific interface)
Just make a base model that has add/removePropertyChangeListener and let
your components listen to that

johan


On Mon, Jul 7, 2008 at 8:28 AM, Matthijs Wensveen <[EMAIL PROTECTED]>
wrote:

Timo Rantalaiho wrote:

On Fri, 04 Jul 2008, Matthijs Wensveen wrote:


How do you cope with deeply nested model properties? For example:

public class PersonViewer extends Component<Person> {
..
}

some other component does:
person.getOrders().get(0).setAmount(0); // first order for free (as in
beer)


I have no idea of Johan's project, but normally you just edit an object in
one place at a time, and PersonViewer would be a read-only component with a
model that always pulls the freshest version of the person it is displaying
from the database.

Best wishes,
Timo



The thing is that when using Ajax you have to specifically add PersonViewer
to the AjaxRequestTarget when 'some other component' modifies the Person
object. The problem is that 'some other component' might not even know about
or have access to PersonViewer (maybe it's a 3rd-party component).
OnModelChanged does not work in this case, because there is no call to
setModelObject, just to some setter of the Person object.

While Ajax does very nice things to the GUI, it kinda messes up the
model-driven (as in wicket model) approach to gui development. That is why I
was thinking about some aspect-oriented solution to let components know
about model updates, even when they keep a reference to the same object.

Matthijs

--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to