Re: OnChangeAjaxBehavior: nth character

2010-02-13 Thread Cemal Bayramoglu
Steven,

Start with something like this:

zipcodeField.add(new OnChangeAjaxBehavior() {
@Override protected void onUpdate(AjaxRequestTarget target) {
// do your stuff here
}
@Override protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() {
@Override public CharSequence decorateScript(CharSequence script) {
return if(this.value.length % 5 == 0){ + script + };
}
};
}
});

Regards - Cemal
jWeekend
OO  Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com


On 12 February 2010 20:45, Steven Haines lyg...@yahoo.com wrote:
 Hi,

 I
 would like to add AJAX behavior to an application that sends an update
 to my application after a certain number of characters have been typed.
 For example, if the user is entering a zipcode, I would like a callback
 to my application to be made after the user enters the fifth character.

 I've
 written code using OnChangeAjaxBehavior that sends messages back to my
 application after every character has been typed, such as the following:

    final TextFieldString zipcodeField = new TextFieldString( zipcode );
    form.add( zipcodeField.setRequired( true ) );
    OnChangeAjaxBehavior zipcodeUpdated = new OnChangeAjaxBehavior() {
     �...@override
      protected void onUpdate( AjaxRequestTarget target ) {
        System.out.println( Zipcode value:  + 
 zipcodeField.getDefaultModelObjectAsString() );
      }
    };
    zipcodeField.add( zipcodeUpdated );


 I
 could check to see the size of the zipcodeField (in this example), but
 it makes my application more chatty than it needs to be. I also tried
 using onblur, which works fine, but does not satisfy my business
 requirements:

  final TextFieldString zipcodeField = new TextFieldString( zipcode );
  form.add( zipcodeField.setRequired( true ) );

  AjaxFormComponentUpdatingBehavior zipcodeOnBlur = new 
 AjaxFormComponentUpdatingBehavior( onblur ) {
     �...@override
      protected void onUpdate( AjaxRequestTarget target ) {
          System.out.println( Zipcode value (form component):  + 
 getFormComponent().getModelObject() );
      }
  };
  zipcodeField.add( zipcodeOnBlur );



 Prior
 to using Wicket (which I'm currently prototyping for my company), we
 would handle this logic in JavaScript (observe changes to the field and
 when the user enters the fifth character then we made an AJAX call back
 our Struts 2 application.)

 What is the best way to achieve the same end using Wicket?

 Thanks, in advance, for your help!
 Steve

 P.S.
 I started using Wicket as part of an article series (because of all of
 your passion for it) and I have to say all of you are doing incredible
 work - I love it.. Here's the link to the article series in case any of
 you are interested:
 http://www.informit.com/guides/content.aspx?g=javaseqNum=529

 -
 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



Proposal for a general solution to integrate a javascript-api

2010-02-13 Thread Fridolin Jackstadt
Looking for a smart way to integrate wicket with extjs
(http://www.extjs.com) i wrote a small piece of code, that can be used
to generate javascript function-calls.

The idea is to rewrite the public api of the javascript library in
java. Everytime you call one of these java-functions a equivalent
javascript function-call will be generated and automaticalliy (can be
done with a proxy or annotations+aspects) written into the
(ajax)responsetarget.

There is a small 14kb maven eclipse project attached with a proof of
concept for this idea.

http://rapidshare.com/files/350028986/WicketAjaxRpc.zip

For the Ext-JS integration some feedback would be very useful, and i
am planning to make it public if you support this proposal.

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



best way to detect session termination

2010-02-13 Thread Andreas Lüdtke
I would like to detect the termination of the session to set the
lastAccesTime in the user profile. This should also happen if the session
times out.

I read in archive about a HttpSessionListener that should do the trick.
Unfortunately I can't find a place to install it.

Thanks

Andreas


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



Re: OnChangeAjaxBehavior: nth character

2010-02-13 Thread Riyad Kalla
Cemal, very intuitive -- thanks for that.

On Sat, Feb 13, 2010 at 6:26 AM, Cemal Bayramoglu 
jweekend_for...@cabouge.com wrote:

 Steven,

 Start with something like this:

 zipcodeField.add(new OnChangeAjaxBehavior() {
 @Override protected void onUpdate(AjaxRequestTarget target) {
 // do your stuff here
}
@Override protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() {
@Override public CharSequence decorateScript(CharSequence
 script) {
return if(this.value.length % 5 == 0){ + script + };
}
};
}
 });

 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket
 Consulting, Development, Training
 http://jWeekend.com


 On 12 February 2010 20:45, Steven Haines lyg...@yahoo.com wrote:
  Hi,
 
  I
  would like to add AJAX behavior to an application that sends an update
  to my application after a certain number of characters have been typed.
  For example, if the user is entering a zipcode, I would like a callback
  to my application to be made after the user enters the fifth character.
 
  I've
  written code using OnChangeAjaxBehavior that sends messages back to my
  application after every character has been typed, such as the following:
 
 final TextFieldString zipcodeField = new TextFieldString(
 zipcode );
 form.add( zipcodeField.setRequired( true ) );
 OnChangeAjaxBehavior zipcodeUpdated = new OnChangeAjaxBehavior() {
   @Override
   protected void onUpdate( AjaxRequestTarget target ) {
 System.out.println( Zipcode value:  +
 zipcodeField.getDefaultModelObjectAsString() );
   }
 };
 zipcodeField.add( zipcodeUpdated );
 
 
  I
  could check to see the size of the zipcodeField (in this example), but
  it makes my application more chatty than it needs to be. I also tried
  using onblur, which works fine, but does not satisfy my business
  requirements:
 
   final TextFieldString zipcodeField = new TextFieldString( zipcode
 );
   form.add( zipcodeField.setRequired( true ) );
 
   AjaxFormComponentUpdatingBehavior zipcodeOnBlur = new
 AjaxFormComponentUpdatingBehavior( onblur ) {
   @Override
   protected void onUpdate( AjaxRequestTarget target ) {
   System.out.println( Zipcode value (form component):  +
 getFormComponent().getModelObject() );
   }
   };
   zipcodeField.add( zipcodeOnBlur );
 
 
 
  Prior
  to using Wicket (which I'm currently prototyping for my company), we
  would handle this logic in JavaScript (observe changes to the field and
  when the user enters the fifth character then we made an AJAX call back
  our Struts 2 application.)
 
  What is the best way to achieve the same end using Wicket?
 
  Thanks, in advance, for your help!
  Steve
 
  P.S.
  I started using Wicket as part of an article series (because of all of
  your passion for it) and I have to say all of you are doing incredible
  work - I love it.. Here's the link to the article series in case any of
  you are interested:
  http://www.informit.com/guides/content.aspx?g=javaseqNum=529
 
  -
  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: best way to detect session termination

2010-02-13 Thread Eelco Hillenius
http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7

Eelco

On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke sam.lued...@t-online.de wrote:
 I would like to detect the termination of the session to set the
 lastAccesTime in the user profile. This should also happen if the session
 times out.

 I read in archive about a HttpSessionListener that should do the trick.
 Unfortunately I can't find a place to install it.

 Thanks

 Andreas


 -
 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: BookmarkablePage with PageParameters

2010-02-13 Thread Pierre Goupil
Mmmh great! I'll give this a try on Monday.

Cheers,

Pierre


On Fri, Feb 12, 2010 at 6:42 PM, vineet semwal
vineetsemwal1...@gmail.comwrote:

 take a look at querystringurlcodingstrategy,mixedparamurlcodingstategy
 ,mixedparamhybridurlcodingstategy,
 and use what suits you .


 Good evening,
 
  I have a BookmarkablePage which may need PageParameters or not, depending
  on
  the business workflow. I used to mount it under /page but now that we do
  use
  the PageParameters-providing constructor I have a problem which forced me
  not to mount the page in my Application class anymore.
 
  When I mounted the page explicitly, the PageParameters constructor call
  used
  to gave such an URL: /page/param/0. So when asking for a resource on that
  page, it gave me this error message: URL fragment has unmatched
  key/valuepairs, responding with 404.
 
  If I don't mount the page, the URL generated is of the form:
  /bookmarkablePage?class=fooparam=0. Which is good regarding the
 parameter
  retrieval.
 
  My question is: is there any way to have the best of both world, I mean
  such
  a pretty URL as /page (no Java class name in the URL) and the parameters
  using the classical '?' and '' symbols? Which would give this URL:
  /page?param=0. I guess that if I don't have any trailing slashes in the
  URL,
  the URL fragment message should be avoided, isn't it?
 
  Thanks in advance and regards,
 
  Pierre
 
 
  --
  Les deux règles universelles du bide :
 
  1) on n'explique pas un bide
 
  2) dans le futur, un bide sera toujours un bide.
 



 --
 regards,
 Vineet Semwal




