Re: Lock timeout per page class

2014-10-28 Thread Martin Grigorov
Hi,

I share Sebastien's concern.
I'll see how to workaround this.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sat, Oct 25, 2014 at 2:57 PM, Sebastien seb...@gmail.com wrote:

 Hi Guillaume,

 Generally speaking, you cannot call a non final method from a
 constructor...

 Best regards,
 Sebastien
 On Oct 25, 2014 1:32 PM, Guillaume Smet guillaume.s...@gmail.com
 wrote:

  Hi Martin,
 
  I got something working with the following changes in Wicket:
 
 
 https://github.com/openwide-java/wicket/commit/6374a4a7c6fb66841143a88933523f97305cf1a4
 
  Do you consider this commitable? If so, I can create a JIRA issue and
 push
  a PR.
 
  Having the pageId in the getTimeout call is quite nice as I don't have
  to get it again from the PageRequestHandlerTracker.
 
  Thanks for your feedback.
 
  On Fri, Oct 24, 2014 at 9:16 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
   If you have a base page then BasePage#onInitialize() should be a good
  place.
   Or you could add the pageIds of the special/slow pages only in the map.
  
   Otherwise you may use PageRequestHandlerTracker#getLastHandler in a
  custom
   IRequestCycleListener#onDetach().
  
   Martin Grigorov
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Fri, Oct 24, 2014 at 10:11 AM, Guillaume Smet 
  guillaume.s...@gmail.com
   wrote:
  
   Hi Martin,
  
   Yeah, I thought about that too but I'm not sure of the best place to
   build the pageId - pageClassName map. Any advice about this?
  
   Once I'll get this working, I'll build a PR for the few changes I made
   in Wicket (based on what you proposed earlier). Would be nice to have
   them in 6.18.
  
   On Fri, Oct 24, 2014 at 8:59 AM, Martin Grigorov 
 mgrigo...@apache.org
   wrote:
Hi Guillaume,
   
Sorry for not thinking more carefully about this the first time!
I'm afraid it is not possible to do it the way I suggested.
PageAccessSynchronizer is the entry point to start using a page and
 it
works only with pageId!
   
Here is a new hackish approach:
Store pageId - pageClassName map in the Session. Then when
PageAccessSynchronizer is requested to lock a page by id use that id
  to
resolve the class name and to decide what timeout to use.
   
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
   
On Thu, Oct 23, 2014 at 5:44 PM, Guillaume Smet 
   guillaume.s...@gmail.com
wrote:
   
Hi Martin,
   
On Wed, Oct 22, 2014 at 9:51 AM, Martin Grigorov 
  mgrigo...@apache.org
wrote:
 I'd like to avoid moving the logic that gets the timeout from
 Session.PageAccessSynchronizerProvider to PageAccessSynchronizer
   because
 this way it will use Application.get() everytime and most apps
  don't
   need
 to pay for this.

 A way to make it possible for you is to remove the 'final'
 from org.apache.wicket.Session#getPageManager and introduce
   overridable
 PageAccessSynchronizer#getTimeout(). This way you can use your
 own
 PageAccessSynchronizer.
 http://pastie.org/9667070
   
After a few experiments, here I am!
   
So, it mostly works: I thought it would be better to add something
  like:
protected IProviderPageAccessSynchronizer
newPageAccessSynchronizerProvider()
{
return new PageAccessSynchronizerProvider();
}
in Session and call it from the constructor instead of removing the
final so I did that in my code.
   
It works pretty well BUT I haven't found a way to get the page
 class
in getTimeout without having the risk to trigger a
  resolvePageInstance
which will try to lock and then call getTimeout leading to a
  wonderful
stack overflow exception when dealing with
ListenerInterfaceRequestHandler.
   
Obviously (...) what interests me the most is the getTimeout in
ListenerInterfaceRequestHandler as it's often actions on buttons
  which
are long to run.
   
Here is what I have in mind for my Session class:
https://gist.github.com/gsmet/3b9e2775d25fadcef5ef
   
