Re: AbstractAjaxTimerBehavior and getPreconditionScript

2011-01-07 Thread Jeremy Thomerson
On Fri, Jan 7, 2011 at 4:56 PM, Nelson Segura  wrote:

> I am writing code that checks whether the user has typed something in the
> page, and if so, goes an AJAX call to keep the user session alive.
> For this I am using AbstractAjaxTimerBehavior to ping the server every
> certain time, and overriding its getPreconditionScript() method to call a
> JS
> function that knows if the user has typed something since the last AJAX
> call.
>
> This works well as long as the user types something between the time calls,
> but if ever the getPreconditionScript() determines the user has not typed
> anything, then the timer will stop.
> I would expect the AJAX call not to be made, but the timer to continue to
> run for the next time, so if the user types something, then the call will
> be
> done in the next run.
>
> What is the correct behavior in this case? Do I have a bug, or is it
> working
> as written? If the second, then any ideas how to avoid the timer from
> stopping?
>
> Code is below. Thanks for your help.
>
> -Nelson
>
> -
>   add(new AbstractAjaxTimerBehavior(Duration.seconds(20)) {
>private static final long serialVersionUID =
> -4426283634345968585L;
>
>@Override
>protected void onTimer(AjaxRequestTarget target) {
>target.focusComponent(null);
>}
>
>@Override
>protected CharSequence getPreconditionScript() {
>StringBuilder sb = new StringBuilder();
>sb.append("if
> (checkKeyPress('").append(getMarkupId()).append("')) { return true } else {
> return false }");
>return sb;
>}
>
>});
>

Are you adding this to *every* component that you want to track?  It's hard
to tell, but the method signature of your checkKeyPress makes me think you
might be.

Although not directly answering your question, I'd actually do it the other
way around:

1 - use an ajax behavior (not a timer) and wrap it in a custom function like
"startKeepAliveTimer()".
1b - in the onRespond of this behavior, simply add a new ajax timer to the
page and let it run continuously
2 - then any component that can accept key presses that should trigger a
keep alive timer can have a normal (non-ajax) behavior attached to them that
appends onkeypress="startKeepAliveTimer()" to their tag.  (this could even
be done automagically via component instantiation listener, or IVisitor,
etc)

This is an easy way to have a single AJAX keep-alive timer for all of your
components on the page.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


Re: using ajaxlink when deployed to google app engine

2011-01-07 Thread fachhoch

Please help me with the issue , I am   trying to deploy wicket in google app
engine, i was able to bring up the home page ,then for further testing I
added a simple ajaxlink  , when  I click  on the link nothing happens  then
I enabled logging of wicket 
and saw this  in logs

 



FINE: ending request for page [Page class =
org.radiosai.saibaba.web.page.HomePage, id = 0, version = 0], request
[method = GET, protocol = HTTP/1.1, requestURL = http://localhost:/app/,
contentType = null, contentLength = -1, contextPath = , pathInfo = null,
requestURI = /app/, servletPath = /app/, pathTranslated = null]
Jan 8, 2011 1:04:01 AM
com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for:
/app/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js
Jan 8, 2011 1:04:01 AM
com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for:
/app/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js
Jan 8, 2011 1:04:01 AM
com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for:
/app/resources/org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow/res/modal.css
Jan 8, 2011 1:04:01 AM
com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for:
/app/resources/org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow/res/modal.js


please advice me how to resolve  this ?
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/using-ajaxlink-when-deployed-to-google-app-engine-tp3178810p3204602.html
Sent from the Users forum mailing list archive at Nabble.com.

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



AbstractAjaxTimerBehavior and getPreconditionScript

2011-01-07 Thread Nelson Segura
I am writing code that checks whether the user has typed something in the
page, and if so, goes an AJAX call to keep the user session alive.
For this I am using AbstractAjaxTimerBehavior to ping the server every
certain time, and overriding its getPreconditionScript() method to call a JS
function that knows if the user has typed something since the last AJAX
call.

This works well as long as the user types something between the time calls,
but if ever the getPreconditionScript() determines the user has not typed
anything, then the timer will stop.
I would expect the AJAX call not to be made, but the timer to continue to
run for the next time, so if the user types something, then the call will be
done in the next run.

What is the correct behavior in this case? Do I have a bug, or is it working
as written? If the second, then any ideas how to avoid the timer from
stopping?

Code is below. Thanks for your help.

-Nelson

-
   add(new AbstractAjaxTimerBehavior(Duration.seconds(20)) {
private static final long serialVersionUID =
-4426283634345968585L;

@Override
protected void onTimer(AjaxRequestTarget target) {
target.focusComponent(null);
}

@Override
protected CharSequence getPreconditionScript() {
StringBuilder sb = new StringBuilder();
sb.append("if
(checkKeyPress('").append(getMarkupId()).append("')) { return true } else {
return false }");
return sb;
}

});


Re: IndicatingAjaxButton (Doesn't display indicator in Internet Explorer)

2011-01-07 Thread MZemeck
This problem still exists in Wicket 1.14.15.  IndicatingAjaxButton does 
not show the busy indicator in IE, it does work in Firefox. 
IndicatingAjaxLink does show the indicator in IE.


- Forwarded by Matthew Zemeck/ADM/NYSOSC on 01/07/2011 03:32 PM -

From:   mzem...@osc.state.ny.us
To: users@wicket.apache.org
Date:   11/30/2010 04:23 PM
Subject:Re: IndicatingAjaxButton (Doesn't display indicator in 
Internet Explorer)



+1

Yes I have seen this as well...




From:   "Corbin, James" 
To: "users@wicket.apache.org" 
Date:   11/30/2010 04:07 PM
Subject:IndicatingAjaxButton (Doesn't display indicator in 
Internet Explorer)



I recently noticed that the IndicatingAjaxButton no longer appears to 
render the asterix in Internet Explorer (all versions including 6,7 and 
8).

I noticed this after moving to Wicket Version 1.4.13.

Has anybody seen this behavior with ajax indicators not displaying in IE?

J.D.

J.D. Corbin | IQNavigator | Senior Software Engineer
Office: (303) 563-1503 * Mobile: (303) 912-0958 * jcor...@iqnavigator.com<
mailto:y...@iqnavigator.com>
6465 Greenwood Plaza Blvd. *  Suite 800 * Centennial, CO *  80111 *  USA

This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy 
all copies of the original message.






Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.



Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

Re: Show wait cursor on every action

2011-01-07 Thread Martin Grigorov
Either I don't understand you again or you don't know how page load works.
When you click a link (no ajax involved) then a request is sent to the
server and the server returns a response which kinda overrides the previous
response.
I.e. when you click the link you change the cursor to be pointer but then
the this page is unloaded and completely new one is loaded in the browser.
The new one doesn't know anything about the state of the previous one, i.e.
the cursor is 'default' initially.
You can keep the state in http parameter or cookie but you can have the
chance to set the old state to the new page as soon as 'ondomready' but at
that time you want to reset the cursor to 'default' so there is no point to
keep this state at all.


On Fri, Jan 7, 2011 at 8:04 PM, Per Newgro  wrote:

> Thanks Martin,
>
> damn bugs :-). I will check it again. If i get it i post the solution.
>
>
> Cheers
> Per
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Show wait cursor on every action

2011-01-07 Thread Per Newgro

Thanks Martin,

damn bugs :-). I will check it again. If i get it i post the solution.

Cheers
Per

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



Re: Show wait cursor on every action

2011-01-07 Thread Martin Makundi
Hi!

I think you just named them all ;)

