Re: DateTextField maxlength idea

2012-02-04 Thread Jim Pinkham
WICKET-4386 https://issues.apache.org/jira/browse/WICKET-4386
On Sat, Feb 4, 2012 at 5:27 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Ticket please :-)

 On Fri, Feb 3, 2012 at 9:58 PM, Jim Pinkham pinkh...@gmail.com wrote:
  I have a simple data entry form with a date/time field.
 
  My end users (web newbies) have found another interesting way to confound
  the most clear and straightforward instruction I can devise regarding
 it's
  (obvious?) use.
 
  I watched an end user type an entire time into the hour component without
  tabbing over to the minute.
 
  So, I'd like to suggest a minor change to
  extensions.yui.calendar.DateTimeField.html to add the maxlength=2 to
 the
  current size=2 on the hour/min input controls.
 
  I think it might be a simple way to give earlier feedback  (I've found it
  unwise to rely on instructions like Please enter dates and times like
  this... ).
 
  I know I could accomplish this for my own instances, perhaps with a copy
 of
  this modified html in a spot higher in the classpath, or maybe an
 attribute
  modifier someplace..., but then I thought what is the downside of making
 it
  the default?   Sure, it would impact a lot of code, but unless some
 locale
  I don't know of has 3 digit minutes, I don't think in a negative way ---
 I
  was suprised to find no other similar past discussion; perhaps there is
  some obvious reason this isn't a good idea?   I can't be the first one to
  think of this, can I?
 
  Cheers,
  Jim
 
  In case all that's not clear, here's what I mean in code:
 
  MyPage.html
  span wicket:id=eventOnMM/DD/ [picker] HH MM [amPM]/span
 
  MyPage.java
  add(new DateTimeField(eventOn));
 
  DateTimeField.html in wicket-datetime-1.5-RC5.1.jar
  wicket:panel xmlns:wicket=http://wicket.apache.org;
   span style=white-space: nowrap;
   input type=text wicket:id=date size=12 /
   input type=text wicket:id=hours size=2 *maxlength=2* /
   span wicket:id=hoursSeparator#160;:/span
   input type=text wicket:id=minutes size=2 *maxlength=2* /
select wicket:id=amOrPmChoice/select
   /span
  /wicket:panel



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

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




DateTextField maxlength idea

2012-02-03 Thread Jim Pinkham
I have a simple data entry form with a date/time field.

My end users (web newbies) have found another interesting way to confound
the most clear and straightforward instruction I can devise regarding it's
(obvious?) use.

I watched an end user type an entire time into the hour component without
tabbing over to the minute.

So, I'd like to suggest a minor change to
extensions.yui.calendar.DateTimeField.html to add the maxlength=2 to the
current size=2 on the hour/min input controls.

I think it might be a simple way to give earlier feedback  (I've found it
unwise to rely on instructions like Please enter dates and times like
this... ).

I know I could accomplish this for my own instances, perhaps with a copy of
this modified html in a spot higher in the classpath, or maybe an attribute
modifier someplace..., but then I thought what is the downside of making it
the default?   Sure, it would impact a lot of code, but unless some locale
I don't know of has 3 digit minutes, I don't think in a negative way --- I
was suprised to find no other similar past discussion; perhaps there is
some obvious reason this isn't a good idea?   I can't be the first one to
think of this, can I?

Cheers,
Jim

In case all that's not clear, here's what I mean in code:

MyPage.html
span wicket:id=eventOnMM/DD/ [picker] HH MM [amPM]/span

MyPage.java
add(new DateTimeField(eventOn));

DateTimeField.html in wicket-datetime-1.5-RC5.1.jar
wicket:panel xmlns:wicket=http://wicket.apache.org;
 span style=white-space: nowrap;
 input type=text wicket:id=date size=12 /
 input type=text wicket:id=hours size=2 *maxlength=2* /
 span wicket:id=hoursSeparator#160;:/span
 input type=text wicket:id=minutes size=2 *maxlength=2* /
 select wicket:id=amOrPmChoice/select
 /span
/wicket:panel


Re: Communication (in-vm) between webapps

2012-02-03 Thread Jim Pinkham
My first thought would be ehcache all the stuff in front end with a
reasonable expiration period (hours maybe), and then expose a very simple
JMX interface to manually reset the cache without bouncing the entire
app.  No need to send much data over JMX other than just a simple 'refresh
all caches' command. Pretty simple, but gives you a lot of options.

Good luck
On Fri, Feb 3, 2012 at 2:51 PM, Bas Gooren b...@iswd.nl wrote:

 Hi All,

 Maybe a fellow wicketeer can help me with this:

 We deploy one of our apps in two components: a frontend and an admin. We
 recently implemented a StringResourceLoader which fetches translations from
 a database.
 So far so good.

 Now we face the following problem: the frontend uses this
 StringResourceLoader, but the actual translations are managed through the
 admin.

 Currently both apps are deployed on the same vm (and in the same tomcat
 instance), but this might change in the future.
 We need a mechanism to tell the frontend to flush the localizer (and
 StringResourceLoader) cache when the user clicks a button in the admin.

 After some investigation we've found a number of solutions, ranging from
 easy to complex:
 - cross context = true, share a boolean through the ServletContext and
 poll for it to change
 - have the frontend expose an MBean (JMX) which the admin can control
 - use a message bus for communication (e.g. rabbitmq)
 - cluster communication, such as jgroups or hazelcast

 Can anyone comment on this? I'd prefer to keep things simple at this stage
 (e.g. setting up an external message bus for this seems overkill), but
 having something which works as we scale out would be preferable.

 Sebastian



Re: wicket + jasper reports

2011-10-24 Thread Jim Pinkham
Got it - found another hint about DownloadLink that led me to this solution:

@Override
public void onSubmit() {
ReportResource resource = new PdfReportResource(getReportName(),
getParamsModel());
getRequestCycle().scheduleRequestHandlerAfterCurrent(
new ResourceRequestHandler(resource, null));
}

So simple, but it took some digging to find so hope this helps someone else.
-- Jim.

On Fri, Oct 21, 2011 at 2:44 PM, Jim Pinkham pinkh...@gmail.com wrote:

 OK, I've almost got it - thanks for the example.

 It comes down to either using a ResourceLinkVoid which serves up the pdf
 with no complaints, but despite being attached to a submit button, the form
 doesn't seem to have been submitted; the parameters don't reflect any user
 input

 or, I can solve that if I use a Button instead, and copy this code from
 ResourceLink.onResourceRequested into the Button's onSubmit()...


 Attributes a = new Attributes(RequestCycle.get().getRequest(),
 RequestCycle.get()
 .getResponse(), null);
 resource.respond(a);

 But if I do that, it works but then I get Header was already written to
 response! as mentioned earlier.

 I also tried making my own MyResourceLink (I would rather have extended
 ResourceLink but I had to go all the way back to Link because ResourceLink's
 onResourceRequested is final) and I put a call to
 ParamsForm.this.process(this); then super.onResourceRequested(), and that
 stopped the error but still didn't submit the form.

 Has anyone found a way to get the best of both?  I found SubmitLink, but I
 guess I need some way to 'mix that in', or decorate the ResourceLink with a
 submit first... not sure how to do that..  (ResourceLink already implements
 IFormSubmittingComponent, but I guess that's not enough)

 (I tried calling inputField.getConvertedInput() like I might do from a
 validator but that just returns null, which is what leads me to believe the
 form hasn't been submitted)

 Thanks,
 -- Jim.


 On Wed, Oct 19, 2011 at 11:55 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Wed, Oct 19, 2011 at 11:46 PM, Paul Szulc paul.sz...@gmail.com
 wrote:
  Ok, below the code I use to create a link that allows to download pdf
 file
  created by jasper on runtime. Hope it helps. Do not hesitate to ask
  questions.
 
 
  public class PdfGenerateLink extends ResourceLinkVoid {
 
 public PdfGenerateLink(final String id, final IModelBid model,
 final
  PdfBuilderFromBidCreator creator) {
 
 super(id, new WebResource() {
 @Override
 public IResourceStream getResourceStream() {
 IResourceStream resourceStream = new
  AbstractResourceStreamWriter() {
 
 public void write(OutputStream output) {
 try {
 generate(output, model.getObject());
 } catch (Exception e) {
 throw new RuntimeException(e);
 }
 }
 
 private void generate(OutputStream output, Bid bid)
  throws Exception {
 PdfOfertaDocumentBuilder pdf =
 creator.create(bid);
 Oferta ?!
 This sounds like Bulgarians are involved here :-)
 InputStream generate = pdf.generate();
 byte[] buffer = new byte[1024];
 while (generate.read(buffer) != -1) {
 output.write(buffer);
 }
 generate.close();
 }
 
 public String getContentType() {
 return application/pdf;
 }
 };
 
 return resourceStream;
 }
 
 @Override
 protected void setHeaders(WebResponse response) {
 super.setHeaders(response);
 response.setCharacterEncoding(UFT-8);
 response.setHeader(Expires, 0);
 response.setHeader(Cache-Control, no-cache);
 response.setHeader(Cache-Control, must-revalidate,
  post-check=0, pre-check=0);
 response.setHeader(Pragma, public);
 
 
 response.setAttachmentHeader(model.getObject().getPublicTask().getName().replace(
  , _) + .pdf);
 }
 });
 add(createImage(icon, pdficon16.png));
 }
  }
 
  On Tue, Oct 18, 2011 at 8:43 PM, Jim Pinkham pinkh...@gmail.com
 wrote:
 
  Paul,
 
  I am doing something very similar - I'd be interested to know more
 about
  how you got this working - here is what I've got that works for now,
 but I'm
  not real happy with it:
 
  In my report forms, I have buttons like this:  (details about params
  omitted - nothing fancy there)
 
  add(new MyReportResourceButton(pdf, new
  ReportResource(MyReport, new PdfResourceHandler()), paramsModel));
  add(new

Re: wicket + jasper reports

2011-10-21 Thread Jim Pinkham
OK, I've almost got it - thanks for the example.

It comes down to either using a ResourceLinkVoid which serves up the pdf
with no complaints, but despite being attached to a submit button, the form
doesn't seem to have been submitted; the parameters don't reflect any user
input

or, I can solve that if I use a Button instead, and copy this code from
ResourceLink.onResourceRequested into the Button's onSubmit()...

Attributes a = new Attributes(RequestCycle.get().getRequest(),
RequestCycle.get()
.getResponse(), null);
resource.respond(a);

But if I do that, it works but then I get Header was already written to
response! as mentioned earlier.

I also tried making my own MyResourceLink (I would rather have extended
ResourceLink but I had to go all the way back to Link because ResourceLink's
onResourceRequested is final) and I put a call to
ParamsForm.this.process(this); then super.onResourceRequested(), and that
stopped the error but still didn't submit the form.

Has anyone found a way to get the best of both?  I found SubmitLink, but I
guess I need some way to 'mix that in', or decorate the ResourceLink with a
submit first... not sure how to do that..  (ResourceLink already implements
IFormSubmittingComponent, but I guess that's not enough)

(I tried calling inputField.getConvertedInput() like I might do from a
validator but that just returns null, which is what leads me to believe the
form hasn't been submitted)

Thanks,
-- Jim.

On Wed, Oct 19, 2011 at 11:55 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Wed, Oct 19, 2011 at 11:46 PM, Paul Szulc paul.sz...@gmail.com wrote:
  Ok, below the code I use to create a link that allows to download pdf
 file
  created by jasper on runtime. Hope it helps. Do not hesitate to ask
  questions.
 
 
  public class PdfGenerateLink extends ResourceLinkVoid {
 
 public PdfGenerateLink(final String id, final IModelBid model, final
  PdfBuilderFromBidCreator creator) {
 
 super(id, new WebResource() {
 @Override
 public IResourceStream getResourceStream() {
 IResourceStream resourceStream = new
  AbstractResourceStreamWriter() {
 
 public void write(OutputStream output) {
 try {
 generate(output, model.getObject());
 } catch (Exception e) {
 throw new RuntimeException(e);
 }
 }
 
 private void generate(OutputStream output, Bid bid)
  throws Exception {
 PdfOfertaDocumentBuilder pdf =
 creator.create(bid);
 Oferta ?!
 This sounds like Bulgarians are involved here :-)
 InputStream generate = pdf.generate();
 byte[] buffer = new byte[1024];
 while (generate.read(buffer) != -1) {
 output.write(buffer);
 }
 generate.close();
 }
 
 public String getContentType() {
 return application/pdf;
 }
 };
 
 return resourceStream;
 }
 
 @Override
 protected void setHeaders(WebResponse response) {
 super.setHeaders(response);
 response.setCharacterEncoding(UFT-8);
 response.setHeader(Expires, 0);
 response.setHeader(Cache-Control, no-cache);
 response.setHeader(Cache-Control, must-revalidate,
  post-check=0, pre-check=0);
 response.setHeader(Pragma, public);
 
 
 response.setAttachmentHeader(model.getObject().getPublicTask().getName().replace(
  , _) + .pdf);
 }
 });
 add(createImage(icon, pdficon16.png));
 }
  }
 
  On Tue, Oct 18, 2011 at 8:43 PM, Jim Pinkham pinkh...@gmail.com wrote:
 
  Paul,
 
  I am doing something very similar - I'd be interested to know more about
  how you got this working - here is what I've got that works for now, but
 I'm
  not real happy with it:
 
  In my report forms, I have buttons like this:  (details about params
  omitted - nothing fancy there)
 
  add(new MyReportResourceButton(pdf, new
  ReportResource(MyReport, new PdfResourceHandler()), paramsModel));
  add(new MyReportResourceButton(xls, new
  ReportResource(MyReport, new XlsResourceHandler()), paramsModel));
 
  (So it will load MyReport.jasper that was compiled and put into
 resources
  folder by maven plugin during build)
 
  MyReportResourceButton has this:
  @Override
  public final void onResourceRequested() {
  MapString,Object params = paramsModel.getObject();
  resource.setReportParameters(params);
  super.onResourceRequested();
  }
 
  and it's superclass MyResourceButton has this:
  @Override
  public void

Re: wicket + jasper reports

2011-10-18 Thread Jim Pinkham
Paul,

I am doing something very similar - I'd be interested to know more about how
you got this working - here is what I've got that works for now, but I'm not
real happy with it:

In my report forms, I have buttons like this:  (details about params omitted
- nothing fancy there)

add(new MyReportResourceButton(pdf, new
ReportResource(MyReport, new PdfResourceHandler()), paramsModel));
add(new MyReportResourceButton(xls, new
ReportResource(MyReport, new XlsResourceHandler()), paramsModel));

(So it will load MyReport.jasper that was compiled and put into resources
folder by maven plugin during build)

MyReportResourceButton has this:
@Override
public final void onResourceRequested() {
MapString,Object params = paramsModel.getObject();
resource.setReportParameters(params);
super.onResourceRequested();
}

and it's superclass MyResourceButton has this:
@Override
public void onSubmit() {
onResourceRequested();
}

/**
 * @see org.apache.wicket.IResourceListener#onResourceRequested()
 */
public void onResourceRequested()
{
Attributes a = new Attributes(RequestCycle.get().getRequest(),
RequestCycle.get()
.getResponse(), null);
resource.respond(a);
}


At runtime, it basically works, however, it gives me this annoying message
in my logs multiple times per report request after the report has been
served and it appears to be trying to just stay on the same page:

2011-10-13 15:22:42,381 [http-80-12] ERROR
org.apache.wicket.DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!
at
org.apache.wicket.protocol.http.HeaderBufferingWebResponse.checkHeader(HeaderBufferingWebResponse.java:64)
at
org.apache.wicket.protocol.http.HeaderBufferingWebResponse.sendRedirect(HeaderBufferingWebResponse.java:112)
at
org.apache.wicket.request.handler.render.WebPageRenderer.redirectTo(WebPageRenderer.java:136)
at
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:261)
at
org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:139)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:717)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:96)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:160)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:216)

Could you tell me if there is some way this differs from how you (or your
contractor) are doing it?

Thanks,
-- Jim.

On Tue, Oct 18, 2011 at 3:58 AM, Paul Szulc paul.sz...@gmail.com wrote:

 yeah, ok, my bad

 resources where under src/main/resource not src/main/resource*s*
 *
 *
 thx Tor



Re: CouldNotLockPageException using localized RequestMapper URLs

2011-10-07 Thread Jim Pinkham
Thanks - I did that, and found the culprit was a file upload (that part was
okay) which fed into an piece of image resizing code:

Graphics2D graphics2D = rescaledImage.createGraphics();

which the stack trace showed was waiting forever on some other AWT init
thread.

So I just kicked it to the curb and used another image scaling library from
http://code.google.com/p/java-image-scaling/  and the problem has gone
away!   So not wicket related at all.

In retrospect, I can't think of a more informative way the framework could
have helped me discover this  - my breakthru came from the old
tried-and-true method of finding a way to reproduce the issue (of course
that is the hard part - seems like it took forever, trying to explore all
the functions in my system) and then when it finally happened, doing a
thread dump.

Anyway, situation resolved!  Back to happy wicket coding...

-- Jim