I must admit that an advice would be welcome as I wouldn't like to
have stack overflow errors popping out in weird edge cases.
   
Thanks!
   
--
Guillaume
   
   
 -
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
   
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: jquery DataTable + wicket Cannot bind a listener

2014-10-28 Thread Martin Grigorov
Hi,

You should read about JavaScript event delegation. This is what they
recommend.

Wicket has basic support for this
with org.apache.wicket.ajax.attributes.AjaxRequestAttributes#setChildSelector.
I.e. you can register an Ajax behavior on the table or tbody and use
childSelector to listen for events only on specific children, e.g. 'tr',
'td', 'td div', etc.

This is more lightweight than using Wicket's built-in AjaxLink, but it is
also a bit more complex for you as an application developer.

Good luck!


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 27, 2014 at 8:37 PM, Jason Novotny jason.novo...@gmail.com
wrote:


 Hi Martin,

 Thanks for the help-- I've reached out to them, the js appears pretty
 complex
 http://cdn.datatables.net/1.10.3/js/jquery.dataTables.js


 They indicate that listeners need to be added according to:
 http://www.datatables.net/examples/advanced_init/events_live.html

 Is there any kind of mode in wicket possibly that would preserve the
 listeners in this way?

 Thanks, Jason


 On 10/26/14, 11:40 PM, Martin Grigorov wrote:

 Hi,

 Try with Ajax loading of the new pages.

 I am not sure how DataTables removes and re-adds the rows later. It should
 use jQuery's clone(true, true) to preserve the event bindings. Ask in
 their
 forums.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Sun, Oct 26, 2014 at 12:46 AM, Jason Novotny jason.novo...@gmail.com
 wrote:

  I've managed to figure out the cause of the problem but no solution.

 jquery datatables removes DOM elements when configured for pagination.
 This means the AjaxLinks in my listview generate wicket javascript like:

 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-0-
 detailsLink,e:click,c:
 detailsLinkff});;
 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-1-
 detailsLink,e:click,c:
 detailsLink100});;
 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-2-
 detailsLink,e:click,c:
 detailsLink101});;
 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-3-
 detailsLink,e:click,c:
 detailsLink102});;
 ...


 If the table has 2 pages, it removes the DOM elements from the 2nd page
 so
 I get the wicket debug error  Wicket.Ajax: Cannot bind a listener for
 event click on element elementId because the element is not in the
 DOM

 Now when I hit the link for next page of the table, the DOM has been
 updated to reflect the rows, but the javascript events need to be added
 again and so the links are broken.

 Is there any good way to do this?

 Thanks, Jason


 On 10/24/14, 1:24 PM, Jason Novotny wrote:

  I should add I'm using Wicket 6.17.

 Thanks, Jason

 On 10/24/14, 10:47 AM, Jason Novotny wrote:

  Hi,

 I'm using latest jquery DataTable with a ListView and in wicket:head of
 the page, I initiate the DataTable:

 $(function () {
  $('.datatable_executed').dataTable({
  'lengthChange': false,
  'dom': 'topdoc-filterholdeript',
  language: {info: _START_-_END_ of _TOTAL_},
  aaSorting: [],
  'iDisplayLength': 12
  });
  });

 It all looks good, however because one of my columns contains
 AjaxLinks,
 I get an error from my wicket debug window with the following:
 Wicket.Ajax: Cannot bind a listener for event click on element
 elementId because the element is not in the DOM

 The thing is the links seem to actually work on the first page, but
 when
 I click - to go to the next page the links don't work. Has anyone
 experienced this before or have any idea how I can debug this?

 Thanks, Jason




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




Re: Lock timeout per page class