Read: you have a bug somewhere in your implementation, otherwise you
should have found the solution already trying those options.

**
Martin

2011/1/7 Per Newgro :
> Thanks Martin,
>
> and excuse me. But i didn't describe the whole problem.
>
> I want to click a link and load another page (simply by calling
> setResponsePage).
>
> I already tried a solution like
> 
>
> But it seems that onload is called if html code is loaded (as name says :-).
> But i would like to "reset" the cursor if page is rendered. Otherwise i
> always have
> a gap between "end of wait cursor" and "page content is presented". I also
> tried
> AbstractBehavior with "ondomready" and "onload". But i had no luck :-(.
>
> If i could get an event if page is rendered then all would be fine. You know
> a way to get that?
>
> Cheers
> Per
>
> -
> 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: Show wait cursor on every action

2011-01-07 Thread Per Newgro

Thanks Martin,

and excuse me. But i didn't describe the whole problem.

I want to click a link and load another page (simply by calling 
setResponsePage).


I already tried a solution like


But it seems that onload is called if html code is loaded (as name says :-).
But i would like to "reset" the cursor if page is rendered. Otherwise i 
always have
a gap between "end of wait cursor" and "page content is presented". I 
also tried

AbstractBehavior with "ondomready" and "onload". But i had no luck :-(.

If i could get an event if page is rendered then all would be fine. You 
know a way to get that?


Cheers
Per

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



RenderBodyOnly and email links

2011-01-07 Thread Jim Pinkham
Many may already have realized this, but for anyone who hasn't, I just came
across this elegant way to handle optional emails.
The user/admin stuff is just an example use-case, simplified to fit here.

// User's Statement page lists some items and who bought them...

AbstractLink myLink;

if (isAdminUser()) {
// admins can view the buyer's full info
myLink = new BookmarkablePageLink("buyer.link",
MemberPage.class, params)
} else {
// normal users get email links to each other instead
myLink = new ExternalLink("buyer.link", email);

// or if they don't have email, just show their name
myLink.setRenderBodyOnly(email.isBlank());// if they don't have
an email
}
myLink.add(new Label("buyer.name"));

Before I found this, I had two separate elements - the a link with it's span
name inside, and then another span name with only one or the other visible -
that was ugly.

Maybe this helps someone else

Cheers,
Jim
http://togetherauction.com


Re: Print all HTML content to file

2011-01-07 Thread Martin Grigorov
See the code for http://wicketstuff.org/wicket14/staticpages/capturedpage

On Fri, Jan 7, 2011 at 4:54 PM, Brown, Berlin [GCG-PFS] <
berlin.br...@primerica.com> wrote:

> I have used the WicketTester to print out the rendered HTML content from
> wicket.  I did that through the unit tests.  How would I run a similar
> operation to return the rendered output document outside of
> WicketTester.I want to print the document from within my J2EE
> server.
>
> Here is the example junit code.
> private WicketTester tester;
>
> // start and render the test page
>
> tester.startPanel( TestRenderPanel.class );
>
> tester.getServletResponse().getDocument();
>
> ...
>
> I want to call tester.getServletResponse().getDocument(); outside of a
> junit test, in a server environment.
>
>
> Berlin Brown
>
>


Print all HTML content to file

2011-01-07 Thread Brown, Berlin [GCG-PFS]
I have used the WicketTester to print out the rendered HTML content from
wicket.  I did that through the unit tests.  How would I run a similar
operation to return the rendered output document outside of
WicketTester.I want to print the document from within my J2EE
server.
 
Here is the example junit code. 
private WicketTester tester;

// start and render the test page

tester.startPanel( TestRenderPanel.class ); 

tester.getServletResponse().getDocument(); 

...
 
I want to call tester.getServletResponse().getDocument(); outside of a
junit test, in a server environment.
 
 
Berlin Brown
 


Re: Wicket web site down with a few hits

2011-01-07 Thread Martijn Dashorst
c3p0 and other connection pools are pretty much deprecated with
hibernate 3.6 (as we discovered). com.jolbox.bonecp is a competent
replacement.

Martijn

On Fri, Jan 7, 2011 at 11:42 AM, LucHub  wrote:
>
> Hi Martin,
>
> thanks for you suggestion. I'll make more test in this direction. Right know
> I temporaly solved the problem avoiding the use of the c3p0 library and
> having a thread that every hour keep the connection awake. Of course I'll do
> test to optimize the app based on your suggestion.
> Thanks a lot for all your precious help.
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Wicket-web-site-down-with-a-few-hits-tp3174117p3178918.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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



Re: Any site running 1.5-M3 examples

2011-01-07 Thread Martin Grigorov
http://www.wicket-library.com/wicket-examples runs 1.5-SNAPSHOT from 29th of
December 2010.
It is a bit hard to poke Johan (he administrates www.wicketstuff.org)
everytime we make a release, so Juergen gave me access to
www.wicket-library.com and we will try to keep it up-to-date with latest
versions.
At http://www.wicket-library.com/brix-cms/index.html you can also make a
test run of the latest version of Brix-CMS

On Fri, Jan 7, 2011 at 2:38 AM, richard emberson  wrote:

> For the images example.
> The site: http://wicketstuff.org/wicket14/
> leads to:
> http://wicketstuff.org/wicket14/images/
> third image's html is:
> 
>
> while the site you reference:
> http://wicketstuff.org/wicket/
> for the images leads to:
>
> http://wicketstuff.org/wicket/images/wicket/bookmarkable/org.apache.wicket.examples.images.Home?1
> and the third image's html is:
> 
>
> So, assuming that wicket14 is wicket 1.4 stuff,
> the site you gave me matches what I get when I build
> 1.5-M3.
>
> Thanks.
>
> Richard
>
>
> On 01/06/2011 05:00 PM, Igor Vaynberg wrote:
>
>> http://wicketstuff.org/wicket/
>>
>>
>> not sure what version it is but its some 1.5.x
>>
>> -igor
>>
>> On Thu, Jan 6, 2011 at 4:57 PM, richard emberson
>>   wrote:
>>
>>>
>>> When a milestone release occurs, is there any site that runs the
>>> example applications?
>>>
>>> Richard
>>> --
>>> Quis custodiet ipsos custodes
>>>
>>> -
>>> 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
>>
>>
>>
> --
> Quis custodiet ipsos custodes
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket web site down with a few hits

2011-01-07 Thread LucHub

Hi Martin,

thanks for you suggestion. I'll make more test in this direction. Right know
I temporaly solved the problem avoiding the use of the c3p0 library and
having a thread that every hour keep the connection awake. Of course I'll do
test to optimize the app based on your suggestion.
Thanks a lot for all your precious help.


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-web-site-down-with-a-few-hits-tp3174117p3178918.html
Sent from the Users forum mailing list archive at Nabble.com.

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



using ajaxlink when deployed to google app engine

2011-01-07 Thread fachhoch

I am trying to create a simple   app using wicket in google app engine.
I did read about semicompatibilty with gae and the changes to be done to
make it work.
I did these changes and  I can see the hompage . I  added AjaxLink to home
page , but on clicking on the link nothing happens and the server console
shows this warning


WARNING: No file found for:
/app/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js


please advice me   on this issue ?
I am using wicket1.4.15




-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/using-ajaxlink-when-deployed-to-google-app-engine-tp3178810p3178810.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: When does a Page or Component die?

2011-01-07 Thread Martijn Dashorst
AFAIK when it is evicted from the page store or when the session expires.

Martijn

On Fri, Jan 7, 2011 at 7:11 AM, Andreas Mueller
 wrote:
> Hi all,
>
> I have found a lot of convenient API to work with the different lifecycle
> phases of a page. However, I couldn't find the point in time when a page is
> actually dead. By dead, I mean there is no chance that wicket will use it
> again.
>
> Any hints are highly appreciated! Thank you very much in advance.
>
> Best,
> Andreas
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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