On Wed, Oct 5, 2011 at 4:27 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 Page ids are session relative. I.e. different users may have the same
 page id. The actual key is (sessionId, pageId).
 Better dump the stacktraces and see why the thread that acquired the
 lock needs more than a minute for it to do its job.

 On Tue, Oct 4, 2011 at 8:37 PM, Jim Pinkham pinkh...@gmail.com wrote:
  Maybe I'm doing something out of the ordinary - I have several
 independant
  'clients' using their own versions of my site, and it's been working OK
 till
  recent increase in my site's use by several clients at once using the
 'same'
  pages.
 
  I have a ClientFirstRootRequestMapper extends AbstractComponentMapper
 that
  pulls the client prefix from my URL and then chains the call to
  super.mapRequest() with the prefix removed from the url - this has been
  working fine since early 1.5.
 
  But now I have these lockups in production recently.  My theory is that
 they
  are somehow sharing ids in the page map(s) such that locking behavior is
 not
  correct.   I'm working on a quickstart, but I thought I'd first throw out
  some details and see if anyone has a better theory?   Obviously, this is
 a
  pretty major issue for me, since it brings my whole site down, with a
 bunch
  of http-80-xx threads showing entries like this:
 
  WARN  - PageAccessSynchronizer - http-80-65 failed to acquire lock to
  page 7, attempted for 1 minute out of allowed 1 minute
  ERROR - PageAccessSynchronizer - failed to acquire lockheld by
  http-80-70. Would have thrown:
  org.apache.wicket.page.CouldNotLockPageException: Could not lock page 7.
  Attempt lasted 1 minute
 at
 
 org.apache.wicket.page.PageAccessSynchronizer.lockPage(PageAccessSynchronizer.java:155)
 at
 
 org.apache.wicket.page.PageAccessSynchronizer$2.touchPage(PageAccessSynchronizer.java:214)
  ...
 at
 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
 at
 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
 at
  org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
 at java.lang.Thread.run(Thread.java:662)
  Oct 3, 2011 5:57:55 PM org.apache.tomcat.util.net.JIoEndpoint
  createWorkerThread
  INFO: Maximum number of threads (200) created for connector with address
  null and port 80
  INFO  - AuctionApplication - Bye
 
  I already tried this attempted fix to bypass throwing this exception and
  just let it get the lock anyway (I'm desparate here).
 String info= held by: ;
 IteratorPageLock locks =
 this.locks.get().values().iterator();
 while (locks.hasNext()) {
 PageLock culprit = locks.next();
 info += culprit.getThread().getName() + , ;
 }
 if (info.endsWith(, ))
 info = info.substring(0, info.length()-2);
 
 logger.error(failed to acquire lock+info+. Would have
 thrown:
  ,
 /*throw*/ new CouldNotLockPageException(pageId,
  thread.getName(), timeout));
 
  In my app, I have mounted a CatalogPage like this:
 
 getRootRequestMapperAsCompound().add(new MountedMapper(/catalog,
  CatalogPage.class, e));
 
  Running this locally with debug turned on for PageAccessSynchronizer, I
 open
  two windows and load this page with different prefixes - it appears they
 use
  the same page id 0 (which might be OK but I'm suspicious..?)
 
  loading http://localhost:8080/clientOne/catalog
 
  13532 [qtp10217370-20] DEBUG - PageAccessSynchronizer -
 'qtp10217370-20'
  attempting to acquire lock to page with id '0'
  13532 [qtp10217370-20] DEBUG - PageAccessSynchronizer -
 qtp10217370-20
  acquired lock to page 0
  13532 [qtp10217370-15] DEBUG - PageAccessSynchronizer -
 'qtp10217370-15'
  attempting to acquire lock to page with id '0'
  13532 [qtp10217370-15] DEBUG - PageAccessSynchronizer -
 qtp10217370-15
  acquired lock to page 0
  13532 [qtp10217370-18] DEBUG - PageAccessSynchronizer -
 'qtp10217370

CouldNotLockPageException using localized RequestMapper URLs

2011-10-04 Thread Jim Pinkham
acquired lock to page 0
41000 [qtp10217370-19] DEBUG - PageAccessSynchronizer - 'qtp10217370-19'
attempting to acquire lock to page with id '0'
41000 [qtp10217370-19] DEBUG - PageAccessSynchronizer - qtp10217370-19
acquired lock to page 0
41000 [qtp10217370-19] DEBUG - PageAccessSynchronizer - qtp10217370-19
released lock to page 0
41000 [qtp10217370-19] DEBUG - PageAccessSynchronizer - qtp10217370-19
notifying blocked threads

Sorry if that's too much detail to swallow at once, but I could really use a
steer in the right direction here.
Thanks,
Jim Pinkham
http://togetherauction.com


Re: ResourceReference.getResource() returns NULL ?

2011-07-02 Thread Jim Pinkham
Search for Dynamically loading image for good examples of how to do this.

Basically, you do not put the image data directly into HTML.  Instead, you
make your page.html  with some table perhaps, and a series of links to your
images.  So you would need one method to list the ids of your images to put
as a parameters into your links.   Then, you will 'mount' the resource in
your application class at app init time, which will allow your app to serve
up the image data for each img src=mountpoint?id=123 tag.

Good luck
Jim

On Tue, Feb 22, 2011 at 8:00 AM, smallufo small...@gmail.com wrote:

 I want to build a DynamicImageResource which can scale internal (packaged)
 images (with name : {index}.gif ) .
 In getImageData() , I try to load a truly existing image , but cannot
 getResource() , it returns null !

 Here is my code :

 public class ScaledImageResource extends DynamicImageResource
 {
  private ThreadLocalInteger index = new ThreadLocalInteger();
  private ThreadLocalInteger width = new ThreadLocalInteger();
  private ThreadLocalInteger height = new ThreadLocalInteger();

  @Override
  public IResourceStream getResourceStream()
  {
ValueMap map = getParameters();
index .set(map.getAsInteger(index ,  1));
width .set(map.getAsInteger(width , 50));
height.set(map.getAsInteger(height, 50));
return super.getResourceStream();
  }

  @Override
  protected byte[] getImageData()
  {
ResourceReference imageResource = new ResourceReference(MyPage.class ,
 icons/byIndex/+index.get()+.gif);
http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gif does
 exist !

try
{
  System.out.println(imageResource.getResource() =  +
 imageResource.getResource()); // returns NULL
  InputStream is =
 imageResource.getResource().getResourceStream().getInputStream();
  BufferedImage bufferedImage = ImageIO.read(is);
  BufferedImage scaledImage = BufferedImageTools.getImage(bufferedImage,
 width.get() , height.get());

  byte[] bytes = null;
  //scale image , build bytes  , skipped here.
  return bytes;
}
catch (Exception e)
{
}
return null;
  }
 }

 And in Application's init():
 getSharedResources().add(IMG_KEY, new ScaledImageResource());
 mountSharedResource(/scaledImage, new
 ResourceReference(IMG_KEY).getSharedResourceKey());

 Note , the image file does exist there ,
 and http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gifdoes
 browsable !

 But why cannot I getResource() of the imageResource ?



Internal Error shows up in Google Cache

2011-06-03 Thread Jim Pinkham
I mentioned a few weeks ago I had some page locking issues.

I turned on logging and overrode the PageAccessSynchronizer to log and
swallow the page lock exception (it still has the timeout wait, so
it's not totally disabled), but of course it hasn't happened since, so
I still haven't found the root cause other than some heavier usage
(1500 page loads/day is busy for me - go ahead, laugh ;)

... but now I just noticed my search results in Google are showing
these Internal Error page in search results!

Yikes - Bad news!

So, my band-aid fix is this:

    protected final class MyInternalErrorPage extends InternalErrorPage {
        private static final long serialVersionUID = 1L;

        @Override
        public void renderHead(IHeaderResponse response) {
            response.renderString(META NAME=\ROBOTS\ CONTENT=\NONE\ /);
        }
    }

and in my application init():
        
getApplicationSettings().setInternalErrorPage(MyInternalErrorPage.class);

I'm thinking this might be a good default for this page?

Of course we don't want internal errors in the first place, but if
they do happen (to a robot), no reason to literally advertise the
fact, right?  Seems like a drag on the brand name to some degree..

On a side note, does anyone know how to tell google to get rid of a
cached search result like this, or am I stuck waiting for the next
robot to come along?

To see what I mean, google for Together Auction (2nd result, crawled
May 21, still here June 3):

Catalog - Internal Error

Internal error. Return to home page.
togetherauction.com/firstuu/catalog - Cached


OK, back to the page locking issues - the only unusual thing I'm doing
is that I have my app deployed at my domain root with suffixes for
each of my clients so they each appear to have their own version of
the web app served from a common ROOT.war.   So my URLs are like this:

mydonamin.com/clientname/restOfURL.   This is done via a
ClientFirstRootRequestMapper extends AbstractComponentMapper
(source if anyone is interested: http://pastebin.com/Zxp561JK )

For some reason, this was working great in 1.5 M3 but since I've
upgraded to RC3, I'm seeing ;jsessionid= on all my URLs now - not sure
if that is related.

I mention the RequestMapper because I wonder if this might result in
two different clients using same page class with instance keys that
might not be unique and thus have locking conflict from that ?

Thanks for any insights any of you wiser wicket ones might have to share.

-- Jim.

TogetherAuction.com

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



Re: Wicket 1.5 and WebPageRenderer warn

2011-06-03 Thread Jim Pinkham
Any update on this?  I am getting also in 1.5 RC3

On Sun, Oct 17, 2010 at 3:24 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Can you try with latest trunk (1.5-SNAPSHOT) ?
 If the warning is still there and you are able to create a quickstart
 application then we will be interested to take a look.
 Thanks!

 On Sun, Oct 17, 2010 at 5:52 PM, Java Programmer 
 jprogrami...@gmail.comwrote:

 Hello,
 I use wicket 1.5-M2.1 right now, and I get warn which I haven't on
 earlier versions:
 WARN  2010-10-17 17:45:55,425 WebPageRenderer: The Buffered response
 should be handled by BufferedResponseRequestHandler

 What could be the reason of this warn (the application was slightly
 migrated from 1.4 - 1.5, but I had solved all compilation issus and
 deprecations)?

 --
 Best regards,
 Adrian

 http://www.codeappeal.com/

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




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



Re: Copying PageMaps from one session to another

2011-06-03 Thread Jim Pinkham
To expand on Josh's suggestion,

In your Login link (probably on an abstract page you inherit for other
app pages) you would have an onClick that doesn't just
setResponsePage(YourLoginPage.class), but instead throws the
Restart...exception.  That way, when the login completes, it should
come back to the page the login link was pressed on.

-- Jim.

On Fri, Jun 3, 2011 at 1:57 PM, Josh Kamau joshnet2...@gmail.com wrote:
 Andy,

 ...Not only security frameworks can use this, you can do it yourself by
 throwing a RestartResponseAtInterceptPage exception.

 Josh


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



Help I need to understand page locking

2011-05-23 Thread Jim Pinkham
I'm using wicket 1.5 RC3 and just started getting some total system lockups
recently in prod that I can't understand.

Once it gets into this state, the only remedy is to restart tomcat.
Unfortunately, I haven't yet figured out how to reproduce this, so meanwhile
I thought I'd ask if someone could please help me understand how page
locking works in general and what I should be looking for.

When I think of locking I usually think of threading, so not sure if it
matters, but I do start one a thread for email sending with the Application
thread local set for it also (because I manage data sources thru the app so
it was easier that way).  I could try refactoring that, but without a
reproducable test case, it's just a guess at this point.  My other plan
would be to revert to some older wicket version, but again, just a guess.

Here is the stack trace; nothing unusual precedes it.  (This is just a user
trying to visit the home page).  The only thing I notice is that these
issues all seem to be using the PageParameter version of the page
constructor.

tomcat stuff omitted..
...
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor9.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:153)
... 27 more
Caused by: org.apache.wicket.page.CouldNotLockPageException: Could not lock
page 0. Attempt lasted 1 minute
at
org.apache.wicket.page.PageAccessSynchronizer.lockPage(PageAccessSynchronizer.java:138)
at
org.apache.wicket.page.PageAccessSynchronizer$1.touchPage(PageAccessSynchronizer.java:194)
at org.apache.wicket.Page.dirty(Page.java:327)
at org.apache.wicket.Page.init(Page.java:779)
at org.apache.wicket.Page.init(Page.java:223)
at org.apache.wicket.Page.init(Page.java:202)
at org.apache.wicket.markup.html.WebPage.init(WebPage.java:99)
at
com.togetherauction.ui.AbstractAuctionPage.init(AbstractAuctionPage.java:31)
at com.togetherauction.ui.HomePage.init(HomePage.java:33)
... 31 more
WARN  - PageAccessSynchronizer - http-80-15 failed to acquire lock to
page 0, attempted for 1 minute out of allowed 1 minute
ERROR - DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Can't instantiate page using
constructor public
com.togetherauction.ui.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)
and argument
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:173)
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:91)
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:43)
at org.apache.wicket.DefaultMapperContext.newPageInstance

I could use a hand here - anyone want to give me some advise?

Thanks,
-- Jim
http://togetherauction.com


Re: Help I need to understand page locking

2011-05-23 Thread Jim Pinkham
Thanks, good tip.  I'll do that, and I'm also going to send in a replacement
copy for PageAccessSynchronizer that still has the one minute delay, but
then if it fails, it forces the lock anyway and swallows the exception -
hopefully that will solve my lock ups until I can find the cause:

locks.put(pageId, lock);  // force it - temporary fix only
logger.error(failed to acquire lock would have thrown: ,
/*throw*/ new CouldNotLockPageException(pageId,
thread.getName(), timeout));


Thanks,
-- Jim.

On Mon, May 23, 2011 at 9:14 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Wicket 1.5 locks access to the same page instance by more than one thread
 at
 a time.
 You can set log level to DEBUG
 for org.apache.wicket.page.PageAccessSynchronizer class and see which
 thread
 acquires the lock for page with version 0 and never releases it.

 Instead of going to previous version of Wicket better go to a newer one.

 On Mon, May 23, 2011 at 3:38 PM, Jim Pinkham pinkh...@gmail.com wrote:

  I'm using wicket 1.5 RC3 and just started getting some total system
 lockups
  recently in prod that I can't understand.
 
  Once it gets into this state, the only remedy is to restart tomcat.
  Unfortunately, I haven't yet figured out how to reproduce this, so
  meanwhile
  I thought I'd ask if someone could please help me understand how page
  locking works in general and what I should be looking for.
 
  When I think of locking I usually think of threading, so not sure if it
  matters, but I do start one a thread for email sending with the
 Application
  thread local set for it also (because I manage data sources thru the app
 so
  it was easier that way).  I could try refactoring that, but without a
  reproducable test case, it's just a guess at this point.  My other plan
  would be to revert to some older wicket version, but again, just a guess.
 
  Here is the stack trace; nothing unusual precedes it.  (This is just a
 user
  trying to visit the home page).  The only thing I notice is that these
  issues all seem to be using the PageParameter version of the page
  constructor.
 
  tomcat stuff omitted..
  ...
  Caused by: java.lang.reflect.InvocationTargetException
 at sun.reflect.GeneratedConstructorAccessor9.newInstance(Unknown
 Source)
 at
 
 
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at
 
 
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:153)
 ... 27 more
  Caused by: org.apache.wicket.page.CouldNotLockPageException: Could not
 lock
  page 0. Attempt lasted 1 minute
 at
 
 
 org.apache.wicket.page.PageAccessSynchronizer.lockPage(PageAccessSynchronizer.java:138)
 at
 
 
 org.apache.wicket.page.PageAccessSynchronizer$1.touchPage(PageAccessSynchronizer.java:194)
 at org.apache.wicket.Page.dirty(Page.java:327)
 at org.apache.wicket.Page.init(Page.java:779)
 at org.apache.wicket.Page.init(Page.java:223)
 at org.apache.wicket.Page.init(Page.java:202)
 at org.apache.wicket.markup.html.WebPage.init(WebPage.java:99)
 at
 
 
 com.togetherauction.ui.AbstractAuctionPage.init(AbstractAuctionPage.java:31)
 at com.togetherauction.ui.HomePage.init(HomePage.java:33)
 ... 31 more
  WARN  - PageAccessSynchronizer - http-80-15 failed to acquire lock to
  page 0, attempted for 1 minute out of allowed 1 minute
  ERROR - DefaultExceptionMapper - Unexpected error occurred
  org.apache.wicket.WicketRuntimeException: Can't instantiate page using
  constructor public
 
 
 com.togetherauction.ui.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)
  and argument
 at
 
 
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:173)
 at
 
 
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:91)
 at
 
 
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:43)
 at org.apache.wicket.DefaultMapperContext.newPageInstance
 
  I could use a hand here - anyone want to give me some advise?
 
  Thanks,
  -- Jim
  http://togetherauction.com
 



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



Re: Last Page visited

2011-05-17 Thread Jim Pinkham
Well, most browsers already have back button, so I'm not sure why you would
want to re-implement that, but assuming you do, here's one way to do what I
think Martin is suggesting by pass a page reference:

abstract class AbstractBase extends WebPage {
 PageReference priorPage;

 public AbstractBase(PageReference priorPage) {
   this.priorPage = priorPage;
 }
 public PageReference getPriorPage() { return priorPage; }
}

class PageThatNeedsABackButton extends AbstractBase {
 public AnyOtherPage() {
super(getPage());// you need to tell it where 'back' is as
you make each page

add(new Link(id) {
  public void onClick() {
   setResponsePage(getPriorPage());// then later you can
go there
  }
});
 }

Hope that makes sense.  Not a great idea, but hope it helps to experiment
and learn.

-- Jim.

On Tue, May 17, 2011 at 1:43 PM, Vitor Granzinoli Vellozo 
vitor.vell...@cpmbraxis.com wrote:


 Martin,

 I really read your example, but on the new NewPage(...); I cannot do
 that, because
 on the BackButton I wont know witch Page is

 The Idea is, put this BackButton throught all application, so it needs to
 discover
 from witch page the actual page was called, just it.

 I swear I read again and again your example, but I had dificulties to
 implement in my
 situation, and I had not success till now.

 Do you really understood my problem?

 Regards,
 Vitor


 -Mensagem original-
 De: Martin Grigorov [mailto:mgrigo...@apache.org]
 Enviada em: terça-feira, 17 de maio de 2011 14:36
 Para: users@wicket.apache.org
 Assunto: Re: Last Page visited

 Read carefully my examples.

 On Tue, May 17, 2011 at 7:31 PM, Vitor Granzinoli Vellozo 
 vitor.vell...@cpmbraxis.com wrote:

 
  Martin,
 
  It not works.
 
  I did: setResponsePage(getPage().getPageReference().getPage());
 
  My structure is:
 
  Page (a separated class)
|- Form (a separated class)
  |- Button (a separated class BackButton)
 
 
  Each component is a separated class in our application.
 
 
  The Button code is:
 
  public class BackButton extends Button {
 
 public BackButton(String id) {
 super(id);
 setDefaultFormProcessing(false); // because it is inside a
  form and cannot make submit forward
 }
 
 @Override
 public void onSubmit() {
 setResponsePage(getPage().getPageReference().getPage());
 }
 
  }
 
 
  On debug, the inspect of the first getPage() is the same Page as
  getPage().getPageReference().getPage().
  In the class BackButton I do not have direct access at
 getPageReference().
 
  I Just need know the preview Page, and don't care witch Page is, because
  the business rules can create different
  paths to the user.
 
  Thanks a lot again!
  Vitor
 
 
 
  -Mensagem original-
  De: Martin Grigorov [mailto:mgrigo...@apache.org]
  Enviada em: terça-feira, 17 de maio de 2011 14:19
  Para: users@wicket.apache.org
  Assunto: Re: Last Page visited
 
  On Tue, May 17, 2011 at 7:18 PM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   The idea is :
  
   setResponsePage(new NewPage(getPageReference()))
  
   later in NewPage you can do:
   Link linkToPreviousPage = new BookmarkablePageLink(link,
   previousPageRef.getPage().getClass())
  
 
  Or even : setResponsePage(previousPageRef.getPage())
 
  
  
   On Tue, May 17, 2011 at 7:11 PM, Vitor Granzinoli Vellozo 
   vitor.vell...@cpmbraxis.com wrote:
  
  
   Igor,
  
   I had a problem with getPageReference().
   I need go back to the preview page. So, from the Page2, go to Page1.
 The
   getPageReference() method
   do not gave me preview Page. It gave me the same Page.
  
   Is there a way to get the Page.class reference of the preview Page?
  
   The code I've tested getPageReference() is:
  
   PageReference reference = getPage().getPageReference();
   setResponsePage(reference.getPage());
  
