> I´m really new to web programming, so how should that solve my Problem? If I 
> got it right the mediator does only know the colleagues which would be Panels 
> in my case. But the methods of these colleague Panels are hidden because of 
> inheritance (myPanel is child of Panel). Could you describe this solution a 
> bit deeper?

In general terms:

class A extends Panel {

        private ABMediator mediator;

                //...
                add(new AjaxLink<Void>("theLink") {
                        public void onClick(AjaxRequestTarget target) {
                                mediator.callIntoB(target);
                });
        }
}

class B extends Panel {

        // ...

        public methodForTheMediator(AjaxRequestTarget target) {
                // Do something
                target.addComponent(someBComponent);
        }
}

class ABMediator {
        private A a;
        private B b;

        // ...

        public void callIntoB(AjaxRequestTarget target) {
                b. methodForTheMediator(target);
        }
}

You could also leave out passing around the target and instead get it using 
AjaxRequestTarget.get(). As you see, the method invoked on B is public in this 
case.

- Tor Iver

Reply via email to