-- 
Les deux règles universelles du bide :

1) on n'explique pas un bide

2) dans le futur, un bide sera toujours un bide.


Re: Slides of Wicket and Struts 2

2010-02-13 Thread César Alberto Barrera
Ohh Thank You!

I will take some ideas to do a presentation in a wicket workshop called
Wicketing the world (Wicketiznado el mundo)

On Mon, Jan 4, 2010 at 9:17 PM, John Armstrong siber...@siberian.org wrote:
 Very good, thanks Lester (the attachment was stripped on my side,
 probably my mailserver).

 J

 On Mon, Jan 4, 2010 at 6:36 PM, Lester Chua cicowic...@gmail.com wrote:
 Hi John,

 I thought I attached the file but here goes,

 Link
 https://docs.google.com/fileview?id=0B8Wi-GkyhJ3XMDVhYzQ3YWUtNDNhMS00NzUxLTg5YzYtZmJkMTIxOTE2MGFmhl=en

 Thanks!

 John Armstrong wrote:

 Link?

 Tx!
 John-

 On Mon, Jan 4, 2010 at 5:52 PM, Lester Chua cicowic...@gmail.com wrote:


 Hi all,

 I'm attaching some slides on some thought I have gathered for a
 presentation
 to management for Wicket justification.
 Was wondering if any of you have time to read it and comment on it =).

 Lester




 -
 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



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





