Re: Header contribution ordering

2015-04-09 Thread Nick Pratt
Thanks Martin, ill check that out.

Is it possible to have a FilteredHeaderContainer in the head section of our
base page so that we can have all the regular Wicket includes (JS and CSS)
added, and then a special bucket for our global css?

I keep running in to: there was an error processing the header response -
you tried to render a bucket of response from FilteringHeaderResponse, but
it had not yet run and been closed.

Can header items be manipulated this way, or only within the body contents
(for late loading JS)


On Thu, Apr 9, 2015 at 2:29 PM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi,


 On Thu, Apr 9, 2015 at 9:23 PM, Nick Pratt nbpr...@gmail.com wrote:

  Based on the wicket guide, since 1.5 the header contributions of children
  should occur before that of the Page they are contained in so that the
 Page
  can override any component contributions.
 
  Is this still valid?  We've got a case where a Panel is contributing a
 CSS
 

 Yes.


  file that's appearing in the final markup after that of the Page (which
  prevents our application level style sheet from overriding the
 component's
  added styles)  - is there a likely reason for this that we've overlooked?
 

 A dependency?
 See HeaderItem#getDependencies() and ResourceReference#getDependencies()


 
  N
 



Header contribution ordering

2015-04-09 Thread Nick Pratt
Based on the wicket guide, since 1.5 the header contributions of children
should occur before that of the Page they are contained in so that the Page
can override any component contributions.

Is this still valid?  We've got a case where a Panel is contributing a CSS
file that's appearing in the final markup after that of the Page (which
prevents our application level style sheet from overriding the component's
added styles)  - is there a likely reason for this that we've overlooked?

N


Re: Gzipping served resources

2015-04-06 Thread Nick Pratt
I had a feeling I did, but the problem still remains.  Anyway, the
resources served by Wicket are served on a response that is committed
(likely due to a flush() invocation).  The Jetty CompressedResponseWrapper
does not compress committed responses:

public ServletOutputStream getOutputStream() throws IOException

{
if (_compressedStream==null)
{
if (getResponse().isCommitted() || _noCompression)
return getResponse().getOutputStream();


_compressedStream=newCompressedStream(_request,(HttpServletResponse)getResponse());
}
else if (_writer!=null)
throw new IllegalStateException(getWriter() called);

return _compressedStream;
}


Is there anyway to not have Wicket commit the response when serving
resources (although Im unsure why the response being committed is an
issue for the Gzip Filter)


On Mon, Apr 6, 2015 at 1:23 AM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi,


 You have asked the same question 2 years ago :-)

 http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%3CCALpvOjtq4=hWkLO=ShUBfG7cZFS+yB-XmWgU+worrgYcTk=+3...@mail.gmail.com%3E

 How does the GZipFilter configuration looks like in your web.xml ?
 Put a debugger in it and see what happens when a Wicket static resource is
 requested.

 Martin Grigorov
 Freelancer, available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Sun, Apr 5, 2015 at 8:52 PM, Nick Pratt nbpr...@gmail.com wrote:

  We've checked all the headers and everything looks fine.  The only
  difference between whether or not Jetty 9.x gzips the files is whether
  Wicket serves the resources.  Wicket generated HTML markup is gzipped, as
  are all static resources served by Jetty's DefaultServlet.  Any .js or
 .css
  files served as PackageResources are not served gzipped to the client.
 
  N
 
  On Sun, Apr 5, 2015 at 3:33 AM, Christoph Läubrich 
 lae...@googlemail.com
  wrote:
 
   Have you checked that the correct content-type is specified?
   We use Jetty8 in a project with Wicket6 and serving package resource
  files
   gzipped works without a problem.
   What kind of Packe-Resource-Files do you see not beeing gziped? Can you
   share Request/Response headers?
  
   Am 03.04.2015 23:56, schrieb Nick Pratt:
  
   Can resources served from Wicket be gzipped by Jetty's GzipFilter?
  
   We've added the GzipFilter to a simple Quickstart (in front of the
   WicketFilter).  We can request and receive gzipped files (such as
 static
   .css and .js files) served from Jetty's DefaultServlet, and we see
 that
   .html files served through Wicket (such as Home.html) are being
  compressed
   by Jetty.  However, all JS/CSS resources served via PackageResources
 are
   not being sent gzipped and we're wondering why this might be the case.
   We've confirmed the various caveats in the GzipFilter documentation
 for
   Jetty 9.2.x are being fulfilled but dont see why package resources
 files
   are not being gzipped?
  
   Regards
  
   Nick
  
  
  
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 



Re: Gzipping served resources

2015-04-06 Thread Nick Pratt
OK, now the Wicket cause of this: Why in AbstractResource do we flush the
response after writing the headers (which is invoked from
setResponseHeaders() )?
/**

 * Flushes the response after setting the headers.
 * This is necessary for Firefox if this resource is an image,
 * otherwise it messes up other images on page.
 *
 * @param response
 *  the current web response
 */
protected void flushResponseAfterHeaders(final WebResponse response)
{
   response.flush();
}


If this issue is solely for images in some (older) version of Firefox,
is there any reason we have to do this for .css and .js files being
served?


Nick


On Mon, Apr 6, 2015 at 11:32 AM, Nick Pratt nbpr...@gmail.com wrote:

 I had a feeling I did, but the problem still remains.  Anyway, the
 resources served by Wicket are served on a response that is committed
 (likely due to a flush() invocation).  The Jetty CompressedResponseWrapper
 does not compress committed responses:

 public ServletOutputStream getOutputStream() throws IOException

 {
 if (_compressedStream==null)
 {
 if (getResponse().isCommitted() || _noCompression)
 return getResponse().getOutputStream();

 
 _compressedStream=newCompressedStream(_request,(HttpServletResponse)getResponse());
 }
 else if (_writer!=null)
 throw new IllegalStateException(getWriter() called);

 return _compressedStream;
 }


 Is there anyway to not have Wicket commit the response when serving resources 
 (although Im unsure why the response being committed is an issue for the Gzip 
 Filter)


 On Mon, Apr 6, 2015 at 1:23 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

 Hi,


 You have asked the same question 2 years ago :-)

 http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%3CCALpvOjtq4=hWkLO=ShUBfG7cZFS+yB-XmWgU+worrgYcTk=+3...@mail.gmail.com%3E

 How does the GZipFilter configuration looks like in your web.xml ?
 Put a debugger in it and see what happens when a Wicket static resource is
 requested.

 Martin Grigorov
 Freelancer, available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Sun, Apr 5, 2015 at 8:52 PM, Nick Pratt nbpr...@gmail.com wrote:

  We've checked all the headers and everything looks fine.  The only
  difference between whether or not Jetty 9.x gzips the files is whether
  Wicket serves the resources.  Wicket generated HTML markup is gzipped,
 as
  are all static resources served by Jetty's DefaultServlet.  Any .js or
 .css
  files served as PackageResources are not served gzipped to the client.
 
  N
 
  On Sun, Apr 5, 2015 at 3:33 AM, Christoph Läubrich 
 lae...@googlemail.com
  wrote:
 
   Have you checked that the correct content-type is specified?
   We use Jetty8 in a project with Wicket6 and serving package resource
  files
   gzipped works without a problem.
   What kind of Packe-Resource-Files do you see not beeing gziped? Can
 you
   share Request/Response headers?
  
   Am 03.04.2015 23:56, schrieb Nick Pratt:
  
   Can resources served from Wicket be gzipped by Jetty's GzipFilter?
  
   We've added the GzipFilter to a simple Quickstart (in front of the
   WicketFilter).  We can request and receive gzipped files (such as
 static
   .css and .js files) served from Jetty's DefaultServlet, and we see
 that
   .html files served through Wicket (such as Home.html) are being
  compressed
   by Jetty.  However, all JS/CSS resources served via PackageResources
 are
   not being sent gzipped and we're wondering why this might be the
 case.
   We've confirmed the various caveats in the GzipFilter documentation
 for
   Jetty 9.2.x are being fulfilled but dont see why package resources
 files
   are not being gzipped?
  
   Regards
  
   Nick
  
  
  
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 





Re: Gzipping served resources

2015-04-06 Thread Nick Pratt
Any chance it can be back ported into 6.20 ?



On Mon, Apr 6, 2015 at 12:17 PM, Martin Grigorov mgrigo...@apache.org
wrote:

 We've figured out that some time ago and removed it for Wicket 7.x.
 On Apr 6, 2015 7:00 PM, Nick Pratt nbpr...@gmail.com wrote:

  OK, now the Wicket cause of this: Why in AbstractResource do we flush the
  response after writing the headers (which is invoked from
  setResponseHeaders() )?
  /**
 
   * Flushes the response after setting the headers.
   * This is necessary for Firefox if this resource is an image,
   * otherwise it messes up other images on page.
   *
   * @param response
   *  the current web response
   */
  protected void flushResponseAfterHeaders(final WebResponse response)
  {
 response.flush();
  }
 
 
  If this issue is solely for images in some (older) version of Firefox,
  is there any reason we have to do this for .css and .js files being
  served?
 
 
  Nick
 
 
  On Mon, Apr 6, 2015 at 11:32 AM, Nick Pratt nbpr...@gmail.com wrote:
 
   I had a feeling I did, but the problem still remains.  Anyway, the
   resources served by Wicket are served on a response that is committed
   (likely due to a flush() invocation).  The Jetty
  CompressedResponseWrapper
   does not compress committed responses:
  
   public ServletOutputStream getOutputStream() throws IOException
  
   {
   if (_compressedStream==null)
   {
   if (getResponse().isCommitted() || _noCompression)
   return getResponse().getOutputStream();
  
  
 
 _compressedStream=newCompressedStream(_request,(HttpServletResponse)getResponse());
   }
   else if (_writer!=null)
   throw new IllegalStateException(getWriter() called);
  
   return _compressedStream;
   }
  
  
   Is there anyway to not have Wicket commit the response when serving
  resources (although Im unsure why the response being committed is an
 issue
  for the Gzip Filter)
  
  
   On Mon, Apr 6, 2015 at 1:23 AM, Martin Grigorov mgrigo...@apache.org
   wrote:
  
   Hi,
  
  
   You have asked the same question 2 years ago :-)
  
  
 
 http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%3CCALpvOjtq4=hWkLO=ShUBfG7cZFS+yB-XmWgU+worrgYcTk=+3...@mail.gmail.com%3E
  
   How does the GZipFilter configuration looks like in your web.xml ?
   Put a debugger in it and see what happens when a Wicket static
 resource
  is
   requested.
  
   Martin Grigorov
   Freelancer, available for hire!
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Sun, Apr 5, 2015 at 8:52 PM, Nick Pratt nbpr...@gmail.com wrote:
  
We've checked all the headers and everything looks fine.  The only
difference between whether or not Jetty 9.x gzips the files is
 whether
Wicket serves the resources.  Wicket generated HTML markup is
 gzipped,
   as
are all static resources served by Jetty's DefaultServlet.  Any .js
 or
   .css
files served as PackageResources are not served gzipped to the
 client.
   
N
   
On Sun, Apr 5, 2015 at 3:33 AM, Christoph Läubrich 
   lae...@googlemail.com
wrote:
   
 Have you checked that the correct content-type is specified?
 We use Jetty8 in a project with Wicket6 and serving package
 resource
files
 gzipped works without a problem.
 What kind of Packe-Resource-Files do you see not beeing gziped?
 Can
   you
 share Request/Response headers?

 Am 03.04.2015 23:56, schrieb Nick Pratt:

 Can resources served from Wicket be gzipped by Jetty's
 GzipFilter?

 We've added the GzipFilter to a simple Quickstart (in front of
 the
 WicketFilter).  We can request and receive gzipped files (such as
   static
 .css and .js files) served from Jetty's DefaultServlet, and we
 see
   that
 .html files served through Wicket (such as Home.html) are being
compressed
 by Jetty.  However, all JS/CSS resources served via
  PackageResources
   are
 not being sent gzipped and we're wondering why this might be the
   case.
 We've confirmed the various caveats in the GzipFilter
 documentation
   for
 Jetty 9.2.x are being fulfilled but dont see why package
 resources
   files
 are not being gzipped?

 Regards

 Nick






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


   
  
  
  
 



Re: Gzipping served resources

2015-04-06 Thread Nick Pratt
Done: https://issues.apache.org/jira/browse/WICKET-5873

Regards

Nick

On Mon, Apr 6, 2015 at 12:22 PM, Martin Grigorov mgrigo...@apache.org
wrote:

 Afaik it didn't break anything in 7.x so I think it is safe to be back
 ported.
 Please file a ticket.
 On Apr 6, 2015 7:20 PM, Nick Pratt nbpr...@gmail.com wrote:

  Any chance it can be back ported into 6.20 ?
 
 
 
  On Mon, Apr 6, 2015 at 12:17 PM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   We've figured out that some time ago and removed it for Wicket 7.x.
   On Apr 6, 2015 7:00 PM, Nick Pratt nbpr...@gmail.com wrote:
  
OK, now the Wicket cause of this: Why in AbstractResource do we flush
  the
response after writing the headers (which is invoked from
setResponseHeaders() )?
/**
   
 * Flushes the response after setting the headers.
 * This is necessary for Firefox if this resource is an image,
 * otherwise it messes up other images on page.
 *
 * @param response
 *  the current web response
 */
protected void flushResponseAfterHeaders(final WebResponse response)
{
   response.flush();
}
   
   
If this issue is solely for images in some (older) version of
 Firefox,
is there any reason we have to do this for .css and .js files being
served?
   
   
Nick
   
   
On Mon, Apr 6, 2015 at 11:32 AM, Nick Pratt nbpr...@gmail.com
 wrote:
   
 I had a feeling I did, but the problem still remains.  Anyway, the
 resources served by Wicket are served on a response that is
 committed
 (likely due to a flush() invocation).  The Jetty
CompressedResponseWrapper
 does not compress committed responses:

 public ServletOutputStream getOutputStream() throws IOException

 {
 if (_compressedStream==null)
 {
 if (getResponse().isCommitted() || _noCompression)
 return getResponse().getOutputStream();


   
  
 
 _compressedStream=newCompressedStream(_request,(HttpServletResponse)getResponse());
 }
 else if (_writer!=null)
 throw new IllegalStateException(getWriter() called);

 return _compressedStream;
 }


 Is there anyway to not have Wicket commit the response when serving
resources (although Im unsure why the response being committed is an
   issue
for the Gzip Filter)


 On Mon, Apr 6, 2015 at 1:23 AM, Martin Grigorov 
  mgrigo...@apache.org
 wrote:

 Hi,


 You have asked the same question 2 years ago :-)


   
  
 
 http://mail-archives.apache.org/mod_mbox/wicket-users/201211.mbox/%3CCALpvOjtq4=hWkLO=ShUBfG7cZFS+yB-XmWgU+worrgYcTk=+3...@mail.gmail.com%3E

 How does the GZipFilter configuration looks like in your web.xml ?
 Put a debugger in it and see what happens when a Wicket static
   resource
is
 requested.

 Martin Grigorov
 Freelancer, available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Sun, Apr 5, 2015 at 8:52 PM, Nick Pratt nbpr...@gmail.com
  wrote:

  We've checked all the headers and everything looks fine.  The
 only
  difference between whether or not Jetty 9.x gzips the files is
   whether
  Wicket serves the resources.  Wicket generated HTML markup is
   gzipped,
 as
  are all static resources served by Jetty's DefaultServlet.  Any
  .js
   or
 .css
  files served as PackageResources are not served gzipped to the
   client.
 
  N
 
  On Sun, Apr 5, 2015 at 3:33 AM, Christoph Läubrich 
 lae...@googlemail.com
  wrote:
 
   Have you checked that the correct content-type is specified?
   We use Jetty8 in a project with Wicket6 and serving package
   resource
  files
   gzipped works without a problem.
   What kind of Packe-Resource-Files do you see not beeing
 gziped?
   Can
 you
   share Request/Response headers?
  
   Am 03.04.2015 23:56, schrieb Nick Pratt:
  
   Can resources served from Wicket be gzipped by Jetty's
   GzipFilter?
  
   We've added the GzipFilter to a simple Quickstart (in front
 of
   the
   WicketFilter).  We can request and receive gzipped files
 (such
  as
 static
   .css and .js files) served from Jetty's DefaultServlet, and
 we
   see
 that
   .html files served through Wicket (such as Home.html) are
 being
  compressed
   by Jetty.  However, all JS/CSS resources served via
PackageResources
 are
   not being sent gzipped and we're wondering why this might be
  the
 case.
   We've confirmed the various caveats in the GzipFilter
   documentation
 for
   Jetty 9.2.x are being fulfilled but dont see why package
   resources
 files
   are not being gzipped?
  
   Regards
  
   Nick

Having Wicket manage resources outside classpath

2015-01-30 Thread Nick Pratt
is it possible to have Wicket manage resources (.css and .js) outside of
the classpath, so that we can leverage all the great dev/prod things that
Wicket does with resources served from within the classpath?

We typically put our resources at the root of the context:
/assets/css
/assets/js
/assets/images
/WEB-INF/

This way we can reference images from within our style sheets using
'background:url(../images/logo.png);'
If Wicket were to serve these resources (I guess we would have to move the
assets down a level so they were brought in to the accessible classpath of
the Wicket app), can we manage such context sensitive references within CSS
files that are being managed by Wicket?

We're using 6.x

N


Handling errors in dynamic Resource generation

2015-01-12 Thread Nick Pratt
I have an AbstractResource modelled after section 15.9 in the Wicket Guide:
http://wicket.apache.org/guide/guide/resources.html

What is the correct way to handle errors (such as expected dynamic data not
available) during the writeCallback?

The specific line in the example is: output.output(getFeed(), writer);


While I throw a WicketRuntimeException during the writeCallback and the
server aborts the request and logs the error, the client sits waiting for
the download. Worse still, after the client times out (Chrome on OS X), the
downloads bar displays what looks like a successfully downloaded valid file
with no indication of error, and while it does have some data in it (in my
case around 4800 bytes) its not valid (Im a little puzzled about the ~4800
bytes or so). Ideally I'd like to give the user a notification that the
download failed.

If I try and get the data before the writecallback, and then set the
ErrorCode on the ResourceResponse when the data is not available, the user
is redirected to an unstyled Jetty served error screen which we don't want
to see - we'd rather signal that the download failed and keep the user on
the same page.  Is this possible with ResourceLink/AbstractResource or do
we have to use an alternative method to make this work more elegantly?


Re: Handling errors in dynamic Resource generation

2015-01-12 Thread Nick Pratt
Thanks Martin.  How would this work though - from the callstack, I see
newResourceResponse() invoked, followed by flushResponseAfterHeaders(), and
then the writeData() callback invocation.  So setting a flag in the
writeData callback occurs too late. If I try and load the data outside the
writeCallback, catch the error and then reset the headers there, the user
gets redirected to the standard Wicket error/exception page.

What does the browser need to receive in order to notify the user that a
download failed (but keep them on the same page)?


We cant (dont want to) ensure that all linked resources are physically
available on disk (or on S3) since that would just kill page loading.  We
have a set of links that should be present, and barring any network issues
or disk issues, they would ordinarily be available.