2014-10-28 Thread Martin Grigorov
Here is my version: http://pastie.org/9680245
Please create a ticket in JIRA if you like it.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 28, 2014 at 9:52 AM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi,

 I share Sebastien's concern.
 I'll see how to workaround this.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Sat, Oct 25, 2014 at 2:57 PM, Sebastien seb...@gmail.com wrote:

 Hi Guillaume,

 Generally speaking, you cannot call a non final method from a
 constructor...

 Best regards,
 Sebastien
 On Oct 25, 2014 1:32 PM, Guillaume Smet guillaume.s...@gmail.com
 wrote:

  Hi Martin,
 
  I got something working with the following changes in Wicket:
 
 
 https://github.com/openwide-java/wicket/commit/6374a4a7c6fb66841143a88933523f97305cf1a4
 
  Do you consider this commitable? If so, I can create a JIRA issue and
 push
  a PR.
 
  Having the pageId in the getTimeout call is quite nice as I don't have
  to get it again from the PageRequestHandlerTracker.
 
  Thanks for your feedback.
 
  On Fri, Oct 24, 2014 at 9:16 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
   If you have a base page then BasePage#onInitialize() should be a good
  place.
   Or you could add the pageIds of the special/slow pages only in the
 map.
  
   Otherwise you may use PageRequestHandlerTracker#getLastHandler in a
  custom
   IRequestCycleListener#onDetach().
  
   Martin Grigorov
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Fri, Oct 24, 2014 at 10:11 AM, Guillaume Smet 
  guillaume.s...@gmail.com
   wrote:
  
   Hi Martin,
  
   Yeah, I thought about that too but I'm not sure of the best place to
   build the pageId - pageClassName map. Any advice about this?
  
   Once I'll get this working, I'll build a PR for the few changes I
 made
   in Wicket (based on what you proposed earlier). Would be nice to have
   them in 6.18.
  
   On Fri, Oct 24, 2014 at 8:59 AM, Martin Grigorov 
 mgrigo...@apache.org
   wrote:
Hi Guillaume,
   
Sorry for not thinking more carefully about this the first time!
I'm afraid it is not possible to do it the way I suggested.
PageAccessSynchronizer is the entry point to start using a page
 and it
works only with pageId!
   
Here is a new hackish approach:
Store pageId - pageClassName map in the Session. Then when
PageAccessSynchronizer is requested to lock a page by id use that
 id
  to
resolve the class name and to decide what timeout to use.
   
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
   
On Thu, Oct 23, 2014 at 5:44 PM, Guillaume Smet 
   guillaume.s...@gmail.com
wrote:
   
Hi Martin,
   
On Wed, Oct 22, 2014 at 9:51 AM, Martin Grigorov 
  mgrigo...@apache.org
wrote:
 I'd like to avoid moving the logic that gets the timeout from
 Session.PageAccessSynchronizerProvider to PageAccessSynchronizer
   because
 this way it will use Application.get() everytime and most apps
  don't
   need
 to pay for this.

 A way to make it possible for you is to remove the 'final'
 from org.apache.wicket.Session#getPageManager and introduce
   overridable
 PageAccessSynchronizer#getTimeout(). This way you can use your
 own
 PageAccessSynchronizer.
 http://pastie.org/9667070
   
After a few experiments, here I am!
   
So, it mostly works: I thought it would be better to add something
  like:
protected IProviderPageAccessSynchronizer
newPageAccessSynchronizerProvider()
{
return new PageAccessSynchronizerProvider();
}
in Session and call it from the constructor instead of removing
 the
final so I did that in my code.
   
It works pretty well BUT I haven't found a way to get the page
 class
in getTimeout without having the risk to trigger a
  resolvePageInstance
which will try to lock and then call getTimeout leading to a
  wonderful
stack overflow exception when dealing with
ListenerInterfaceRequestHandler.
   
Obviously (...) what interests me the most is the getTimeout in
ListenerInterfaceRequestHandler as it's often actions on buttons
  which
are long to run.
   
Here is what I have in mind for my Session class:
https://gist.github.com/gsmet/3b9e2775d25fadcef5ef
   
I must admit that an advice would be welcome as I wouldn't like to
have stack overflow errors popping out in weird edge cases.
   
Thanks!
   
--
Guillaume
   
   
 -
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
   
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 
  