-- 
César Alberto Barrera  abarrera at gmail dot com

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



Re: OnChangeAjaxBehavior: nth character

2010-02-13 Thread Steven Haines
Thanks so much, I appreciate all of your collective help. This list is a 
testimony to the passion I spoke of about the Wicket community - you guys rock!

Steve



- Original Message 
From: Cemal Bayramoglu jweekend_for...@cabouge.com
To: users@wicket.apache.org
Sent: Sat, February 13, 2010 8:26:37 AM
Subject: Re: OnChangeAjaxBehavior: nth character

Steven,

Start with something like this:

zipcodeField.add(new OnChangeAjaxBehavior() {
@Override protected void onUpdate(AjaxRequestTarget target) {
// do your stuff here
}
@Override protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() {
@Override public CharSequence decorateScript(CharSequence script) {
return if(this.value.length % 5 == 0){ + script + };
}
};
}
});

Regards - Cemal
jWeekend
OO  Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com


On 12 February 2010 20:45, Steven Haines lyg...@yahoo.com wrote:
 Hi,

 I
 would like to add AJAX behavior to an application that sends an update
 to my application after a certain number of characters have been typed.
 For example, if the user is entering a zipcode, I would like a callback
 to my application to be made after the user enters the fifth character.

 I've
 written code using OnChangeAjaxBehavior that sends messages back to my
 application after every character has been typed, such as the following:

final TextFieldString zipcodeField = new TextFieldString( zipcode );
form.add( zipcodeField.setRequired( true ) );
OnChangeAjaxBehavior zipcodeUpdated = new OnChangeAjaxBehavior() {
  @Override
  protected void onUpdate( AjaxRequestTarget target ) {
System.out.println( Zipcode value:  + 
 zipcodeField.getDefaultModelObjectAsString() );
  }
};
zipcodeField.add( zipcodeUpdated );


 I
 could check to see the size of the zipcodeField (in this example), but
 it makes my application more chatty than it needs to be. I also tried
 using onblur, which works fine, but does not satisfy my business
 requirements:

  final TextFieldString zipcodeField = new TextFieldString( zipcode );
  form.add( zipcodeField.setRequired( true ) );

  AjaxFormComponentUpdatingBehavior zipcodeOnBlur = new 
 AjaxFormComponentUpdatingBehavior( onblur ) {
  @Override
  protected void onUpdate( AjaxRequestTarget target ) {
  System.out.println( Zipcode value (form component):  + 
 getFormComponent().getModelObject() );
  }
  };
  zipcodeField.add( zipcodeOnBlur );



 Prior
 to using Wicket (which I'm currently prototyping for my company), we
 would handle this logic in JavaScript (observe changes to the field and
 when the user enters the fifth character then we made an AJAX call back
 our Struts 2 application.)

 What is the best way to achieve the same end using Wicket?

 Thanks, in advance, for your help!
 Steve

 P.S.
 I started using Wicket as part of an article series (because of all of
 your passion for it) and I have to say all of you are doing incredible
 work - I love it.. Here's the link to the article series in case any of
 you are interested:
 http://www.informit.com/guides/content.aspx?g=javaseqNum=529

 -
 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



How to hide / show additional descriptive Row below empty DataView?

2010-02-13 Thread bht
Hi all,

How is it possible to dynamically show and hide an additional dummy
row No items to show below a DataView?

I tried this with code similar to code below but it does not work even
though isVisible() is called. I have a small testcase ready to go.
It's quite basic so I must be missing something obvious.

Many thanks

Bernard


In a DataView, with an AjaxFallbackLink delete action, in onClick I do
something like

item.setVisible(false);
target.addComponent(item);
target.addComponent(emptyRow);

with emptyRow as follows:

final WebMarkupContainer emptyRow = new
WebMarkupContainer(emptyRow){
@Override
public boolean isVisible(){
return rowProvider.size() == 0;
}
};
emptyRow.setOutputMarkupId(true);
add(emptyRow);

In HTML:

tr wicket:id=dataRow
td wicket:id=IdID/td
tda wicket:id=deleteDelete/a/td
/tr
tr wicket:id=emptyRow
td colspan=2No Items to show/td
/tr


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



AjaxPagingNavigator and mounted pages produces incorrect links

2010-02-13 Thread Ryan
I just filed bug: https://issues.apache.org/jira/browse/WICKET-2743

I have a 2 mounted pages, one mounted at home and one mounted at
page2. When clicking a BookmarkablePageLink for home the browser is
sent to the correct page. The home page then uses a DataView to create
many panels with BookmarkablePageLinks to page2. If you paginate using
AjaxPagingNavigator the links in the panels incorrectly point to
/home/test/foo/page2. Where test/foo was a pageparameter sent to the
page. 

It could be user error, but I think thats a pretty standard use case.
Does anyone else have errors with generated urls for mounted pages when
using ajax?

I just tested this on 1.4.5 and it works correctly.

-Ryan

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



Re: AjaxPagingNavigator and mounted pages produces incorrect links

2010-02-13 Thread vineet semwal
i think it's a issue 2717 which has been fixed,you can confirm the correct
behavior in 1.4.x.

On Sun, Feb 14, 2010 at 11:51 AM, Ryan wicket-us...@mandrake.us wrote:

 I just filed bug: https://issues.apache.org/jira/browse/WICKET-2743

 I have a 2 mounted pages, one mounted at home and one mounted at
 page2. When clicking a BookmarkablePageLink for home the browser is
 sent to the correct page. The home page then uses a DataView to create
 many panels with BookmarkablePageLinks to page2. If you paginate using
 AjaxPagingNavigator the links in the panels incorrectly point to
 /home/test/foo/page2. Where test/foo was a pageparameter sent to the
 page.

 It could be user error, but I think thats a pretty standard use case.
 Does anyone else have errors with generated urls for mounted pages when
 using ajax?

 I just tested this on 1.4.5 and it works correctly.

 -Ryan

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




-- 
regards,
Vineet Semwal


Generics for datatable columns

2010-02-13 Thread Sam Barrow
This is a stupid minor thing but I was wondering.

If I have a datatable of SubClass objects, shouldn't a I be able to add
an IColumnSuperClass to the list of columns?

Not very often used, but could be useful occasionally like for
inheritance with domain entities. Couldn't hurt to implement this right
(just add a generics wildcard)?



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



Re: How to hide / show additional descriptive Row below empty DataView?

2010-02-13 Thread vineet semwal
two suggestions,
1)emptyrow.setoutputmarkupplaceholdertag(true) instead of
setoutputmarkupid(true).
2)you can use dataview.getitemscount() instead of data.size() as later can
be expensive.

On Sun, Feb 14, 2010 at 8:11 AM, b...@actrix.gen.nz wrote:

 Hi all,

 How is it possible to dynamically show and hide an additional dummy
 row No items to show below a DataView?

 I tried this with code similar to code below but it does not work even
 though isVisible() is called. I have a small testcase ready to go.
 It's quite basic so I must be missing something obvious.

 Many thanks

 Bernard


 In a DataView, with an AjaxFallbackLink delete action, in onClick I do
 something like

 item.setVisible(false);
 target.addComponent(item);
 target.addComponent(emptyRow);

 with emptyRow as follows:

final WebMarkupContainer emptyRow = new
 WebMarkupContainer(emptyRow){
@Override
public boolean isVisible(){
return rowProvider.size() == 0;
}
};
emptyRow.setOutputMarkupId(true);
add(emptyRow);

 In HTML:

tr wicket:id=dataRow
td wicket:id=IdID/td
tda wicket:id=deleteDelete/a/td
/tr
tr wicket:id=emptyRow
td colspan=2No Items to show/td
/tr


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




-- 
regards,
Vineet Semwal