On Mon, Jan 12, 2015 at 3:12 PM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi,

 Override #flushResponseAfterHeaders() (see

 https://github.com/apache/wicket/blob/wicket-6.x/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java#L673
 )
 so that you are able to reset the response if an error occurs while writing
 the body.

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

 On Mon, Jan 12, 2015 at 8:46 PM, Nick Pratt nbpr...@gmail.com wrote:

  I have an AbstractResource modelled after section 15.9 in the Wicket
 Guide:
  http://wicket.apache.org/guide/guide/resources.html
 
  What is the correct way to handle errors (such as expected dynamic data
 not
  available) during the writeCallback?
 
  The specific line in the example is: output.output(getFeed(), writer);
 
 
  While I throw a WicketRuntimeException during the writeCallback and the
  server aborts the request and logs the error, the client sits waiting for
  the download. Worse still, after the client times out (Chrome on OS X),
 the
  downloads bar displays what looks like a successfully downloaded valid
 file
  with no indication of error, and while it does have some data in it (in
 my
  case around 4800 bytes) its not valid (Im a little puzzled about the
 ~4800
  bytes or so). Ideally I'd like to give the user a notification that the
  download failed.
 
  If I try and get the data before the writecallback, and then set the
  ErrorCode on the ResourceResponse when the data is not available, the
 user
  is redirected to an unstyled Jetty served error screen which we don't
 want
  to see - we'd rather signal that the download failed and keep the user on
  the same page.  Is this possible with ResourceLink/AbstractResource or do
  we have to use an alternative method to make this work more elegantly?
 



Re: Ordering of OnDomReadyHeaderItem

2014-11-03 Thread Nick Pratt
Thanks Martin.

I added this in JIRA.  Im still curious why we need to requeue the events -
cant we just fire the click handlers as and where defined?



On Mon, Nov 3, 2014 at 8:27 AM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi,

 A colleague of mine asked me the same question recently so I've just added
 a new global event that is fired once all Wicket.Ajax.ajax() calls are
 done.
 https://issues.apache.org/jira/browse/WICKET-5746

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

 On Fri, Oct 31, 2014 at 7:58 PM, Nick Pratt nbpr...@gmail.com wrote:

  I got the required JS to be rendered lower down the page (using
  Application#setHeaderResponseDecorator( new IHeaderResponseDecorator(){}
 )
  , but I couldn't get the FilteredHeaderItem to be added in the head
  section of the page (only outside of the head element).  Not too much
 of
  an issue, but what Im seeing now is that my OnDomReadyHeader items
 rendered
  at the foot of the page are firing before the Wicket click handlers are
  fired (which are in the script inside the head of the page).
 
  Is this expected? I was expecting that the Wicket click handlers in
 head
  would execute before my script lower down the page.
 
 
 
 
  On Fri, Oct 31, 2014 at 11:01 AM, Nick Pratt nbpr...@gmail.com wrote:
  
   Is is possible to modify the ordering of OnDomReadyHeaderItem? I see a
  way to modify the JS lib ordering using
  IResourceSettings#setHeaderItemComparator, but that doesn't get invoked
 for
  all the click handlers and scripts added via OnDomReadyHeaderItem.  I
 have
  a script that needs to be invoked after all of the Wicket click handlers
  etc have been executed.
  
   Do I have to implement a filter on FilteredHeaderItem and add my script
  into a separate script bucket that is ordered at the end of the head or
  in the footer?
 



Ordering of OnDomReadyHeaderItem

2014-10-31 Thread Nick Pratt
Is is possible to modify the ordering of OnDomReadyHeaderItem? I see a way
to modify the JS lib ordering using
IResourceSettings#setHeaderItemComparator, but that doesn't get invoked for
all the click handlers and scripts added via OnDomReadyHeaderItem.  I have
a script that needs to be invoked after all of the Wicket click handlers
etc have been executed.

Do I have to implement a filter on FilteredHeaderItem and add my script
into a separate script bucket that is ordered at the end of the head or
in the footer?


Re: Ordering of OnDomReadyHeaderItem

2014-10-31 Thread Nick Pratt
I got the required JS to be rendered lower down the page (using
Application#setHeaderResponseDecorator( new IHeaderResponseDecorator(){} )
, but I couldn't get the FilteredHeaderItem to be added in the head
section of the page (only outside of the head element).  Not too much of
an issue, but what Im seeing now is that my OnDomReadyHeader items rendered
at the foot of the page are firing before the Wicket click handlers are
fired (which are in the script inside the head of the page).

Is this expected? I was expecting that the Wicket click handlers in head
would execute before my script lower down the page.




On Fri, Oct 31, 2014 at 11:01 AM, Nick Pratt nbpr...@gmail.com wrote:

 Is is possible to modify the ordering of OnDomReadyHeaderItem? I see a
way to modify the JS lib ordering using
IResourceSettings#setHeaderItemComparator, but that doesn't get invoked for
all the click handlers and scripts added via OnDomReadyHeaderItem.  I have
a script that needs to be invoked after all of the Wicket click handlers
etc have been executed.

 Do I have to implement a filter on FilteredHeaderItem and add my script
into a separate script bucket that is ordered at the end of the head or
in the footer?


Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
Wicket 6.17.0

I have a RadioChoice (in a Form) that has an attached
AjaxFormComponentUpdatingBehavior.

The onUpdate() method of the Behavior fires an event for other components
on the page to update (change visibility depending on user selection in
radio choice).

Im trying to unit test it using:

formTester.selectRadioChoice( propertyType, 2 );

and then I'm trying to trigger the behavior to fire so that I can
check that the various components are visible/invisible:

Component component = baseTester.getComponentFromLastRenderedPage(
form:propertyType );
for ( Behavior b : component.getBehaviors() )
{
   if ( b instanceof AjaxFormComponentUpdatingBehavior )
   {
  baseTester.executeBehavior( (AbstractAjaxBehavior) b );
   }
}

However, I'm running in to this when the behavior is executed:

org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
Behavior rejected interface invocation.

Is it possible to unit test this specific behavior, and am I going
about this the right way?

I've verified that the application works as expected in a browser.


Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
That was a typo - apologies.  I'm using a
AjaxFormChoiceComponentUpdatingBehavior

As for the tester, its the EnhancedFormTester - its a thin wrapper that
invokes: formTester.select( path, index ); (where formTester is the Wicket
FormTester)

On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene an.delb...@gmail.com
wrote:

 On 30/10/14 21:08, Nick Pratt wrote:

 Wicket 6.17.0

 I have a RadioChoice (in a Form) that has an attached
 AjaxFormComponentUpdatingBehavior.

 The onUpdate() method of the Behavior fires an event for other components
 on the page to update (change visibility depending on user selection in
 radio choice).

 Im trying to unit test it using:

 formTester.selectRadioChoice( propertyType, 2 );

 I guess that's a typo :) or are you using a custom formTester?


 and then I'm trying to trigger the behavior to fire so that I can
 check that the various components are visible/invisible:

 Component component = baseTester.getComponentFromLastRenderedPage(
 form:propertyType );
 for ( Behavior b : component.getBehaviors() )
 {
 if ( b instanceof AjaxFormComponentUpdatingBehavior )
 {
baseTester.executeBehavior( (AbstractAjaxBehavior) b );
 }
 }

 However, I'm running in to this when the behavior is executed:

 org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx
 ception:
 Behavior rejected interface invocation.

 Is it possible to unit test this specific behavior, and am I going
 about this the right way?

 I've verified that the application works as expected in a browser.

 BTW, multiple-choice component should use 
 AjaxFormChoiceComponentUpdatingBehavior
 instead of AjaxFormComponentUpdatingBehavior.


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




Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
Thanks Paul

 I read that before posting, and tried a couple of things.  Is there
anything specific in that section other than:

tester.executeAjaxEvent(label, click);

If this is what is needed, how do I simulate a click on a specific
item from a RadioChoice? Do I set the value using the normal
formTester methods and then fire a generic click event?


On Thu, Oct 30, 2014 at 4:31 PM, Paul Bors p...@bors.ws wrote:

 Since you want to test a AjaxFormComponentUpdatingBehav
 ior and not a standard form component (non-ajax) you don't use
 formTester.selectRadioChoice( propertyType, 2 ) you have to create the
 AjaxTarget and etc.

 See Testing AJAX behaviors section at:
 http://wicket.apache.org/guide/guide/testing.html

 On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene an.delb...@gmail.com
 wrote:

  On 30/10/14 21:08, Nick Pratt wrote:
 
  Wicket 6.17.0
 
  I have a RadioChoice (in a Form) that has an attached
  AjaxFormComponentUpdatingBehavior.
 
  The onUpdate() method of the Behavior fires an event for other
 components
  on the page to update (change visibility depending on user selection in
  radio choice).
 
  Im trying to unit test it using:
 
  formTester.selectRadioChoice( propertyType, 2 );
 
  I guess that's a typo :) or are you using a custom formTester?
 
 
  and then I'm trying to trigger the behavior to fire so that I can
  check that the various components are visible/invisible:
 
  Component component = baseTester.getComponentFromLastRenderedPage(
  form:propertyType );
  for ( Behavior b : component.getBehaviors() )
  {
  if ( b instanceof AjaxFormComponentUpdatingBehavior )
  {
 baseTester.executeBehavior( (AbstractAjaxBehavior) b );
  }
  }
 
  However, I'm running in to this when the behavior is executed:
 
  org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx
  ception:
  Behavior rejected interface invocation.
 
  Is it possible to unit test this specific behavior, and am I going
  about this the right way?
 
  I've verified that the application works as expected in a browser.
 
  BTW, multiple-choice component should use
 AjaxFormChoiceComponentUpdatingBehavior
  instead of AjaxFormComponentUpdatingBehavior.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
I reproduced this in a simple quickstart using this unit test:

@Test
public void testAjaxEventFired() throws Exception
{
   HomePage homePage = new HomePage( new PageParameters() );
   tester.startPage( homePage );

   FormTester formTester = tester.newFormTester( form );
   formTester.select( radioChoice, 2 );

   Component component = tester.getComponentFromLastRenderedPage(
form:radioChoice );
   List? extends Behavior behaviors = component.getBehaviors();
   for( Behavior behavior : behaviors )
   {
  if( behavior instanceof AjaxFormChoiceComponentUpdatingBehavior )
  {
 AjaxFormChoiceComponentUpdatingBehavior afccub =
(AjaxFormChoiceComponentUpdatingBehavior) behavior;
 tester.executeBehavior( afccub );
  }
   }

   assertEquals( true, homePage.eventFired );
   assertEquals( C, homePage.chosen );
}


This is working as expected.  HomePage has a RadioChoice with a
ListString of choices, A,B,C,D,E.


There must be something in our application that's causing the
invocation to be rejected which Ill dig in to.


On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene an.delb...@gmail.com
wrote:

 On 30/10/14 21:08, Nick Pratt wrote:

 Wicket 6.17.0

 I have a RadioChoice (in a Form) that has an attached
 AjaxFormComponentUpdatingBehavior.

 The onUpdate() method of the Behavior fires an event for other components
 on the page to update (change visibility depending on user selection in
 radio choice).

 Im trying to unit test it using:

 formTester.selectRadioChoice( propertyType, 2 );

 I guess that's a typo :) or are you using a custom formTester?


 and then I'm trying to trigger the behavior to fire so that I can
 check that the various components are visible/invisible:

 Component component = baseTester.getComponentFromLastRenderedPage(
 form:propertyType );
 for ( Behavior b : component.getBehaviors() )
 {
 if ( b instanceof AjaxFormComponentUpdatingBehavior )
 {
baseTester.executeBehavior( (AbstractAjaxBehavior) b );
 }
 }

 However, I'm running in to this when the behavior is executed:

 org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx
 ception:
 Behavior rejected interface invocation.

 Is it possible to unit test this specific behavior, and am I going
 about this the right way?

 I've verified that the application works as expected in a browser.

 BTW, multiple-choice component should use 
 AjaxFormChoiceComponentUpdatingBehavior
 instead of AjaxFormComponentUpdatingBehavior.


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




Re: turning off page versioning

2014-09-24 Thread Nick Pratt
Funny this thread appeared this week - I had a client question our
forward/back navigation last Wednesday and we got into a fairly lengthy
discussion about this specific topic.  What came out of that was that their
expectations of page navigation in a webapp vs a desktop app are different
in today's fairly accessible web world where all their users have access
to, and use a variety of web apps on a daily basis (as examples given -
Gmail, Outlook, Facebook, Strava, FreshDirect, Google Search, NYTimes, WSJ,
Bloomberg, Amazon and various niche commercial/internal sites).  In a web
browser, they expect that forward/back navigation changes pages (not
versions).  In some cases, having some form data saved between page navs
was nice, but our forms just aren't that big that they wouldn't be upset
about re-entering that data, had they navigated away.  In short, they felt
the current provided functionality of state storage between page views
(from the end user standpoint) was unnecessary (and possibly a little
confusing in some cases) given their user's expectations of current web
apps.

I'm not intending to say either way is better/worse or right/wrong - just
throwing another data point into the discussion.

In my view, some way to disable versioning and move to a simpler model
restful type architecture (and Im well aware we could just move to a pure
JS+REST model and drop Wicket) would be nice.  Having used Wicket almost
daily for 6 years I've got fairly used to it, but I do see Garret's point,
and I have also wondered but dont know (I dont know enough about the
internals to make a more definitive statement here) if there's a lot of
current complexity to handle the versioning.  Were that to be removed (and
I'm not saying or implying that it should or should not) Id be curious to
see if there were alternative mechanisms that Wicket could employ to
provide the current model/view simplicity that it currently does.  Maybe we
add a mode which drops the versioning concept and simply resets all form
elements back to their defaults when rendered. I dont know how that would
impact data flow between the browser and Wicket.  I do also think that
developer knowledge on webapp construction/architecture has
changed/improved a lot in the last 6 years, and perhaps we've all learnt
something about simpler constructs.  Perhaps not :-)

JM2C.

Nick

On Wed, Sep 24, 2014 at 8:26 AM, Martijn Dashorst 
martijn.dasho...@gmail.com wrote:

 On Wed, Sep 24, 2014 at 2:13 AM, Garret Wilson gar...@globalmentor.com
 wrote:
  I'm not denying that versioned pages may be a useful concept for some use
  cases (even though I can't think of any offhand).

 Persioning is a very useful concept and used in many applications. You
 are just focussing on your particular use case for today and not
 thinking of broader issues that we have tackled for about a decade.

 Take google's search page with the pagination at the bottom. Click on
 2, click on back. What do you expect? go back to the page before you
 searched google? Or go back to page 1?

 Could stateless support in Wicket be improved, sure as hell. Is there
 a drive from the core developers to do so? Apparently our applications
 that drive Wicket development are dependent on stateful pages and we
 don't get caught up in a minor thing as a number showing up in a url
 that opens up a ton of support in Wicket for complex interactions with
 pages that were not possible before.

 Martijn

 --
 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




Extending Border

2014-05-16 Thread Nick Pratt
Ive got a class 'A' that extends Border, with the following markup:

wicket:border
div
 h1span wicket:id=header/spanspan
class=closeaX/a/span/h1
wicket:body/wicket:body
 /div
/wicket:border


This all works fine.  Can I extend class A? If so what should the markup of
class B look like (i.e. how do I get the child markup dropped in to the
wicket:body section)?

I'm currently hitting:

B.html: Unable to find wicket:border tag in associated markup file for
Border: [B [Component id = bPanel]] MarkupStream: [unknown]



Regards

Nick


Re: Behavior rendering

2014-05-12 Thread Nick Pratt
in the beforeRender() and afterRender(), is there anything better than
adding something like:

WebRequest request = (WebRequest) component.getRequest();
 boolean ajax = request.isAjax();
if( ajax )
{
 return;
}

prior to appending the additional markup?



On Fri, May 9, 2014 at 2:34 PM, Nick Pratt nbpr...@gmail.com wrote:

 I have a Behavior attached to a WebMarkupContainer with a bind() method as
 follows:

 @Override
 public void bind( Component component )
  {
 this.boundComponent = component;

 component.setOutputMarkupId( true );
  component.setOutputMarkupPlaceholderTag( true );


 //

 //
 component.add( new BorderBehaviour() );

 //

 //

 this.borderMarkupId = component.getMarkupId() + _brd;
 }

 
 
 
 class BorderBehaviour extends Behavior
 {
 @Override
  public void beforeRender( Component component )
 {
 Response response = component.getResponse();

 response.write( div id=\ );
 response.write( borderMarkupId ); // Generated from the bound component
 above
  response.write( \ class=\popup\ style=\display:none;\h1span
 );
 response.write( headerTextModel.getObject() );
  response.write( /spanspan class=\close\aX/a/span/h1 );
 }

 @Override
 public void afterRender( Component component )
 {
  component.getResponse().write( /div );
 }
 }


 When a page is initially loaded, beforeRender() and afterRender() get
 executed just fine.  If the user hits the browser reload button, everything
 still works (these two functions get executed).  However, during an Ajax
 triggered event, I end up with duplicate markup being appended to the bound
 component (since these two methods above run again, but the Component
 hierarchy isn't re-generated, thus multiple copies of the additional markup
 are written to the stream).

 I tried making the behavior temporary, and while that fixes the Ajax case,
 it breaks in the user-presses-reload-button case - since the behavior,
 now temporary, gets detached from the request after the initial render and
 doesnt get rerun when the user requests a page that is already
 generated/cached.

 How can I make this work for all three cases -
 1. Page load
 2. Page reload (same page ID)
 3. Ajax

 I noticed that the response in (3) is an AbstractAjaxResponse - is the
 only way to fix this to run an instanceof check on the response type or is
 there an alternate way?

 N



Re: Behavior rendering

2014-05-12 Thread Nick Pratt
This works great - thank you.

Nick


On Sun, May 11, 2014 at 3:26 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 See org.apache.wicket.ajax.IAjaxRegionMarkupIdProvider

 Martin Grigorov
 Wicket Training and Consulting


 On Fri, May 9, 2014 at 9:34 PM, Nick Pratt nbpr...@gmail.com wrote:

  I have a Behavior attached to a WebMarkupContainer with a bind() method
 as
  follows:
 
  @Override
  public void bind( Component component )
   {
  this.boundComponent = component;
 
  component.setOutputMarkupId( true );
   component.setOutputMarkupPlaceholderTag( true );
 
 
 
 //
 
 
 
 //
  component.add( new BorderBehaviour() );
 
 
 
 //
 
 
 //
 
  this.borderMarkupId = component.getMarkupId() + _brd;
  }
 
  
  
  
  class BorderBehaviour extends Behavior
  {
  @Override
   public void beforeRender( Component component )
  {
  Response response = component.getResponse();
 
  response.write( div id=\ );
  response.write( borderMarkupId ); // Generated from the bound component
  above
   response.write( \ class=\popup\ style=\display:none;\h1span
 );
  response.write( headerTextModel.getObject() );
   response.write( /spanspan class=\close\aX/a/span/h1 );
  }
 
  @Override
  public void afterRender( Component component )
  {
   component.getResponse().write( /div );
  }
  }
 
 
  When a page is initially loaded, beforeRender() and afterRender() get
  executed just fine.  If the user hits the browser reload button,
 everything
  still works (these two functions get executed).  However, during an Ajax
  triggered event, I end up with duplicate markup being appended to the
 bound
  component (since these two methods above run again, but the Component
  hierarchy isn't re-generated, thus multiple copies of the additional
 markup
  are written to the stream).
 
  I tried making the behavior temporary, and while that fixes the Ajax
 case,
  it breaks in the user-presses-reload-button case - since the behavior,
  now temporary, gets detached from the request after the initial render
 and
  doesnt get rerun when the user requests a page that is already
  generated/cached.
 
  How can I make this work for all three cases -
  1. Page load
  2. Page reload (same page ID)
  3. Ajax
 
  I noticed that the response in (3) is an AbstractAjaxResponse - is the
 only
  way to fix this to run an instanceof check on the response type or is
 there
  an alternate way?
 
  N
 



Re: Behavior rendering

2014-05-12 Thread Nick Pratt
Martin

While this updates correctly, Im running in to a problem of state with
regards to visibility.  Is there anyway to preserve client side state
(specifically the value of 'display') when updating a component with such a
border wrapped around it?

Is there a way to inspect the value of the element attributes being
replaced before Wicket replaces the element in the DOM, and then after its
replaced the element set some attribute values back that were set
previously?

N


On Mon, May 12, 2014 at 8:06 AM, Nick Pratt nbpr...@gmail.com wrote:

 This works great - thank you.

 Nick


 On Sun, May 11, 2014 at 3:26 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 See org.apache.wicket.ajax.IAjaxRegionMarkupIdProvider

 Martin Grigorov
 Wicket Training and Consulting


 On Fri, May 9, 2014 at 9:34 PM, Nick Pratt nbpr...@gmail.com wrote:

  I have a Behavior attached to a WebMarkupContainer with a bind() method
 as
  follows:
 
  @Override
  public void bind( Component component )
   {
  this.boundComponent = component;
 
  component.setOutputMarkupId( true );
   component.setOutputMarkupPlaceholderTag( true );
 
 
 
 //
 
 
 
 //
  component.add( new BorderBehaviour() );
 
 
 
 //
 
 
 //
 
  this.borderMarkupId = component.getMarkupId() + _brd;
  }
 
  
  
  
  class BorderBehaviour extends Behavior
  {
  @Override
   public void beforeRender( Component component )
  {
  Response response = component.getResponse();
 
  response.write( div id=\ );
  response.write( borderMarkupId ); // Generated from the bound component
  above
   response.write( \ class=\popup\
 style=\display:none;\h1span );
  response.write( headerTextModel.getObject() );
   response.write( /spanspan class=\close\aX/a/span/h1 );
  }
 
  @Override
  public void afterRender( Component component )
  {
   component.getResponse().write( /div );
  }
  }
 
 
  When a page is initially loaded, beforeRender() and afterRender() get
  executed just fine.  If the user hits the browser reload button,
 everything
  still works (these two functions get executed).  However, during an Ajax
  triggered event, I end up with duplicate markup being appended to the
 bound
  component (since these two methods above run again, but the Component
  hierarchy isn't re-generated, thus multiple copies of the additional
 markup
  are written to the stream).
 
  I tried making the behavior temporary, and while that fixes the Ajax
 case,
  it breaks in the user-presses-reload-button case - since the behavior,
  now temporary, gets detached from the request after the initial render
 and
  doesnt get rerun when the user requests a page that is already
  generated/cached.
 
  How can I make this work for all three cases -
  1. Page load
  2. Page reload (same page ID)
  3. Ajax
 
  I noticed that the response in (3) is an AbstractAjaxResponse - is the
 only
  way to fix this to run an instanceof check on the response type or is
 there
  an alternate way?
 
  N
 





Behavior rendering

2014-05-11 Thread Nick Pratt
I have a Behavior attached to a WebMarkupContainer with a bind() method as
follows:

@Override
public void bind( Component component )
 {
this.boundComponent = component;

component.setOutputMarkupId( true );
 component.setOutputMarkupPlaceholderTag( true );

//

//
component.add( new BorderBehaviour() );

//
//

this.borderMarkupId = component.getMarkupId() + _brd;
}




class BorderBehaviour extends Behavior
{
@Override
 public void beforeRender( Component component )
{
Response response = component.getResponse();

response.write( div id=\ );
response.write( borderMarkupId ); // Generated from the bound component
above
 response.write( \ class=\popup\ style=\display:none;\h1span );
response.write( headerTextModel.getObject() );
 response.write( /spanspan class=\close\aX/a/span/h1 );
}

@Override
public void afterRender( Component component )
{
 component.getResponse().write( /div );
}
}


When a page is initially loaded, beforeRender() and afterRender() get
executed just fine.  If the user hits the browser reload button, everything
still works (these two functions get executed).  However, during an Ajax
triggered event, I end up with duplicate markup being appended to the bound
component (since these two methods above run again, but the Component
hierarchy isn't re-generated, thus multiple copies of the additional markup
are written to the stream).

I tried making the behavior temporary, and while that fixes the Ajax case,
it breaks in the user-presses-reload-button case - since the behavior,
now temporary, gets detached from the request after the initial render and
doesnt get rerun when the user requests a page that is already
generated/cached.

How can I make this work for all three cases -
1. Page load
2. Page reload (same page ID)
3. Ajax

I noticed that the response in (3) is an AbstractAjaxResponse - is the only
way to fix this to run an instanceof check on the response type or is there
an alternate way?

N


Re: WildCard URL strategy for E-Commerce Products

2014-03-15 Thread Nick Pratt
Mount your product details page and then use PagePatameters to extract the
query params.

N
On Mar 15, 2014 10:44 AM, Arjun Dhar dhar...@yahoo.com wrote:

 Hi,
 for the sake of SEO. It is recommended that URL path params for a product
 look like:

 Example --
 /../Category1/SubCategory2/SubSubCategory2/productDetails?name=SHOE123


 Now, one stupid way of doing this could be to load every product in the
 database by generating the link to it. However I feel thats too
 inefficient.

 I'd simply like to define a Strategy /*/productDetails?name=SHOE123
 ... Where Wicket would not care what came before productDetails and
 recognizes productDetails as the Page. The PATH PARAMS are merely a SEO
 formality and not of consequence to the final Page loading.

 Do I write my own strategy for this stuff or is there something Out of the
 Box?

 thanks

 -
 Software documentation is like sex: when it is good, it is very, very
 good; and when it is bad, it is still better than nothing!
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/WildCard-URL-strategy-for-E-Commerce-Products-tp4664984.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




Testing Form with AjaxSubmitLink

2014-03-13 Thread Nick Pratt
How do you submit a form via WicketTester and an AjaxSubmitLink?


*HomePage.java:*

public class HomePage extends WebPage
{
 private static final long serialVersionUID = 1L;

private String email;

public HomePage( final PageParameters parameters )
 {
super( parameters );

Form form = new Form( form );
 add( form );

form.add( new EmailTextField( email, new PropertyModel(this, email) ) );
 form.add( new AjaxSubmitLink(submit)
{
@Override
 protected void onSubmit( AjaxRequestTarget target, Form? form )
{
int i = 0;
 }
});
}
}

*HomePage.html*

!DOCTYPE html
html xmlns:wicket=http://wicket.apache.org;
body

form wicket:id=form
 input type=email wicket:id=email placeholder=Email
button type=submit wicket:id=submitSign Up/button
 /form

/body
/html

*Unit Test:*

@Test
 public void testPanel() throws Exception
{
WicketTester tester = new WicketTester();
 tester.startPage( HomePage.class );

FormTester formTester = tester.newFormTester( form );
 formTester.setValue( email, t...@test.com );
formTester.submit( submit );
 }


Re: Testing Form with AjaxSubmitLink

2014-03-13 Thread Nick Pratt
Any reason that the FormTester.submit() couldn't be modified to check the
type of the form submitter, and invoke the correct code accordingly?

N


On Thu, Mar 13, 2014 at 3:28 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 See the javadoc of
 org.apache.wicket.util.tester.BaseWicketTester#clickLink(java.lang.String,
 boolean)

 Martin Grigorov
 Wicket Training and Consulting


 On Thu, Mar 13, 2014 at 8:06 PM, Nick Pratt nbpr...@gmail.com wrote:

  How do you submit a form via WicketTester and an AjaxSubmitLink?
 
 
  *HomePage.java:*
 
  public class HomePage extends WebPage
  {
   private static final long serialVersionUID = 1L;
 
  private String email;
 
  public HomePage( final PageParameters parameters )
   {
  super( parameters );
 
  Form form = new Form( form );
   add( form );
 
  form.add( new EmailTextField( email, new PropertyModel(this, email) )
  );
   form.add( new AjaxSubmitLink(submit)
  {
  @Override
   protected void onSubmit( AjaxRequestTarget target, Form? form )
  {
  int i = 0;
   }
  });
  }
  }
 
  *HomePage.html*
 
  !DOCTYPE html
  html xmlns:wicket=http://wicket.apache.org;
  body
 
  form wicket:id=form
   input type=email wicket:id=email placeholder=Email
  button type=submit wicket:id=submitSign Up/button
   /form
 
  /body
  /html
 
  *Unit Test:*
 
  @Test
   public void testPanel() throws Exception
  {
  WicketTester tester = new WicketTester();
   tester.startPage( HomePage.class );
 
  FormTester formTester = tester.newFormTester( form );
   formTester.setValue( email, t...@test.com );
  formTester.submit( submit );
   }
 



ListView - onComponentTag

2014-03-10 Thread Nick Pratt
Is there any reason why onComponentTag() wouldn't be invoked on a ListView:

ListViewUser users = new ListViewUser( team-members, usersModel )
 {
@Override
protected void onComponentTag( ComponentTag tag )
 {
super.onComponentTag( tag );
int i = 0;
 }
...


I set a breakpoint on 'int i =0'; but its never hit - either on initial
page render or when the containing Panel is refreshed via Ajax. None of the
child behaviors attached to the ListView are triggered either (no
onComponentTag execution)
Wicket 6.14.0

N


Re: Teaming up remotely

2014-01-29 Thread Nick Pratt
We found the simplest way to handle this situation was to let the HTML/CSS
folks design and style the page in pure HTML, no Wicket tags, with sample
data they made up.  They then committed their changes into the shared VCS.
 The designers Ive worked with in the past just didn't (or didn't want to)
understand the Wicket tags and their structure.  We spent way too much time
fixing broken markup because the designers thought it was ok to or they
didnt realize they were moving tags around. The designers also dont run
Java unit tests so you dont catch page rendering errors until the markup
changes hit the Java devs desktops. After several attempts at explaining in
what scenarios Wicket tags couldnt be moved we gave up and had them run a
page or two in front of the Java devs.  Converting plain HTML with sample
data into a Wicket page was far simpler and easier for the Java/Wicket
programmers than the other way around.

Your mileage may vary ;-)


