Multiple AjaxLazyLoadPanel's never load

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple AjaxLazyLoadPanel's never load

Michael Zhavzharov
This post was updated on .
Hi, all!

I have a problem with list of AjaxLazyLoadPanels. Only the first panel loads, but others never. It's looks like this:


I need to load N lazyPanels, and I trying to do next:

In Java:

List components = new ArrayList();
for (int i = 0; i < 6; i++) {
    components.add(i);
}

add(new ListView("list", components) {
            @Override
            protected void populateItem(ListItem item) {
                item.add(new AjaxLazyLoadPanel("ajaxPanel") {
                    @Override
                    public Component getLazyLoadComponent(String markupId) {
                        return new Label(markupId, "Simple Label");
                    }
                });
            }
});

In HTML:
        <div wicket:id="list">
            <div wicket:id="ajaxPanel" id="ajaxPanel" ></div>
        </div>

But this does not works.
I tried to set every ALLP's markupId unique, but this led to the fact that even the first element-loaded stoped.

Can somebody help me with this problem?

Regards, Michael.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Martin Grigorov-4
Hi,

I'm not sure why it stops but I see another problem in it.
There is synchronization when using the page instance, i.e. the first
Ajax call will acquire the lock on the page and all other requests
will have to wait it to release it. So the ALLPs will load
sequentially.

How to solve this? It depends on the type of data you need to load.
You can use Wicket IResource which is not locked like Page, or
Atmosphere/Native Web Sockets to push the data when ready.

On Fri, Oct 12, 2012 at 10:24 AM, Michael Zhavzharov
<[hidden email]> wrote:

> Hi, all!
>
> I have a problem with list of AjaxLazyLoadingPanels. Only the first panel
> loads, but others never. It's looks like this:
> <http://apache-wicket.1842946.n4.nabble.com/file/n4652907/lazyloading.jpg>
>
> I need to load N lazyPanels, and I trying to do next:
>
> *In Java:*
>
> List components = new ArrayList();
> for (int i = 0; i < 6; i++) {
>     components.add(i);
> }
>
> add(new ListView("list", components) {
>             @Override
>             protected void populateItem(ListItem item) {
>                 item.add(new AjaxLazyLoadPanel("ajaxPanel") {
>                     @Override
>                     public Component getLazyLoadComponent(String markupId) {
>                         return new Label(markupId, "Simple Label");
>                     }
>                 });
>             }
> });
>
> *In HTML:*
>         <div wicket:id="list">
>             <div wicket:id="ajaxPanel" id="ajaxPanel" ></div>
>         </div>
>
> But this does not works.
> I tried to set every ALLP's markupId unique, but this led to the fact that
> even the first element-loaded stoped.
>
> Can somebody help me with this problem?
>
> Regards, Michael.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Multiple-AjaxLazyLoadingPanel-s-never-load-tp4652907.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Michael Zhavzharov
This post was updated on .
Hi, Martin! Thank You for your reply.

I realized, that it is not an option for me to use ALLP. I need to load different data - Labels, Link and Image in one lazy panel, also I should be able to interact with other components in page, while ALLP loads it's content.

>>>You can use Wicket IResource which is not locked like Page,

I don't understand how to use IResource instead of Page. As I know IResource could carry an image, or css, and is not used like MarkupContainer. Am I wrong?

>>>Atmosphere/Native Web Sockets to push the data when ready

It seems to me, that time has come to learn sockets.


Nevertheless, it is interesting to understand the problem with ALLP.
I put sleep() into getLazyLoadComponent method and set different Models for returned Label. After starting the app I saw, that every ALLP changes first generated Label to it's own. It's looks like this:
Label1                                 Label2                                       Label3
*                  become           *                     become                *
*                                         *                                                *
(where * - loading indicator)

I think all the same that the matter is in markupId, but can't fix it.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Martin Grigorov-4
Hi,

On Fri, Oct 12, 2012 at 5:43 PM, Michael Zhavzharov <[hidden email]> wrote:

> Hi, Martin! Thank You for your reply.
>
> I realized, that it is not an option for me to use ALLP. I need to load
> different data - Labels, Link and Image in one lazy panel, also I should be
> able to interact with other components in page, while ALLP loads it's
> content.
>
>>>>You can use Wicket IResource which is not locked like Page,
>
> I don't understand how to use IResource instead of Page. As I know IResource
> could carry an image, or css, and is not used like MarkupContainer. Am I
> wrong?
>

You are correct. With IResource you can deliver back only data (JSON,
byte[], XML, ...). So my suggestion was applicable in the case when
you want to load some data to show it. If you need to replace the
loading image with Wicket components then it is still possible but
again you'll need to acquire the page lock, i.e. you will face the
same problem.

>>>>Atmosphere/Native Web Sockets to push the data when ready
>
> It seems to me, that time has come to learn sockets.

This approach is the same as with IResource - you need the page lock
to be able to work with Components.

>
>
> Nevertheless, it is interesting to understand the problem with ALLP.
> I put sleep() into getLazyLoadComponent method and set different Models for
> returned Label. After starting the app I saw, that every ALLP changes first
> generated Label to it's own. It's looks like this:
> Label1                                 Label2
> Label3
> *                  become           *                     become
> *
> *                                         *
> *
>
> I think all the same that the matter is in markupId, but can't fix it.

Please create a quickstart app and I'll take a look.

>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Multiple-AjaxLazyLoadPanel-s-never-load-tp4652907p4652925.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Michael Zhavzharov
>>>you'll need to acquire the page lock, i.e. you will face the same problem.

i.e. there is no way to load components in page, showing loading indicator and give user an opportunity to work with another elements on page?

Thank you for your concern.
I don't know were to load app, that's why I loaded it to Google docs:
allpProject.zip on google

Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Ernesto Reinaldo Barreiro-4
Hi,

On Mon, Oct 15, 2012 at 10:50 AM, Michael Zhavzharov <[hidden email]>wrote:

> >>>you'll need to acquire the page lock, i.e. you will face the same
> problem.
>
> i.e. there is no way to load components in page, showing loading indicator
> and give user an opportunity to work with another elements on page?
>
>
Roll your won version of AjaxLazyLoadPanel that instead of "blocking the
page"  just starts a timer that periodically checks if "panel contents are
ready". Once contents are ready replace the timer panel with the final
panel. This way you could create a more fluid user experience. I remember a
post by Igor where he suggested a modification of ALLP to achieve this but
I can't find the reference on my mail  box.


--
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com
Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Martin Grigorov-4
In reply to this post by Michael Zhavzharov
Hi,

On Mon, Oct 15, 2012 at 11:50 AM, Michael Zhavzharov
<[hidden email]> wrote:
>>>>you'll need to acquire the page lock, i.e. you will face the same problem.
>
> i.e. there is no way to load components in page, showing loading indicator
> and give user an opportunity to work with another elements on page?

There is. You need to use different names for the ajax channels of the
Ajax behaviors.
See org.apache.wicket.ajax.attributes.AjaxRequestAttributes#setChannel

>
> Thank you for your concern.
> I don't know were to load app, that's why I loaded it to Google docs:
> allpProject.zip on google
> <https://docs.google.com/open?id=0BwHokpA1QcAkdGk2QmdrQ0RhUzQ>

The solution is to remove id="ajaxPanel" from the markup. Just leave
wicket:id there.

>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Multiple-AjaxLazyLoadPanel-s-never-load-tp4652907p4652968.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Martin Grigorov-4
On Mon, Oct 15, 2012 at 2:56 PM, Martin Grigorov <[hidden email]> wrote:

> Hi,
>
> On Mon, Oct 15, 2012 at 11:50 AM, Michael Zhavzharov
> <[hidden email]> wrote:
>>>>>you'll need to acquire the page lock, i.e. you will face the same problem.
>>
>> i.e. there is no way to load components in page, showing loading indicator
>> and give user an opportunity to work with another elements on page?
>
> There is. You need to use different names for the ajax channels of the
> Ajax behaviors.
> See org.apache.wicket.ajax.attributes.AjaxRequestAttributes#setChannel

This will remove the synchronization at the client side but to improve
the blocking at the server side you will need to poll for the new
state as Ernesto suggested.

>
>>
>> Thank you for your concern.
>> I don't know were to load app, that's why I loaded it to Google docs:
>> allpProject.zip on google
>> <https://docs.google.com/open?id=0BwHokpA1QcAkdGk2QmdrQ0RhUzQ>
>
> The solution is to remove id="ajaxPanel" from the markup. Just leave
> wicket:id there.
>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Multiple-AjaxLazyLoadPanel-s-never-load-tp4652907p4652968.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Michael Zhavzharov
In reply to this post by Ernesto Reinaldo Barreiro-4
Hi, Ernesto.

Thank You, for your reply! May be this is an option. I'll try to find Igor's post
Reply | Threaded
Open this post in threaded view
|

Re: Multiple AjaxLazyLoadingPanel's never load

Michael Zhavzharov
In reply to this post by Martin Grigorov-4
Thank You very much, Martin!

I am ashamed that I did not solve this problem by myself.