   Some ligth?
  
  
   Thanks a lot,
   Vitor
  
  
  
   -Mensagem original-
   De: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
   Enviada em: terça-feira, 17 de maio de 2011 13:40
   Para: users@wicket.apache.org
   Assunto: Re: Last Page visited
  
   you can pass PageReference objects around. see Page#getPageReference()
  
   -igor
  
   On Tue, May 17, 2011 at 7:38 AM, Vitor Granzinoli Vellozo
   vitor.vell...@cpmbraxis.com wrote:
   
   
Wicketers,
   
   
   
What is the Best way to store the last Page visited? My business
 need
that to create a Page control to make
   
a special back action, not the back browser action. In this case, my
application is inside another.
   
   
   
Thanks,
   
Vitor
   
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
   

[Vote] New Wicket Version Numbering

2011-04-01 Thread Jim Pinkham
I've had a hard time lately trying to get corporate acceptance of the Wicket
framework.

In fact, our company looked at this comparison of java frameworks:

http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks

  *Project* *Current Stable Version*  Apache Click  2.2.0   Apache Cocoon
2.2.0   Apache Struts  2.2.1.1   Apache Tapestry  5.2.4   Apache Wicket
1.4.15   AppFuse  2.0.2   Aranea  1.0.10   Eclipse RAP  1.2.0   FormEngine
1.7.1   Google Web Toolkit  2.2.0   Hamlets  1.6  IceFaces  2  ItsNat
1  JavaServer
Faces  2  JBoss Seam  2.2.0 GA   Jspx-bay  1.1.0   JVx WebUI  0.8  ManyDesigns
Portofino  3.1.10   OpenLaszlo  4.1  OpenXava  4.0.1   Oracle ADF  11.1.1.4
Play  1.1.1   RIFE  1.6.2   Shale  1.0.4   Sling  5  SmartClient  8  Spring
3.0.5   Stripes  1.5.4   Telosys  1.1.1   ThinWire  1.2  Vaadin(IT Mill
Toolkit)  6.5.1   Wavemaker  6.1.10   WebObjects  5.4.3   WebWork  2.2.6
ZK  5.0.5   ztemplates  0.9.9.6

The powers that be decided to pick Smart Client over Apache Wicket because
they have the highest version number.

So, I think the time is right to move straight to the front of the pack and
release version 10.0.

Who's with me?

-- Jim

Spinal Tap Industries, Inc.


Re: Wicket in Action: problem with redirection

2011-03-18 Thread Jim Pinkham
Martin,

Thanks, no I hadn't seen that... but now I think this is just because I
over-simplified the quickstart - it still doesn't explain why it was working
properly up thru 1.5-M3   (using examples from wicket-auth-roles to have
login link hander throw this restart exception, so if that's not a bug, I
must be missing something else...

So I've got my kludge fix for now, and it works in both the quickstart and
my own app, so it'll get me along for a while..  I'm happy to assist further
but feeling a bit past my level of experience.

Thanks,
-- Jim.

On Fri, Mar 18, 2011 at 3:41 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Fri, Mar 18, 2011 at 8:39 PM, Jim Pinkham pinkh...@gmail.com wrote:

  .. and I also attached a fairly ugly patched version of
 
  RestartResponseAtInterceptPageException
 
   that seem to work for me, but use at your own risk.
 
  Did you see Igor's response ?




Re: Wicket in Action: problem with redirection

2011-03-17 Thread Jim Pinkham
OK, I just attached a quickstart (my first) - hope it helps with resolution
(soon).

On Wed, Mar 16, 2011 at 5:03 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Thanks Jim,

 But without a quickstart it is hard to debug it.
 There is a ticket which sounds to be related to what you described:
 https://issues.apache.org/jira/browse/WICKET-3493

 On Wed, Mar 16, 2011 at 9:54 PM, Jim Pinkham pinkh...@gmail.com wrote:

  FYI - rc2 still has this problem.  It works OK on a  BookmarkablePageLink
  to
  a page that implement IAuthorizationStrategy, but not on the new
  LinkMyLoginPage on a panel on my home page.  After login is complete,
 the
  link is hidden and replaced with a logout link, so the user gets an
  AccessDenied page after login as they try to 'restart the response' to
 the
  (wrong) onClick handler url for the now-invisible login link.
 
  Not sure when I'll get to making quickstart, but I thought I'd give at
  least
  this brief info for now.
  Thanks,
  -- Jim.
 
  On Wed, Mar 16, 2011 at 5:01 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   Try with RC2 and if it still fails please create a ticket with a
  quickstart
  
   On Tue, Mar 15, 2011 at 11:27 PM, Jim Pinkham pinkh...@gmail.com
  wrote:
  
I think I've got the same situation happening.
   
It's a login link on my home page, whose onClick
uses the usual:
   throw new RestartResponseAtInterceptPageException(
   AuctionApplication.get().getSignInPageClass());
   
I've stepped thru this a bit, and I find a problematic point in:
RestartResponseAtInterceptPageException.InterceptData.set() where it
captures what I think is supposed to be the home page url, which it
 is
saving as follows:
...
   data.originalUrl = request.getOriginalUrl();
   
However, in my debugger, this is instead the Url of the link:
   
   
  
 
 http://localhost:8080/myapp/wicket/page?0-1.ILinkListener-userPanel-signIn
   
If I manually change it in the debugger to just my home page Url, it
   seems
to work fine.
   
This was working last for me in 1.5-M3, and now in 1.5-RC1 it appears
  to
have broken.
   
Hope this helps narrow the search...
   
Thanks,
-- Jim.
   
On Thu, Mar 10, 2011 at 1:50 PM, Jeremy Thomerson 
jer...@wickettraining.com
 wrote:
   
 On Thu, Mar 10, 2011 at 12:36 PM, Jim Goodwin 
 sophin...@comcast.net
  
 wrote:

  I'm a Wicket newbie, working my way through /Wicket in Action.
 
  /I don't understand redirection too clearly yet, but there is
  an example in the book which doesn't work right when I
  try it and I'd like to ask if the book example code makes
  sense to more experienced folks.
 
  Page 271 Listing 11.3 line 4: The onSubmit() method calls
  !continueToOriginalDestination().
 

 continueToOriginalDestination() lets the user continue on to the
  place
they
 were going before being interrupted by the security mechanism if
 they
 aren't
 logged in.  i.e:

 user on home page
 user clicks restricted page link
 security strategy says can't go there without being logged in as
 X,
 redirects user to login page
 user logs in, and continueToOriginalDestination() redirects to
restricted
 page (original dest) and returns true.

 another example:
 user clicks bookmarked link in a new tab in their browser to login
  page
(or
 goes to unrestricted home page and clicks link for login page)
 user logs in, and continueToOriginalDestination() can't redirect
 them
 anywhere, because there is no original destination that was
   interrupted

 Page 272 Listing 11.4 , new Link(...){ ... method onClick():
  throws new RestartResponseAtInterceptPageException(signInPage)
 

 This is a way to stop processing at ANY point in your application
 and
 redirect the user to a certain page.


  How is this supposed to work?
 
  Suppose the user is on the Home page, and the Home Page
  has a UserPanel, and the user clicks on the Sign In link.
  Then  the link itself sets an intercept to the sign-in page
  (that is how the link arranges to take you there, as far as I can
  understand).
 
  But then, when the user enters name/password and submits, and
  the submit method  calls continueToOriginalDestination(), it will
  always succceed, and find the original destination to be the
  signIn
  page, regardless of where it really originated (the Home Page, in
  this case).
 

 You're a bit confused by original and destination.  Since the
  user
 clicked the signin page link, the *destination* was the signin
 page
  -
 which is unrestricted, so the continueToOriginalDestination()
 method
   can
 not
 redirect them anywhere, and thus returns false.  You now need to
   redirect
 them somewhere manually

Re: [1.5] Two formcomponents editing the same model?

2011-03-17 Thread Jim Pinkham
Hmm... If I were designing a component like this (and for some reason didn't
like the ones out there like datepicker that already do this)  I'd make a
new component that extends panel with 2 separate child controls, each with
their own date models.  Then use a top level model  getter / setter that
just pushes/pulls the 2 child dates independently using the
java.util.Calendar's fields independently.

Hope that helps,
-- Jim.

On Thu, Mar 17, 2011 at 2:53 PM, nino martinez wael 
nino.martinez.w...@gmail.com wrote:

 Hi

 Essentially I've made my own datepicker and timepicker using some jquery
 components. I am having my two components editing the same model (one edits
 time and the other date). Both components extending datetextfield

 Problem are if I change time then month/day are reset. Im thinking that it
 has something todo with hourdatetextfield are the last component added.
 I've
 tried various things also editing the raw model object. Nothing works..



 public class HourDateTextField extends DateTextField {

 public HourDateTextField(String id, IModelDate model,
 DateConverter converter) {
 super(id, model, converter);

 add(new TimePickerBehavior());
 }

 @Override
 protected void convertInput() {
 MutableDateTime dateOld = new MutableDateTime(getModelObject());
 super.convertInput();
 Date dateNew = this.getConvertedInput();
 dateOld.setHourOfDay(dateNew.getHours());
 dateOld.setMinuteOfHour(dateNew.getMinutes());
 setModelObject(dateOld.toDate());

 }

 }

 public class MonthDayDateTextField extends DateTextField {

 public MonthDayDateTextField(String id, IModelDate model,
 DateConverter converter) {
 super(id, model, converter);

 add(new DatePickerBehavior());
 }

 @Override
 protected void convertInput() {

 MutableDateTime dateOld = new MutableDateTime(getModelObject());
 super.convertInput();
 Date dateNew = this.getConvertedInput();
 dateOld.setDayOfMonth(dateNew.getDay());
 dateOld.setMonthOfYear(dateNew.getMonth());
 setModelObject(dateOld.toDate());

 }

 }



Re: Wicket in Action: problem with redirection

2011-03-16 Thread Jim Pinkham
FYI - rc2 still has this problem.  It works OK on a  BookmarkablePageLink to
a page that implement IAuthorizationStrategy, but not on the new
LinkMyLoginPage on a panel on my home page.  After login is complete, the
link is hidden and replaced with a logout link, so the user gets an
AccessDenied page after login as they try to 'restart the response' to the
(wrong) onClick handler url for the now-invisible login link.

Not sure when I'll get to making quickstart, but I thought I'd give at least
this brief info for now.
Thanks,
-- Jim.

On Wed, Mar 16, 2011 at 5:01 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Try with RC2 and if it still fails please create a ticket with a quickstart

 On Tue, Mar 15, 2011 at 11:27 PM, Jim Pinkham pinkh...@gmail.com wrote:

  I think I've got the same situation happening.
 
  It's a login link on my home page, whose onClick
  uses the usual:
 throw new RestartResponseAtInterceptPageException(
 AuctionApplication.get().getSignInPageClass());
 
  I've stepped thru this a bit, and I find a problematic point in:
  RestartResponseAtInterceptPageException.InterceptData.set() where it
  captures what I think is supposed to be the home page url, which it is
  saving as follows:
  ...
 data.originalUrl = request.getOriginalUrl();
 
  However, in my debugger, this is instead the Url of the link:
 
 
 http://localhost:8080/myapp/wicket/page?0-1.ILinkListener-userPanel-signIn
 
  If I manually change it in the debugger to just my home page Url, it
 seems
  to work fine.
 
  This was working last for me in 1.5-M3, and now in 1.5-RC1 it appears to
  have broken.
 
  Hope this helps narrow the search...
 
  Thanks,
  -- Jim.
 
  On Thu, Mar 10, 2011 at 1:50 PM, Jeremy Thomerson 
  jer...@wickettraining.com
   wrote:
 
   On Thu, Mar 10, 2011 at 12:36 PM, Jim Goodwin sophin...@comcast.net
   wrote:
  
I'm a Wicket newbie, working my way through /Wicket in Action.
   
/I don't understand redirection too clearly yet, but there is
an example in the book which doesn't work right when I
try it and I'd like to ask if the book example code makes
sense to more experienced folks.
   
Page 271 Listing 11.3 line 4: The onSubmit() method calls
!continueToOriginalDestination().
   
  
   continueToOriginalDestination() lets the user continue on to the place
  they
   were going before being interrupted by the security mechanism if they
   aren't
   logged in.  i.e:
  
   user on home page
   user clicks restricted page link
   security strategy says can't go there without being logged in as X,
   redirects user to login page
   user logs in, and continueToOriginalDestination() redirects to
  restricted
   page (original dest) and returns true.
  
   another example:
   user clicks bookmarked link in a new tab in their browser to login page
  (or
   goes to unrestricted home page and clicks link for login page)
   user logs in, and continueToOriginalDestination() can't redirect them
   anywhere, because there is no original destination that was
 interrupted
  
   Page 272 Listing 11.4 , new Link(...){ ... method onClick():
throws new RestartResponseAtInterceptPageException(signInPage)
   
  
   This is a way to stop processing at ANY point in your application and
   redirect the user to a certain page.
  
  
How is this supposed to work?
   
Suppose the user is on the Home page, and the Home Page
has a UserPanel, and the user clicks on the Sign In link.
Then  the link itself sets an intercept to the sign-in page
(that is how the link arranges to take you there, as far as I can
understand).
   
But then, when the user enters name/password and submits, and
the submit method  calls continueToOriginalDestination(), it will
always succceed, and find the original destination to be the signIn
page, regardless of where it really originated (the Home Page, in
this case).
   
  
   You're a bit confused by original and destination.  Since the user
   clicked the signin page link, the *destination* was the signin page -
   which is unrestricted, so the continueToOriginalDestination() method
 can
   not
   redirect them anywhere, and thus returns false.  You now need to
 redirect
   them somewhere manually or the signin page will re-render.
  
   The *origin* was the home page - but that doesn't matter.  Don't be
  thrown
   off by original (destination) and origin - which are two different
   things.  :)
  
   For a while my code was working like that: Signing in worked,
i.e. it did sign you in, but you were returned to a blank sign-in
 page.
(My code doesn't work like that just this minute, but that is only
because I've been enhancing it with other bugs.)
   
Can anyone explain how the book-example is supposed to work?
   
Thanks
Jim
   
  
  
   --
   Jeremy Thomerson
   http://wickettraining.com
   *Need a CMS for Wicket?  Use Brix! http://brixcms.org

Re: Wicket in Action: problem with redirection

2011-03-15 Thread Jim Pinkham
I think I've got the same situation happening.

It's a login link on my home page, whose onClick
uses the usual:
throw new RestartResponseAtInterceptPageException(
AuctionApplication.get().getSignInPageClass());

I've stepped thru this a bit, and I find a problematic point in:
RestartResponseAtInterceptPageException.InterceptData.set() where it
captures what I think is supposed to be the home page url, which it is
saving as follows:
...
data.originalUrl = request.getOriginalUrl();

However, in my debugger, this is instead the Url of the link:

http://localhost:8080/myapp/wicket/page?0-1.ILinkListener-userPanel-signIn

If I manually change it in the debugger to just my home page Url, it seems
to work fine.

This was working last for me in 1.5-M3, and now in 1.5-RC1 it appears to
have broken.

Hope this helps narrow the search...

Thanks,
-- Jim.

On Thu, Mar 10, 2011 at 1:50 PM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 On Thu, Mar 10, 2011 at 12:36 PM, Jim Goodwin sophin...@comcast.net
 wrote:

  I'm a Wicket newbie, working my way through /Wicket in Action.
 
  /I don't understand redirection too clearly yet, but there is
  an example in the book which doesn't work right when I
  try it and I'd like to ask if the book example code makes
  sense to more experienced folks.
 
  Page 271 Listing 11.3 line 4: The onSubmit() method calls
  !continueToOriginalDestination().
 

 continueToOriginalDestination() lets the user continue on to the place they
 were going before being interrupted by the security mechanism if they
 aren't
 logged in.  i.e:

 user on home page
 user clicks restricted page link
 security strategy says can't go there without being logged in as X,
 redirects user to login page
 user logs in, and continueToOriginalDestination() redirects to restricted
 page (original dest) and returns true.

 another example:
 user clicks bookmarked link in a new tab in their browser to login page (or
 goes to unrestricted home page and clicks link for login page)
 user logs in, and continueToOriginalDestination() can't redirect them
 anywhere, because there is no original destination that was interrupted

 Page 272 Listing 11.4 , new Link(...){ ... method onClick():
  throws new RestartResponseAtInterceptPageException(signInPage)
 

 This is a way to stop processing at ANY point in your application and
 redirect the user to a certain page.


  How is this supposed to work?
 
  Suppose the user is on the Home page, and the Home Page
  has a UserPanel, and the user clicks on the Sign In link.
  Then  the link itself sets an intercept to the sign-in page
  (that is how the link arranges to take you there, as far as I can
  understand).
 
  But then, when the user enters name/password and submits, and
  the submit method  calls continueToOriginalDestination(), it will
  always succceed, and find the original destination to be the signIn
  page, regardless of where it really originated (the Home Page, in
  this case).
 

 You're a bit confused by original and destination.  Since the user
 clicked the signin page link, the *destination* was the signin page -
 which is unrestricted, so the continueToOriginalDestination() method can
 not
 redirect them anywhere, and thus returns false.  You now need to redirect
 them somewhere manually or the signin page will re-render.

 The *origin* was the home page - but that doesn't matter.  Don't be thrown
 off by original (destination) and origin - which are two different
 things.  :)

 For a while my code was working like that: Signing in worked,
  i.e. it did sign you in, but you were returned to a blank sign-in page.
  (My code doesn't work like that just this minute, but that is only
  because I've been enhancing it with other bugs.)
 
  Can anyone explain how the book-example is supposed to work?
 
  Thanks
  Jim
 


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



Re: [VOTE] WICKET-3218 - Component#onInitialize is broken for Pages

2011-03-08 Thread Jim Pinkham
Interesting problem.

It helped me visualize the issue when I tried to suggest:

myPage() {
   add(new Thing(this,...)); // 'this' doesn't exist yet
}

I think building component hierarchy from constructors feels natural and
it's going to be a hard sell to change to support this use case where some
components might need to know their parents.

I thought I was keeping pretty much up-to-speed on 1.5 changes, but I'm kind
of surprised this is the first I'm noticing this fairly substantial API
change.

Sorry if something like this has already been shot down - I didn't look -
but just off the top of my head, seems like there could be a way to have the
framework (as it is about to add a page to it's map or at some other
convenient early point) go back down thru the hierarchy and visit all the
components to offer them a parent reference?   Maybe guarantee it would
happen before the first onBeforeRender or something like that?

Then, we could let these visitors 'vote' on when the hierarchy is finished
changing -  (i.e. components could use this information to make additional
changes to the hierarchy) by returning a value.   Perhaps call this new
component visitor something like int onParentChanged(Component parent) -
return flags that would let the framework interrupt and restart, repeat
after finish, or just continue visiting (or maybe just return boolean repeat
flag).

-- Jim Pinkham
TogetherAuction.com

On Tue, Mar 8, 2011 at 8:33 AM, Zoltán Nagy zberke...@gmail.com wrote:

 Hi!

 My idea is this: Somewhere in the future (for example in wicket 1.6)
 adding copmonents from the constructor will be prohibited, but till
 than it should be allowed.

 --
 Zoltán Nagy

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




Re: Wicket 1.5 events and Eclipse

2011-03-03 Thread Jim Pinkham
Yes, happens to me also.  I've just been ignoring it.

I'm on 1.5-M3

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



Re: CheckBoxMultipleChoice.getInput() = NULL after switch to AjaxSubmit

2011-02-23 Thread Jim Pinkham
Just a thought - have you looked at the difference between
AjaxFormChoiceComponentUpdatingBehavior and
AjaxFormComponentUpdatingBehavior?  (I know you mentioned upload, but
perhaps there is a clue in there...)

-- Jim Pinkham

On Wed, Feb 23, 2011 at 10:57 AM, eugenebalt eugeneb...@yahoo.com wrote:


 Hi Kikiya, thanks a lot for the reply. Can you provide details on what you
 did?

 For everyone else reading this. Maybe the original post wasn't worded very
 well, but here's the issue: When I'm doing Form onSubmit(),
 CheckBoxMultipleChoice.getInput() returns correct results. However, in any
 Ajax code, CheckBoxMultipleChoice.getInput() returns NULL. This is only a
 problem with the CheckBoxMultipleChoice, not with any other fields.

 I talked with co-workers and we think it's because the top-level
 CheckBoxMultipleChoice isn't propagating the Input changes to the
 lower-level checkboxes. But on the Form onSubmit(), everything gets mapped
 correctly, and the whole checkbox group gives the right inputs on
 getInput().

 Thanks
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/CheckBoxMultipleChoice-getInput-NULL-after-switch-to-AjaxSubmit-tp3317829p3321248.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




How to make DateTimeField default to PM

2011-01-24 Thread Jim Pinkham
I wanted to have my DateTimeField (That's the wicket-extensions component
with a date text field, button to open calendar, and hours/minutes fields
with optional AM_PM choice) default to PM instead of AM for new dates
because I noticed most dates in this part of my app are evening dates.

I came up with this; maybe it helps someone, or let me know if you have a
better way:

FormComponentDate dateField = new DateTimeField(eventOn) {
private static final long serialVersionUID = 1L;

// amOrPmChoice is final, so we have a little kludge to
default new item's eventOn date to PM
// TODO: find a less clever way
@Override
protected void onBeforeRender() {
Date d = (Date)getDefaultModelObject();
if (d == null) { // user hasn't entered a date (yet)
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 18);  // anything after
noon would work
IModelDate dm = (IModelDate) getDefaultModel();
dm.setObject(c.getTime());
super.onBeforeRender();   // initializes
amOrPmChoice as side-effect
dm.setObject(null);
}
super.onBeforeRender();
}

@Override
protected DateTextField newDateTextField(final String id,
final PropertyModelDate dateFieldModel) {
return DateTextField.forDatePattern(id, dateFieldModel,
MM/dd/);
}
};
Cheers,
-- Jim.


Re: Free wicket from component hierarchy hell

2011-01-20 Thread Jim Pinkham
I'm not a committer, just a normal 1.5 user concerned about bloat.

For what it's worth, I took a few minutes to actually look at the change
(MarkupContainer as you'd expect) and I can see that if you don't use the
new queue methods, the only a memory overhead is the *static* QUEUE (nothing
extra per component!) so I appreciate that performance-wise anyway, it's a
low impact feature you can ignore without penalty.

I'm not thrilled about the conceptual impact of adding a new concern to an
already large class, but the implementation looks quite nice actually, so my
first concern that it might break existing behavior is satisfied.

I still don't think it's necessary, and wonder if it might actually be
counter-productive to have more than one way to learn for new adopters.  If
it goes forward, I don't suppose there's much precedent for taking something
back out, is there?

What a difficult discussion to have over email - I'm in the -1 camp on this
overall, but I think I do appreciate the admirable motive to innovate, so I
hope the committers will give this serious consideration and then chuck it
in the bin where it ...  no, just kidding,  ;)  and then make a fair
decision.

Thanks,
--Jim Pinkham.

On Thu, Jan 20, 2011 at 12:24 PM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 http://farm5.static.flickr.com/4089/4968160827_b742a7448a_z.jpg

 ..hrm.. putting that aside, did you give it a test drive?

 **
 Martin

 2011/1/20 Jeremy Thomerson jer...@wickettraining.com:
  On Wed, Jan 19, 2011 at 3:55 AM, Martin Makundi 
  martin.maku...@koodaripalvelut.com wrote:
 
  Can we bargain about this? Say, also wicket auto ajax enclosure and
  both into 1.4-x
 
 
  This made me laugh.  What is the other side of the bargain?  What does
 the
  giving party get in return?  :)
 
  Apache is all about consensus.  If the project management committee (who
  ultimately has to lead and guide the project) agrees that something is
  useful, beneficial, and not detrimental, they allow it to be added by the
  committers.  In the case of Wicket, each committer is also on the PMC.
  So,
  with several committers against this feature being added to 1.4.x (myself
  included) and possibly even 1.5, you must persuade them (us) as to why it
 is
  needed.
 
  That being said, this has already been a really long thread (over 100
  messages), so you're up against bad odds.
 
  --
  Jeremy Thomerson
  http://wickettraining.com
  *Need a CMS for Wicket?  Use Brix! http://brixcms.org*
 

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




Re: JasperReport viewing options for wicket 1.5

2011-01-18 Thread Jim Pinkham
Thanks - so glad to see it's been ported to 1.5; now, I need the jar.

Maven gives me:
Unable to find resource 'org.wicketstuff:jasperreports:pom:1.5-SNAPSHOT' in
repository public (http://public)
.. and then again for 2 repositories I tried adding: wicket-snaps, and
nonatype-nexus-snapshots at
urlhttp://wicketstuff.org/maven/repository/url
and
urlhttp://oss.sonatype.org/content/repositories/snapshots
/url

Am I missing a new repository since the move to GIT ?  Everything else
(wicket, wicket-extensions, wicket-datetime, wicket-auth-roles,
mysql-connectory-java, commons-dbcp, spring, jasperreports, ehcache, jetty
...etc works OK.  ??

Perhaps someone who knows might be able to update this wiki page:
http://wicketstuff.org/confluence/display/STUFFWEB/Home#Home-WheredoIdownloadstablereleases%3F

Thanks,
-- Jim.

On Tue, Jan 18, 2011 at 3:16 AM, Martin Grigorov mgrigo...@apache.orgwrote:


 https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/jasperreports-parent




Re: JasperReport viewing options for wicket 1.5

2011-01-18 Thread Jim Pinkham
Well, I seem to be making good progress, but still not 100% there.

I got git and did a clone of wicketstuff and built jasperreports and added
it's target\jar to my local repo.
I only had to change the core's pom.xml to refer to the 1.5-M3 version I'm
using instead of 1.5-SNAPSHOT.

So far so good - pdf reports work fine (hooray) but now XLS is giving me
this:

NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFCellStyle

Also, while I'm at it, maybe this saves someone else a bit of effort -

I had to add a log4j dependency to the jasperreports-maven-plugin as
described in the final post here:
http://jasperforge.org/plugins/espforum/view.php?group_id=102forumid=103topicid=63750

And here's how I'm using it:

public class ReportResource extends JRConcreteResourceIJRResourceHandler {

public ReportResource(final String report, final IJRResourceHandler handler,
final MapString,Object params) {
super(new File(ReportResource.class.getClassLoader()
.getResource(report+.jasper).getFile()), fixXls(handler));

setReportParameters(params);
setFileName(report+handler.getExtension());
setConnectionProvider(new IDatabaseConnectionProvider() {
private static final long serialVersionUID = 1L;
public Connection get() {
try {
// If I hold on to conn reference here I get
serializable problems
return
MyApplication.get().getConnectionForCurrentDatabase();
} catch (SQLException e) {
return null;
}
}
public void release() {}   // should I be doing conn.close?
});
}
}

And then here's how I use it:
add(new ResourceLinkVoid(testPdf, new ReportResource(report1,
new PdfResourceHandler(), params)));
add(new ResourceLinkVoid(testXls, new ReportResource(report1,
new XlsResourceHandler(), params)));

So I think it's just a missing dependency someplace... anyone got a tip for
me? (ideally, how I can find it myself rather than mooch)

Any advice would be most welcome!

Thanks,
-- Jim.

On Tue, Jan 18, 2011 at 8:59 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 You'll need to build it yourself locally.
 There is not yet a release of wicketstuff-1.5 at oss.sonatype.org. I think
 we will release it once Wicket 1.5-RC1 is released (hopefully this week).

 On Tue, Jan 18, 2011 at 2:48 PM, Jim Pinkham pinkh...@gmail.com wrote:

  Thanks - so glad to see it's been ported to 1.5; now, I need the jar.
 
  Maven gives me:
  Unable to find resource 'org.wicketstuff:jasperreports:pom:1.5-SNAPSHOT'
 in
  repository public (http://public)
  .. and then again for 2 repositories I tried adding: wicket-snaps, and
  nonatype-nexus-snapshots at
 urlhttp://wicketstuff.org/maven/repository/url
  and
 urlhttp://oss.sonatype.org/content/repositories/snapshots
  /url
 
  Am I missing a new repository since the move to GIT ?  Everything else
  (wicket, wicket-extensions, wicket-datetime, wicket-auth-roles,
  mysql-connectory-java, commons-dbcp, spring, jasperreports, ehcache,
 jetty
  ...etc works OK.  ??
 
  Perhaps someone who knows might be able to update this wiki page:
 
 
 http://wicketstuff.org/confluence/display/STUFFWEB/Home#Home-WheredoIdownloadstablereleases%3F
 
  Thanks,
  -- Jim.
 
  On Tue, Jan 18, 2011 at 3:16 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
  
  
 
 https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/jasperreports-parent
  
  
 



Re: JasperReport viewing options for wicket 1.5

2011-01-18 Thread Jim Pinkham
... and to follow up briefly - I got past the class not found by adding:
 !--  this should be redundant?? --
dependency
groupIdorg.apache.poi/groupId
artifactIdpoi/artifactId
version3.2-FINAL/version
/dependency

(Although even then, mvn eclipse:eclipse didn't add it - I had to add it
myself to the classpath! - perhaps because it's declared as optional in
the projects's pom.xml ?  wierd.)

So now I can click on my link and download an XLS, but then I get this
lovely message:

Excel found unreadable content in 'report1xls'.  Do you want to recover the
contents...  OK sure... then:
'Damage to the file was so extensive that repairs were not possible.
...etc'.

The resulting workbook that finally opens looks like it's ok at first, then
all messed up starting a few pages down where a string value contains an
ampersand  (It's possible the data has some HTML like  amp;).

To say that I'm out of my element here is an understatement.

If I don't get any better ideas, I'll go with this hack (notice I switch to
using the HTML exporter):

private static IJRResourceHandler fixXls(IJRResourceHandler handler) {
// kludge for xls
if (handler instanceof XlsResourceHandler) {
return new XlsResourceHandler() {
private static final long serialVersionUID = 1L;
@Override
public JRAbstractExporter newExporter()
{
JRAbstractExporter exporterXLS = new JRHtmlExporter();

exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_ONE_PAGE_PER_SHEET,
Boolean.TRUE);

exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_DETECT_CELL_TYPE,
Boolean.TRUE);

exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_WHITE_PAGE_BACKGROUND,
Boolean.TRUE);

exporterXLS.setParameter(JRXlsAbstractExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
Boolean.TRUE);
return exporterXLS;
}
};
}
return handler;
}

But it makes all kinds of ugly dead image links every other row and column
around the data.  Yuck.

Any other jasper users want to share any tips here?

Thanks,
-- Jim.

On Tue, Jan 18, 2011 at 2:17 PM, Jim Pinkham pinkh...@gmail.com wrote:

 Well, I seem to be making good progress, but still not 100% there.

 I got git and did a clone of wicketstuff and built jasperreports and
 added it's target\jar to my local repo.
 I only had to change the core's pom.xml to refer to the 1.5-M3 version I'm
 using instead of 1.5-SNAPSHOT.

 So far so good - pdf reports work fine (hooray) but now XLS is giving me
 this:

 NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFCellStyle

 Also, while I'm at it, maybe this saves someone else a bit of effort -

 I had to add a log4j dependency to the jasperreports-maven-plugin as
 described in the final post here:

 http://jasperforge.org/plugins/espforum/view.php?group_id=102forumid=103topicid=63750

 And here's how I'm using it:

 public class ReportResource extends JRConcreteResourceIJRResourceHandler
 {

 public ReportResource(final String report, final IJRResourceHandler
 handler, final MapString,Object params) {
 super(new File(ReportResource.class.getClassLoader()
 .getResource(report+.jasper).getFile()),
 fixXls(handler));

 setReportParameters(params);
 setFileName(report+handler.getExtension());
 setConnectionProvider(new IDatabaseConnectionProvider() {
 private static final long serialVersionUID = 1L;
 public Connection get() {
 try {
 // If I hold on to conn reference here I get
 serializable problems
 return
 MyApplication.get().getConnectionForCurrentDatabase();
 } catch (SQLException e) {
 return null;
 }
 }
 public void release() {}   // should I be doing conn.close?
 });
 }
 }

 And then here's how I use it:
 add(new ResourceLinkVoid(testPdf, new ReportResource(report1,
 new PdfResourceHandler(), params)));
 add(new ResourceLinkVoid(testXls, new ReportResource(report1,
 new XlsResourceHandler(), params)));

 So I think it's just a missing dependency someplace... anyone got a tip for
 me? (ideally, how I can find it myself rather than mooch)

 Any advice would be most welcome!

 Thanks,
 -- Jim.


 On Tue, Jan 18, 2011 at 8:59 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 You'll need to build it yourself locally.
 There is not yet a release of wicketstuff-1.5 at oss.sonatype.org. I
 think
 we will release it once Wicket 1.5-RC1 is released (hopefully this week).

 On Tue, Jan 18, 2011 at 2:48 PM, Jim Pinkham pinkh...@gmail.com wrote:

  Thanks - so glad to see it's been ported to 1.5; now, I need the jar.
 
  Maven gives me:
  Unable to find resource 'org.wicketstuff:jasperreports:pom:1.5

JasperReport viewing options for wicket 1.5

2011-01-17 Thread Jim Pinkham
I found this tantalizingly close msg:

http://www.mail-archive.com/users@wicket.apache.org/msg55375.html

Sounds like about what I'd need; except I've moved on to wicket 1.5.

I don't need any pagination or other bells  whistles - just a simple way to
deliver dynamically generated pdf reports.  (Although Excel ouput might be
nice too)

I think I'd do links with report name and other named parameters in the URL,
then have my app declare a shared resource mounted at \reports.

I was hoping someone has already done this and I could learn (or shamelessly
copy) from it.  ;)

I could not find any version of org.wicketstuff jasperreports  1.4.x

I did find jasperreports-maven-plugin and so it's compiling .jrxml into
.jasper at build time just fine.

Could someone kindly point me in the right direction with a brief example
perhaps?

Thanks,
-- Jim.


RenderBodyOnly and email links

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

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

AbstractLink myLink;

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

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

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

Maybe this helps someone else

Cheers,
Jim
http://togetherauction.com


PageParametersEncoder migrating from Hybrid

2010-12-22 Thread Jim Pinkham
In my 1.5-M3 app's init, I've got:

// this part works fine, just wanted to show where the  comes
from below...
getRootRequestMapperAsCompound().add(customHomeMapper);

getRootRequestMapperAsCompound().add(
new MountedMapper(/statement, StatementPage.class));

and my StatementPage URLs look like this:

http://localhost:8080//statement?id=3p2=75

I need them to look like this:

http://localhost:8080//statement/id/3/p2/75

Looks like HybridURLCodingStrategy is out and PageParametersEncoder is it's
replacement... but no subclasses that do what I need.

Is there a 1.5 equivalent before I go write one, or is there another way?

BTW, the ability to have the custom home component mapper is the reason I'm
migrating - I'm so happy to have that feature!!
I just need a bit of help getting this into final form.

Thanks,
-- Jim.


Re: PageParametersEncoder migrating from Hybrid

2010-12-22 Thread Jim Pinkham
Peter,

That worked great!

For mine, I added a test for even number of segments like so:
ListString segs = request.getUrl().getSegments();
if (segs.size()%2==1)
segs.add(0);  // maybe throw exception instead?

String[] named = segs.toArray(new String[segs.size()]);
Thanks again,
-- Jim.

2010/12/22 Major Péter majorpe...@sch.bme.hu

 Hi,

 I've played with the encoders, and currently this is what I'm using:
 https://gist.github.com/717942
 It isn't really tested out, but did the job for a quick look :)

 Hope this helps

 Regards,
 Peter

 2010-12-22 18:23 keltezéssel, Jim Pinkham írta:

  In my 1.5-M3 app's init, I've got:

 // this part works fine, just wanted to show where the  comes
 from below...
 getRootRequestMapperAsCompound().add(customHomeMapper);

 getRootRequestMapperAsCompound().add(
 new MountedMapper(/statement, StatementPage.class));

 and my StatementPage URLs look like this:

 http://localhost:8080//statement?id=3p2=75

 I need them to look like this:

 http://localhost:8080//statement/id/3/p2/75

 Looks like HybridURLCodingStrategy is out and PageParametersEncoder is
 it's
 replacement... but no subclasses that do what I need.

 Is there a 1.5 equivalent before I go write one, or is there another way?

 BTW, the ability to have the custom home component mapper is the reason
 I'm
 migrating - I'm so happy to have that feature!!
 I just need a bit of help getting this into final form.

 Thanks,
 -- Jim.


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




maybe this authorization strategy helps someone

2010-12-14 Thread Jim Pinkham
I needed to authorize some pages not just by annotation but also based on
PageParameters.

I came up with this:

App.init()


((CompoundAuthorizationStrategy)getSecuritySettings().getAuthorizationStrategy())
.add(new RequiresRolesUnlessAdminAuthorizationStrategy(new
Roles(ADMIN)));

public interface IRequiresRole
{
Roles requiresRoles();
}

public class ProfilePage extends MyWebPage implements IRequiresRole
{
private String id;
public ProfilePage(PageParameters p) {
id = p.get(id).toString();
}
public Roles requiresRoles() {
return new Roles(id);   // I'm just using the id as a role for
testing but you can lookup your object and see what roles it needs here
}
}

And the fun one:

public class RequiresRolesUnlessAdminAuthorizationStrategy implements
IAuthorizationStrategy {

private Roles alwaysAllow;

public RequiresRolesUnlessAdminAuthorizationStrategy(Roles alwaysAllow)
{
this.alwaysAllow = alwaysAllow;
}

public boolean isActionAuthorized(Component component, Action action) {
if (component instanceof IRequiresRole)
{
Roles r = ((IRequiresRole) component).requiresRoles();
return AuthenticatedWebSession.get().isSignedIn() 
(
AuthenticatedWebSession.get().getRoles().hasAllRoles(r)
||
(alwaysAllow != null 
AuthenticatedWebSession.get().getRoles().hasAnyRole(alwaysAllow))
);
}
return true;
}

public T extends IRequestableComponent boolean
isInstantiationAuthorized(
ClassT componentClass) {
return true;
}
}

So if you are ADMIN you can do anything, otherwise you need whatever role
corresponds to object identified by the PageParameter id.

Am I re-inventing someone's wheel here, or does this sound good?

Thanks,
-- Jim.


how to have one app at multiple root contexts

2010-11-22 Thread Jim Pinkham
I've got a wicket 1.3 app I'm refactoring to add security and more scalable
'root contexts'.

I think may involve going to wicket 1.5 but I haven't found any actual
examples of this to study - seems like it would be a common need.

Right now, I have a dozen different maven profiles that crank out nearly
identical war files named for each profile (aka root-context aka clients).
I'll run out of memory soon with this approach so I'd really like to get
back to just a single war file to deploy at root context and somehow pull
the client names dynamically.

It would be OK to redeploy to add client mappings at app.init since there is
some db config for each new one anyway, although it would be best to have no
outage for other clients when new one is added

For the security, I found a great help
herehttp://out-println.blogspot.com/2009/02/wicket-swarm-spring-security-how-to.html.
Unfortunately, it doesn't work with Wicket 1.5.  Anyone working on that?  I
gave it a quick effort, but got stuck on the  WaspWebApplication's
newRequestCycle method which I just don't understand.  The best I could do
was get it all working with:
wicket.version1.4.13/wicket.version
swarm.version1.4.1/swarm.version   (and for this I had to
declare and download manually: swarm,wasp,hive,wicomsec)
jetty.version6.1.25/jetty.version
spring-security.version2.0.4/spring-security.version

I had thought to try spring-security's OpenID authentication so my users
could use their existing gmail or flickr or whatever ids and not have to
create a new one just for my sites... but now I'm thinking to keep it
simpler and just use wicket-auth-roles in order to use wicket 1.5.

Can anyone offer advice to help me make progress on either of these issues?

Thanks,
-- Jim.

http://togetherauction.com


Re: how to have one app at multiple root contexts

2010-11-22 Thread Jim Pinkham
I've studied the example, but I'm still not seeing how to make it work at
the root.  I'm trying to get URLs like this

http://localhost:8080/-   container should render index.html
http://localhost:8080/foo  -  should render HomePage
http://localhost:8080/bar  -  should render HomePage
http://localhost:8080/foo/wicket/bookmarkable/com.example.OtherPage

which don't have the /localized prefix (the example uses /localized/en_US/)

So I tried replacing this:

getRootRequestMapperAsCompound().add(
new LocaleFirstMapper(new MountedMapper(/localized,
LocalizedPage.class)));

with this (because I don't have a prefix like /localized)

getRootRequestMapperAsCompound().add(
new MyLocaleFirstMapper(getRootRequestMapper()));

but then it goes into a loop delegating to the chain.

I feel like I'm missing something obvious...  not too proud to ask for a bit
more hand holding?

Thanks very much,
-- Jim.

On Mon, Nov 22, 2010 at 1:13 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 this would indeed be much simpler with 1.5. wicket-examples in 1.5
 contains some request mapper examples you can take a look at.
 basically, you can use the same idea as LocaleFirstMapper to always
 prepend the client name into the first segment of the url - creating
 virtual contexts in the url space of an app that runs as the root
 context.

 -igor

 On Mon, Nov 22, 2010 at 9:58 AM, Jim Pinkham pinkh...@gmail.com wrote:
  I've got a wicket 1.3 app I'm refactoring to add security and more
 scalable
  'root contexts'.
 
  I think may involve going to wicket 1.5 but I haven't found any actual
  examples of this to study - seems like it would be a common need.
 
  Right now, I have a dozen different maven profiles that crank out nearly
  identical war files named for each profile (aka root-context aka
 clients).
  I'll run out of memory soon with this approach so I'd really like to get
  back to just a single war file to deploy at root context and somehow pull
  the client names dynamically.
 
  It would be OK to redeploy to add client mappings at app.init since there
 is
  some db config for each new one anyway, although it would be best to have
 no
  outage for other clients when new one is added
 
  For the security, I found a great help
  here
 http://out-println.blogspot.com/2009/02/wicket-swarm-spring-security-how-to.html
 .
  Unfortunately, it doesn't work with Wicket 1.5.  Anyone working on that?
  I
  gave it a quick effort, but got stuck on the  WaspWebApplication's
  newRequestCycle method which I just don't understand.  The best I could
 do
  was get it all working with:
 wicket.version1.4.13/wicket.version
 swarm.version1.4.1/swarm.version   (and for this I had to
  declare and download manually: swarm,wasp,hive,wicomsec)
 jetty.version6.1.25/jetty.version
 spring-security.version2.0.4/spring-security.version
 
  I had thought to try spring-security's OpenID authentication so my users
  could use their existing gmail or flickr or whatever ids and not have to
  create a new one just for my sites... but now I'm thinking to keep it
  simpler and just use wicket-auth-roles in order to use wicket 1.5.
 
  Can anyone offer advice to help me make progress on either of these
 issues?
 
  Thanks,
  -- Jim.
 
  http://togetherauction.com
 

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




Re: how to have one app at multiple root contexts

2010-11-22 Thread Jim Pinkham
Super - that works great!

I especially like how it won't have to be a PageParameter this way.  (At one
point I thought I'd have to do it that way).

You've saved me a lot of work!

Thanks again,
-- Jim.

On Mon, Nov 22, 2010 at 6:29 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 you would insert yours as first. if you were using the locale one


 IRequestMapper root=getRootRequestMapper();
 LocaleFirstMapper first=new LocaleFirstMapper(root);
 setRootRequestMapper(first);

 in this way the locale first will process all urls.

 -igor


 On Mon, Nov 22, 2010 at 3:02 PM, Jim Pinkham pinkh...@gmail.com wrote:
  I've studied the example, but I'm still not seeing how to make it work at
  the root.  I'm trying to get URLs like this
 
  http://localhost:8080/-   container should render index.html
  http://localhost:8080/foo  -  should render HomePage
  http://localhost:8080/bar  -  should render HomePage
  http://localhost:8080/foo/wicket/bookmarkable/com.example.OtherPage
 
  which don't have the /localized prefix (the example uses
 /localized/en_US/)
 
  So I tried replacing this:
 
 getRootRequestMapperAsCompound().add(
 new LocaleFirstMapper(new MountedMapper(/localized,
  LocalizedPage.class)));
 
  with this (because I don't have a prefix like /localized)
 
 getRootRequestMapperAsCompound().add(
 new MyLocaleFirstMapper(getRootRequestMapper()));
 
  but then it goes into a loop delegating to the chain.
 
  I feel like I'm missing something obvious...  not too proud to ask for a
 bit
  more hand holding?
 
  Thanks very much,
  -- Jim.
 
  On Mon, Nov 22, 2010 at 1:13 PM, Igor Vaynberg igor.vaynb...@gmail.com
 wrote:
 
  this would indeed be much simpler with 1.5. wicket-examples in 1.5
  contains some request mapper examples you can take a look at.
  basically, you can use the same idea as LocaleFirstMapper to always
  prepend the client name into the first segment of the url - creating
  virtual contexts in the url space of an app that runs as the root
  context.
 
  -igor
 
  On Mon, Nov 22, 2010 at 9:58 AM, Jim Pinkham pinkh...@gmail.com
 wrote:
   I've got a wicket 1.3 app I'm refactoring to add security and more
  scalable
   'root contexts'.
  
   I think may involve going to wicket 1.5 but I haven't found any actual
   examples of this to study - seems like it would be a common need.
  
   Right now, I have a dozen different maven profiles that crank out
 nearly
   identical war files named for each profile (aka root-context aka
  clients).
   I'll run out of memory soon with this approach so I'd really like to
 get
   back to just a single war file to deploy at root context and somehow
 pull
   the client names dynamically.
  
   It would be OK to redeploy to add client mappings at app.init since
 there
  is
   some db config for each new one anyway, although it would be best to
 have
  no
   outage for other clients when new one is added
  
   For the security, I found a great help
   here
 
 http://out-println.blogspot.com/2009/02/wicket-swarm-spring-security-how-to.html
  .
   Unfortunately, it doesn't work with Wicket 1.5.  Anyone working on
 that?
   I
   gave it a quick effort, but got stuck on the  WaspWebApplication's
   newRequestCycle method which I just don't understand.  The best I
 could
  do
   was get it all working with:
  wicket.version1.4.13/wicket.version
  swarm.version1.4.1/swarm.version   (and for this I had to
   declare and download manually: swarm,wasp,hive,wicomsec)
  jetty.version6.1.25/jetty.version
  spring-security.version2.0.4/spring-security.version
  
   I had thought to try spring-security's OpenID authentication so my
 users
   could use their existing gmail or flickr or whatever ids and not have
 to
   create a new one just for my sites... but now I'm thinking to keep it
   simpler and just use wicket-auth-roles in order to use wicket 1.5.
  
   Can anyone offer advice to help me make progress on either of these
  issues?
  
   Thanks,
   -- Jim.
  
   http://togetherauction.com
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

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




Re: Bug in DateTimeField related to Daylight Savings Time

2010-10-27 Thread Jim Pinkham
It also won't accept 3/13/2011 2PM.  I added a brief comment to the JIRA.
Any fix for this?  I don't really want 24hr format.
-- Jim P.


learn from my security mistake with getString

2010-07-23 Thread Jim Pinkham
I was just looking around for my dunce cap after noticing this little gotcha
- and I thought of this forum instead to share my moment of
not-so-brilliance:

public LoginForm(final String id) {
... other stuff ...
add(new FormComponentFeedbackBorder(user.feedback).add(new
TextField(user).setRequired(true)));
passwordField = new PasswordTextField(password);
passwordField.setRequired(true);
add(new
FormComponentFeedbackBorder(password.feedback).add(passwordField));
}
protected void onSubmit() {
String password=getString(password).trim();
if (password.equalsIgnoreCase(getPassword())) {
((AuctionSession)getSession()).setAdmin(true);
((AuctionSession)getSession()).setUserName(getUser());
if (!continueToOriginalDestination())
setResponsePage(getApplication().getHomePage());
} else
passwordField.error(invalid user/password);
}
}

Pretty basic, I know.  Maybe you have a page like this in your Wicket app?


The mistake I wanted to share is that I'm using the same name for the
password wicket:id, and the string property in MyLoginPage.properties,
which just has a line that says password=super_secret_whatever.  (Actually,
it's ${profile.password} and I have different maven profiles for different
versions of the app, but that's another story).

Anyway, imagine my suprise when I accidentally left the password blank by
mistake - the required error message uses the same property and shows the
password to the wide world in the feedback message: 'super_secret_whatever'
is required.  Hah!(Yup, it's been in production for quite a while like
this...)

Just wanted to share that one with y'all - may all your mistakes be
entertaining and/or educational...
:)

-- Jim.


Configuration Q re Maven Profiles and Start

2010-07-07 Thread Jim Pinkham
There must be something simple I'm missing - I'm fairly new to maven, but I
love the profile feature for different client versions of a hosted turnkey
app I'm working on.

So, I build multiple war files specifying each -PprofileName and rename the
WARs to the context root I want (usually same as the profile name) and
deploy them - everything works OK.  This lets me put references to
${profile.thisOrThat}
in various places - html files, Somepage.properties, even
applicationContext.xml and web.xml.

But I realized, I've now lost the handy ability to debug Start.java - of
course, it sees the plain version of these config setting, so it doesn't get
very far.  This is slowing me down on minor HTML tweaks, for example, that
used to be super-fast and easy cause now I'm back to the old fix, compile,
deploy dev cycle.

I've got the Eclipse maven plug in, and I've made a Debug Configuration of
type Maven Build but I'm not sure what to put for the goal.

Something like run org.mypackage.Start ?

Thanks for any clues,
-- Jim.


Re: multiple feedback panels in same page

2010-04-06 Thread Jim Pinkham
I just had this page with 2 forms issue - each form has some
RequiredTextFields, and some fields with custom StringValidators that I
didn't want to change from error to form.error.

This thread got me 90% of the way there, but

new FeedbackPanel(feedback, new *Container*FeedbackMessageFilter(myForm))

did the trick for my situation.

Just thought I'd mention it for benefit of fellow googlers in case they try
*Component*FeedbackMessageFilter and wonder where the messages went...
-- Jim P.
On Fri, Aug 21, 2009 at 8:34 PM, satar starl...@gmail.com wrote:


 Thank you for the quick example. I think I actually seen this way of
 setting
 up a feedback panel at one point in time but had forgotten and then bumped
 into the problem of having two feedback panels on one page. This got me
 moving on quickly -- thank again!
 --
 View this message in context:
 http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p25089341.html
  Sent from the Wicket - User 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: Multiple Copies of One Wicket App

2010-02-25 Thread Jim Pinkham
I have a follow-up question related to this.

My current setup is simply myclient.war with my web.xml having one
filter-name and one filter-mapping with url-pattern /*  so my home page is
myhost/myclient.   Life is good, but now I'm growing!

What I'd like to do is have separate versions of the app for several
clients.  So I'd rename myclient.war to generic.war, then have
several filter-mappings with url-pattern  /myclient and /mynewclient.   I
think this way I can have specific init-param entries for each one and get
the right database and so forth for each one - that's pretty much how I
read this answer, so that's great as far as it goes.

So my followup question is, I have some ThisPage.properties files with text
specific to my current client, and I'd like to have some way to load
properties in a consistent way, perhaps ThisPage.properites, with overrides
taken from myclient.properties - kind of like locales, but not exactly.
For that matter, I might even do the same thing with ThisPage.html and
ThisPage.mynewclient.html files.   I also have a few
MyApplication.properties.  Perhaps I could refactor these (there aren't too
many) into some other organization?

Anyone have any tips for me in this regard?  I don't anticipate any other
future locales other than default US, but I'd hate to break from convention
allowing for that if there's a better way.

I'm still on 1.3.7 btw, if that matters.

Thanks,
-- Jim.

On Fri, Jan 9, 2009 at 8:42 AM, Serkan Camurcuoglu 
serkan.camurcuo...@telenity.com wrote:

 I know this would be very difficult to create by hand, but if you
 automatically create a web.xml which includes 200 such filter definitions
 (replacing Application1 and dbfile1 with other values) I think that would do
 what you want. Note that here you obtain the db configuration file name as a
 filter init parameter, you should modify your application's init method
 accordingly..

   filter
   filter-nameApplication1/filter-name

 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
   init-param
   param-nameapplicationClassName/param-name
   param-valuecom.mycompany.MyApplication/param-value
   /init-param
   init-param
   param-namedbFileName/param-name
   param-valuedbfile1.properties/param-value
   /init-param
   /filter

   filter-mapping
   filter-nameApplication1/filter-name
   url-pattern/dbfile1/*/url-pattern
   dispatcherREQUEST/dispatcher
   dispatcherINCLUDE/dispatcher
   /filter-mapping




 Sean W wrote:

 path:
 /ContextPath/wicket/BookmarkablePage

 It appears to me that using Wicket you cannot place anything in the path
 between the context path and the mounted name except for wicket, which
 is
 defined as your url-pattern. In other words, a mounted page cannot be
 referenced from more than one path. This also means Wicket can't support
 sub contexts.

 Perhaps I'll have to try and deploy a single app 200 times in tomcat with
 the same WAR. :-S




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




Re: Handling Ajax session expired

2009-12-28 Thread Jim Pinkham
I think this suggestion is worth condsidering more carefully:

 Can you just achieve what you wan't making siloA, siloB, siloC been
 different Wicket applications?

No, that is not the proper solution. They are the same application.

OK, but could you deploy multiple copies of the same app to different root
contexts - that would give you the info you want in each URL and thus be
able to do different home/error pages with some config along with each copy
of the app.  Seems worth exploring whether your Silos might divide well in
this manner, maybe with a bit of work, but probably more likely to happen
than what it seems like you are looking for, which doesn't sound (just one
casual observer's option) broadly applicable enough to warrant framework
inclusion.

Good luck
Jim P
On Mon, Dec 28, 2009 at 8:04 AM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 2009/12/28 Ernesto Reinaldo Barreiro reier...@gmail.com:
  but I'm no core developer... So, why not wait to see what
  do they comment on this issue?

 Maybe they just want us to weather this out on ourselves ... ;)

 **
 Martin

 
  On Mon, Dec 28, 2009 at 1:44 PM, Martin Makundi 
  martin.maku...@koodaripalvelut.com wrote:
 
  How would you formulate such RFE?
 
  Wicket needs an autonomus but parametrizable global behavior, that is
  transparent to all url encoding schemes, that can be used to identify
  users's silo in the application. When session is invalidated or other
  errors occur, each silo can have its own errorpage/homepage which is
  automatically rendered by the behavior.
 
  Is this descriptive enough?
 
  Maybe some junit wickettester test cases?
  - test 1: User has begun using Silo1Homepage.class when session is
  invalidated. User is redirected back to Silo1Homepage.
  - test 2: User has begun using Silo2Homepage.class when session is
  invalidated. User is redirected back to Silo2Homepage.
  - similar for error pages, and after error page - silo-home-page
  - etc.
 
  **
  Martin
 
 
  2009/12/28 Ernesto Reinaldo Barreiro reier...@gmail.com:
   Create a RFE? Maybe on 1.5 it is already possible?
  
   Ernesto
  
   On Mon, Dec 28, 2009 at 1:16 PM, Martin Makundi 
   martin.maku...@koodaripalvelut.com wrote:
  
   It should be automatic and global, like a url encoding scheme, and it
   should come with an interpreter that will process the
   homepage/errorpage when necessary.
  
   **
   Martin
  
   2009/12/28 Ernesto Reinaldo Barreiro reier...@gmail.com:
   
   
But where could we bind the silo information into urls globally?
   
   
Mounting pages? Or better having some kind of configuration class
 that
   you
use to mount the pages and do the ugly URL plumbing on that method?
   
Best,
   
Ernesto
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

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




Re: Setup for stepping into wicket source in eclipse

2009-10-29 Thread Jim Pinkham
You may also want to check out JadClipse - it lets you step into
de-complied-on-the-fly versions of source code from the jar/class files of
any 3rd party tool.

http://jadclipse.sourceforge.net/wiki/index.php/Main_Page

Not as good as the fully commented source of course, but often good for a
quick answer to what's going on.

-- Jim.
On Thu, Oct 29, 2009 at 12:18 AM, Flavius flav...@silverlion.com wrote:


 Nicolas, yes my build automatically is checked.

 Pedro, that fixed it!  Thank you very much!



 Pedro H. O. dos Santos wrote:
 
  Debug Configuration  your server configuration  Source tab  remove
  older
  source codes from it if there is one
 
  On Tue, Oct 27, 2009 at 10:55 AM, Nicolas Melendez 
  nmelen...@getsense.com.ar wrote:
 
  is your build automatically checked?
 
  On Mon, Oct 26, 2009 at 1:07 AM, Flavius flav...@silverlion.com
 wrote:
 
  
   I am trying to debug an issue and am trying to step into wicket
   from my project.  However, the line numbers are not matching
   up with the source I have.  I've done this several times with other
   projects and this is indicative of having the wrong version of the
   source vs. the jar file.
  
   I am using eclipse version 3.5.0.v20090611a.  I'm also using
   jdk1.6.0_14.
  
   My project is setup as a java web project and I have a webapp/
   WEB-INF/lib dir with my jars.  These include wicket-1.4.3.jar,
   wicket-extensions-1.4.3.jar, and wicket-datetime-1.4.3.jar.  If I
   remove the wicket jar, the project can no longer identify any
   of the org.apache.wicket.* imports.  This tells me that it isn't
   getting a reference to derived classes.
  
   If I then either put the wicket jar back and set the source to the
   wicket-sources.jar or simply link to the
   apache-wicket-1.4.3\src\wicket\src\main\java, I still get the same
   result.
  
   As an example, when I CTRL-click on setDefaultModelObject(), it
   takes me to Component.class line 3022.  I can see it going to
   wicket-1.4.3.jar org.apache.wicket.Component in my Package
   Explorer.  However, when I actually run the code and step into
   that method (having attached the wicket-sources.jar), the method
   setDefaultModelObject is actually on line 3031.
  
   I've gone into the wicket src dir for wicket 1.4.3 and built the
 wicket
   jar and sources and pulled them from the target dir and still get the
   same results.
  
   Can anybody offer any insight into this?
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 
 
 
 
  --
  Pedro Henrique Oliveira dos Santos
 
 

 --
 View this message in context:
 http://www.nabble.com/Setup-for-stepping-into-wicket-source-in-eclipse-tp26054432p26105471.html
 Sent from the Wicket - User 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: Highlight some words in the markup content

2009-10-19 Thread Jim Pinkham
I'd be interested to know if anyone else is using this technique for search
highlighting with a DataTable.

http://pastebin.com/m5446797d

The data in my grid may contain HTML, so that makes it considerably more
complicated (my first attempt didn't address this problem).  I'd love to
know if someone else has a better/simpler way, although this does appear to
work fine, it took a day to come up with.

In general, I kind of like the idea of separating this concern from the
model, whose purpose is just to get the data, and think of this search
highlighting as more of a decorator that applies to the entire grid rather
than any particular column, since I've got several PropertyColumn subclasses
(LinkPropertyColumn, ImagePropertyColumn, NonEscapedHTMLPropertyColumn,
...etc).

Hope this helps someone else.

Thanks,
-- Jim.

On Fri, Oct 24, 2008 at 1:06 PM, Jim Pinkham pinkh...@gmail.com wrote:

 I've got a few embellishments to that idea that others might enjoy.  These
 include the ability to use on non-string properties, and caching the last
 compiled pattern (maybe uses a bit less CPU than replaceAll each time).

 protected static class HighlightingModel extends
 LoadableDetachableModel {
 private static final long serialVersionUID = 1L;

 private transient IModel text;
 private transient IModel searchWord;
 private transient Pattern lastp;
 private transient String lastSearch;

 HighlightingModel(IModel text, IModel searchWord) {
 this.text = text;
 this.searchWord = searchWord;
 }

 @Override
 protected String load() {
 String srch = (String)searchWord.getObject();
 Object object = text.getObject();
 String txt = ;
 if (object != null) {
 IConverter converter =
 Application.get().getConverterLocator().getConverter(object.getClass());
 txt = converter.convertToString(object,
 Session.get().getLocale());
 }
 if (srch != null) {
 Pattern p = null;
 if (lastp != null  srch.equals(lastSearch) )
 p = lastp;
 else {
 try {
 p = Pattern.compile(srch,
 Pattern.CASE_INSENSITIVE);
 } catch (PatternSyntaxException e) {
 if (e.getIndex()-1) {
 srch = srch.substring(0, e.getIndex());
 try {
 p = Pattern.compile(srch,
 Pattern.CASE_INSENSITIVE);
 } catch (Exception e2) {
 srch = null;
 }
 } else
 srch = null;
 }
 }
 if (p != null) {
 Matcher m = p.matcher(txt);
 return m.replaceFirst(span
 class=\search\$0/span);
 }
 }
 return txt;
 }

 @Override
 protected void onDetach() {
 super.onDetach();
 text = null;
 searchWord = null;
 }
 }

 -- Jim Pinkham


 On Thu, Oct 16, 2008 at 3:24 PM, Thomas Singer wic...@regnis.de wrote:

 Thanks all. The first tests work fine now, still need to handle the
 ignore-case searching...

 Is there anybody else interested in this feature? Then I will try to
 prepare the IResponseFilter implementation for public viewing/integration in
 Wicket.

  as far as i know the response filter runs within the request cycle and
 request cycle has metadata facility, so


 We already make use of RequestCycle.get(), but if you don't work on Wicket
 the full day like you, then one forgets such secrets.


 --
 Cheers,
 Tom


 Igor Vaynberg wrote:

 as far as i know the response filter runs within the request cycle and
 request cycle has metadata facility, so

 -igor

 On Wed, Oct 15, 2008 at 10:07 AM, Thomas Singer wic...@regnis.de
 wrote:

  Thanks. But how the filter should know about the request which contains
 the
 information about what to highlight?

 --
 Cheers,
 Tom



 Igor Vaynberg wrote:

  iresponsefilter

 -igor

 On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer wic...@regnis.de
 wrote:

  OK, this looks trivial, but were should I place this code to replace
 all

 content, no matter whether it comes from a page template, border or
 fragment?

 --
 Cheers,
 Tom



 Martijn Dashorst wrote:

  tekst.replaceAll(searchword, span class=search + searchword +

 /span);

 label.setEscapeModelStrings(false);

 Martijn

 On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer wic...@regnis.de
 wrote:

  We are using Wicket as base for our website (www.syntevo.com). We
 have

 a
 simple search feature on the website, but want to extend it like it
 is
 known
 to work in forums: the searched words should be highlighted.

 Does someone

img tags from external src slow down my page

2009-07-02 Thread Jim Pinkham
Hi,

I have an AjaxFallbackDefaultDataTable on the main page of my Wicket
app with an image column like this:

columns.add(new ImagePropertyColumn(new ResourceModel(imageURL),
imageURL));

My item model has an imageURL string property backed by a database
column, and it pretty much works OK.

I don't need to store any images, bandwidth is low, and it's simple,
but I have seen some users enter URLs to huge TIFF images that are not
properly sized, and it makes my page display take forever.   I'd like
to try to fix or prevent this.

I had a few ideas:

1. a note on the item entry page asking users to 'please don't do that'.   :)
2. add an ImageURLValidator to check the image size somehow... hmmm...
3. find some utility to help read the image, properly size it, and
store a local copy with my own id (filesystem should work fine)
and let my model's imageURL property point to it.

I'm trying to write this so it could scale up a bit without getting
crazy - This app lists items for a charity fundraising auction event,
so access is light for several weeks, then peaks at about 300 hits per
day (I know, not much) for a few days.  But on those peak days, I'd
like it to be fast (despite the decrepit old server it's running on).

I've got about 300 items to show on a single page (users prefer a
simple scrollbar without pagination).   Also, I should mention that I
have a search form that 'decorates' the matching text as it filters
rows, and I'd like to make it fast enough to take away the search
button and just ajax refresh on keypresses.

Thanks for any suggestions, links to examples ...etc.
-- Jim.

http://firstuucolumbus.org/auction

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



Re: OT: JavaOne

2009-05-18 Thread Jim Pinkham
I'm planning to visit the Pavillion only on Tues June 2.

With economy down, management sees JavaOne as nonessential, so I'm on the
outside looking in this year.  Oh well.  More time for Yosemite and such.

Anyway, I don't have the cool wicket bling, but pick a vendor both and time,
and maybe I'll find you?
Jim Pinkham
Sr. Developer, NetJets Services, Inc
Board member First UU Church of Columbus OH

Oh, and FYI, here's the Wicket App I did:
http://firstuucolumbus.org/auction/?wicket:bookmarkablePage=:org.firstuucolumbus.auction.page.AboutPagehttp://firstuucolumbus.org/auction

I'd love to chat about how to improve it :)

(If you poke around, our main site just moved so there are several broken
links - just insert /oldsite for now)

On Mon, May 18, 2009 at 1:11 PM, Ryan wicket-us...@mandrake.us wrote:

 Are there any Wicket fans going to JavaOne this year? I'm flying in from
 Boise on June 1st and would love to meet some fellow wicketers while I'm
 there. I'll be wearing all my Wicket attire and singing the Wicket
 praise every chance I get... maybe we will see a session on wicket next
 year.

 -Ryan

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




Re: Google App Engine and Wicket

2009-05-11 Thread Jim Pinkham
I've followed with interest all the wicket on GAE threads I can, and these
all seem to address necessary minor tweaks to get it set up, but the one big
thing I haven't seen much discussion on is the BigTable storage system,
since we wouldn't be able to use MySQL.

Maybe that's the whole point for some folks looking for high scalability,
but from my perspective, I'm more interested in the idea of a free
turnkey(ish) Java hosting environment.

I'd like to be able to resell my wicket app (it's a fundraising auction
system designed for nonprofits) to lots of tiny churches or other nonprofit
organizations - they typically have no IT experience, so bypassing the
hosting concerns could be a big win.  Plus, the system would be ultra low
traffic by google standards especially (maybe 8 concurrent users tops per
org during peak demand!).

Right now it's 'incubated' as an old underpowered Windows 2000 server
running Jetty sitting in a closet at my church, where the business class ISP
licence agreement legally permits it.  Seems like quite a leap to be
considering GAE, but if it's free and folks trust the availability and I can
easily configure it for each additional client, that could work out pretty
well for me.

But of course my system is all heavily SQL oriented - seems like this would
be a pretty fundamental rewrite for me to go to BigTable, and I was
wondering if any other wicket developers were also attracted to this type of
system, for these or other reasons, or whether I should just shell out for
some shared hosting blades and go for it?

Thanks,
-- Jim
On Sun, Apr 12, 2009 at 2:15 PM, Maarten Bosteels
mbosteels@gmail.comwrote:

 Good news:
 http://groups.google.com/group/google-appengine-java/msg/f50bbb131dc524c1

 quote
 HttpSessions will work out of the box if you enable them in your
 appengine-web.xml.

 We do not guarantee that all requests for the same session go to the same
 JVM, but persistence of sessions is managed behind the scenes with the
 datastore and memcache.

 You are, of course, free to use the memcache and/or datastore API's
 directly
 if you want more control. 
 /quote

 Maarten

 On Sun, Apr 12, 2009 at 4:18 PM, Adriano dos Santos Fernandes
 adrian...@uol.com.br wrote:
  Maarten Bosteels wrote:
 
  But AFAIK GAE doesn't use/guarantee sticky sessions, so I am afraid
  you can't rely on local memory.
 
  App Engine uses multiple web servers to run your application, and
  automatically adjusts the number of servers it is using to handle
  requests reliably. A given request may be routed to any server, and it
  may not be the same server that handled a previous request from the
  same user.
 
 
 http://code.google.com/appengine/docs/java/runtime.html#Requests_and_Servlets
 
  It would be interesting to test the performance of an ISessionStore
  backed by the App Engine datastore.
 
  FYI, I've put a app. with a static variable counter (just a static, not
 in
  session). And since two days there, the counter is maintained.
 
  So I guess they solution uses something like Terracotta. BTW, they web
  server is Jetty.
 
 
  Adriano
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




Re: Tomcat Publishing and Hot-Swapping with Wicket (solved)

2009-05-05 Thread Jim Pinkham
I often talk to myself - sometimes it's the most intelligent conversation I
can find  (really?  so do I!)

On Tue, May 5, 2009 at 7:23 AM, nino martinez wael 
nino.martinez.w...@gmail.com wrote:

 I like these kind of monologs, I often do them myself also known as
 parrot talks :) We both need to remember not to do them too often, if
 too often then we end up in a room with soft walls :)

