thats simple
what you there create is an inner class in an inner class...
so your textfield has a ajax behavior that is an inner class fo the Visitor
inner class so that behavior has a parent reference to the visitor..
make that ajax behavior his own class and your problem is solved
johan
On Tue, Nov 4, 2008 at 4:26 PM, Adriano dos Santos Fernandes <
[EMAIL PROTECTED]> wrote:
> I had a serialization problem (when redeploying the application in Tomcat)
> that I can't understand... Basically, I had this on my Page.onBeforeRender:
> ---------------
> visitChildren(TextField.class, new Visitor<TextField<?>>() {
> private static final long serialVersionUID = 1L;
>
> public Object component(TextField<?> textField)
> {
> textField.add(new AjaxEventBehavior("onchange") {
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void onEvent(AjaxRequestTarget target)
> {
> if (mode == Mode.NAVIGATE)
> {
> mode = Mode.EDIT;
> setupMode();
> target.addComponent(buttonPanel);
> }
> }
> });
>
> setupValidators(textField);
> return IVisitor.CONTINUE_TRAVERSAL;
> }
> });
> ---------------
>
> The non-serializable class was the one created by "new
> Visitor<TextField<?>> () { ... }". Creating MyVisitor and replacing this
> call solved the problem:
> ---------------
> private abstract class MyVisitor<X extends Component>
> implements IVisitor<X>, Serializable
> {
> private static final long serialVersionUID = 1L;
> }
> ---------------
>
> Why should a non-serializable Visitor could case this problem? Does (why?)
> it get cached on the page?
>
>
> Adriano
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>