On Wed, Jan 29, 2014 at 3:54 AM, Lucio Crusca lu...@sulweb.org wrote:

 Hello everybody,

 today I need to begin a project where, for the 1st time in my life, the
 team
 members won't work close to each other, and, again for the 1st time, I'm
 going
 to use Wicket in such a project. I'm in charge of writing all the code
 (mostly
 Java with Wicket being the framework of choice for the UI). The rest of the
 team is located about 700km from me and they're going to take care of HTML
 and
 CSS development.

 Are there any recognized best practices I should suggest them in HTML/CSS
 production in order to avoid problems on my side? E.g. is it usual asking
 for
 HTML files split into common header for all pages, common footer,
 common
 whatever and page specific content apart? Or is it more common to split
 them
 myself?

 How should we manage revisions? I could arrange for a bazaar server or the
 like, but how are those tools understood by web designers? Or should I take
 their files and manage conflicts and commits on my side without even
 telling
 them? But, then again, revision control works best on a line by line based
 comparison, and with Wicket I suspect conflicts will be the norm. E.g.
 suppose
 they change anything on their side in a HTML file that I already edited
 with
 wicket tags and committed to bzr:

 --- Their HTML file
 old: span class=myclass
 new: span class=myclass2

 -- My HTML file
 committed: span class=myclass wicket:id=myid
 new: span class=myclass2

 -- conflict (because they aren't aware of my edits and they can't be,
 unless
 they split HTML files in header, footer, whatever and use bzr themselves).

 I'm puzzled, that has to be a so common problem I hardly believe there's no
 standardized solution. Please advice.

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




Form submit without URL modification

2013-12-20 Thread Nick Pratt
Is it possible to create a form submission that hits a specific URL and
doesn't modify the original URL displayed in the browser.

e.g. I have a single simple Page, that has a StatelessForm on it. I hit
this via http://localhost:8080/
When I hit the form submit button, the URL in the browser changes to:
http://localhost:8080//?-1.IFormSubmitListener-form

Im trying to create a button that can always be clicked regardless of
Wicket session expiration and that doesnt modify the URL - is this possible?

N


WicketTester - asserting on HTML

2013-11-21 Thread Nick Pratt
Is it possible to to make assertions on the rendered HTML of a Wicket page?

Im trying to make assertions on element attributes (class contents
specifically).  Is this possible with WicketTester?

N


Re: Conditionally include header item when page contains ajax components

2013-11-14 Thread Nick Pratt
The javascript will only be included if your Ajax enabled component is
included that in turn references the JS ResourceReference, otherwise it
wont be.

N


On Thu, Nov 14, 2013 at 7:59 AM, Marios Skounakis msc...@gmail.com wrote:

 If I'm not mistaken this will cause JQuery to be included whenever my js
 reference is included. Effectively this will cause non-ajax pages to load
 javascript which applies only to ajax requests.

 What I want is the opposite: to not include my js reference when the page
 does not have any ajax.


 On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote:

  Hi Marios,
 
  IMO the best way IMO is to make your js reference extending
  JQueryPluginResourceReference (wicket 6)
 
  Best regards,
  Sebastien.
 
 
  On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com
  wrote:
 
   Hi all,
  
   I have a base page from which all my pages inherit. I want to
  conditionally
   include a javascript reference (header item) if the page contains an
 ajax
   component. The reference is a veil implementation based on BlockUI
 which
  is
   redundant (and also causes a javascript error) if the page has not ajax
   (and hence JQuery is not loaded).
  
   Any suggestions?
  
   Thanks
   Marios
  
 



Re: Conditionally include header item when page contains ajax components

2013-11-14 Thread Nick Pratt
Then you're doing something odd :-)

If you have dependencies like this:

CustomComponent -- Custom JS Reference (and this is added in the public
void renderHead( Component component, IHeaderResponse response ) method)
-- Wicket's JQuery JS Reference

Page A (no Ajax components or components depending on Wicket's jquery ref)
Page B -- CustomComponent  (Page B being a copy of Page with a single
instance of your CustomComponent)

When you load Page A, the JS will not be loaded.
When you load Page B, both the Wicket JS and the custom JS will be added to
the page.

If you are seeing Jquery being loaded in Page A then some component on that
page requires the Wicket JS libraries and is causing it to be added.

N



On Thu, Nov 14, 2013 at 8:56 AM, Marios Skounakis msc...@gmail.com wrote:

 Thanks Martin, this worked well.

 Sebastien and Nick, I tried the solution with JQueryPluginResourceReference
 but this indeed caused JQuery to be loaded in non ajax pages.


 On Thu, Nov 14, 2013 at 3:04 PM, Martin Grigorov mgrigo...@apache.org
 wrote:

  Hi,
 
  You can create custom IHeaderResponseDecorator and by using custom
  IHeaderResponse you can check for contributions
  of org.apache.wicket.ajax.WicketAjaxJQueryResourceReference
  See
 
 http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/?0
   and http://wicketinaction.com/2012/07/wicket-6-resource-management/
 
 
  On Thu, Nov 14, 2013 at 2:59 PM, Marios Skounakis msc...@gmail.com
  wrote:
 
   If I'm not mistaken this will cause JQuery to be included whenever my
 js
   reference is included. Effectively this will cause non-ajax pages to
 load
   javascript which applies only to ajax requests.
  
   What I want is the opposite: to not include my js reference when the
 page
   does not have any ajax.
  
  
   On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com wrote:
  
Hi Marios,
   
IMO the best way IMO is to make your js reference extending
JQueryPluginResourceReference (wicket 6)
   
Best regards,
Sebastien.
   
   
On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis msc...@gmail.com
 
wrote:
   
 Hi all,

 I have a base page from which all my pages inherit. I want to
conditionally
 include a javascript reference (header item) if the page contains
 an
   ajax
 component. The reference is a veil implementation based on BlockUI
   which
is
 redundant (and also causes a javascript error) if the page has not
  ajax
 (and hence JQuery is not loaded).

 Any suggestions?

 Thanks
 Marios

   
  
 



Re: Conditionally include header item when page contains ajax components

2013-11-14 Thread Nick Pratt
Understood.

Martin - (for my own curiousity now) would it be possible and would there
be any benefit to replacing the default Wicket jQuery resource reference
with a custom veil.js ResourceReference that also included the packaged
Wicket jquery resource ref as a dependency (i.e. configure this all in
Application.init() )?

Nick


On Thu, Nov 14, 2013 at 3:04 PM, Marios Skounakis msc...@gmail.com wrote:

 I probably wasn't clear enough.

 Here's my case:

 BasePage.renderHead() adds veil.js as javascript resource reference.

 All my pages inherit from BasePage. But veil.js is only useful when a page
 has wicket ajax.

 If I declare that veil.js has a dependency on jquery then the result is
 that all pages get both veil.js and jquery. What I want is that pages that
 don't have ajax (i.e. no Wicket-Ajax or Wicket-Event libraries) don't
 include veil.js. I could do it on a per component basis but this would be
 cumbersome and error prone. So instead I used Martin's solution and
 conditionally render veil.js only if the headerResponse renders
 Wicket-Event.


 On Thu, Nov 14, 2013 at 5:09 PM, Nick Pratt nbpr...@gmail.com wrote:

  Then you're doing something odd :-)
 
  If you have dependencies like this:
 
  CustomComponent -- Custom JS Reference (and this is added in the public
  void renderHead( Component component, IHeaderResponse response ) method)
  -- Wicket's JQuery JS Reference
 
  Page A (no Ajax components or components depending on Wicket's jquery
 ref)
  Page B -- CustomComponent  (Page B being a copy of Page with a single
  instance of your CustomComponent)
 
  When you load Page A, the JS will not be loaded.
  When you load Page B, both the Wicket JS and the custom JS will be added
 to
  the page.
 
  If you are seeing Jquery being loaded in Page A then some component on
 that
  page requires the Wicket JS libraries and is causing it to be added.
 
  N
 
 
 
  On Thu, Nov 14, 2013 at 8:56 AM, Marios Skounakis msc...@gmail.com
  wrote:
 
   Thanks Martin, this worked well.
  
   Sebastien and Nick, I tried the solution with
  JQueryPluginResourceReference
   but this indeed caused JQuery to be loaded in non ajax pages.
  
  
   On Thu, Nov 14, 2013 at 3:04 PM, Martin Grigorov mgrigo...@apache.org
   wrote:
  
Hi,
   
You can create custom IHeaderResponseDecorator and by using custom
IHeaderResponse you can check for contributions
of org.apache.wicket.ajax.WicketAjaxJQueryResourceReference
See
   
  
 
 http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/?0
 and http://wicketinaction.com/2012/07/wicket-6-resource-management/
   
   
On Thu, Nov 14, 2013 at 2:59 PM, Marios Skounakis msc...@gmail.com
wrote:
   
 If I'm not mistaken this will cause JQuery to be included whenever
 my
   js
 reference is included. Effectively this will cause non-ajax pages
 to
   load
 javascript which applies only to ajax requests.

 What I want is the opposite: to not include my js reference when
 the
   page
 does not have any ajax.


 On Thu, Nov 14, 2013 at 2:04 PM, Sebastien seb...@gmail.com
 wrote:

  Hi Marios,
 
  IMO the best way IMO is to make your js reference extending
  JQueryPluginResourceReference (wicket 6)
 
  Best regards,
  Sebastien.
 
 
  On Thu, Nov 14, 2013 at 12:20 PM, Marios Skounakis 
  msc...@gmail.com
   
  wrote:
 
   Hi all,
  
   I have a base page from which all my pages inherit. I want to
  conditionally
   include a javascript reference (header item) if the page
 contains
   an
 ajax
   component. The reference is a veil implementation based on
  BlockUI
 which
  is
   redundant (and also causes a javascript error) if the page has
  not
ajax
   (and hence JQuery is not loaded).
  
   Any suggestions?
  
   Thanks
   Marios
  
 

   
  
 



Re: Issue w/ Ajax and setting form containers visible in Deployment mode.

2013-11-07 Thread Nick Pratt
This functionality does work - can you put your code up on
pastebin/gist/whatever so we can take a look? (Markup and Source please)


On Wed, Nov 6, 2013 at 8:14 PM, Ben S br...@yahoo.com wrote:

 Hello,

 I've been trying to work on this issue for hours and have had no luck.

 Basically, my code works just fine in development mode as intended,
 however when in Deployment mode I can't seem to get WebMarkupContainers
 toggle between visibility.

 If they're visible, they won't go invisible, however if they are invisible
 they will toggle visible.

 However, the markup containers seems to work as expected when the form is
 passed to the AjaxRequestTarget,  however this will clear all the data
 that's on the form page, even though the form is set up for a compound
 property model..

 Is there any way to set the webmarkupcontainers visible to false using
 ajax in Deployment mode?


Component detecting Ajax update

2013-11-01 Thread Nick Pratt
Is there a way for a Component to detect if its been added to an
AjaxRequestTarget?

N


RequestCycle with multiple handlers

2013-10-31 Thread Nick Pratt
Wicket 6.11

I have an AbstractDefaultAjaxBehavior that returns JSON in its protected
void respond( AjaxRequestTarget target ) method by:

requestCycle.scheduleRequestHandlerAfterCurrent( new TextRequestHandler(
text/plain, UTF-8, json ) );

This ADAB is used for returning status information back to a client side
Javascript component (FileUploader), and the interoperation of the
Javascript component and Wicket via JSON works.

However, it seems that simple javascript appended to the ART is not being
invoked on the client.  Is the scheduleRequestHandlerAfterCurrent() above
replacing the Ajax response that would normally have been sent back to the
client (in this case the Ajax updates - components and javascripts added to
the ART)?

Is there way to return JSON, and also have the ART updates triggered? I'm
not seeing anything in the AjaxDebugger on the client, so it looks like my
simple test alert('here'); is not being sent or interpreted correctly by
the client.

N


Re: RequestCycle with multiple handlers

2013-10-31 Thread Nick Pratt
The JS component sends JSON to the server and expects JSON in response.  I
was stepping through the Wicket code, and it looks like I can only invoke
scheduleRequestHandlerAfterCurrent once since there is only a single 'next'
variable. Any JS appended to the ART doesn't seem to get executed on the
client when Im sending the JSON response back. ill keep digging.


On Thu, Oct 31, 2013 at 4:35 PM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Hi,

 Yes I think than when you schedule new request target ajax request target
 is discarded.

 I do not know how this component works but maybe you can return your JSON
 as part as a javaScript eval

 target.append(myEvalaJSON('JSON'))

 ?


 On Thu, Oct 31, 2013 at 8:35 PM, Nick Pratt nbpr...@gmail.com wrote:

  Wicket 6.11
 
  I have an AbstractDefaultAjaxBehavior that returns JSON in its protected
  void respond( AjaxRequestTarget target ) method by:
 
  requestCycle.scheduleRequestHandlerAfterCurrent( new TextRequestHandler(
  text/plain, UTF-8, json ) );
 
  This ADAB is used for returning status information back to a client side
  Javascript component (FileUploader), and the interoperation of the
  Javascript component and Wicket via JSON works.
 
  However, it seems that simple javascript appended to the ART is not being
  invoked on the client.  Is the scheduleRequestHandlerAfterCurrent() above
  replacing the Ajax response that would normally have been sent back to
 the
  client (in this case the Ajax updates - components and javascripts added
 to
  the ART)?


 
 Is there way to return JSON, and also have the ART updates triggered? I'm
  not seeing anything in the AjaxDebugger on the client, so it looks like
 my
  simple test alert('here'); is not being sent or interpreted correctly by
  the client.
 
  N
 



 --
 Regards - Ernesto Reinaldo Barreiro



Re: RequestCycle with multiple handlers

2013-10-31 Thread Nick Pratt
I figured this out - the handler was being invoked by the JS component in
two different places - one using Wicket.Ajax.get() and the other by direct
jquery Ajax invocation (same callback URL).   I swapped out the plain
jQuery invocation for a Wicket.ajax call and everything works as expected.


N


On Thu, Oct 31, 2013 at 5:28 PM, Nick Pratt nbpr...@gmail.com wrote:

 The JS component sends JSON to the server and expects JSON in response.  I
 was stepping through the Wicket code, and it looks like I can only invoke
 scheduleRequestHandlerAfterCurrent once since there is only a single 'next'
 variable. Any JS appended to the ART doesn't seem to get executed on the
 client when Im sending the JSON response back. ill keep digging.


 On Thu, Oct 31, 2013 at 4:35 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

 Hi,

 Yes I think than when you schedule new request target ajax request target
 is discarded.

 I do not know how this component works but maybe you can return your JSON
 as part as a javaScript eval

 target.append(myEvalaJSON('JSON'))

 ?


 On Thu, Oct 31, 2013 at 8:35 PM, Nick Pratt nbpr...@gmail.com wrote:

  Wicket 6.11
 
  I have an AbstractDefaultAjaxBehavior that returns JSON in its protected
  void respond( AjaxRequestTarget target ) method by:
 
  requestCycle.scheduleRequestHandlerAfterCurrent( new TextRequestHandler(
  text/plain, UTF-8, json ) );
 
  This ADAB is used for returning status information back to a client side
  Javascript component (FileUploader), and the interoperation of the
  Javascript component and Wicket via JSON works.
 
  However, it seems that simple javascript appended to the ART is not
 being
  invoked on the client.  Is the scheduleRequestHandlerAfterCurrent()
 above
  replacing the Ajax response that would normally have been sent back to
 the
  client (in this case the Ajax updates - components and javascripts
 added to
  the ART)?


 
 Is there way to return JSON, and also have the ART updates triggered? I'm
  not seeing anything in the AjaxDebugger on the client, so it looks like
 my
  simple test alert('here'); is not being sent or interpreted correctly by
  the client.
 
  N
 



 --
 Regards - Ernesto Reinaldo Barreiro





Re: CSS include order

2013-10-24 Thread Nick Pratt
Thanks Martin.

I figured out a slightly simpler approach (which I think works, please
correct me if Im mistaken) - I added the site-wide CSS to my BasePage in
Java rather than a simple include ref in the markup :

@Override
public void renderHead( IHeaderResponse response )
 {
super.renderHead( response );
 response.render( CssReferenceHeaderItem.forUrl( assets/css/global.css )
);
}

This results in the global.css being appended last in the head and thus
allows us to override anything provided by any Component or Behavior used
on the Page.


On Thu, Oct 24, 2013 at 3:33 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 1) You can use FilteredHeaderItem to group the site-wide CSS in the
 beginning of the body, for example.
 2) You can use PriorityHeaderItem to put component ones at the top
 3) You can use custom header item comparator to re-order them on your
 custom criteria

 See http://wicketinaction.com/2012/07/wicket-6-resource-management/ for
 explanation of all of those approaches.


 On Wed, Oct 23, 2013 at 6:34 PM, Nick Pratt nbpr...@gmail.com wrote:

  Is there a quick/simple way to ensure that our site-wide CSS is included
  last (as included in our BasePage.html head section), after all other
  Components have contributed their CSS files?
 
  N
 



CSS include order

2013-10-23 Thread Nick Pratt
Is there a quick/simple way to ensure that our site-wide CSS is included
last (as included in our BasePage.html head section), after all other
Components have contributed their CSS files?

N


Re: continueToOriginalDestination issue

2013-10-02 Thread Nick Pratt
One thing to check is if your login page is stateless.  If its not, and you
attempt to login using your login page some time after your initially
loaded the page in the browser, then the original login page displayed
would have timed out and the attempted login wont succeed.  Ive seen this
behavior a couple of times now (after which we fix the Login Page and make
it stateless)


On Wed, Oct 2, 2013 at 1:28 PM, shimin_q smq...@hotmail.com wrote:

 Hello,

 My homepage URL is http://server ip/awol, and it is linked to
 MainPage.html and MainPage.java.  I also have a HomePage.html/HomePage.java
 that is essentially a login page and contains a LoginForm.

 public Class? extends Page getHomePage() {
 return MainPage.class;
 }

 @Override
 protected Class? extends WebPage getSignInPageClass() {
 return HomePage.class;
 }

  I use continueToOriginalDestination() once LoginForm submitted
 username/password and was authenticated:

 protected void onSubmit() {
 Login login = getModelObject();

 AuthenticatedWebSession session =
 AuthenticatedWebSession.get();
 if (session.authenticate(login.getUsername(),
 login.getPassword())) {
 logger.debug(authentication successful);
 this.continueToOriginalDestination();
 }
 else {
 error(Invalid credentials);
 }
 }

 I am expecting that continueToOriginalDestination would take me to the
 MainPage after user successfully logged in, but intermittently,
 continueToOriginalDestination() just stays on the HomePage (with the
 LoginForm) even after the user name/password is authenticated.

 What could be the issue?  Please help!!

 Thanks!!



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654.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: continueToOriginalDestination issue

2013-10-02 Thread Nick Pratt
Any components on your Page that aren't stateless cause the Page containing
them to be Stateful- Forms are stateful by default.  Add this to your
page's onInitialize() and it will help you see what's going on.  Check out
Wicket's StatelessForm class.

@Override
protected void onInitialize()
 {
super.onInitialize();

visitChildren( new IVisitorComponent, Void()
{
 @Override
public void component( Component component, IVisitVoid visit )
 {
if( component.isStateless() )
 {
return;
 }

log.warn( Not Stateless: Component:  + component.getId() +  /  +
component.getMarkupId() +  -  + component.getPageRelativePath() );
 }
} );
}



On Wed, Oct 2, 2013 at 5:05 PM, shimin_q smq...@hotmail.com wrote:

 This could explain the intermittent nature of the problem.  Thanks, Nick!
 Could you elaborate on what you mean by stateless login page?  Here is my
 Login page and Login Form inside it.  Could you please tell me what I need
 to change?

 public class HomePage extends WebPage {

 public HomePage() {
 add(new Label(headerMessage, OmniVista 8770 Login));

 add(new LoginForm(form));

 add(new FeedbackPanel(feedback));
 }

 }

 public class LoginForm extends FormLogin {

 private static final Logger logger =
 LoggerFactory.getLogger(LoginForm.class);

 private static final long serialVersionUID = 1L;

 private TextFieldString username;
 private PasswordTextField password;

 public LoginForm(String id) {
 super(id, new CompoundPropertyModelLogin(new Login()));

 username = new TextFieldString(username);
 username.setRequired(true);
 add(username);
 password = new PasswordTextField(password);
 add(password);
 }

 @Override
 protected void onSubmit() {
 Login login = getModelObject();

 AuthenticatedWebSession session =
 AuthenticatedWebSession.get();
 if (session.authenticate(login.getUsername(),
 login.getPassword())) {
 logger.debug(authentication successful);
 this.continueToOriginalDestination();
 }
 else {
 error(Invalid credentials);
 }
 }

 }



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661662.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: continueToOriginalDestination issue

2013-10-02 Thread Nick Pratt
Are you entering the URL of your main page or your login page?

You also have to check if there is a continue-to-destination field set and
if not you have to send your user to a default home page.

N
On Oct 2, 2013 8:18 PM, shimin_q smq...@hotmail.com wrote:

 Thanks - that sounds exactly what I observed in my case where the login
 page
 (HomePage class) gets redisplayed after I entered the user name and
 password.

 I am looking at some sample code with Stateless login forms, in addition to
 using StatelessForm instead Form, a bind() is called too after
 authenticate().  So I changed my LoginForm as follows (note that LoginForm
 is part of my HomePage class):

 public class LoginForm extends StatelessFormLogin {

 private static final Logger logger =
 LoggerFactory.getLogger(LoginForm.class);

 private static final long serialVersionUID = 1L;

 private TextFieldString username;
 private PasswordTextField password;

 public LoginForm(String id) {
 super(id, new CompoundPropertyModelLogin(new Login()));

 username = new TextFieldString(username);
 username.setRequired(true);
 add(username);
 password = new PasswordTextField(password);
 add(password);
 }

 @Override
 protected void onSubmit() {
 Login login = getModelObject();

 AuthenticatedWebSession session =
 AuthenticatedWebSession.get();
 if(session instanceof AwolAuthenticatedWebSession) {
 logger.debug(session is
 AwolAuthenticatedWebSession);
 }
 if (session.authenticate(login.getUsername(),
 login.getPassword())) {
 logger.debug(authentication successful);
 if (session.isTemporary()) {
 logger.debug(session temporary, bind to
 permanent);
 session.bind();  // according to sample
 code, this makes the temporary
 session used by the stateless login page permanent
 }

 this.continueToOriginalDestination();
 }
 else {
 error(Invalid credentials);
 }
 }

 But this code change does not seem to work either.  The first time I log
 in,
 the session.isTemporary returns true, so it did session.bind().  But after
 continueToOriginalDestination(), it is still the login page displayed, it
 does not go on to MainPage.  If I enter username/password again, this time,
 the code seems to get a session.isTemporary returns false, and
 continueToOriginalDestination() still does not go on to MainPage.

 Anything else I am missing here?  Thanks for your help!



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661667.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: Rendering conditional html tags for IE CSS targetting

2013-08-14 Thread Nick Pratt
The workaround we use is to have multiple html close tags:

!--[if lt IE 7]/html![endif]--
!--[if IE 7]/html![endif]--
!--[if IE 8]/html![endif]--
!--[if gt IE 8]!--/html!--![endif]--


On Wed, Aug 14, 2013 at 7:17 AM, Robert Gründler r.gruend...@gmail.comwrote:

 Hi,

 i'm trying to use the markup provided by html5 boilerplate:
 http://html5boilerplate.com/

 They use !--[if lt IE 7]   ![endif]--  comments to render different
 opening html tags for different versions of Internet Explorer, easing CSS
 selectors for IE.

 Here's how it looks like: https://gist.github.com/pulse00/6230134

 When using this markup in wicket, i see the following exception: Tag does
 not have a close tag /html

 It looks like wicket is getting confused by the html comments containing
 html tags.

 Has anyone an idea how to implement this in wicket?


 regards


 -robert



Re: receive non-wicket json payload via wicket website

2013-08-04 Thread Nick Pratt
Write a servlet.
On Aug 4, 2013 10:35 AM, ricb r...@brinydeep.net wrote:

 I have a requirement to receive some json payloads via a wicket website. (I
 have IP and port restrictions that make it difficult to receive it
 elsewhere.) These payloads are unrelated to the content of the website, and
 will be sent via simple http post calls.

 Is there a way to bypass most of the wicket infrastructure for these http
 calls and just do something simple with the json payloads (e.g., save to
 disk or a postgresql database)?

 Thanks much.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/receive-non-wicket-json-payload-via-wicket-website-tp4660680.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: Wicket with Spring for IOC

2013-06-25 Thread Nick Pratt
I have the following in my web.xml:

 filter
filter-nameWicketAppFilter/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-name*applicationClassName*/param-name
param-valuecom.test.app.MyApplication/param-value
/init-param
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param
init-param
param-nameconfiguration/param-name
param-valuedevelopment/param-value
!--param-valuedeployment/param-value--
/init-param
/filter

On Tue, Jun 25, 2013 at 11:30 AM, Michael Chandler 
michael.chand...@onassignment.com wrote:

 I received outstanding guidance yesterday on integrating wicket-spring
 into my application and combined with the write-up along with a lot of
 other similar articles/blogs I found online, I'm confident I'm on the right
 track.  I have encountered an error that has me a little mystified and was
 hoping someone could help shed some light.  I'm getting the following
 exception when I attempt to start Tomcat within Eclipse:

 java.lang.IllegalStateException: bean of type
 [org.apache.wicket.protocol.http.WebApplication] not found

 Full stack trace below.

 Despite having defined my WebApplication bean in the
 applicationContext.xml, this exception appears at start-up, leading me to
 believe that it cannot find my applicationContext.xml configuration, though
 I feel that I'm pointing Spring and Wicket in the right direction with the
 following:

 context-param
 param-namecontextConfigLocation/param-name
 param-valueclasspath:applicationContext.xml/param-value
 /context-param

 listener

 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
 /listener

 I have also adjusted my filter to leverage SpringWebApplicationFactory as
 follows:

 filter
 filter-namewicket.wicketFilter/filter-name

 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class

 init-param
 param-nameapplicationFactoryClassName/param-name

 param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
 /init-param
 /filter

 filter-mapping
 filter-namewicket.wicketFilter/filter-name
 url-pattern/*/url-pattern
 /filter-mapping

 And in my applicationContext.xml, my WebApplication bean has been defined:

 bean id=wicketApplication class=com.oa.frontoffice.FrontOfficeApp /

 Lastly, I have the following in my init() method on the WebApplication
 object:

 getComponentInstantiationListeners().add(new
 SpringComponentInjector(this));

 Has anyone encountered this exception before who can offer me some advice
 on where to start digging?

 The full stack trace is here:

 Jun 25, 2013 8:17:52 AM org.apache.catalina.core.StandardContext
 filterStart
 SEVERE: Exception starting filter wicket.wicketFilter
 java.lang.IllegalStateException: bean of type
 [org.apache.wicket.protocol.http.WebApplication] not found
 at
 org.apache.wicket.spring.SpringWebApplicationFactory.createApplication(SpringWebApplicationFactory.java:161)
 at
 org.apache.wicket.spring.SpringWebApplicationFactory.createApplication(SpringWebApplicationFactory.java:140)
 at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:370)
 at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:336)
 at
 org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
 at
 org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
 at
 org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
 at
 org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:103)
 at
 org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4624)
 at
 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281)
 at
 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
 at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
 at
 java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)

 Regards,

 Mike

 -Original Message-
 From: Joachim Schrod [mailto:jsch...@acm.org]
 Sent: Monday, June 24, 2013 12:28 PM
 To: users@wicket.apache.org
 Subject: Re: Wicket with Spring 

Re: Introduction and some questions about Wicket

2013-06-13 Thread Nick Pratt
For 3.) here are some of our experiences:

1.) If you are building from scratch and utilizing a separate
design/styling team, we found its far easier/quicker to let the CSS folks
do their thing and provide static pages, which the dev team then interprets
and builds towards.  Most devs can read HTML and understand its structure,
so converting that in to Wicket components is straight forward.  The
inverse, in our experience, is far from true.  While this approach gets you
up and running the quickest (since you can find CSS styling consultants
everywhere - at least you can here) it can leave you in a little bit of a
hole unless you intend to hire someone on to the team full time with this
knowledge.

2.) Having an employee with lots of current CSS knowledge on the dev team
is a huge help. If they also have JS knowledge, thats an even bigger bonus.

3.) If you are trying to retrofit styling to an already built application
(or where significant portions have been built), having a separate/isolated
styling team is a major drag on app development.

In our experience (and I don't intend this to be a blanket statement), most
folks with good CSS knowledge are highly resistant to understanding Java
and/or Wicket, and thus a significant impedance mismatch exists between the
two efforts. If you find a Java dev with solid CSS knowledge, hang on to
them!

Nick

On Wed, Jun 12, 2013 at 3:47 PM, Michael Pence mike.pe...@gmail.com wrote:

 Hi guys,

 My name is Mike Pence. I think that I have dipped into this list a time or
 two in the past, but I am here, this time, with serious intent to use
 Wicket for a very big project -- big both in terms of how many users it
 will have, and big in its impact.

 I have been doing Rails for the last 7 or 8 years (spoke at Ruby and Rails
 conferences about rich web apps), after coming from a Delphi and Java
 background (and Microsoft stuff, but I leave that out).

 So, Rails is great but does not give me the modularity and component
 re-use in the UI that I loved in Delphi. I am making some assumptions about
 Wicket, and would appreciate your feedback on these assumptions:

 1. That wicket lets you model rich and highly interactive web apps that
 can feel like desktop apps, but in the browser. (Examples?)
 2. That building complex UI widgets -- grids, trees, custom components
 like timelines or graphs or calendars -- is comparatively painless.
 3. That you can largely leave the markup and styling to the people who
 like doing that kind of thing (why they would, I don't get…)

 I would love to do Scala with Wicket but I can't raise the bar that high,
 right now. If there was a JRuby version of wicket…that would be awesome.
 JVM runtime is a big win for this, because the project definitely will have
 many, many users.

 Has anyone done any work with wicket focused on mobile devices?

 Appreciate your thoughts.

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




Re: Wicket mail and pdf

2013-06-13 Thread Nick Pratt
Did you modify your pom.xml to include the PDF?

In buildresources you should have something similar to:

resource
filteringfalse/filtering
directorysrc/main/java/directory
includes
include**/include
/includes
excludes
exclude**/*.java/exclude
/excludes
/resource

Is the PDF checked in to your version control system?

N

On Thu, Jun 13, 2013 at 6:48 AM, Piratenvisier
hansheinrichbr...@yahoo.dewrote:

 Martin thank you for your instantanious answers,

 I tried the mailtemplate example changed resource.text to resource.pdf and
 after some research concerning the error I got included
   IPackageResourceGuard packageResourceGuard =
 getResourceSettings().**getPackageResourceGuard();
 if (packageResourceGuard instanceof
 SecurePackageResourceGuard)
 {
 SecurePackageResourceGuard guard =
 (SecurePackageResourceGuard)
 packageResourceGuard;
 guard.addPattern(+*.pdf);
 }
 in the init method of the Application.
 I get the Document :
 !DOCTYPE html
 html

 head
 titleA template based on a page/title
 /head

 body
 !-- The next is dynamically generated --
 Hello, spanBraun/span

 You receive this email because you are subscribed for our products.
 We just released a new version of product X.

 !-- This link is also dynamically generated --
 Please download it a href=http://localhost:8080/**
 mailtemplate/wicket/resource/**org.apache.wicket.examples.**
 asemail.MailTemplate/resource.**pdfhttp://localhost:8080/mailtemplate/wicket/resource/org.apache.wicket.examples.asemail.MailTemplate/resource.pdf
 here/a!

 br/br/
 Sincerely,
 The Marketing team
 /body

 /html
 and when I use the link I get the error:

 Problem accessing /mailtemplate/wicket/resource/**
 org.apache.wicket.examples.**asemail.MailTemplate/resource.**pdf. Reason:

 Unable to find resource


 What is still wrong ?



 Am 11.06.2013 08:45, schrieb Martin Grigorov:

 Hi,

 At http://www.wicket-library.com/**wicket-examples-6.0.x/**
 mailtemplate/?0http://www.wicket-library.com/wicket-examples-6.0.x/mailtemplate/?0you
 can see an example of rendering the markup for a page, a panel and a
 resource.
 At 
 http://markmail.org/message/**em4wqtsxhetu4skjhttp://markmail.org/message/em4wqtsxhetu4skjyou
  can see how to create
 PDF out of the produced HTML.


 On Tue, Jun 11, 2013 at 9:39 AM, Piratenvisier
 hansheinrichbr...@yahoo.de**wrote:

  Does anybody know some example example code to start with
 concerning email and pdf

 Thanks in advance
 Heiner Braun
 Am 10.06.2013 10:34, schrieb Martin Grigorov:

  Hi,

 If you use Wicket 6.7.0+ then you can use ComponentRenderer class to get
 the markup of any Wicket Page/Panel/Component.
 Then you can use the generated markup for mails and PDF creation.
 For PDF creation you can check
 https://github.com/flyingsaucerproject/flyingsaucerhttps://github.com/**flyingsaucerproject/**flyingsaucer
 https://github.**com/flyingsaucerproject/**flyingsaucerhttps://github.com/flyingsaucerproject/flyingsaucer
 .
 There is a mail in the
 users@ mail archives from the last few days by another user showing how
 to
 use FlyingSaucer's ITextRenderer.


 On Sat, Jun 8, 2013 at 8:39 PM, Piratenvisier**hansheinrichbrau**
 n...@yahoo.dehansheinrichbraun@**yahoo.de hansheinrichbr...@yahoo.de
 wrote:

   I wanted to integrate mail and pdf creation in my wicket application.

 Till now I manage this by sending a request to a cocoon-2.2.0
 application.
 This is a good solution but because I see no upgrade way using my
 cocoon
 application
 and integrating newer versions of spring I am looking for an
 alternative.

 Heiner

 --**--**--**
 --**-
 To unsubscribe, e-mail: users-unsubscribe@wicket.apa**che.org
 http://apache.org**
 users-unsubscribe@**wicket.**apache.org http://wicket.apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 
 For additional commands, e-mail: users-h...@wicket.apache.org



  --**
 --**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apa**che.orghttp://apache.org
 users-unsubscribe@**wicket.apache.orgusers-unsubscr...@wicket.apache.org
 
 For additional commands, e-mail: users-h...@wicket.apache.org






Re: Spring @Autowire not working

2013-05-12 Thread Nick Pratt
OK, your test doesnt test anything Wicket related, and is purely a Spring
application.

In order to use Spring in a wicket app, you need to check out some of the
articles on the web - Google for Wicket spring application and there are
several full working examples of how to use Spring in a Wicket application.

Primarily you have to initialize the Spring app context in the web.xml via
a ContextLoaderListener, and then in your Wicket Application's init()
method, you need to add a SpringComponentInjector as a listener.  Then as I
mentioned a few days back, you need to use @SpringBean to annotate the
fields you want autowired.  There are a handful of other cases where you
will have to trigger the bean injection manually, but get your basic app
working first with Spring.

N


On Sun, May 12, 2013 at 12:34 AM, ORACLEADF ora@gmail.com wrote:

 Hi Nick
 Thank you.
 I create a file applicationContext.xml like the following pic and I use it
 in DAO and BO classes :
 applicationContext.xml_.png
 
 http://apache-wicket.1842946.n4.nabble.com/file/n4658733/applicationContext.xml_.png
 

 and I tested it using public static void main like the following pic :
 psvm.png 
 http://apache-wicket.1842946.n4.nabble.com/file/n4658733/psvm.png




 -
 Regards
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Spring-Autowire-not-working-tp4658728p4658733.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: Spring @Autowire not working

2013-05-11 Thread Nick Pratt
@Autowired is a Spring thing.  If you want to use auto wired beans within a
Wicket instantiated page (as opposed to an object instantiated inside/by
the Spring container) you need to use the @SpringBean annotation (which is
a Wicket provided annotation)

N


On Sat, May 11, 2013 at 11:27 AM, ORACLEADF ora@gmail.com wrote:

 The @Autowired annotation works when I call it from my tests, but doesn't
 work when I call it
 from my Wicket pages.
 How can I fix this?




 -
 Regards
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Spring-Autowire-not-working-tp4658728.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: Spring @Autowire not working

2013-05-11 Thread Nick Pratt
Are your unit tests extending one of the Spring unit test base classes, or
are you running with one of the Spring Junit Test runners?


On Sat, May 11, 2013 at 12:12 PM, ORACLEADF ora@gmail.com wrote:

 Nick, you are probably right and maybe this post doesn't belong on the
 Wicket forum. The reason why I posted it is that @Autowired annotation
 works when I call it from my tests, but doesn't work when I call it
 from my Wicket pages. So, this is more of a configuration rather
 than a bug question.  Keep up the good work!



 -
 Regards
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Spring-Autowire-not-working-tp4658728p4658731.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: Redirect user in Ajax response

2013-05-06 Thread Nick Pratt
I've attached a quickstart that exhibits this behavior.

Run Start, and access locally at: localhost:8080/gateway

Then try hitting: localhost:8080/target

While both approaches intercept the destination page (TargetPage), the
first case displays the Ajax Response content after auth.  The second case
works as expected.

Enter anything for user and password.



On Mon, May 6, 2013 at 11:04 AM, Nick Pratt nbpr...@gmail.com wrote:

 Im trying to redirect a user from an emailed link to an authenticated
 page.  The user clicks the link, I show a page (after checking the link
 validity etc.), and then using an AjaxTimerBehavior, I instantiate an
 auth-protected page, and invoke setResponsePage( myPage );

 Wicket then shows the login form, and after successful authentication, the
 browser then shows the XML content of any empty ajax-response/ instead of
 the target page.  I see
 the org.apache.wicket.request.RequestHandlerStack$ReplaceHandlerException
 being thrown when I invoke continueToOriginalDestination();

 Ive also tried invoking requestCycle.scheduleRequestHandlerAfterCurrent()
 and requestCycle.replaceAllRequestHandlers() instead of setResponsePage()
 but I hit the same problem.

 Im using Wicket 6.7.0.

 Should I be able to redirect the user to an auth protected page on an Ajax
 timer callback like this?

 Nick



quickstart.tar.gz
Description: GNU Zip compressed data

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

Re: Adding javascript to form submit

2013-05-06 Thread Nick Pratt
Add an AjaxFormSubmitBehavior and override getPreconditionScript() (or
override that for your AjaxButton)


On Mon, May 6, 2013 at 11:39 AM, krishnamohank
k.krishnamoha...@gmail.comwrote:

 I have a wicket Form and a AjaxButton on it, my requirement is to create a
 cookie/local storage on form submit. For this i tried to add following js:

 addEvent(form[0], submit, save);

 function addEvent(elem, evt, fn) {
 if (elem.addEventListener)
 elem.addEventListener(evt, fn, false);
 else if (elem.attachEvent)
 elem.attachEvent(on + evt, fn);
 }

 function save() {
 
 createStorage();
 }

 but this js is not executed at all, submit event is not fired.(I dont want
 to use setPersistent() also as I want to use localstorage as well)

 Can you please tell me how to add  javascript to form submit for the above
 scenario.

 TIA
 Krishna Mohan



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Adding-javascript-to-form-submit-tp4658587.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: May Ajax handlers in Wicket 6 slow down rendering?

2013-05-03 Thread Nick Pratt
Thanks Martin - I meant more aligned with the existing Wicket framework - I
understand the JS concept, but was wondering if anyone had built the
(de)multiplexing code on the client and server to handle a single event
handler for a table/repeater component and how that could hook up with
existing server side Wicket components.

N


On Fri, May 3, 2013 at 3:51 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 There are many articles in the web about javascript event delegation.
 Here is one of them: http://davidwalsh.name/event-delegate

 The idea is that you should use AjaxEventBehavior on the table component
 without using AjaxLink or any other Ajax component/behavior for the
 components in the cells.
 The cells and rows can have data-xyz attributes with their specific data.
 When a cell is clicked AjaxCallListener can collect the related data from
 the data- attributes and send it to the server. The #onClick() method can
 process the posted data or just broadcast it with Wicket event to the
 children components so they can process it themselves.

 This pattern is not so straithforward as using AjaxLink but it indeed makes
 a difference in the performance, especially in IE family.



 On Fri, May 3, 2013 at 12:15 AM, Nick Pratt nbpr...@gmail.com wrote:

  Any demos of this with Wicket form components or simple click listeners ?
 
  I'd much rather a repeater have a single listener for grouped events (or
  maybe at the column level for tables)
 
  N



Re: May Ajax handlers in Wicket 6 slow down rendering?

2013-05-02 Thread Nick Pratt
Any demos of this with Wicket form components or simple click listeners ?

I'd much rather a repeater have a single listener for grouped events (or
maybe at the column level for tables)

N
On May 2, 2013 6:10 PM, Dan Retzlaff dretzl...@gmail.com wrote:

 Martin-G elaborated a bit on this last year:

 http://mail-archives.apache.org/mod_mbox/wicket-users/201209.mbox/%3ccamomwmqdf3ytlstb_kbnvn9t1pump_-+npdtmtvyt+ac6ec...@mail.gmail.com%3E

 I think the gist is that you can avoid attaching listeners to each child
 with a single listener on the parent with enough smarts to figure out which
 child generated the event.


 On Thu, May 2, 2013 at 3:25 PM, Martin Dietze d...@fh-wedel.de wrote:

  Than you for your help!
 
  On Thu, May 02, 2013, Martin Grigorov wrote:
 
long blocks of Javascript code executed at domready.
   
  
   This depends on how many Ajax components/behaviors you have in your
 page
   and how many OnDomReadyHeaderItems are contributed.
  
   If you use JavaScript event delegation with Wicket Ajax Behavior that
   broadcasts events then you can decrease this dramatically.
 
  That sounds interesting, but - forgive me my ignorance - this is
  the first time I hear about this kind of thing. Can you hint me
  at some example?
 
  Cheers,
 
  M'bert
 
  --
  --- / http://herbert.the-little-red-haired-girl.org /
  -
  =+=
  Katz' Law: Man and nations will act rationally when all other
 possibilities have been exhausted.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: Skip dynamically an item in populateItem of ListView

2013-04-30 Thread Nick Pratt
Surely the list is provided to the ListView (either via a List or
IModelList).  So just wrap that List or IModel in another IModel
(LoadableDetachableModel) and then filter the List contents inside the
getObject() call.

N


On Tue, Apr 30, 2013 at 9:21 AM, Marco Di Sabatino Di Diodoro 
marco.disabat...@tirasa.net wrote:


 On Apr 30, 2013, at 3:19 PM, Maxim Solodovnik wrote:

  Maybe you can filter List prior to populate items from it?

 No, I can not filter the List before.

 M
 
 
 
  On Tue, Apr 30, 2013 at 8:01 PM, Marco Di Sabatino Di Diodoro 
  mdisabatinodidiod...@gmail.com wrote:
 
  Hi all,
 
  Which is the best way to skip dynamically an item in populateItem of
  ListView.
  Currently I use setEnable and setVisible, but I like to know if there
 was
  a better approach.
 
  Regards
  Marco
 
 
  --
 
  Dott. Marco Di Sabatino Di Diodoro
  mdisabatinodidiod...@gmail.com
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  WBR
  Maxim aka solomax

 --

 Dott. Marco Di Sabatino Di Diodoro
 Tel. +39 3939065570

 Tirasa S.r.l.
 Viale D'Annunzio 267 - 65127 Pescara
 Tel +39 0859116307 / FAX +39 085973
 http://www.tirasa.net

 Apache Syncope PMC Member
 http://people.apache.org/~mdisabatino








Changes in Wicket 6.x branch related to page instantiation?

2013-04-19 Thread Nick Pratt
Has anything changed in the Wicket 6.x branch with regards to page
instantiation and authentication?


I had code that was working that did the following:

Page page = new MyAuthProtectedPage( someParams, someIModel );

This page was then passed to a RedirectPanel, where I did this in the
Panel's constructor:

add(new AbstractAjaxTimerBehavior( Duration.seconds( 2 ) )
{
@Override
 protected void onTimer( AjaxRequestTarget target )
{
this.stop( target );
 setResponsePage( webPage );
}
});

This was working, and if the page I passed in was protected, then Wicket
intercepted the redirect, showed the login page and allowed authentication,
and then after successful auth, the page I had constructed was shown.  Now
with Wicket 6.7.0 Im hitting exceptions during the initial page
construction - Im getting a RestartResponseAtInterceptPageException during
the constructor.

Any thoughts?

Nick


Re: Changes in Wicket 6.x branch related to page instantiation?

2013-04-19 Thread Nick Pratt
There is no stack.  All I see in the Exception is:

org.apache.wicket.RestartResponseAtInterceptPageException


Nick


On Fri, Apr 19, 2013 at 9:42 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Show us the stacktrace.


 On Fri, Apr 19, 2013 at 4:36 PM, Nick Pratt nbpr...@gmail.com wrote:

  Has anything changed in the Wicket 6.x branch with regards to page
  instantiation and authentication?
 
 
  I had code that was working that did the following:
 
  Page page = new MyAuthProtectedPage( someParams, someIModel );
 
  This page was then passed to a RedirectPanel, where I did this in the
  Panel's constructor:
 
  add(new AbstractAjaxTimerBehavior( Duration.seconds( 2 ) )
  {
  @Override
   protected void onTimer( AjaxRequestTarget target )
  {
  this.stop( target );
   setResponsePage( webPage );
  }
  });
 
  This was working, and if the page I passed in was protected, then Wicket
  intercepted the redirect, showed the login page and allowed
 authentication,
  and then after successful auth, the page I had constructed was shown.
  Now
  with Wicket 6.7.0 Im hitting exceptions during the initial page
  construction - Im getting a RestartResponseAtInterceptPageException
 during
  the constructor.
 
  Any thoughts?
 
  Nick
 



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



Re: Update ListView with Ajax, performance.

2013-04-12 Thread Nick Pratt
Id use one of various Javascript libs to implement this sort of
functionality - I think select2 and datatables would both work for such a
list (I think they both support infinite scrolling lists) that only
render/send a page of information at a time. There's a wicket-select2
library, but its fairly minimal in nature - you'll need to understand the
JS docs to get anywhere with it. I think there's a Wicket lib for
Datatables, but I dont know its maintenance status.  There are countless
other JS libraries to do this as well.

Nick


On Fri, Apr 12, 2013 at 4:05 PM, Raul ralva...@netwie.com wrote:

 Hello, I need to implement a component that can display a list of users
 from
 a ListView, at the end of the list you should see a link to see more
 users. What I need is to update the list of users displayed but without
 rendering at all in ListView again. Because right now I use a AjaxLink that
 updates the entire ListView container, but when many users are penalized
 performance and gives a sense of slowness. Anyone know if you can implement
 some of this functionality with wicket.





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Update-ListView-with-Ajax-performance-tp4657948.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: Update ListView with Ajax, performance.

2013-04-12 Thread Nick Pratt
I guess you could build something with just the core framework, but I think
it would be a lot clunkier than one of the libs - for instance, on the
client side JS libs, you get events that can trigger Ajax callbacks to load
the next set of data while the user is scrolling through the list - since
its async, its much smoother and a better experience.

Ive used (and am using in a current project) both select2 and datatables.
 While the initial learning curve is reasonable with both libs (you're not
likely to be able to avoid writing your own JS init/config for these
components), they are stable, and work very well.

N


On Fri, Apr 12, 2013 at 4:36 PM, Raul ralva...@netwie.com wrote:

 Nick, I sensed that the solution was going to use Javascript, my question
 was
 if there was any easier than the framework could provide. Select2 prove.

 Alexy single client solution does not help me as I have a large volume of
 data.

 Regards and thanks for the guidance.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Update-ListView-with-Ajax-performance-tp4657948p4657951.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




AddOrReplace with Ajax

2013-04-11 Thread Nick Pratt
I use addOrReplace fairly frequently in normal requests, but Im having
trouble making this work in an Ajax request.

1. Add EmptyPanel(someId); to page
2. User clicks link, and then on the server side I do: addOrReplace(new
DetailPanel(someId));
 and the Details Panel appears in place of the EmptyPanel.

How do I make this work in an AjaxLink?

In order to update the component via Ajax, I need its markupId in the
existing markup - EmptyPanel doesnt have one (or has a different one to the
DetailPanel).

Should I set the markupId of the EmptyPanel and the constructed DetailPanel
to be the same value?

Regards

Nick


Repainting repeaters - why the need for the enclosing element

2013-04-09 Thread Nick Pratt
I've never really understood this concept, and Im hoping that someone can
explain:

When I have a repeater, say a ListView, and I have the tags set up:

div wicket:id=myRepeater
 ...
 whatever
 ...
/div

Why cant I repaint that component via Ajax? There's an ID etc.  - what in
Wicket forces us to wrap that component in a (typically) WebMarkupContainer
just to repaint the repeater?

N


Markup ID set on a container

2013-04-03 Thread Nick Pratt
Ive started to see this in my logs:

2013-04-03 14:11:31,332 WARN  [http-bio-8080-exec-2]
org.apache.wicket.Component - Markup id set on a component that is usually
not rendered into markup. Markup id: wmcb7, component id: wmc, component
tag: container.
2013-04-03 14:11:35,079 WARN  [http-bio-8080-exec-2]
org.apache.wicket.Component - Markup id set on a component that is usually
not rendered into markup. Markup id: wmcdb, component id: wmc, component
tag: container.
2013-04-03 14:11:50,590 WARN  [http-bio-8080-exec-2]
org.apache.wicket.Component - Markup id set on a component that is usually
not rendered into markup. Markup id: wmcfe, component id: wmc, component
tag: container.
2013-04-03 14:12:01,359 WARN  [http-bio-8080-exec-2]
org.apache.wicket.Component - Markup id set on a component that is usually
not rendered into markup. Markup id: wmc12c, component id: wmc, component
tag: container.


When did this warning get added (Im using Wicket 6.7.0-SNAPSHOT)? It's very
common (at least here) to put repeaters and other groups of components in
to WebMarkupContainers and then update them via Ajax as a single unit.

N


Re: Markup ID set on a container

2013-04-03 Thread Nick Pratt
Ah, many thanks Igor!

Nick


On Wed, Apr 3, 2013 at 2:23 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 this warning is because you attach the webmarkupcontainer to a
 wicket:container tag

 this tag is not rendered in deployment mode, so the id you want to
 output using setOutputMarkupId() wont be there either - thus the
 warning.

 -igor

 On Wed, Apr 3, 2013 at 11:18 AM, Nick Pratt nbpr...@gmail.com wrote:
  Ive started to see this in my logs:
 
  2013-04-03 14:11:31,332 WARN  [http-bio-8080-exec-2]
  org.apache.wicket.Component - Markup id set on a component that is
 usually
  not rendered into markup. Markup id: wmcb7, component id: wmc, component
  tag: container.
  2013-04-03 14:11:35,079 WARN  [http-bio-8080-exec-2]
  org.apache.wicket.Component - Markup id set on a component that is
 usually
  not rendered into markup. Markup id: wmcdb, component id: wmc, component
  tag: container.
  2013-04-03 14:11:50,590 WARN  [http-bio-8080-exec-2]
  org.apache.wicket.Component - Markup id set on a component that is
 usually
  not rendered into markup. Markup id: wmcfe, component id: wmc, component
  tag: container.
  2013-04-03 14:12:01,359 WARN  [http-bio-8080-exec-2]
  org.apache.wicket.Component - Markup id set on a component that is
 usually
  not rendered into markup. Markup id: wmc12c, component id: wmc, component
  tag: container.
 
 
  When did this warning get added (Im using Wicket 6.7.0-SNAPSHOT)? It's
 very
  common (at least here) to put repeaters and other groups of components in
  to WebMarkupContainers and then update them via Ajax as a single unit.
 
  N

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




Re: Tracking performance issues on requests best practices

2013-04-01 Thread Nick Pratt
We use JProfiler, but Ive also used Yourkit (both very good profilers).

N


On Mon, Apr 1, 2013 at 3:45 PM, Serban.Balamaci thespamtr...@gmail.comwrote:

 Hello guys,
 I'm trying to have a finer look at what is taking time on the serverside in
 our application.

 What I have so far is that I'm using Spring AOP to track down calls to all
 the methods and time to the Services layer. PS: I'm using JETM
 http://jetm.void.fm/ (it may be old, but is simple and give pretty much
 what
 you need).

 2. I've collected the time for the whole request to process in a
 AbstractRequestCycleListener onBeginRequest, onEndRequest so as to see a
 sum
 of the total time spent on a particular usecase.

 What I've expected to find is that most of the resulting time would be
 spent
 in the services layer and pretty much summed up to be near the request time
 on the requestcyclelistener.

 Practical data shows however otherwise, with the sum of the service time
 not
 even close to the total of the request time.

 3. So I've fine tuned the result to also show the rendering time for the
 components taking as example RenderPerformanceListener which measure the
 time between component onBeforeRender and onAfterRender.
 It's pretty nice to see in jetm hierarchycal component-services call,
 however it still not nearly close to the whole request time.

 I'm still looking and seeing that there is some logic also on some
 component's constructors and also onInitialize() methods that I see no easy
 way to measure them. IComponentInitializationListener seems to only trigger
 after initialization, I see no  easy way to mark the start time of the
 onInitialize() and collect the time in the listener.

 So I'm asking if anyone got an idea, or I'm interested what you guys
 usually
 do to track down any performance issues in the app.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Tracking-performance-issues-on-requests-best-practices-tp4657676.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: Wicket and Stripe integration

2013-03-12 Thread Nick Pratt
This really boils down to being able to intercept the form submit action,
fire off the Stripe JS, and then once that action returns, trigger the
normal Wicket form submission.  Can such form interception be done?

On Tue, Mar 12, 2013 at 3:36 PM, Nick Pratt nbpr...@gmail.com wrote:

 Has anyone integrated Wicket with Stripe (payment processing
 www.stripe.com) ?

 If so, how did you hook up their JS with a Wicket form so that the token
 is accessible on the server?

 Nick




Re: Page Hierachy and Packages

2013-03-08 Thread Nick Pratt
Do the pages in your auth package inherit from your BasePage class?  In
your auth package pages markup, do you have wicket:extend tags?

Nick

On Fri, Mar 8, 2013 at 9:17 AM, David Beer david.m.b...@gmail.com wrote:

 Hi All

 I am new Wicket and like what I have found so far. My problem is that I
 have created a few pages and forms and placed them in a package named
 auth. I can navigate to the pages easily but they don't seem to inherite
 the CSS from the BasePage which is in a different package. Also any links
 to the HomePage which is in the default package is not found.

 My BasePage HTML looks like the following:

 html xmlns=http://www.w3.org/1999/**xhtml http://www.w3.org/1999/xhtml
 
   xmlns:wicket=http://wicket.**apache.org/dtds.data/wicket-**
 xhtml1.4-strict.dtdhttp://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd
 
   xml:lang=en
   lang=en
   head
 wicket:head
   wicket:link
 link rel=stylesheet type=text/css href=style.css/
   /wicket:link
 /wicket:head
   /head
   body
 div id=container
   div id=header
 header wicket:id=headerpanel/
   /div
   div class=content_container
 wicket:child/
   /div
   div id=footer
 footer wicket:id=footerpanel /
   /div
 /div
   /body
 /html

 My AdminPage which is in the auth package is never finds the css file
 declared in the base page.

 My project structure is as follows:

 src/main/java/example/BasePage and HomePage
 src/main/java/example/auth/**AdminPage and SignInPage and SignOutPage

 html xmlns:wicket=http://wicket.**apache.org http://wicket.apache.org
 
   head
 meta http-equiv=Content-Type content=text/html; charset=UTF-8/
 titleAdminPage/title
   /head
   body
 wicket:extend
   h2Welcome ADMIN!/h2
   p
 This page should only be accessible if you are signed in as an
 administrator.
   /p
   p
 wicket:linka href=HomePage.htmlHome/a**/wicket:linkbr/
 wicket:linka href=SignOutPage.htmlSign Out/a/wicket:link
   /p
 /wicket:extend
   /body
 /html

 I mount the pages in the xxApplication class as follows:

 mountPage(/Home, HomePage.class);
 mountPage(/guest-list, GuestListPage.class);
 mountPage(/auth/adminpage, AdminPage.class);
 mountPage(/auth/signin, SignInPage.class);
 mountPage(/auth/signout, SignOutPage.class);

 How can fix the navigation and the location of the css file so that it is
 found. The css file is located the Webapps dir.

 Thanks

 David

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




Re: ThreadLocal with ajax

2013-03-06 Thread Nick Pratt
How are you ensuring that the thread that created the page is the same one
that's used to service the AJAX call?

N
On Mar 6, 2013 6:37 AM, Ann Baert ann.ba...@tvh.com wrote:

 Hi,

 I have a springbean with a ThreadLocal property. On the page (constructor
 and onBeforeRenderer) I set a value to that ThreadLocal property. When I do
 the get of that property after an ajax call, the value is null.

 I made a quickstart to simulate the problem. I print the ThreadLocal value
 on the page (correct) and
 after call on the ajaxlink the value is null.
 Does anyone know a solution for this?

 ThreadLocalTest.zip
 
 http://apache-wicket.1842946.n4.nabble.com/file/n4657018/ThreadLocalTest.zip
 



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/ThreadLocal-with-ajax-tp4657018.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: JS execution order problem

2013-03-06 Thread Nick Pratt
Thanks - that seems to confirm the problem - delaying the Datatables JS to
after the Wicket link listeners have executed will fix it, since the errors
are coming from the Wicket Link Listeners not being able to find markup IDs
that the Datatables JS paginates out of view. (load fires after ready if my
research is correct)

I expect the execution order to be:
1. All link listeners within the table would be executed (all rows in table
are available at this point)
2. Datatables JS then executes and paginates the table

Although when I look at the page source I see the Wicket event listeners
listed before the Datatables JS, they seem to be executing in a different
order - this is what is confusing.

N

On Wed, Mar 6, 2013 at 12:10 PM, Andrea Del Bene an.delb...@gmail.comwrote:

 Replacing OnDomReadyHeaderItem with OnLoadHeaderItem (class
 DatatablesBehavior) seems to solve your problem. It's likely that your
 script (the one from DatatablesBehavior) depends on some other code and it
 must wait for it to be loaded before being executed.

 Im having a problem with Javascript execution order that I could use some
 help with.  I made a quickstart here:
 https://dl.dropbox.com/u/**107816727/quickstart.tar.gzhttps://dl.dropbox.com/u/107816727/quickstart.tar.gz

 Basically, this is a Wicket DefaultDataTable, with an embedded
 AjaxEventBehavior, overlaid with a Datatables.net JS behavior (
 www.datatables.net).

 What seems to be happening is that the Datatables.net JS is executing
 before the Wicket AjaxEventBehavior JS, and in so doing, it paginates the
 table and removes a couple of IDs that Wicket then cannot find.
 I thought the default JS execution order was children first, then parent,
 so I was expecting the AjaxEventBehavior JS to execute first and then the
 Datatables.net JS (which is on the parent DefaultDataTable)

 To reproduce simply click any of the Click Me cells in the table.

 Any suggestions would be most appreciated,

 Regards

 Nick



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




Re: JS execution order problem

2013-03-06 Thread Nick Pratt
I take some of that back:

In the initial page rendering, the Javascript is ordered as I expect (child
JS then parent JS).
However, in the Ajax update, the Wicket listeners are added *after* the
datatables init call, which results in an out of order sequence.

Why is the Ajax update change the order of the JS of the parent and child
elements?

N

On Wed, Mar 6, 2013 at 12:27 PM, Nick Pratt nbpr...@gmail.com wrote:

 Thanks - that seems to confirm the problem - delaying the Datatables JS to
 after the Wicket link listeners have executed will fix it, since the errors
 are coming from the Wicket Link Listeners not being able to find markup IDs
 that the Datatables JS paginates out of view. (load fires after ready if my
 research is correct)

 I expect the execution order to be:
 1. All link listeners within the table would be executed (all rows in
 table are available at this point)
 2. Datatables JS then executes and paginates the table

 Although when I look at the page source I see the Wicket event listeners
 listed before the Datatables JS, they seem to be executing in a different
 order - this is what is confusing.

 N

  On Wed, Mar 6, 2013 at 12:10 PM, Andrea Del Bene an.delb...@gmail.comwrote:

 Replacing OnDomReadyHeaderItem with OnLoadHeaderItem (class
 DatatablesBehavior) seems to solve your problem. It's likely that your
 script (the one from DatatablesBehavior) depends on some other code and it
 must wait for it to be loaded before being executed.

 Im having a problem with Javascript execution order that I could use some
 help with.  I made a quickstart here:
 https://dl.dropbox.com/u/**107816727/quickstart.tar.gzhttps://dl.dropbox.com/u/107816727/quickstart.tar.gz

 Basically, this is a Wicket DefaultDataTable, with an embedded
 AjaxEventBehavior, overlaid with a Datatables.net JS behavior (
 www.datatables.net).

 What seems to be happening is that the Datatables.net JS is executing
 before the Wicket AjaxEventBehavior JS, and in so doing, it paginates the
 table and removes a couple of IDs that Wicket then cannot find.
 I thought the default JS execution order was children first, then parent,
 so I was expecting the AjaxEventBehavior JS to execute first and then the
 Datatables.net JS (which is on the parent DefaultDataTable)

 To reproduce simply click any of the Click Me cells in the table.

 Any suggestions would be most appreciated,

 Regards

 Nick



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





Re: JS execution order problem

2013-03-06 Thread Nick Pratt
I logged: https://issues.apache.org/jira/browse/WICKET-5082 and added some
comments with my interpretation of what's going on.

N

On Wed, Mar 6, 2013 at 12:31 PM, Nick Pratt nbpr...@gmail.com wrote:

 I take some of that back:

 In the initial page rendering, the Javascript is ordered as I expect
 (child JS then parent JS).
 However, in the Ajax update, the Wicket listeners are added *after* the
 datatables init call, which results in an out of order sequence.

 Why is the Ajax update change the order of the JS of the parent and child
 elements?

 N

 On Wed, Mar 6, 2013 at 12:27 PM, Nick Pratt nbpr...@gmail.com wrote:

 Thanks - that seems to confirm the problem - delaying the Datatables JS
 to after the Wicket link listeners have executed will fix it, since the
 errors are coming from the Wicket Link Listeners not being able to find
 markup IDs that the Datatables JS paginates out of view. (load fires after
 ready if my research is correct)

 I expect the execution order to be:
 1. All link listeners within the table would be executed (all rows in
 table are available at this point)
 2. Datatables JS then executes and paginates the table

 Although when I look at the page source I see the Wicket event listeners
 listed before the Datatables JS, they seem to be executing in a different
 order - this is what is confusing.

 N

  On Wed, Mar 6, 2013 at 12:10 PM, Andrea Del Bene 
 an.delb...@gmail.comwrote:

 Replacing OnDomReadyHeaderItem with OnLoadHeaderItem (class
 DatatablesBehavior) seems to solve your problem. It's likely that your
 script (the one from DatatablesBehavior) depends on some other code and it
 must wait for it to be loaded before being executed.

 Im having a problem with Javascript execution order that I could use
 some
 help with.  I made a quickstart here:
 https://dl.dropbox.com/u/**107816727/quickstart.tar.gzhttps://dl.dropbox.com/u/107816727/quickstart.tar.gz

 Basically, this is a Wicket DefaultDataTable, with an embedded
 AjaxEventBehavior, overlaid with a Datatables.net JS behavior (
 www.datatables.net).

 What seems to be happening is that the Datatables.net JS is executing
 before the Wicket AjaxEventBehavior JS, and in so doing, it paginates
 the
 table and removes a couple of IDs that Wicket then cannot find.
 I thought the default JS execution order was children first, then
 parent,
 so I was expecting the AjaxEventBehavior JS to execute first and then
 the
 Datatables.net JS (which is on the parent DefaultDataTable)

 To reproduce simply click any of the Click Me cells in the table.

 Any suggestions would be most appreciated,

 Regards

 Nick



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






Re: Loading different ApplicationContexts(Spring) for each WicketServlet

2013-03-05 Thread Nick Pratt
You could embed Jetty inside your app (rather than deploying a war to
tomcat) and run multiple copies taking a couple of command line params -
namely port number and config file location.

N
On Mar 5, 2013 7:19 AM, MG miha.go...@gmail.com wrote:

 
  You can try with different interfaces for the different beans, or by
 using
  @
  Qualifier
 

 I don't think I understand what do you mean here.
 Do you propose I should have beanA and beanB in my application logic? If
 so, this is just what I was trying to avoid, because the beautiful part of
 the application is that I can have an implementation which isn't aware of A
 and B scenario and doesn't have to be as long as the beans are initialized
 correctly. Please correct me if I didn't understand you correctly.


  or you can even split the app in two - two different .war files that
 share
  a common .jar. The wars just have different web.xml and
  applicationContext.xml
 
 
 OK, this solution would probably work. It was one of the options I
 considered before posting here, but I didn't like the overhead of packaging
 and deploying multiple wars.

 Is there a third(fourth) option?


 
  On Tue, Mar 5, 2013 at 12:51 PM, MG miha.go...@gmail.com wrote:
 
   Excuse me, if anyone is reading this for the second time, because I
  already
   tried with this question on stackoverflow (with no luck).
  
   I'm developing a web application with Spring and Wicket.
  
   I would like to achieve, that different paths get different
   applicationContexts loaded. *How can I do that?*
  
   For example:
  
  - http://myhost/ this in my entry page with some static data.
  - http://myhost/A/(and all subfolders) gets loaded
  applicationContext-A.xml
  - http://myhost/B/(and all subfolders) gets loaded
  applicationContext-B.xml
  
   Imagine that I have 2 databases which have the same structure, but hold
   contextually different data. My application logic is the same for
 both. I
   just have to initialize different dataSource and a couple of other
  beans
   initialized the-A-way or the-B-way.
  
   I managed to define two *WicketServlets (servletA and servletB)* in
   *web.xml
   * and I passed as a parameter the path to *applicationContext-A.xml*
 and
  *
   applicationContext-B.xml* respectively.
  
   The problem with this solution is, that I have to load the context in *
   WebApplication* by hand and then get the beans out of it with
   *getBean(..)
   * methods, instead of just using *@SpringBean* to wire the beans
   automatically.
  
   Best regards
  
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com http://jweekend.com/
 



Re: Dynamic Sidebar

2013-03-04 Thread Nick Pratt
ListString links = new ArrayListString();

ListView listView = new ListView(linksId, links)
{
void populateItem(  )
{
IModelString model = getModel(); (or whatever its called)
Link link = new Link(linkId, model );
item.add(link);
}
}

Markup will be something like:

ol
li wicket:id=linksId
a wicket:id=linkId/a
/li
/ol

Nick

On Sat, Mar 2, 2013 at 5:26 PM, Stephen Walsh step...@connectwithawalsh.com
 wrote:

 I think that's what I'm having trouble with.  I have created the list view
 like this:

 //define menu items
 final ListLink sidebarMenu = new ArrayListLink();
 sidebarMenu.add(new Link(new) {
 public void onClick() {
 setResponsePage(new EditBlogEntry(new Blog()));
 }
 });

 //put them into a model
 IModel sidebarLDM = new LoadableDetachableModel() {
 @Override
 protected Object load() {
 return sidebarMenu;
 }
 };

 //pass the model to the panel constructor
 add(new SidebarPanel(sidebar, sidebarLDM));

 public SidebarPanel(String id, IModel sidebarMenu) {
 super(id, sidebarMenu);

 add(new ListView(sidebarMenuItems, sidebarMenu) {
 @Override
 protected void populateItem(ListItem item) {
 item.add((Link)item.getModelObject());
 }
 });
 }

 I'm not sure what the markup needs to look like for the html

 For my base page I have this to include the panel with the repeater:
 div wicket:id=sidebar

 /div

 But I'm not sure what to put in the html for the actual panel with the list
 view

 wicket:panel
 div wicket:id=sidebarMenuItems
 /div
 /wicket:panel

 This is what I started with and it's not working currently.

 Thanks for the help.



 ___
 Stephen Walsh | http://connectwithawalsh.com


 On Sat, Mar 2, 2013 at 3:45 PM, Nick Pratt nbpr...@gmail.com wrote:

  You can use a ListView or any of the other repeaters to achieve this.
 
  Your repeated markup will be an anchor.
 
  N
  On Mar 2, 2013 3:35 PM, Stephen Walsh step...@connectwithawalsh.com
  wrote:
 
   I want to create a sidebar panel that is dynamic based on the links
  attach
   to it.  So far I have created a LDM that gets the list view of links
  that I
   create.  I pass the LDM the sidebar panel constructor and Wicket is
   complaining about not having the markup for the link that is passed.
Obviously this makes sense, but I'm not quite sure how to markup the
  html
   when I don't know what it's going to look like necessarily?
  
   I've been looking at containers and enclosures but I'm not quite
 getting
   it.
  
   Any thoughts on this?  I search all over google and couldn't find
 exactly
   what I was looking for.
  
   Thanks!
   ___
   Stephen Walsh | http://connectwithawalsh.com
  
 



Re: Dynamic Sidebar

2013-03-02 Thread Nick Pratt
You can use a ListView or any of the other repeaters to achieve this.

Your repeated markup will be an anchor.

N
On Mar 2, 2013 3:35 PM, Stephen Walsh step...@connectwithawalsh.com
wrote:

 I want to create a sidebar panel that is dynamic based on the links attach
 to it.  So far I have created a LDM that gets the list view of links that I
 create.  I pass the LDM the sidebar panel constructor and Wicket is
 complaining about not having the markup for the link that is passed.
  Obviously this makes sense, but I'm not quite sure how to markup the html
 when I don't know what it's going to look like necessarily?

 I've been looking at containers and enclosures but I'm not quite getting
 it.

 Any thoughts on this?  I search all over google and couldn't find exactly
 what I was looking for.

 Thanks!
 ___
 Stephen Walsh | http://connectwithawalsh.com



Re: Conditional Logic in HTML

2013-02-28 Thread Nick Pratt
Something I just noticed. if you only have a single conditional statement
then everything works fine - it looks like Wicket is ignoring the
conditional statements altogether, and simply sees multiple opening html
tags, and thus doesn't find multiple close tags.

N

On Thu, Feb 28, 2013 at 3:19 PM, Nick Pratt nbpr...@gmail.com wrote:

 Should the following work with Wicket 6.5/6.6?

 !DOCTYPE html

 !--[if IE]
 html class=IE
 ![endif]--
 !--[if !IE] --
 html class=NOT_IE
 !-- ![endif]--

 /html


 Wicket is not parsing the conditional when its around the html element
 itself - its failing to find the close tag

 ERROR - DefaultExceptionMapper - Unexpected error occurred
 Tag does not have a close tag

 Just put the above HTML in the Quickstart HomePage.html, and remove all
 the Components from HomePage.java to reproduce.

 It would also be helpful to tweak that error message to include the name
 of the tag that cant be found.

 Nick



Re: Infinite Scrolling in Wicket 6

2013-02-27 Thread Nick Pratt
Ive used Datatables (www.datatables.net) for similar features and it works
pretty well.

N

On Wed, Feb 27, 2013 at 4:58 AM, Martin Dietze d...@fh-wedel.de wrote:

 I will soon have to implement infinite scrolling in my project
 and would thus like to know if there are already libraries or
 code snippets for this based on Wicket 6?

 What I found after a quick search was oegyscroll [1], but this
 seems to be based on Wicket 1.4.x.

 But as this feature is becoming increasingly popular, I'm sure
 that others have already implemented this kind of thing and can
 give me a recommendation?

 Cheers,

 M'bert

 [1] https://github.com/reaktor/oegyscroll

 --
 --- / http://herbert.the-little-red-haired-girl.org /
 -
 =+=
 Ruft man einen Hund, dann kommt er. Ruft man eine Katze, dann nimmt
 sie das zur Kenntnis, und kommt gelegentlich darauf zurueck.

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




Re: a loading ... something ...

2013-02-13 Thread Nick Pratt
AjaxLazyLoadingPanel or write your own async models.

Look back at the recent mailing list history - someone kindly posted an
example application utilizing various async loading techniques.

This would be a good topic for the new ref docs!

N

On Wed, Feb 13, 2013 at 12:15 PM, grazia grazia.russolass...@gmail.comwrote:

 There are some pages in my app that load slowly due to the amount of data
 the
 customer needs to have (we have already optimized the retrieval part as
 much
 as possible). So I thought it would be nice to have a Loading ... dialog
 or something that disappears as soon as the data on the page have finished
 loading.
 What would you recommend for a Wicket app ? Any examples I could look at ?
 Thank you !



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/a-loading-something-tp4656323.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: ReferenceError: wicketGet is not defined

2013-02-01 Thread Nick Pratt
Some examples here for 6.0:
https://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html

On Fri, Feb 1, 2013 at 11:27 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 wicketGet - Wicket.get() (or Wicket.$())

 For Wicket 6 all such small methods were moved into Wicket.** namespace.
 There is a table with the old - new names in the migration guide for Ajax.


 On Fri, Feb 1, 2013 at 5:08 PM, saty satya...@gmail.com wrote:

  trying to use this example from
  org.apache.wicket.extensions.ajax.markup.html.autocomplete
  Class AbstractAutoCompleteRendererT
 
  example 1:
 
   protected CharSequence getOnSelectJavascript(Address address)
   {
  final StringBuilder js = new StringBuilder();
  js.append(wicketGet('street').value =' + address.getStreet() +
 ';);
  js.append(wicketGet('zipcode').value =' + address.getZipCode() +
  ';);
  js.append(wicketGet('city').value =' + address.getCity() + ';);
  js.append(input); // -- do not use return statement here!
  return js.toString();
   }
 
  Am i missing any necessary java script imports?
 
  Thanks
 
 
 
 
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/ReferenceError-wicketGet-is-not-defined-tp4655998.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
 
 


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



Re: collecting JavaScripts evals to improve client side rendering times and decrease response sizes

2013-01-25 Thread Nick Pratt
Couldn't we make some of these additional optimizations part of the
deployment options, similar to how other things are enabled in development
vs deployment?

N

On Fri, Jan 25, 2013 at 8:42 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Fri, Jan 25, 2013 at 3:30 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

  Hi Martin,
 
  Thanks for your answer!
 
  On Fri, Jan 25, 2013 at 1:51 PM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Hi Ernesto,
  
   Since https://issues.apache.org/jira/browse/WICKET-4881 (6.4.0)
  Wicket
   combines all JS snippets (AjaxRequestTarget#append/prependJavaScript())
   into at most one evaluate-priority and one evaluate. So this
   optimization is in place in core.
  
  
  Yes this is one big step on such optimization!
 
  Another step could be collecting all
 
 
 
 Wicket.Ajax.ajax({u:./list?3-1.IBehaviorListener.0-entities-entitiesList-bictables-1-actions-edit,e:click,c:editf6});
  
 
  into a single
 
  Wicket.Ajax.ajax([{a1}, {a}, ... {aN} ]);
 
  For this case you don't gain much (just removing a few
  Wicket.Ajax.ajax))...
 
  Or you can collect them by event and do something like
 
  Wicket.Ajax.ajax([{e:click,[{a1}, {a}, ... {aN}]}, {e:onchage, [{b1},
  ... {bN}]]}, ...]);
 
  in this case you get rid of a lot of repeated e: click and e:onchage.
  Of course this will only pay of for page with lots of links and so on...
 
  In our use case for the date picker this a big optimizations because
 there
  is a lot of static data that is repeater over and over (I so you
 already
  rolled out something like that at the client side for 6.0.x date picker).
 
 
 I prefer to keep it simple and easy for maintain and debug.
 If we have an evidence that it is really slow then we can think on
 optimizations.


 
   For non-Ajax requests you can use
   org.apache.wicket.markup.html.IHeaderResponseDecorator. You can again
   collect all JS in a thread local (or in RequestCycle's metadata) and
   contribute it as optimized JS call just before HeaderResponse#close().
   I.e. instead of having N entries in Wicket.Event.add(window,
 'domready',
   function() { HERE }) you will have just one (the optimized) entry.
  
  
  Thank you very much for the idea!
 
  --
  Regards - Ernesto Reinaldo Barreiro
  Antilia Soft
  http://antiliasoft.com/ http://antiliasoft.com/antilia
 



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



Re: Component to String

2013-01-24 Thread Nick Pratt
The real issue here is that most Email clients render HTML really badly, or
dont render it at all (or their implementations of such rendering is just
wrong).

Even modern email clients, like the latest Outlook or GMail dont render
significant portions of HTML/CSS correctly, and you will likely have to
resort to table layout to get anything even remotely like what you're
after.

N

On Thu, Jan 24, 2013 at 1:04 PM, Francois Meillet 
francois.meil...@gmail.com wrote:

 Hi Cedric,

 Great !
 It works on 6.5

 François


 Le 24 janv. 2013 à 17:39, Cedric Gatay gata...@gmail.com a écrit :

  Hi,
  I recently needed to do this, I come with a simple solution (quickly
  deprecated by our main application architecture however). I blogged about
  it here
 
 http://www.bloggure.info/work/java-work/use-wicket-templating-system-to-generate-html.html
 
  I hope it will help you, I don't know if it works well with Wicket 6
  (written for 1.5).
 
  Regards,
 
 
  __
  Cedric Gatay
  http://www.bloggure.info | http://cedric.gatay.fr |
  @Cedric_Gatayhttp://twitter.com/Cedric_Gatay
 
 
  On Thu, Jan 24, 2013 at 5:25 PM, Steve Lowery 
 slow...@gatessolutions.comwrote:
 
  I found several threads on the user list about converting a Component
 into
  a String.  There are at least 2 very valid use cases where doing this
 makes
  sense:
 
  1.  You are trying to create an html email to send out to your
 customers.
  Building that content out with wicket is a great way to do it.  We are
  able to harness Wicket's awesome i18n capabilities to generate the
 content.
  Otherwise, we resort to ResourceBundles or having to introduce some
 other
  templating library.
 
  2.  Many Javascript APIs/JQuery Plugins (i.e. growl notifications,
  popovers, etc) want the html content passed in.  Again, ideally the
  component is written in wicket.
 
  The threads I've seen have asked for potential ways to do this, but I'm
  wondering if this is a utility that should be included within Wicket
  itself.  What do you think?
 
  If you think this type of utility does not belong in the framework and
  should be implemented by the users instead, can you provide a wicket 6
 way
  of accomplishing this?
 
  Thanks.
 
  --
 
 
  IMPORTANT: This e-mail (including any attachments) is intended for the
 use
  of the individual or entity to which it is addressed and may contain
  information that is classified, private, or confidential. If the reader
 of
  this message is not the intended recipient, or the employee or agent
  responsible for delivering the message to the intended recipient, you
 are
  hereby notified that any dissemination, distribution, or copying of this
  communication is prohibited. If you have received this communication in
  error, please notify us immediately by replying to this e-mail. Thank
 you.
 


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




Re: Best way to set up a handler for 'Internal error'

2012-12-25 Thread Nick Pratt
Does Application getExceptionSettings().setUnexpectedExceptionDisplay( 
); help?

Look at DefaultExceptionMapper (which I think you can also set in
Application.init() )

N

On Tue, Dec 25, 2012 at 3:15 PM, Chris Colman
chr...@stepaheadsoftware.comwrote:

 When running in production mode and an error occurs Wicket will display
 'Internal error/return to home page'.

 What is the best place to put in a hook or a listener to be activated
 when this occurs so that we can have an email sent to an admin or log
 extra details etc.,

 Yours sincerely,

 Chris Colman



Re: Form submit with CollectionChild

2012-12-11 Thread Nick Pratt
It works well, but not ideal - making it work with JPA does require some
tweaking to prevent the Collection being replaced (and thus Hibernate will
complain about the Collection not being the one it was managing) or
duplicates being created.

On Mon, Dec 10, 2012 at 4:11 PM, Nick Pratt nbpr...@gmail.com wrote:

 I just found this:
 http://wicketinaction.com/2008/10/building-a-listeditor-form-component/which 
 works great.


 N

 On Mon, Dec 10, 2012 at 3:56 PM, Nick Pratt nbpr...@gmail.com wrote:

 Here is a quickstart:

 https://dl.dropbox.com/u/107816727/quickstart.tar.gz


 Two problems:
  1. Hit add more than once causes an exception
 2. On form submit doesnt set the ListB up in the A instance.

 Any pointers would be appreciated.

 Regards

 Nick


 On Mon, Dec 10, 2012 at 2:49 PM, Paul Bors p...@bors.ws wrote:

 Sounds like it should be working... unless someone else on the list has
 another quick idea of what could be wrong given the few details you have
 provided I would advise you to create a quick start and try to see if you
 can replicate the problem and then upload it somewhere we can get access
 to
 it or in a Jira ticket.

 Hopefully in doing so you'll spot what's wrong and fix it :)

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Nick Pratt [mailto:nbpr...@gmail.com]
 Sent: Monday, December 10, 2012 2:21 PM
 To: users@wicket.apache.org
 Subject: Re: Form submit with CollectionChild

 I have an LDM that I pass in to the Panel containing the Form.  I wrap
 the
 passed-in LDM IModel with a CompoundPropertyModel which I supply to the
 Form.  All my components then use wicketid--propertyExpressions.

 I supply the A.b name as the Wicket Id when I construct the LV.

 N

 On Mon, Dec 10, 2012 at 2:11 PM, Paul Bors p...@bors.ws wrote:

  t


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






Form submit with CollectionChild

2012-12-10 Thread Nick Pratt
My understanding of Form submit behavior with models is that onSubmit,
Wicket loads the model, and then applies all the changed form values to
that model.  This works fine for non-collection types (Strings, ints etc)
set from all the input types Ive been using (TextField, RadioChoice, DDC
etc.).

However, what is not working is the addition of new Entities that live
inside a Collection of the IModel entity.  Lets say I have a 1..N
relationship, A..B, and I want to add 2 new Bs to A's collection (a fairly
common requirement) in my form. I dont want these new B entities persisted
in the DB until the entire form is submitted (Im using JPA cascade).   How
do I code this part of the form/logic so that when I hit submit, I get
those 2 new B entities added to the A.b collection, so that I can save(a)
and have everything update?