 regards Nino

 2009/5/4 Kaspar Fischer fisch...@inf.ethz.ch:
   I intended to post the following questions but found the answer myself,
  finally.
 
  I post it anyway in the hope that it helps others.
 
  Kaspar Fischer almost posted the following:
 
  My app takes quite some time to start up, so I don't want changes to my
  Wicket HTML or Wicket Java files to cause Tomcat to completely reload
 the
  web app. Is it (at all) possible that only the changed Wicket
  HTML/Java/.properties file get reloaded and the rest (Spring beans,
 etc.)
  stays?
 
  Yes. It is working for HTML, Java, and .properties files under Eclipse
 with
  WTP and Tomcat.
 
  I am a little confused about the terms used in this context. Here's how
 I
  see; please correct me if I am wrong.
 
  - Hotswapping means replacing a given class implementation with another
  one.
  - Publishing (as seen in the server configuration panel in Eclipse when
  clicking on a Tomcat server in the Servers view) means shutting a
 webapp
  down and restarting it, hithout actually shutting Tomcat down.
 
  I can't answer myself on this. But I guess it's more or less fine ;-)
 
  There is also an option Update context paths in the Tomcat Server
  configuration panel (under Publishing). Is it related?
 
  It is checked in my set up but I don't know whether it is related.
 
  Finally, *how* can I get Tomcat/Eclipse/Wicket to only reload Wicket
  HTML/Java/.properties files that changed? In particular, I am unsure
 whether
  I have to:
 
  - Debug instead of Run the server (i.e., click Debug in the
 Eclipse
  Servers view)?
 
  With Debug it works.
 
  - Should the server have Automatically publish when resources change
  selected (in the server's configuration panel in Eclipse)?
 
  I have this checkbox checked.
 
  - What Tomcat Context configuration must I use? I currently have
  something like:
 
 Context docBase=myproject path=/myproject reloadable=true
  source=org.eclipse.jst.j2ee.server:myproject/
 
  This works for me.
 
  - In the server's configuration panel, in tab Modules, should I check
  Auto reloading enabled?
 
  No. Otherwise Tomcat reloads the *whole* webapp.
 
  I know that Wicket must be running in development mode.
 
  I think so, too ;-)
 
  Many thanks for any pointers and sharing your settings!
 
  Kaspar, you're welcome.
 
  Kaspar
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




