autoadded components only exist during the render of the page.

-igor

On Fri, Sep 24, 2010 at 2:33 AM, Alexandru Artimon
<aarti...@dgfoundation.org> wrote:
>  Hello,
>
> I'll share the code gladly, here's the resolve method from the class
> implementing IComponentResolver:
>
>   public boolean resolve(MarkupContainer container,
>                MarkupStream markupStream, ComponentTag tag) {
>
>            if (tag.getName().compareTo("translate") == 0) {
>                String messageKey = tag.getAttributes().getString("key");
>                if ((messageKey == null) || (messageKey.trim().length()
>   == 0)) {
>                    throw new MarkupException(
>                            "Wrong format of <wicket:trn key='xxx'>:
>   attribute 'key' is missing");
>                }
>
>                final String id = TRANSLATION_COMPONENT_PREFIX +
>   container.getPage().getAutoIndex();
>
>                Session session = container.getPage().getSession();
>                session.bind();
>
>                AjaxEditableLabel label = new AjaxEditableLabel(id, new
>   Model(messageKey));
>                label.setOutputMarkupId(true);
>                boolean ret = container.autoAdd(label, markupStream);
>
>                session.setMetaData(TRANSLATION_KEY, label);
>
>                // Yes, we handled the tag
>                return true;
>            }
>
>            // We were not able to handle the tag
>            return false;
>        }
>
>
> On 09/24/2010 12:25 PM, Alexander Morozov wrote:
>>
>> Alexandru Artimon wrote:
>>>
>>> The thing is that I'm coding my own tag<wicket:translate>  and I use a
>>> class that implements IComponentResolver in order to resolve it.
>>> Now the problem is that when I click on the AjaxEditableLabel (that took
>>> place of my tag) it makes an Ajax request in order to hide the label and
>>> show the editor, but wicket can't find the component in the page.
>>> Probably because the component resolver is run on render and the ajax
>>> request doesn't reach that point (or doesn't need to). So thats why I
>>> try to resolve the RequestTarget myself for the AjaxRequest and this
>>> involves the session stuff. I didn't find a better way yet. Maybe you
>>> guys have other ideas ?
>>
>> I think that the problem is in<wicket:translate>  resolver. You should
>> share
>> the code...
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to