Re: [7.0.0-SNAPSHOT] WebSocketResponse#sendError throws UnsupportedOperationException

2014-10-28 Thread Martin Grigorov
Hi Sebastien,

I've improved it with https://issues.apache.org/jira/browse/WICKET-5737
Please let me know if you see more improvements.
Thanks !

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 23, 2014 at 8:08 PM, Sebastien seb...@gmail.com wrote:

 Hi Martin,

 I finally end up with the underlying issue, I will open a new thread for
 that one... (I am not sure you will like it :s)

 Regarding this thread, I confirm you that's important to log the error
 instead of throwing the UnsupportedOperationException. Actually, the error
 message was empty but at least it did not shortcut the other exception. I
 made the change locally that's what helps me to understand what was
 happening...

 Thanks  best regards,
 Sebastien.


 On Mon, Oct 13, 2014 at 10:37 AM, Sebastien seb...@gmail.com wrote:

  Hi Martin,
 
  If #sendError() is called on purpose, then you are right it should not be
  ignored
  Sadly, I do not have many time to investigate more on this and try to
  understand the exact behavior and the relationship with the error thrown
 on
  my side. (It was part of a PoC I'm not supposed to work on for now...)
 
  I will let you know if I have some news...
 
  Thanks again  best regards,
  Sebastien.
 
 
 



Re: jquery DataTable + wicket Cannot bind a listener

2014-10-28 Thread Jason Novotny


Hi Martin,

Are there examples? What about this simple piece of code...

WebMarkupContainer tbody = new WebMarkupContainer(tbody);
tbody.add(new AjaxEventBehavior(onclick) {
@Override
protected void onEvent(AjaxRequestTarget target) {

}

protected void updateAjaxAttributes(AjaxRequestAttributes 
attributes) {

super.updateAjaxAttributes(attributes);
attributes.setChildSelector(td);
// TODO what do i do here?
}
});


Thanks, Jason

On 10/28/14, 1:10 AM, Martin Grigorov wrote:

Hi,

You should read about JavaScript event delegation. This is what they
recommend.

Wicket has basic support for this
with org.apache.wicket.ajax.attributes.AjaxRequestAttributes#setChildSelector.
I.e. you can register an Ajax behavior on the table or tbody and use
childSelector to listen for events only on specific children, e.g. 'tr',
'td', 'td div', etc.

This is more lightweight than using Wicket's built-in AjaxLink, but it is
also a bit more complex for you as an application developer.

Good luck!


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 27, 2014 at 8:37 PM, Jason Novotny jason.novo...@gmail.com
wrote:


Hi Martin,

Thanks for the help-- I've reached out to them, the js appears pretty
complex
http://cdn.datatables.net/1.10.3/js/jquery.dataTables.js


They indicate that listeners need to be added according to:
http://www.datatables.net/examples/advanced_init/events_live.html

Is there any kind of mode in wicket possibly that would preserve the
listeners in this way?

Thanks, Jason


On 10/26/14, 11:40 PM, Martin Grigorov wrote:


Hi,

Try with Ajax loading of the new pages.

I am not sure how DataTables removes and re-adds the rows later. It should
use jQuery's clone(true, true) to preserve the event bindings. Ask in
their
forums.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sun, Oct 26, 2014 at 12:46 AM, Jason Novotny jason.novo...@gmail.com
wrote:

  I've managed to figure out the cause of the problem but no solution.

jquery datatables removes DOM elements when configured for pagination.
This means the AjaxLinks in my listview generate wicket javascript like:

Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
executedTransactionPanel-executedListView-0-
detailsLink,e:click,c:
detailsLinkff});;
Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
executedTransactionPanel-executedListView-1-
detailsLink,e:click,c:
detailsLink100});;
Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
executedTransactionPanel-executedListView-2-
detailsLink,e:click,c:
detailsLink101});;
Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
executedTransactionPanel-executedListView-3-
detailsLink,e:click,c:
detailsLink102});;
...


If the table has 2 pages, it removes the DOM elements from the 2nd page
so
I get the wicket debug error  Wicket.Ajax: Cannot bind a listener for
event click on element elementId because the element is not in the
DOM

Now when I hit the link for next page of the table, the DOM has been
updated to reflect the rows, but the javascript events need to be added
again and so the links are broken.

Is there any good way to do this?

Thanks, Jason


On 10/24/14, 1:24 PM, Jason Novotny wrote:

  I should add I'm using Wicket 6.17.

Thanks, Jason

On 10/24/14, 10:47 AM, Jason Novotny wrote:

  Hi,

I'm using latest jquery DataTable with a ListView and in wicket:head of
the page, I initiate the DataTable:

$(function () {
  $('.datatable_executed').dataTable({
  'lengthChange': false,
  'dom': 'topdoc-filterholdeript',
  language: {info: _START_-_END_ of _TOTAL_},
  aaSorting: [],
  'iDisplayLength': 12
  });
  });

It all looks good, however because one of my columns contains
AjaxLinks,
I get an error from my wicket debug window with the following:
Wicket.Ajax: Cannot bind a listener for event click on element
elementId because the element is not in the DOM

The thing is the links seem to actually work on the first page, but
when
I click - to go to the next page the links don't work. Has anyone
experienced this before or have any idea how I can debug this?

Thanks, Jason




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





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



Re: [7.0.0-SNAPSHOT] WebSocketResponse#sendError throws UnsupportedOperationException

2014-10-28 Thread Sebastien
Hi Martin,

Tested, I like it :)

Thanks,
Sebastien.


On Tue, Oct 28, 2014 at 10:37 AM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi Sebastien,

 I've improved it with https://issues.apache.org/jira/browse/WICKET-5737
 Please let me know if you see more improvements.
 Thanks !

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Thu, Oct 23, 2014 at 8:08 PM, Sebastien seb...@gmail.com wrote:

  Hi Martin,
 
  I finally end up with the underlying issue, I will open a new thread for
  that one... (I am not sure you will like it :s)
 
  Regarding this thread, I confirm you that's important to log the error
  instead of throwing the UnsupportedOperationException. Actually, the
 error
  message was empty but at least it did not shortcut the other
 exception. I
  made the change locally that's what helps me to understand what was
  happening...
 
  Thanks  best regards,
  Sebastien.
 
 
  On Mon, Oct 13, 2014 at 10:37 AM, Sebastien seb...@gmail.com wrote:
 
   Hi Martin,
  
   If #sendError() is called on purpose, then you are right it should not
 be
   ignored
   Sadly, I do not have many time to investigate more on this and try to
   understand the exact behavior and the relationship with the error
 thrown
  on
   my side. (It was part of a PoC I'm not supposed to work on for now...)
  
   I will let you know if I have some news...
  
   Thanks again  best regards,
   Sebastien.
  
  
  
 



Re: jquery DataTable + wicket Cannot bind a listener

2014-10-28 Thread Martin Grigorov
Hi,

On Tue, Oct 28, 2014 at 5:00 PM, Jason Novotny jason.novo...@gmail.com
wrote:


 Hi Martin,

 Are there examples? What about this simple piece of code...


I don't have any open source example at hand ... :-/



 WebMarkupContainer tbody = new WebMarkupContainer(tbody);
 tbody.add(new AjaxEventBehavior(onclick) {


use just 'click'


 @Override
 protected void onEvent(AjaxRequestTarget target) {

 }

 protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setChildSelector(td);
 // TODO what do i do here?


this is enough to make a listener on the whole tbody that will notify you
only when a td is clicked

to make it useful you will need some JS code to extract the values for this
td

e.g. attributes.getDynamicExtraParameters().add(return
extractData(attrs.event))

where 'extractData' is a your own JS function that is loaded in the current
document. It can extract all needed info from the JS event - event.target,
some data-xyz attributes, anything you need
once extracted you will need to put it in a JS object as the one returned
by http://api.jquery.com/jquery.param/

P.S. I think Ernesto Barreiro have created a demo at his GitHub account
before for another Wicket user. But I don't see it as a project at
https://github.com/reiern70/antilia-bits

}
 });


 Thanks, Jason


 On 10/28/14, 1:10 AM, Martin Grigorov wrote:

 Hi,

 You should read about JavaScript event delegation. This is what they
 recommend.

 Wicket has basic support for this
 with org.apache.wicket.ajax.attributes.AjaxRequestAttributes#
 setChildSelector.
 I.e. you can register an Ajax behavior on the table or tbody and use
 childSelector to listen for events only on specific children, e.g. 'tr',
 'td', 'td div', etc.

 This is more lightweight than using Wicket's built-in AjaxLink, but it is
 also a bit more complex for you as an application developer.

 Good luck!


 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Mon, Oct 27, 2014 at 8:37 PM, Jason Novotny jason.novo...@gmail.com
 wrote:

  Hi Martin,

 Thanks for the help-- I've reached out to them, the js appears pretty
 complex
 http://cdn.datatables.net/1.10.3/js/jquery.dataTables.js


 They indicate that listeners need to be added according to:
 http://www.datatables.net/examples/advanced_init/events_live.html

 Is there any kind of mode in wicket possibly that would preserve the
 listeners in this way?

 Thanks, Jason


 On 10/26/14, 11:40 PM, Martin Grigorov wrote:

  Hi,

 Try with Ajax loading of the new pages.

 I am not sure how DataTables removes and re-adds the rows later. It
 should
 use jQuery's clone(true, true) to preserve the event bindings. Ask in
 their
 forums.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Sun, Oct 26, 2014 at 12:46 AM, Jason Novotny 
 jason.novo...@gmail.com
 wrote:

   I've managed to figure out the cause of the problem but no solution.

 jquery datatables removes DOM elements when configured for pagination.
 This means the AjaxLinks in my listview generate wicket javascript
 like:

 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-0-
 detailsLink,e:click,c:
 detailsLinkff});;
 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-1-
 detailsLink,e:click,c:
 detailsLink100});;
 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-2-
 detailsLink,e:click,c:
 detailsLink101});;
 Wicket.Ajax.ajax({u:./executed?7-1.IBehaviorListener.0-container-
 executedTransactionPanel-executedListView-3-
 detailsLink,e:click,c:
 detailsLink102});;
 ...


 If the table has 2 pages, it removes the DOM elements from the 2nd page
 so
 I get the wicket debug error  Wicket.Ajax: Cannot bind a listener for
 event click on element elementId because the element is not in the
 DOM

 Now when I hit the link for next page of the table, the DOM has been
 updated to reflect the rows, but the javascript events need to be added
 again and so the links are broken.

 Is there any good way to do this?

 Thanks, Jason


 On 10/24/14, 1:24 PM, Jason Novotny wrote:

   I should add I'm using Wicket 6.17.

 Thanks, Jason

 On 10/24/14, 10:47 AM, Jason Novotny wrote:

   Hi,

 I'm using latest jquery DataTable with a ListView and in wicket:head
 of
 the page, I initiate the DataTable:

 $(function () {
   $('.datatable_executed').dataTable({
   'lengthChange': false,
   'dom': 'topdoc-filterholdeript',
   language: {info: _START_-_END_ of _TOTAL_},
   aaSorting: [],
   'iDisplayLength': 12
   });
   });

 It all looks good, however because 

Re: Lock timeout per page class

2014-10-28 Thread Guillaume Smet
Hi Martin,

Looks sane to me. I created a JIRA issue:
https://issues.apache.org/jira/browse/WICKET-5740 .

Thanks again for your help!

On Tue, Oct 28, 2014 at 9:45 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Here is my version: http://pastie.org/9680245
 Please create a ticket in JIRA if you like it.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Tue, Oct 28, 2014 at 9:52 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

 Hi,

 I share Sebastien's concern.
 I'll see how to workaround this.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Sat, Oct 25, 2014 at 2:57 PM, Sebastien seb...@gmail.com wrote:

 Hi Guillaume,

 Generally speaking, you cannot call a non final method from a
 constructor...

 Best regards,
 Sebastien
 On Oct 25, 2014 1:32 PM, Guillaume Smet guillaume.s...@gmail.com
 wrote:

  Hi Martin,
 
  I got something working with the following changes in Wicket:
 
 
 https://github.com/openwide-java/wicket/commit/6374a4a7c6fb66841143a88933523f97305cf1a4
 
  Do you consider this commitable? If so, I can create a JIRA issue and
 push
  a PR.
 
  Having the pageId in the getTimeout call is quite nice as I don't have
  to get it again from the PageRequestHandlerTracker.
 
  Thanks for your feedback.
 
  On Fri, Oct 24, 2014 at 9:16 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
   If you have a base page then BasePage#onInitialize() should be a good
  place.
   Or you could add the pageIds of the special/slow pages only in the
 map.
  
   Otherwise you may use PageRequestHandlerTracker#getLastHandler in a
  custom
   IRequestCycleListener#onDetach().
  
   Martin Grigorov
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Fri, Oct 24, 2014 at 10:11 AM, Guillaume Smet 
  guillaume.s...@gmail.com
   wrote:
  
   Hi Martin,
  
   Yeah, I thought about that too but I'm not sure of the best place to
   build the pageId - pageClassName map. Any advice about this?
  
   Once I'll get this working, I'll build a PR for the few changes I
 made
   in Wicket (based on what you proposed earlier). Would be nice to have
   them in 6.18.
  
   On Fri, Oct 24, 2014 at 8:59 AM, Martin Grigorov 
 mgrigo...@apache.org
   wrote:
Hi Guillaume,
   
Sorry for not thinking more carefully about this the first time!
I'm afraid it is not possible to do it the way I suggested.
PageAccessSynchronizer is the entry point to start using a page
 and it
works only with pageId!
   
Here is a new hackish approach:
Store pageId - pageClassName map in the Session. Then when
PageAccessSynchronizer is requested to lock a page by id use that
 id
  to
resolve the class name and to decide what timeout to use.
   
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
   
On Thu, Oct 23, 2014 at 5:44 PM, Guillaume Smet 
   guillaume.s...@gmail.com
wrote:
   
Hi Martin,
   
On Wed, Oct 22, 2014 at 9:51 AM, Martin Grigorov 
  mgrigo...@apache.org
wrote:
 I'd like to avoid moving the logic that gets the timeout from
 Session.PageAccessSynchronizerProvider to PageAccessSynchronizer
   because
 this way it will use Application.get() everytime and most apps
  don't
   need
 to pay for this.

 A way to make it possible for you is to remove the 'final'
 from org.apache.wicket.Session#getPageManager and introduce
   overridable
 PageAccessSynchronizer#getTimeout(). This way you can use your
 own
 PageAccessSynchronizer.
 http://pastie.org/9667070
   
After a few experiments, here I am!
   
So, it mostly works: I thought it would be better to add something
  like:
protected IProviderPageAccessSynchronizer
newPageAccessSynchronizerProvider()
{
return new PageAccessSynchronizerProvider();
}
in Session and call it from the constructor instead of removing
 the
final so I did that in my code.
   
It works pretty well BUT I haven't found a way to get the page
 class
in getTimeout without having the risk to trigger a
  resolvePageInstance
which will try to lock and then call getTimeout leading to a
  wonderful
stack overflow exception when dealing with
ListenerInterfaceRequestHandler.
   
Obviously (...) what interests me the most is the getTimeout in
ListenerInterfaceRequestHandler as it's often actions on buttons
  which
are long to run.
   
Here is what I have in mind for my Session class:
https://gist.github.com/gsmet/3b9e2775d25fadcef5ef
   
I must admit that an advice would be welcome as I wouldn't like to
have stack overflow errors popping out in weird edge cases.
   
Thanks!
   
--
Guillaume
   
   
 -
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org