Re: serialVersionUID

2009-04-11 Thread Jim Pinkham
I'm suprised no one has mentioned the runtime cost of computing a default
serialversionid which is avoided if a constant is supplied.   I used to make
it a habit for this reason.

This thread made me curious if that was really true, so I googled a bit and
found this 
articlehttp://www.javaworld.com/javaworld/javaqa/2003-06/02-qa-0627-mythser.htmlwhich
found no such benefit, and suggests we needn't bother.  I think I'll
turn off the Eclipse warning instead.

-- Jim.

On Sat, Apr 11, 2009 at 10:50 PM, John Krasnay j...@krasnay.ca wrote:

 On Sat, Apr 11, 2009 at 05:32:51PM -0400, Ben Tilford wrote:
  The purpose of the *public* static final long serialVersionUID is for
 long
  term storage or situations where you may potentially have made
 modifications
  to the class that make it incompatible with previous versions
 (distributed
  apps/clustering).

 It only prevents trivial changes (e.g. adding a public method) from
 breaking your serialization compatibility. You can still break the
 compatibility even with a serialVersionUID, e.g. by renaming a field.
 Besides, Wicket page maps are neither long-term storage nor remotely
 communicated, so I don't really see the point of putting in the effort.

  I'd say that its easier to just add it in case you ever
  need it, its only 1 line of code.

 Given Wicket's reliance on component inheritance, adding
 serialVersionUID in every place Eclipse complains about it would amount
 to hundreds of lines of code on my projects. Java code has enough noise
 already.

 jk

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