Regards

Nick


Re: Form submit with CollectionChild

2012-12-10 Thread Nick Pratt
I have the following entities:

class A {
int someOtherVal;
String foo;
ListB b;
}

class B {
int someVal;
}

Ive created a form to edit an instance of A.  I want the form to be able to
add/remove instances of B from the A.b collection.  Ive tried using
different repeaters (started with ListView, setReuseItems(true) and
listView.removeAll() in the click handler for the add-link. However, in
form.onSubmit, the collection values of the Entity A (i.e. the 'b' values I
created and added to A.b) are not applied to the IModel accessible in the
onSubmit handler, thus Im unable to add new 'B' entities to the A.b
collection.

Other form values like A.foo and A.someOtherVal are all correctly updated
in the form submit ( I see the entity A loaded from the DB (via an LDM),
A.setSomeOtherValue(), and A.setFoo() being invoked). I dont see any access
of setB() etc.

N

On Mon, Dec 10, 2012 at 1:35 PM, Paul Bors p...@bors.ws wrote:

 I for one can't follow your example but sounds to me that you are setting
 your model on the form and are using collections.

 First use-case like that which comes to my mind is a list of selected radio
 and check boxes or multiple selections in a select box.

 Using Wicket you shouldn't have to work too hard on updating the model
 object (be it a collection) to update it with the user input. Wicket should
 do that for you and if it's not working you might be doing something wrong
 or forgetting something else.

 I would suggest to take a look at how CollectionModel is used:

 http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/or
 g.apache.wicket.examples.compref.PalettePage?0

 Perhaps that can aid answering your quest.

 Otherwise, please better phrase your question and/or submit some code
 examples to help us better understand.

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Nick Pratt [mailto:nbpr...@gmail.com]
 Sent: Monday, December 10, 2012 1:11 PM
 To: users@wicket.apache.org
 Subject: Form submit with CollectionChild

 My understanding of Form submit behavior with models is that onSubmit,
 Wicket loads the model, and then applies all the changed form values to
 that
 model.  This works fine for non-collection types (Strings, ints etc) set
 from all the input types Ive been using (TextField, RadioChoice, DDC etc.).

 However, what is not working is the addition of new Entities that live
 inside a Collection of the IModel entity.  Lets say I have a 1..N
 relationship, A..B, and I want to add 2 new Bs to A's collection (a fairly
 common requirement) in my form. I dont want these new B entities persisted
 in the DB until the entire form is submitted (Im using JPA cascade).   How
 do I code this part of the form/logic so that when I hit submit, I get
 those
 2 new B entities added to the A.b collection, so that I can save(a) and
 have
 everything update?

 Regards

 Nick


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




Re: Form submit with CollectionChild

2012-12-10 Thread Nick Pratt
I have an LDM that I pass in to the Panel containing the Form.  I wrap the
passed-in LDM IModel with a CompoundPropertyModel which I supply to the
Form.  All my components then use wicketid--propertyExpressions.

I supply the A.b name as the Wicket Id when I construct the LV.

N

On Mon, Dec 10, 2012 at 2:11 PM, Paul Bors p...@bors.ws wrote:

 t


Re: Form submit with CollectionChild

2012-12-10 Thread Nick Pratt
Here is a quickstart:

https://dl.dropbox.com/u/107816727/quickstart.tar.gz


Two problems:
1. Hit add more than once causes an exception
2. On form submit doesnt set the ListB up in the A instance.

Any pointers would be appreciated.

Regards

Nick


On Mon, Dec 10, 2012 at 2:49 PM, Paul Bors p...@bors.ws wrote:

 Sounds like it should be working... unless someone else on the list has
 another quick idea of what could be wrong given the few details you have
 provided I would advise you to create a quick start and try to see if you
 can replicate the problem and then upload it somewhere we can get access to
 it or in a Jira ticket.

 Hopefully in doing so you'll spot what's wrong and fix it :)

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Nick Pratt [mailto:nbpr...@gmail.com]
 Sent: Monday, December 10, 2012 2:21 PM
 To: users@wicket.apache.org
 Subject: Re: Form submit with CollectionChild

 I have an LDM that I pass in to the Panel containing the Form.  I wrap the
 passed-in LDM IModel with a CompoundPropertyModel which I supply to the
 Form.  All my components then use wicketid--propertyExpressions.

 I supply the A.b name as the Wicket Id when I construct the LV.

 N

 On Mon, Dec 10, 2012 at 2:11 PM, Paul Bors p...@bors.ws wrote:

  t


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




Re: Form submit with CollectionChild

2012-12-10 Thread Nick Pratt
I just found this:
http://wicketinaction.com/2008/10/building-a-listeditor-form-component/which
works great.


N

On Mon, Dec 10, 2012 at 3:56 PM, Nick Pratt nbpr...@gmail.com wrote:

 Here is a quickstart:

 https://dl.dropbox.com/u/107816727/quickstart.tar.gz


 Two problems:
  1. Hit add more than once causes an exception
 2. On form submit doesnt set the ListB up in the A instance.

 Any pointers would be appreciated.

 Regards

 Nick


 On Mon, Dec 10, 2012 at 2:49 PM, Paul Bors p...@bors.ws wrote:

 Sounds like it should be working... unless someone else on the list has
 another quick idea of what could be wrong given the few details you have
 provided I would advise you to create a quick start and try to see if you
 can replicate the problem and then upload it somewhere we can get access
 to
 it or in a Jira ticket.

 Hopefully in doing so you'll spot what's wrong and fix it :)

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Nick Pratt [mailto:nbpr...@gmail.com]
 Sent: Monday, December 10, 2012 2:21 PM
 To: users@wicket.apache.org
 Subject: Re: Form submit with CollectionChild

 I have an LDM that I pass in to the Panel containing the Form.  I wrap the
 passed-in LDM IModel with a CompoundPropertyModel which I supply to the
 Form.  All my components then use wicketid--propertyExpressions.

 I supply the A.b name as the Wicket Id when I construct the LV.

 N

 On Mon, Dec 10, 2012 at 2:11 PM, Paul Bors p...@bors.ws wrote:

  t


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





Re: Conditional JS includes

2012-12-07 Thread Nick Pratt
Do TextTemplate's aggregate, and can that aggregate be provided as a single
Resource?

N

On Fri, Dec 7, 2012 at 3:28 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 You can also use TextTemplate(s) to construct/concat the JS dynamically.


 On Fri, Dec 7, 2012 at 12:51 AM, Nick Pratt nbpr...@gmail.com wrote:

  I currently have a single javascript file in a custom Behavior that Id
 like
  to conditionally include sections of depending on provided user options.
 
  Whats the best way to achieve this?
 
  Split the single file in to, say 3 separate JS files and then
 conditionally
  include them in Java during the renderHead() of my Behavior? Is there a
  better way?
 
 
  Nick
 



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



Create/Edit domain object data

2012-12-07 Thread Nick Pratt
Im looking for recommendations on how to work with Form data and a
JPA/Hibernate model, specifically around creating and editing domain data.

I have a JPA backed domain model, and I want to create a page/panel/form
that allows entry of a new Foo, as well as being able to pass an existing
LDMFoo to the Page/Panel so that I can edit it.

Obviously I'd like to use an IModel for the domain object so that I dont
end up serializing the DB in to the session, but at the same time, I cant
use an LDM until the new entity is saved and an ID is assigned to the
object.

For the 'new' case, do you just serialize the domain entity in to the
session, IModelFoo model = Model.of( new Foo() ); and let the Foo object
be serialized until such time as the Foo.id is set so you can switch out
the IModel ref to an LDM? Or is it best to just show the minimal number of
fields required (*) to create a new Foo (accessed via PropertyModel(this,
attributeName), save it, and then set the LDMFoo reference in the page
and then let the other form elements be shown? (This approach duplicates
code - the fields in the domain object are duplicated as primitives in the
Page (which get serialized in to the session) )

The edit functionality needs to allow all fields to be edited (including
the fields mentioned in (*) above) - I dont want to duplicate form markup
and code - once for the 'new' case and once for the 'edit' case - the
'edit' case would have a lot more fields that could be entered/edited.

Are there other approaches that I'm missing, and what is the best pattern
to follow here?


Re: Create/Edit domain object data

2012-12-07 Thread Nick Pratt
As a followup, Ive used both approaches - although we tended to wrap the
non-persisted entity inside a DomainLDM

N

On Fri, Dec 7, 2012 at 1:14 PM, Nick Pratt nbpr...@gmail.com wrote:

 Im looking for recommendations on how to work with Form data and a
 JPA/Hibernate model, specifically around creating and editing domain data.

 I have a JPA backed domain model, and I want to create a page/panel/form
 that allows entry of a new Foo, as well as being able to pass an existing
 LDMFoo to the Page/Panel so that I can edit it.

 Obviously I'd like to use an IModel for the domain object so that I dont
 end up serializing the DB in to the session, but at the same time, I cant
 use an LDM until the new entity is saved and an ID is assigned to the
 object.

 For the 'new' case, do you just serialize the domain entity in to the
 session, IModelFoo model = Model.of( new Foo() ); and let the Foo object
 be serialized until such time as the Foo.id is set so you can switch out
 the IModel ref to an LDM? Or is it best to just show the minimal number of
 fields required (*) to create a new Foo (accessed via PropertyModel(this,
 attributeName), save it, and then set the LDMFoo reference in the page
 and then let the other form elements be shown? (This approach duplicates
 code - the fields in the domain object are duplicated as primitives in the
 Page (which get serialized in to the session) )

 The edit functionality needs to allow all fields to be edited (including
 the fields mentioned in (*) above) - I dont want to duplicate form markup
 and code - once for the 'new' case and once for the 'edit' case - the
 'edit' case would have a lot more fields that could be entered/edited.

 Are there other approaches that I'm missing, and what is the best pattern
 to follow here?




Re: Upload file and display its contents using AJAX

2012-12-04 Thread Nick Pratt
Once the file is uploaded, set the contents of the IModel backing the
TextArea, and then add the Form(or TextArea) to the AjaxRequestTarget.

On Tue, Dec 4, 2012 at 11:51 AM, pureza pur...@gmail.com wrote:

 Hi,

 I need to upload a file, parse it and display its contents inside a
 textarea, all this using ajax.

 At first I tried to use jquery-file-upload, and I was able to upload the
 file to an IResource as explained at
 http://wicketinaction.com/2012/11/uploading-files-to-wicket-iresource/.
 However, I have no idea as to how to display the contents of the file
 inside
 the textarea when the upload is finished.

 Then I tried to use a plain FileUploadField component and I attached an
 AjaxFormSubmitBehavior to it, but it seems that the model is always null
 and
 I am unable to access the uploaded files.

 Any help is appreciated.

 Thanks!




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Upload-file-and-display-its-contents-using-AJAX-tp4654473.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: How to display PDF in wicket 6.0?

2012-12-04 Thread Nick Pratt
Do you want to display the PDF on screen, or provide a PDF download so that
the file could be opened in Acrobat Reader (or PDF viewer of your choice)?

On Tue, Dec 4, 2012 at 11:06 AM, appwicket wwx@gmail.com wrote:

 Hi all,
 I have been trying all the ways to display PDF through wicket.
 I have my pdf resource in Byte[].
 I tried the following methods in my AjaxButton's onSubmit method:
 1. this gives me exception:
 Header was already written to response!
 Wicket.Ajax.Call.failure: Error while parsing response: Error: Invalid XML:
 %PDF-1.4

 WebResponse r = (WebResponse)getRequestCycle().getResponse();
 r.setContentType(application/pdf);
 r.setHeader(Content-Disposition, inline; filename=\data.pdf\);
 r.write(reportService.generatePDF());
 getRequestCycle().setResponsePage(DownloadPopup.class);
 -
 2.this gives me exception:
 Wicket.Ajax.Call.failure: Error while parsing response: Error: Invalid XML:
 %PDF-1.4

 ByteArrayResource bar = new ByteArrayResource(application/pdf,
 reportService.generatePDF());
 RequestCycle.get().scheduleRequestHandlerAfterCurrent(new
 ResourceRequestHandler(bar, null));
 -
 3. I also tried example from AJAX update and file download in one blow

 https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html
 
 https://cwiki.apache.org/WICKET/ajax-update-and-file-download-in-one-blow.html
 
 but Im not able to convert Byte array to IResourceStream.

 Anyone knows how to do this?

 appreciated!





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-display-PDF-in-wicket-6-0-tp4654471.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: which server?

2012-12-03 Thread Nick Pratt
Tomcat is stable, very widely used, and has lots of documentation /
examples out there.  Jetty also works well. We normally deploy on Tomcat
(7.x now)


On Mon, Dec 3, 2012 at 10:28 AM, Lucio Crusca lu...@sulweb.org wrote:

 Hello *,

 I'm approaching my 1st web application deployment (be it wicket or else).
 It
 will have only one user, so raw performance is not a priority. I have to
 choose an application server. Is there a recommended app server for wicket?
 How common is Glassfish in production environments? Is Tomcat enough? Is
 Jetty
 a reasonable choice?

 Thanks in advance
 Lucio.

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




Re: Jetty Gzip Compression

2012-11-30 Thread Nick Pratt
Ive stepped through the GzipFilter, and things look to be processed through
the Gzip compression, but only my welcome.html page is returned as gzipped
- all the .css and .js resources do not have a gzip Content-Encoding set on
them.

Just to clarify, did you really mean text/application instead of
text/css and application/javascript ?

N


On Fri, Nov 30, 2012 at 3:45 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 The gzip filter should be before Wicket filter. This way it has the chance
 to manipulate the response generated by Wicket.
 Wicket just calls httpServletResponse.setContentType(text/application)
 and httpServletResponse.write(someStringWithJS).
 GZipFilter's job is to change the content type and gzip the JS string.
 I recommend you to put a breakpoint in GZipFilter and see what happens.


 On Thu, Nov 29, 2012 at 8:30 PM, Nick Pratt nbpr...@gmail.com wrote:

  Ive enabled Gzip compression via the Jetty filter for my application
 (Jetty
  v6 and v8).
  Based on Chrome Dev Tools and Firebug in Firefox, my .js and .css files
 are
  not being compressed (browser states in the request that it will take
 gzip
  response), although text/html is, and Im trying to understand why.
 
  Ive got the mimeTypes configured in the GzipFilter servlet, minGzipSize
  defaults to 0 bytes.
 
  In Wicket 6, is there anything going on with the resources that would
  prevent Jetty's GzipFilter from working?
 
  Ive tried placing the filter both before and after the WicketFilter.
 
  Chrome's PageSpeed analyzer also thinks most of my larger JS files are
 not
  compressed (Ive been looking at the Response headers)
 
  Any thoughts?
 
  N
 



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



Re: What is Atmosphere doing wrong so i cant debug the websocket

2012-11-29 Thread Nick Pratt
Are you sure  web socket connection was established? Maybe your connection
is long-polling.

N
On Nov 29, 2012 7:36 AM, MattyDE ufer.mar...@gmail.com wrote:

 Hi Folks,

 iam using Wicket 6.2.0 with Wicket-Atmosphere 0.4 and everything works
 great, but Iam not able to debug the websocket-transfer in Chrome
 Debug-Tools like its explained and working here :

 http://blog.kaazing.com/2012/05/09/inspecting-websocket-traffic-with-chrome-developer-tools/

 Is there something wrong with the initialization of the WebSocket in
 Atmosphere so Chrome cant identify it as a WebSocket?

 Iam also want to know, how i could disable the window.info/.console output
 on every WebSocket-Pull

 Thanks in Advance for any Hints or Help :)

 - Matty



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/What-is-Atmosphere-doing-wrong-so-i-cant-debug-the-websocket-tp4654322.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: Dynamic Components

2012-11-29 Thread Nick Pratt
This works great! Many thanks.

I made a small addition to allow the markupId to be passed in via a new
constructor - this is for the case where a JS component/lib creates new
elements and inserts them into a specific place in the DOM - I pass the new
ID back via an Ajax call, and then let the helper deal with hooking up the
Wicket component.


Thanks again

Nick


On Wed, Nov 28, 2012 at 5:34 PM, Bas Gooren b...@iswd.nl wrote:

 Hi,

 We've written the following class to dynamically add components to a page
 and then render them in an ajax request:

 http://pastebin.com/p4cSNsUw

 The rendered component is in the current page, not in a dummy page, so
 everything works as expected.
 The only thing that doesn't work is a full re-render, since that requires
 a hook in the page markup, which does not exist (hence dynamic
 components). To circumvent that, the dynamic components are automatically
 removed on a full page re-render.

 Have a look at the code, maybe it helps you. It's rather simple when you
 think about it.
 onInitialize() and ajax calls in the dynamically injected components work
 as expected for us.

 We use it in our (wicket 1.5) cms to dynamically inject editors and popups.

 Met vriendelijke groet,
 Kind regards,

 Bas Gooren

 Op 28-11-2012 21:00, schreef Nick Pratt:

 Martin

 The approach of adding the Sub/Details Panel to a DummyPage works fine for
 basic Panels, but there are a few problems I've hit:
 1. onInitialize() isnt called - Im assuming this is because the Panel
 doesnt go through a normal lifecycle before being rendered back to the
 ART?
 2. None of the Ajax/Links work - they are loading up the DummyPage

 Now Im assuming this is all because the Component/Panel on the server side
 isnt associated with a real live page?

 Following on from a discussion thread that Chris Colman was going on about
 IComponentResolvers and those components being second class citizens,
 would
 it be possible to create dynamic components in a Page, and store them in a
 non-markup related area of the Page, such that they would go through
 normal
 lifecycle events etc, and AJAX callbacks would work to the Page, but they
 wouldnt be associated with the normal markup/component hierarchy?

 Based on Chris' comments, it seems like he has the initial stages of a
 workable solution to breaking the Component / Markup hierarchy and
 allowing
 a very flexible way of building applications.  While I dont know what else
 Component Queueing was going to add, it seems that such functionality
 would
 provide a way to break the current hierarchy matching requirement.

 In my specific case, Im ok if the Components get thrown away on a full
 page
 (re)render, or that if Components were instantiated and not referenced in
 the markup, then they could be thrown away.

 While this might not suit the core framework for v7.0, could I build such
 functionality using the existing v6 APIs (maybe via a custom BasePage/
 Component wrapper) and hooking in to the rendering cycle?

 N





Re: What is Atmosphere doing wrong so i cant debug the websocket

2012-11-29 Thread Nick Pratt
Its likely your web server capabilities / configuration


On Thu, Nov 29, 2012 at 8:18 AM, MattyDE ufer.mar...@gmail.com wrote:

 How should i test this? I did no special configuration and testing it with
 the latest google chrome, which supports WebSockets.

 I think the atmosphere implementation tests on clientside which type of
 transfer is possible (WebSocket, SSE, Long-Polling etc.)



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/What-is-Atmosphere-doing-wrong-so-i-cant-debug-the-websocket-tp4654322p4654327.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: a question on different data grid components available for wicket

2012-11-28 Thread Nick Pratt
Ive been working on an improved DataTables.net wrapper for Wicket.  Its
applied as a Behavior on top of the existing Wicket repeaters/datatables -
with one caveat that the Behavior requires a table element to work with
that has a complete structure -  table, thead, tbody.  With some
assistance from Martin Ive got the expandable details panels working -
these load dynamically via Ajax.  Datatables supports most of the things
you listed there, as well as many others (client side pagination, sorting,
multi-column sort, client side search/filtering) etc.  The Behavior can
overlay its functionality on top of pre-rendered information in the DOM, or
it can be configured to retrieve data from the server via AJAX. You can
also configure server side paging and filtering/searching if your data set
is really big.  It's still a work-in-progress but Im using it now in an
application I'm developing so the API is being tweaked as I use it.  I'll
push it to SVN or Github soon.




On Wed, Nov 28, 2012 at 3:22 AM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Hi,

 On Wed, Nov 28, 2012 at 9:14 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

  Hi,
 
  InMethod Grid is more smarter. It supports column reordering, resizing,
  better Ajax support. But it is no active maintainer at the moment.
  Different community members provide patches when they need fixes but
 that's
  all.
  It is also based on Yahoo UI v.2.
 
 
 Maybe it is time to try to rewrite all column reordering, re-sizing logic
 based on jquery (instead of YUI). Now that jquery comes for free with
 wicket 6.x

 --
 Regards - Ernesto Reinaldo Barreiro
 Antilia Soft
 http://antiliasoft.com/ http://antiliasoft.com/antilia



Re: View and edit panel

2012-11-28 Thread Nick Pratt
You can set the Panel non-editable, and all those Form components will
become non-editable.


On Wed, Nov 28, 2012 at 4:06 AM, Thomas Götz t...@decoded.de wrote:

 Hi there,

 I'm currently implementing a panel that is used for viewing and editing of
 some entity. I wonder if there is an elegant solution for this.

 The situation:
 all my view/edit panels have a common abstract parent class (Panel),
 providing some general markup, i.e. I'm using wicket:extend in my
 concrete Panel implementation. Not every component is editable, only some.
 Currently I have a solution where I'm using a flag (isEditMode) and some
 if/else constructs to create either a label or e.g. a TextField. I keep the
 markup for the FormComponents as Fragments or separate Panels. Any more
 sophisticated ideas on how to implement this? ;-)

 Cheers,
-Tom



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




Re: Jqwicket

2012-11-28 Thread Nick Pratt
The current version on wiquery uses an older jquery version than does
Wicket 6.3.0 which was causing issues for us.

N
On Nov 28, 2012 1:23 PM, vishal vrvai...@gmail.com wrote:

 Hi Folks - has there been any progress on JQWicket for Wicket 6.0? I am
 unable to upgrade to Wicket 6.3 because I am using several JQWicket
 components. I would like to avoid switching over to Wi-Query since our
 system is in production and it will have widespread impact at this time.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Jqwicket-tp4651665p4654306.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




Dynamic Components

2012-11-28 Thread Nick Pratt
Martin

The approach of adding the Sub/Details Panel to a DummyPage works fine for
basic Panels, but there are a few problems I've hit:
1. onInitialize() isnt called - Im assuming this is because the Panel
doesnt go through a normal lifecycle before being rendered back to the ART?
2. None of the Ajax/Links work - they are loading up the DummyPage

Now Im assuming this is all because the Component/Panel on the server side
isnt associated with a real live page?

Following on from a discussion thread that Chris Colman was going on about
IComponentResolvers and those components being second class citizens, would
it be possible to create dynamic components in a Page, and store them in a
non-markup related area of the Page, such that they would go through normal
lifecycle events etc, and AJAX callbacks would work to the Page, but they
wouldnt be associated with the normal markup/component hierarchy?

Based on Chris' comments, it seems like he has the initial stages of a
workable solution to breaking the Component / Markup hierarchy and allowing
a very flexible way of building applications.  While I dont know what else
Component Queueing was going to add, it seems that such functionality would
provide a way to break the current hierarchy matching requirement.

In my specific case, Im ok if the Components get thrown away on a full page
(re)render, or that if Components were instantiated and not referenced in
the markup, then they could be thrown away.

While this might not suit the core framework for v7.0, could I build such
functionality using the existing v6 APIs (maybe via a custom BasePage/
Component wrapper) and hooking in to the rendering cycle?

N


  1   2   >