Hello,

This aproach didn't work for me. I tried first only adding an AjaxEditableLabel in my ComponentResolver, but once I clicked the label (in order to change into an edit box) wicket complained that it couldn't find the AjaxEditableLabel component in the Page. So that's how I ended up overwriting resolveListenerInterfaceTarget in order to resolve the AjaxEditableLabel. I couldn't return a new instance of it (because adding it to the page at this point seems difficult) so I thought to use the session.

Our intended translation tag looks like this: <wicket:translation key="home:nameField">[Here the default value for it]</wicket:translation>. We need something like this because we are porting an existing webapp to Wicket that has a similar mechanism now.

Thanks,
Alexandru

On 09/23/2010 02:07 PM, Martin Grigorov wrote:
I'm not sure why the children disappear but it looks odd to me to save
component in the session in first place.

why not:
if (request.getParameter("editMode")) { label = new AjaxEditableLabel(id,
model);} else {label = new Label(id, model);}
parent.addOrReplace(label);

?

On Thu, Sep 23, 2010 at 12:24 PM, Mihai Postelnicu<
[email protected]>  wrote:

Guys,
I work on the same project as below (integrating an interface translator
with Wicket) and we are a bit stuck. Any ideas?

Thanks in advance for your time !
Mihai


On 09/23/2010 12:29 PM, Alexandru Artimon wrote:

  Forgot to mention that the component is an AjaxEditableLabel and I need
to save it to session because I'm creating a custom wicket tag for
translation purposes. When in translator mode I want all the labels to be
replaced by AjaxEditableLabel's so that the translator can do his job
easier.

The problem I have is that when I click on the label of the
AjaxEditableLabel, it produces an ajax request in order to change visibility
modes and show the edit box. I did my custom tag replacing by implementing
an IComponentResolver, which (from what I figured) happens on render. So my
AjaxEditableLabel component isn't in the page when the Ajax request arrives.
I planned to solve this by fetching the missing component from the session
on my own, by overwriting resolveListenerInterfaceTarget. Now when I fetch
the original AjaxEditableLabel from the session, all it's children (the
Label and TextField) are gone.

Any ideas will be much appreciated.

Thanks,
Alexandru



On 09/23/2010 11:57 AM, Alexandru Artimon wrote:

Hello,

I have a problem when saving a component to the session, all it's
children disappear.
I do the save like this:

    session.bind();
    session.setMetaData(MY_KEY, component);


Regards,
Alexandru



Reply via email to