Re: Can client cache pages effectively?

2009-04-09 Thread Jim Pinkham
A quick follow up in case anyone else was curious about how this is going:

I ended up using ehcache page cache filter for a simple page that just
displays 'current' items (calendar view of events) based on a db query.  No
forms (state) on this page so it works pretty well.  In my DAO that does
updates, I clear the cache.  Very simple, works great.  (Only catch I ran
into is that my menus change when I have a session and I'm logged in as
super-user, so I have to make sure I don't let that version of the page be
cached - I do that by adding 'super' page parameter so URL is different
and filter is set to only cache the 'normal' version.

So, that still leaves me with my main catalog page, which is primarily a
similar list of items, but it also has some active content (in particular, a
search form).

So my bright idea (tm)  (i.e. I'd love to hear critiques before I get too
far along with it) is the following:

Make a new page for just the data grid, with page parameters including the
search string and last-modified date (and super-user login because I get
some edit links and such with that).  Mount it and ehcache it, and override
setHeader so it becomes client cache-able.   Then, my outer catalog page
with the search form on it just uses an IFrame to display the grid data
(easy to keep track of last-modified globally).  Same clear method in DAO
dumps the cache whenever a change is made.

Also, I'd want to make a robot no-follow thing to avoid google trap on that
page.  Could this actually be a legitimate use of otherwise dodgy IFRAME ?

Sound like a good plan?

Thanks,
-- Jim.

On Fri, Mar 27, 2009 at 1:56 PM, Jim Pinkham pinkh...@gmail.com wrote:

 Jeremy,

 Thanks for your thoughtful reply - Scenario is exactly right.
 I played around with page headers to make the whole page cacheable, but ran
 into several problems - I have a search form, and there's an 'admin' login
 that enables edit links.  So it's really a stateful page, but I want to
 speed up the most common state.

 The bulk of the content is from an AjaxFallbackDefaultDataTable with
 sortable columns. I re-sorted a column with the Ajax Debug window open to
 measure it's data size - about 225000 chars.  My database search takes
 64ms.  Overall client repaint time is about 2 sec with browser on
 localhost.  I haven't found the right hook to measure total wicket response
 time yet, but it appears pretty quick - so that's why I thougth it made
 sense to focus on client caching.

 Before I give up entirely on this idea, I'm wondering if it might make
 sense to make the grid a public Resource, which I'm hoping the browser would
 treat like an image.  I can afford a separate db query to just get my
 max(lastModified), which might let me save the time to generate HTML, which
 looks as though it could be my bottleneck.  If this way is too hard, I'll
 give up, but it sounds do-able - what do you think?
 Thanks,
 -- Jim.


 On Thu, Mar 26, 2009 at 6:30 PM, Jeremy Thomerson 
 jer...@wickettraining.com wrote:

 How is this going to help you?  Scenario as I understand it:


   1. User requests homepage - pulls from site - with your etag in it
   2. User requests homepage again - calls site - your server does all of
   the loading of data - then you calculate / set etag
   3. Browser now knows that it is the same as before and does not have to
   pull the HTML down

 The user saves what is likely a very short time in the overall scheme of
 things - downloading the HTML.
 The user still has to sit through the process of you loading the data from
 the search / DB / etc. and generating HTML
 Your server saves no load - but a little bandwidth.

 I'd look at caching before it even gets to your server.  Otherwise your
 user
 will likely not see much benefit unless you are sending multiple MB of
 data
 back.  Sounds like premature optimization to me.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



  On Thu, Mar 26, 2009 at 5:26 PM, Jim Pinkham pinkh...@gmail.com wrote:

  Thanks Jerry; I think that applies only to static pages.
 
  My next idea is to try overridding WebPage.setHeaders and just set the
 
  response.setHeader(Cache-Control, max-age=3600, must-revalidate);
 
  response.setHeader(ETag, 1);  // I'll use a checksum on the data
 coming
  back from my search (Even better would be a checksum on the rendered
 page
  data - any idea how to do that?)
  Initial test (above) seems promising...
 
  Thanks,
  -- Jim.
 
  On Thu, Mar 26, 2009 at 3:22 PM, Jeremy Thomerson 
  jer...@wickettraining.com
   wrote:
 
   Have you looked at a standard HTTP caching proxy like
   http://www.squid-cache.org/ ?
  
  
   --
   Jeremy Thomerson
   http://www.wickettraining.com
  
  
  
   On Thu, Mar 26, 2009 at 2:02 PM, Jim Pinkham pinkh...@gmail.com
 wrote:
  
Changing my search query to this got some better hits:
http://lmgtfy.com/?q=cacheability
So, allow me to refine my question based on that - has anyone tried
  some
   of
these approaches (see first

Re: How To Download Excel File?

2009-03-31 Thread Jim Pinkham
Another way I'm using is like this (it works best if your clients have excel
installed of course)

Markup:  http://pastebin.com/m41ee5cbe

Java:  http://pastebin.com/m488291d4

With the most important bits being:

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

getRequestCycle().getResponse().setContentType(application/x-msexcel);
}

and then a simple DataView with something like this:
...
head
  titleExcel Download/title
  meta http-equiv=Content-Type content=application/x-msexcel
  meta http-equiv=Content-disposition: attachment;
filename=whatever_default_filename.xls
/head
body
table
tr
thName/th
... more ...
/tr
tr wicket:id=rows
td wicket:id=namenbsp;/td

That makes most browsers open a dialog box where the user can open (usually
in excel) or save the html - no binary conversion to excel's file format is
really needed - excel can read HTML just fine.  So if you are just doing a
simple tabular report like I'm doing here, this could be a good option for
you.

-- Jim Pinkham

On Tue, Mar 31, 2009 at 12:58 PM, Luther Baker lutherba...@gmail.comwrote:

 These responses were great! I learned something from almost each variant of
 the answer.

 For what its worth, depending on how the app will be used - one might need
 to be careful about writing files to the filesystem ... but again, thanks
 for all the great examples listed here.

 -Luther



 On Tue, Mar 31, 2009 at 10:11 AM, francisco treacy 
 francisco.tre...@gmail.com wrote:

  hola wadi
 
  to generate the excel file, have a look at the poi apache project:
  http://poi.apache.org/spreadsheet/index.html
 
  then you will need to create a resource for that file / byte array.
  you might find some inspiration from this pastie:
  http://paste.pocoo.org/show/110449/
 
  finally, use
 
  new ResourceLinkVoid(downloadAsExcel, new PdfResource() {
 
   (...)
 
  }
 
  declare the link on your html and you're done!
 
  francisco
 
 
  2009/3/31 Wadi Jalil Maluf wad...@yahoo.com.ar:
   Hi All, I would like to know how can I put a link into a page so when
 the
   user clicks I fetch some data from database , export it to Excel so the
  user
   directly downloads an xls file with the content.
  
   Any help is appreciated,
  
   Thanks in advance,
  
   Wadi
  
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: Can client cache pages effectively?

2009-03-27 Thread Jim Pinkham
Jeremy,

Thanks for your thoughtful reply - Scenario is exactly right.
I played around with page headers to make the whole page cacheable, but ran
into several problems - I have a search form, and there's an 'admin' login
that enables edit links.  So it's really a stateful page, but I want to
speed up the most common state.

The bulk of the content is from an AjaxFallbackDefaultDataTable with
sortable columns. I re-sorted a column with the Ajax Debug window open to
measure it's data size - about 225000 chars.  My database search takes
64ms.  Overall client repaint time is about 2 sec with browser on
localhost.  I haven't found the right hook to measure total wicket response
time yet, but it appears pretty quick - so that's why I thougth it made
sense to focus on client caching.

Before I give up entirely on this idea, I'm wondering if it might make sense
to make the grid a public Resource, which I'm hoping the browser would treat
like an image.  I can afford a separate db query to just get my
max(lastModified), which might let me save the time to generate HTML, which
looks as though it could be my bottleneck.  If this way is too hard, I'll
give up, but it sounds do-able - what do you think?
Thanks,
-- Jim.


On Thu, Mar 26, 2009 at 6:30 PM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 How is this going to help you?  Scenario as I understand it:


   1. User requests homepage - pulls from site - with your etag in it
   2. User requests homepage again - calls site - your server does all of
   the loading of data - then you calculate / set etag
   3. Browser now knows that it is the same as before and does not have to
   pull the HTML down

 The user saves what is likely a very short time in the overall scheme of
 things - downloading the HTML.
 The user still has to sit through the process of you loading the data from
 the search / DB / etc. and generating HTML
 Your server saves no load - but a little bandwidth.

 I'd look at caching before it even gets to your server.  Otherwise your
 user
 will likely not see much benefit unless you are sending multiple MB of data
 back.  Sounds like premature optimization to me.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



  On Thu, Mar 26, 2009 at 5:26 PM, Jim Pinkham pinkh...@gmail.com wrote:

  Thanks Jerry; I think that applies only to static pages.
 
  My next idea is to try overridding WebPage.setHeaders and just set the
 
  response.setHeader(Cache-Control, max-age=3600, must-revalidate);
 
  response.setHeader(ETag, 1);  // I'll use a checksum on the data
 coming
  back from my search (Even better would be a checksum on the rendered page
  data - any idea how to do that?)
  Initial test (above) seems promising...
 
  Thanks,
  -- Jim.
 
  On Thu, Mar 26, 2009 at 3:22 PM, Jeremy Thomerson 
  jer...@wickettraining.com
   wrote:
 
   Have you looked at a standard HTTP caching proxy like
   http://www.squid-cache.org/ ?
  
  
   --
   Jeremy Thomerson
   http://www.wickettraining.com
  
  
  
   On Thu, Mar 26, 2009 at 2:02 PM, Jim Pinkham pinkh...@gmail.com
 wrote:
  
Changing my search query to this got some better hits:
http://lmgtfy.com/?q=cacheability
So, allow me to refine my question based on that - has anyone tried
  some
   of
these approaches (see first result from above) to generrate and dump
content
to a static file (renamed if it chages) and having the wicket home
 page
   be
a
redirect to that file, or something like that?
   
Thanks,
-- Jim.
On Thu, Mar 26, 2009 at 12:53 PM, Jim Pinkham pinkh...@gmail.com
   wrote:
   
 I've found a few posts about how to mark dynamic pages so they
 won't
  be
 cached.

 I've got a different situation that I think is fairly common - the
   'home'
 page of my app is effectively a (cheesr-like) catalog of items that
changes
 infrequently.   Users didn't like paging, so it's about 300 items
 in
  a
 simple scrollable page.  Once a user views it, they often drill
 down
   into
an
 item, then use the back button (or sometimes the Home link) to
   re-display
 it.

 The db query is actually pretty fast; I think the bottleneck seems
 to
   be
 fetching the HTML.

 My question is, can I use some kind of header caching hint with a
   version
 number so that once the content is identified as being the same as
 a
 previously fetched page, the user's browser will repaint it from a
   local
 cache?  (I know this is typically done with images, but I was
  wondering
if
 this would make sense to do also do with content that technically
'dynamic'
 but actually is 'fairly static' ?   (I say version number rather
 than
time
 to expire so that in case I add/change an item I can increment the
catalog
 version)

 Thanks,
 -- Jim

   
  
 



Can client cache pages effectively?

2009-03-26 Thread Jim Pinkham
I've found a few posts about how to mark dynamic pages so they won't be
cached.

I've got a different situation that I think is fairly common - the 'home'
page of my app is effectively a (cheesr-like) catalog of items that changes
infrequently.   Users didn't like paging, so it's about 300 items in a
simple scrollable page.  Once a user views it, they often drill down into an
item, then use the back button (or sometimes the Home link) to re-display
it.

The db query is actually pretty fast; I think the bottleneck seems to be
fetching the HTML.

My question is, can I use some kind of header caching hint with a version
number so that once the content is identified as being the same as a
previously fetched page, the user's browser will repaint it from a local
cache?  (I know this is typically done with images, but I was wondering if
this would make sense to do also do with content that technically 'dynamic'
but actually is 'fairly static' ?   (I say version number rather than time
to expire so that in case I add/change an item I can increment the catalog
version)

Thanks,
-- Jim


Re: Can client cache pages effectively?

2009-03-26 Thread Jim Pinkham
Changing my search query to this got some better hits:
http://lmgtfy.com/?q=cacheability
So, allow me to refine my question based on that - has anyone tried some of
these approaches (see first result from above) to generrate and dump content
to a static file (renamed if it chages) and having the wicket home page be a
redirect to that file, or something like that?

Thanks,
-- Jim.
On Thu, Mar 26, 2009 at 12:53 PM, Jim Pinkham pinkh...@gmail.com wrote:

 I've found a few posts about how to mark dynamic pages so they won't be
 cached.

 I've got a different situation that I think is fairly common - the 'home'
 page of my app is effectively a (cheesr-like) catalog of items that changes
 infrequently.   Users didn't like paging, so it's about 300 items in a
 simple scrollable page.  Once a user views it, they often drill down into an
 item, then use the back button (or sometimes the Home link) to re-display
 it.

 The db query is actually pretty fast; I think the bottleneck seems to be
 fetching the HTML.

 My question is, can I use some kind of header caching hint with a version
 number so that once the content is identified as being the same as a
 previously fetched page, the user's browser will repaint it from a local
 cache?  (I know this is typically done with images, but I was wondering if
 this would make sense to do also do with content that technically 'dynamic'
 but actually is 'fairly static' ?   (I say version number rather than time
 to expire so that in case I add/change an item I can increment the catalog
 version)

 Thanks,
 -- Jim



Re: Can client cache pages effectively?

2009-03-26 Thread Jim Pinkham
Thanks Jerry; I think that applies only to static pages.

My next idea is to try overridding WebPage.setHeaders and just set the

response.setHeader(Cache-Control, max-age=3600, must-revalidate);

response.setHeader(ETag, 1);  // I'll use a checksum on the data coming
back from my search (Even better would be a checksum on the rendered page
data - any idea how to do that?)
Initial test (above) seems promising...

Thanks,
-- Jim.

On Thu, Mar 26, 2009 at 3:22 PM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 Have you looked at a standard HTTP caching proxy like
 http://www.squid-cache.org/ ?


 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Thu, Mar 26, 2009 at 2:02 PM, Jim Pinkham pinkh...@gmail.com wrote:

  Changing my search query to this got some better hits:
  http://lmgtfy.com/?q=cacheability
  So, allow me to refine my question based on that - has anyone tried some
 of
  these approaches (see first result from above) to generrate and dump
  content
  to a static file (renamed if it chages) and having the wicket home page
 be
  a
  redirect to that file, or something like that?
 
  Thanks,
  -- Jim.
  On Thu, Mar 26, 2009 at 12:53 PM, Jim Pinkham pinkh...@gmail.com
 wrote:
 
   I've found a few posts about how to mark dynamic pages so they won't be
   cached.
  
   I've got a different situation that I think is fairly common - the
 'home'
   page of my app is effectively a (cheesr-like) catalog of items that
  changes
   infrequently.   Users didn't like paging, so it's about 300 items in a
   simple scrollable page.  Once a user views it, they often drill down
 into
  an
   item, then use the back button (or sometimes the Home link) to
 re-display
   it.
  
   The db query is actually pretty fast; I think the bottleneck seems to
 be
   fetching the HTML.
  
   My question is, can I use some kind of header caching hint with a
 version
   number so that once the content is identified as being the same as a
   previously fetched page, the user's browser will repaint it from a
 local
   cache?  (I know this is typically done with images, but I was wondering
  if
   this would make sense to do also do with content that technically
  'dynamic'
   but actually is 'fairly static' ?   (I say version number rather than
  time
   to expire so that in case I add/change an item I can increment the
  catalog
   version)
  
   Thanks,
   -- Jim
  
 



Re: DataView vs ListView

2009-01-07 Thread Jim Pinkham
Also, in MySQL syntax, you've got stuff like this that gets you right to the
page you want:

 sql = Select ... whatever ..;
 sql +=  limit  + query.getFrom() + ,+query.getCount();
Oracle and other variants have similar options - I agree conn pool probably
makes most difference.

-- Jim
On Wed, Jan 7, 2009 at 9:52 AM, Ames, Tim tim.a...@promedica.org wrote:

 My humble opinion is that you have to pay the price somewhere.  Either you
 are going to load all that data into memory in a List or get it from the
 database for each page.  I use JPersist to map the database to objects. I
 have found it to be quite fast.  Connection pooling helps too.

 If you have several users searching and returning large Lists in memory,
 you may not be too happy with those results either :)

 -Original Message-
 From: Dane Laverty [mailto:danelave...@chemeketa.edu]
 Sent: Tuesday, January 06, 2009 8:08 PM
 To: users@wicket.apache.org
 Subject: DataView vs ListView

 I've been trying to understand when DataView would come in handy. I have
 a SQL database table with about 1,000,000 rows. The user can enter a
 search string, and my application returns a list of all the rows that
 match the search string. This list might be over 10,000 rows.



 At first I thought this would be a perfect situation for a DataView,
 since it involves large numbers of rows, and I don't necessarily want to
 get all 10,000 rows if the user only needs to look at the first 20.
 However, I'm finding that, since DataView re-queries the database with
 each page view of the results list, any time advantage I might have
 gotten initially is quickly lost. It seems that using a
 PageableListView, I just query the database once and I'm good.



 So my question is, am I misunderstanding the purpose of the DataView?
 All of the online examples I find for DataView use Java databases rather
 than SQL relational databases. Is the DataView only useful if you
 already have some kind of a Java database to back it up? Or is there
 some way that I can take advantage of DataView in this situation without
 having to re-query the database whenever the user clicks to a different
 page of the result list?

 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

 EMAIL CONFIDENTIALITY NOTICE

 This Email message, and any attachments, may contain confidential
 patient health information that is legally protected. This information
 is intended only for the use of the individual or entity named above.
 The authorized recipient of this information is prohibited from disclosing
 this information to any other party unless required to do so by law
 or regulation and is required to destroy the information after its stated
 need has been fulfilled. If you are not the intended recipient, you are
 hereby notified that any disclosure, copying, distribution, or action
 taken in reliance on the contents of this message is strictly prohibited.

 If you have received this information in error, please notify
 the sender immediately by replying to this message and delete the
 message from your system.


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




Re: DownloadLink, BIRT report

2008-12-31 Thread Jim Pinkham
I don't know about BIRT, but I recently did an output to Excel page.  You
link to it like any other page:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html xmlns:wicket=http://wicket.apache.org/;
head
titleAuction Excel Download/title
meta http-equiv=Content-Type content=application/x-msexcel
meta http-equiv=Content-disposition: attachment; filename=catalog.xls
/head
body
table
tr wicket:id=rows
td wicket:id=idnbsp;/td
td wicket:id=member.idnbsp;/td
td wicket:id=namenbsp;/td

That meta content in the head is more for documentation - it doesn't seem to
work without the final step below:

The Java code looks something like this to populate the table:

add(new DataView(rows, new MyDataProvider()) {
public void populateItem(final Item item) {
item.setModel(new CompoundPropertyModel(new
DetachableXYZModel(item.getModelObject(;
item.add(new Label(name));

And the final magic makes it ask if you want to open it with excel:

@Override
protected void configureResponse() {
super.configureResponse();
getRequestCycle().getResponse().setContentType(application/x-msexcel);
}

That worked for me - hope it helps.  (Also note you can output a mix of
literal data and formulas)

I use web app to collect data, then word merge templates for reports.

-- Jim Pinkham
http://firstuucolumbus.org/auction

On Wed, Dec 31, 2008 at 10:22 AM, newbieabc newbie...@yahoo.com wrote:

 The generation of the excel report.
 I am really new to BIRT and wicket..
 I've created the BIRT report (report.rptdesign)(in eclipse) but need it to
 be output as xls.
 I'd really appreciate some help.
 Thank you


 reiern70 wrote:
 
  Sure you can... Which part is giving you problems? The generation of the
  excel report with BIRT? Or the creation of the link?
 
  Best,
 
  Ernesto
 
  newbieabc wrote:
  Hello..
  How can create a download link on a webpage, that converts a BIRT report
  to
  excel format and downloads to client machine?
 
  Thank you.
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 


 -- View this message in context:
 http://www.nabble.com/DownloadLink%2C-BIRT-report-tp21218997p21232850.html

 Sent from the Wicket - User 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: Round corners n' stuff? Possible Contribution?

2008-12-22 Thread Jim Pinkham
FYI - I was curious about that so I ran:

http://browsershots.org/http://www.css3.info/preview/rounded-border/

-- Jim Pinkham

On Mon, Dec 22, 2008 at 5:19 AM, Martijn Dashorst 
martijn.dasho...@gmail.com wrote:

 On Mon, Dec 22, 2008 at 11:14 AM, Steve Swinsburg
 s.swinsb...@lancaster.ac.uk wrote:
  or the simple CSS you can apply yourself.
  .roundedThing {
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  }
  however that may not be 100% across all browsers.

 Which is great: it rewards users that have up-to-date browsers that
 aren't locked in the previous century with a much prettier UI, whilst
 still having a functioning app.

 Martijn

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




Re: Howto mark a FormComponent as invalid without having a feedbackmessage?

2008-11-11 Thread Jim Pinkham
Matt,

Try using a CheckGroup

- Jim.

On Tue, Nov 11, 2008 at 5:50 AM, Matthias Keller
[EMAIL PROTECTED]wrote:

 Hi

 I'm using a custom FormValidator to validate a group of  checkboxes. I want
 to raise an error whenever none of the checkboxes is checked.
 In the effect I must have all checkboxes marked as invalid so that I can
 apply some style to them to visually display this too. Unfortunately when I
 add the error to every formcomponent concerned, I get 10 error messages with
 the same text.
 Marking a FormComponent invalid by invoking  invalid()  doesn't work too,
 as this method does NOTHING by default. The only class overriding
 onInvalid() I found was
 org.apache.wicket.extensions.markup.html.form.palette.component.Recorder
 Shouldn't  FormComponent.invalid()  also mark a component as invalid so
 that it returns  false  when asked for isValid() ?

 Is there any other method to have them marked as invalid while only getting
 that one feedback message?

 Thanks

 Matt

 --
 [EMAIL PROTECTED]  +41 44 268 83 98
 Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
 http://www.ergon.ch
 __
 e r g o nsmart people - smart software





Why don't I get onSubmit() for my form?

2008-11-11 Thread Jim Pinkham
I can't figure out why my form's onSubmit isn't firing when I click my
submit button.

Can anyone see what I've done wrong?

Here's the HTML:  http://pastebin.com/m5b1440a0

Here's Java code: http://pastebin.com/m4a217d31

At line#114, onSubmit is not being called.  I've tried lots of different
things - I've tried adding a wicket:id to make it a Link, it gets execution
flow, but without the model having been updated yet, which isn't really what
I want.   Similarly, I can make it a Button, but that also doesn't get the
onSubmit.

Any tips for me?  I feel like I'm missing something really simple...

Thanks,
-- Jim

(To see the larger app this is a part of, goto:
http://firstuucolumbus.org/auction)


Re: Why don't I get onSubmit() for my form?

2008-11-11 Thread Jim Pinkham
Thanks!

That helped me find the problem - I broke it when I added this to get $
prefix for my Double (in this app all doubles are currency) values:

converterLocator.set(Double.class, new AbstractDecimalConverter() {
private static final long serialVersionUID = 1L;

@Override
public NumberFormat getNumberFormat(Locale locale) {
return NumberFormat.getCurrencyInstance();
}
// from DoubleConverter
public Object convertToObject(final String value, Locale locale)
{
final Number number = parse(value, -Double.MAX_VALUE,
Double.MAX_VALUE, locale);
if (number == null)
return null;
return new Double(number.doubleValue());
}
@SuppressWarnings(unchecked)
protected Class getTargetType() {
return Double.class;
}
});

Seemed like a good idea, except I forgot about input!  oops!

So, I'll take away from this the lesson to always have a feedback panel
someplace on any form.

Thanks again,
-- Jim.

On Tue, Nov 11, 2008 at 2:51 PM, jWeekend [EMAIL PROTECTED]wrote:


 Jim,

 Temporarily add a FeedbackPanel to make sure you are successfully getting
 through validation.
 There's much too much irrelevant code there (to demonstrate such a
 problem),
 but I did notice, for instance, that you're using a RequiredTextField which
 means that the form must have a value for that field, otherwise the form
 processing lifecyle will be cut short - one of the consequences of failing
 validation is that onSubmit() will not get called, onError() will.

 Regards - Cemal
 http://www.jWeekend.co.uk http://jWeekend.co.uk



 Jim Pinkham wrote:
 
  I can't figure out why my form's onSubmit isn't firing when I click my
  submit button.
 
  Can anyone see what I've done wrong?
 
  Here's the HTML:  http://pastebin.com/m5b1440a0
 
  Here's Java code: http://pastebin.com/m4a217d31
 
  At line#114, onSubmit is not being called.  I've tried lots of different
  things - I've tried adding a wicket:id to make it a Link, it gets
  execution
  flow, but without the model having been updated yet, which isn't really
  what
  I want.   Similarly, I can make it a Button, but that also doesn't get
 the
  onSubmit.
 
  Any tips for me?  I feel like I'm missing something really simple...
 
  Thanks,
  -- Jim
 
  (To see the larger app this is a part of, goto:
  http://firstuucolumbus.org/auction)
 
 

 --
 View this message in context:
 http://www.nabble.com/Why-don%27t-I-get-onSubmit%28%29-for-my-form--tp20446473p20447007.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why don't I get onSubmit() for my form?

2008-11-11 Thread Jim Pinkham
Thanks to all who helped find this - yes, it was failing to validate my
input numeric 123.45.

I came up with this fix in my application class:

protected IConverterLocator newConverterLocator() {
converterLocator.set(Double.class, new AbstractDecimalConverter() {
private static final long serialVersionUID = 1L;
IConverter delegate = DoubleConverter.INSTANCE;

@Override
public String convertToString(final Object value, Locale locale)
{
return Currency.getInstance(locale).getSymbol() +
super.convertToString(value, locale);
}
@Override
protected Class getTargetType() {
return Double.class;
}
public Object convertToObject(String value, Locale locale) {
if (value != null 
value.startsWith(Currency.getInstance(locale).getSymbol()))
value = value.substring(1);
return delegate.convertToObject(value, locale);
}
});

Thanks,
-- Jim.

On Tue, Nov 11, 2008 at 2:29 PM, Christopher Lyth 
[EMAIL PROTECTED] wrote:

 Is the onError getting called for the form?

 --
 Christopher J Lyth
 [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Basic print.css question

2008-11-06 Thread Jim Pinkham
Sorry this isn't so wicket specific, but I think I'm doing this media type
thing correctly - what am I missing?  Here's the view-source of my wicket
page:

head
  titleFirst Unitarian Universalist Church of Columbus Auction 2009/title
  link href=app.css rel=stylesheet type=text/css media=all/
  link href=print.css rel=stylesheet type=text/css media=print/
/head
body
  div id=navcontainer
h2 align=centerFirstUU Auction span wicket:id=year22009/span/h2

ul id=navlist
  wicket:link
lia href=./Home Page/a/li
lia 
href=?wicket:bookmarkablePage=:org.firstuucolumbus.auction.page.CatalogPageAuction
Catalog/a/li
lia href=CalendarPage.htmlEvent Calendar/a/li
lia 
href=?wicket:bookmarkablePage=:org.firstuucolumbus.auction.page.StatementPageMy
Statement/a/li
  /wicket:link
/ul
span class=noprint wicket:id=helloWelcome Jim Pinkham/span

yadda yadda yadda.

For some reason, when I do print-preview, I'm still seeing the ul
id=navlist element and the last line span class=noprint ... Welcome
...

app.css and print.css are in the same folder, and print.css starts with:

div#footer ul#navlist, #noprint
{
display: none;
}

All the app.css styles are applied properly, but the display:none doesn't
seem to be taking effect on the class=noprint or the ul#navlist.

Thanks,
-- Jim.


Inmethod grid with more edit controls

2008-10-02 Thread Jim Pinkham
I'm just getting started with inmethod grid and loving what it does so far.

Now I'd like some to use other input controls such as checkbox, radiobutton,
datepicker, or ChoiceList.

I see EditablePropertyColumn has newCellPanel I could override to return
Panels with various input component types in edit mode.

Before I embark on this, does anyone have other ideas about how to approach
this?

Panels could benefit from the way TextFieldPanel puts feedback into title,
which suggests to me a new class such as AbstractEditablePropertyColumn
where this could be moved.  I also notice that CheckBoxColumn has the
concern of being a row-selector that could be separated into
RowSelectingCheckBoxColumn, for example (leaving the name CheckBoxColumn
available as the obvious choice for editing any boolean column).

I also like the idea of the light-weight propertycolumn (currently newCell
just puts value into response) to use these same corresponding panels in
disabled mode - maybe for radio and checkbox render the corresponding
control markup as disabled (display-only) to retain the light-weightness but
also have a richer display.

I know that's a lot to ask, but it seems a reasonable target to aim for...
Thoughts?

Thanks,
-- Jim.


Re: Inmethod Grid with wicket 1.3

2008-10-01 Thread Jim Pinkham
Nice.

OK, now I'm getting more ideas - I added more columns, but now I'd like some
to use other input controls such as checkbox, radiobutton, datepicker, or
ChoiceList.

I see EditablePropertyColumn has newCellPanel I could override to return
Panels with various input component types in edit mode.

Before I embark on this, perhaps you have some ideas to share about this?

If there is some minor refactoring involved, I'm not afraid to jump in and
help if it also benefits others.

For example, these Panels could benefit from the way TextFieldPanel puts
feedback into title, which suggests to me a new class such as
AbstractEditablePropertyColumn where this could be moved.  I also notice
that CheckBoxColumn has the concern of being a row-selector that could be
separated into RowSelectingCheckBoxColumn, for example (leaving the name
CheckBoxColumn available as the obvious choice for editing any boolean
column).

That could be step one, then once that works, the next step could be for the
light-weight propertycolumn (currently newCell just puts value into
response) to use these same corresponding panels in disabled mode.

I know that's a lot to ask, but it seems a reasonable next level to aim
for...   Thoughts?

Thanks,
-- Jim.

On Tue, Sep 30, 2008 at 2:40 PM, Matej Knopp [EMAIL PROTECTED] wrote:

 If you don't use multiple select than you can override
 CheckBoxColumn#newHeader(String componentId) and return panel that
 displays the title you want to show.

 -Matej

 On Tue, Sep 30, 2008 at 6:11 PM, Jim Pinkham [EMAIL PROTECTED] wrote:
  Got that working.  Now, since I'm using row selection to indicate
  deletion, and since I've disabled row multiselect (so rows get deleted
  one-at-a-time), I'd like to give the checkbox column a header: new
  Model(Delete), but I don't see a way to do that.  I was able to
  override getHeaderModel, but isVisible is false in the HeadPanel.
 
  Can I visit the component by attribute name somehow to do it?
 
  Really appreciate the help - it's starting to look good.  Since I'm
  using a pageSize of 500, avoiding the page refresh allows me to have
  super-simple yet snappy interface for non web-savvy proofreaders.
 
  Thanks,
  -- Jim.
 
  On Tue, Sep 30, 2008 at 10:27 AM, Matej Knopp [EMAIL PROTECTED]
 wrote:
  If you want to save the entity, SubmitCancelColumn is indeed the right
  place. but you should be overriding the onSubmitted method. As for
  custom delete link in SubmitCancelColumn, that might be a bit
  problematic as the panel is package private.
 
  Anyway, I usually don't put the delete link in that column, it doesn't
  make much sense IMHO. WhatI do is to add CheckBoxColumn and a separate
  delete link that removes all checked items.
 
  -Matej
 
  On Tue, Sep 30, 2008 at 3:54 PM, Jim Pinkham [EMAIL PROTECTED]
 wrote:
  OK, now a question about using inmethod grid:  (I really like this
  grid, by the way - awesome work Matej!!)
 
  On a grid with some editable columns, I override setItemEdit to use
  the same grid in non-editable mode, and also to save the edits.
 
 if (enableEdits)
 columns.add(new SubmitCancelColumn(esd, new
 Model(Edit)));
 DataGrid grid = new DefaultDataGrid(grid, new
 MyDataSource(), columns) {
 @Override
 public void setItemEdit(IModel rowModel, boolean
 edit) {
 if (enableEdits) {
 super.setItemEdit(rowModel,
 edit);
 if (!edit)
 // dao save row goes
 here
 }
 }
 };
 
  I think the IDataSource is very clear, but it is for loading. For
  updating, is this appropriate, or am I overlooking a simpler/better
  way?
 
  Then, I would like to add a delete link inside the SubmitCancelColumn
  - has anyone already done that?  I'm thinking it would only be visible
  if editMode is false to share the same screen space with the ok/cancel
  icons.
 
  I suppose a blank line to add a new row at the end would be nice too,
  but I think I can figure that out myself...
 
  Thanks,
  -- Jim.
 
  On Mon, Sep 29, 2008 at 5:57 PM, Jim Pinkham [EMAIL PROTECTED]
 wrote:
  That did the trick, thanks a million!
 
  On Mon, Sep 29, 2008 at 5:20 PM, Matej Knopp [EMAIL PROTECTED]
 wrote:
  I don't think the grid snapshots in maven are recent enough. You
  should fetch it from svn and build it yourself if you want to use it.
  Also keep in mind that grid version for 1.3 is in the 1.3 branch of
  wicket stuff, not the trunk:
 
 
 http://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/branches/wicket-1.3.x/inmethod-grid/
 
  -Matej
 
  On Mon, Sep 29, 2008 at 10:21 PM, Jim Pinkham [EMAIL PROTECTED]
 wrote:
  I'd like to use inmethod grid in my charity auction project.
 
  I've got a slightly modified version of one of the grid

Re: Inmethod Grid with wicket 1.3

2008-09-30 Thread Jim Pinkham
OK, now a question about using inmethod grid:  (I really like this
grid, by the way - awesome work Matej!!)

On a grid with some editable columns, I override setItemEdit to use
the same grid in non-editable mode, and also to save the edits.

if (enableEdits)
columns.add(new SubmitCancelColumn(esd, new 
Model(Edit)));
DataGrid grid = new DefaultDataGrid(grid, new 
MyDataSource(), columns) {
@Override
public void setItemEdit(IModel rowModel, boolean edit) {
if (enableEdits) {
super.setItemEdit(rowModel, edit);
if (!edit)
// dao save row goes here
}
}
};

I think the IDataSource is very clear, but it is for loading. For
updating, is this appropriate, or am I overlooking a simpler/better
way?

Then, I would like to add a delete link inside the SubmitCancelColumn
- has anyone already done that?  I'm thinking it would only be visible
if editMode is false to share the same screen space with the ok/cancel
icons.

I suppose a blank line to add a new row at the end would be nice too,
but I think I can figure that out myself...

Thanks,
-- Jim.

On Mon, Sep 29, 2008 at 5:57 PM, Jim Pinkham [EMAIL PROTECTED] wrote:
 That did the trick, thanks a million!

 On Mon, Sep 29, 2008 at 5:20 PM, Matej Knopp [EMAIL PROTECTED] wrote:
 I don't think the grid snapshots in maven are recent enough. You
 should fetch it from svn and build it yourself if you want to use it.
 Also keep in mind that grid version for 1.3 is in the 1.3 branch of
 wicket stuff, not the trunk:

 http://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/branches/wicket-1.3.x/inmethod-grid/

 -Matej

 On Mon, Sep 29, 2008 at 10:21 PM, Jim Pinkham [EMAIL PROTECTED] wrote:
 I'd like to use inmethod grid in my charity auction project.

 I've got a slightly modified version of one of the grid-examples using
 DataGrid like so:

DataGrid grid = new DefaultDataGrid(grid,

 AuctionApplication.get().getDao().getItems(getYear()),   // returns
 IDataSource
Arrays.asList(new IGridColumn[] {
new PropertyColumn(new ResourceModel(id), id),
new PropertyColumn(new ResourceModel(name), 
 name),
// I'll try editable columns here once I get
 basic display working...
new SubmitCancelColumn(esd, new Model(Edit)),
}));
add(new Form(form).add(grid));

 I'm getting this error at runtime I don't understand:

 NoSuchMethodError: org.apache.wicket.MetaDataKey: method init()V not found
at com.inmethod.grid.common.AbstractGrid$4.init(AbstractGrid.java:908)
at com.inmethod.grid.common.AbstractGrid.clinit(AbstractGrid.java:907)
at org.firstuucolumbus.CatalogPage.init(CatalogPage.java:43)

 Unfortunately, I'm a total Maven newbie, so I'm guessing something
 must be amiss in pom.xml (below)

 or the way I'm using it:  mvn clean install eclipse:clean eclipse:eclipse

 (Then I usually run Start from Eclipse)

 Would someone wiser in the ways of inmethod and/or Maven care to give
 me a hand here?

 Any help much appreciated.

 Thanks,
 -- Jim.

 project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
 http://maven.apache.org/maven-v4_0_0.xsd;

modelVersion4.0.0/modelVersion
groupIdorg.firstuucolumbus/groupId
artifactIdauction/artifactId
packagingwar/packaging
version1.0-SNAPSHOT/version
!-- TODO project name  --
nameauction/name
description/description

licenses
license
nameThe Apache Software License, Version 2.0/name

 urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url
distributionrepo/distribution
/license
/licenses

dependencies
!--  WICKET DEPENDENCIES --
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version${wicket.version}/version
/dependency

!-- LOGGING DEPENDENCIES - LOG4J --
dependency
groupIdorg.slf4j/groupId
artifactIdslf4j-log4j12/artifactId
version${slf4j.version

Inmethod Grid with wicket 1.3

2008-09-29 Thread Jim Pinkham
I'd like to use inmethod grid in my charity auction project.

I've got a slightly modified version of one of the grid-examples using
DataGrid like so:

DataGrid grid = new DefaultDataGrid(grid,
AuctionApplication.get().getDao().getItems(getYear()),  
 // returns
IDataSource
Arrays.asList(new IGridColumn[] {
new PropertyColumn(new ResourceModel(id), id),
new PropertyColumn(new ResourceModel(name), name),
// I'll try editable columns here once I get
basic display working...
new SubmitCancelColumn(esd, new Model(Edit)),
}));
add(new Form(form).add(grid));

I'm getting this error at runtime I don't understand:

NoSuchMethodError: org.apache.wicket.MetaDataKey: method init()V not found
at com.inmethod.grid.common.AbstractGrid$4.init(AbstractGrid.java:908)
at com.inmethod.grid.common.AbstractGrid.clinit(AbstractGrid.java:907)
at org.firstuucolumbus.CatalogPage.init(CatalogPage.java:43)

Unfortunately, I'm a total Maven newbie, so I'm guessing something
must be amiss in pom.xml (below)

or the way I'm using it:  mvn clean install eclipse:clean eclipse:eclipse

(Then I usually run Start from Eclipse)

Would someone wiser in the ways of inmethod and/or Maven care to give
me a hand here?

Any help much appreciated.

Thanks,
-- Jim.

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;

modelVersion4.0.0/modelVersion
groupIdorg.firstuucolumbus/groupId
artifactIdauction/artifactId
packagingwar/packaging
version1.0-SNAPSHOT/version
!-- TODO project name  --
nameauction/name
description/description

licenses
license
nameThe Apache Software License, Version 2.0/name

urlhttp://www.apache.org/licenses/LICENSE-2.0.txt/url
distributionrepo/distribution
/license
/licenses

dependencies
!--  WICKET DEPENDENCIES --
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket/artifactId
version${wicket.version}/version
/dependency   
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version${wicket.version}/version
/dependency

!-- LOGGING DEPENDENCIES - LOG4J --
dependency
groupIdorg.slf4j/groupId
artifactIdslf4j-log4j12/artifactId
version${slf4j.version}/version
/dependency
dependency
groupIdlog4j/groupId
artifactIdlog4j/artifactId
version${log4j.version}/version
/dependency

!--  JUNIT DEPENDENCY FOR TESTING --
 dependency
 groupIdjunit/groupId
 artifactIdjunit/artifactId
 version3.8.2/version
 scopetest/scope
 /dependency

!--  JETTY DEPENDENCIES FOR TESTING  --
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty-util/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty-management/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty-plus/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty-naming/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency