Re: backspace - when not on focus in field

2014-03-13 Thread Martin Grigorov
Hi,


On Thu, Mar 13, 2014 at 3:15 AM, nazeem md.naz...@gmail.com wrote:

 Thanks Niranjan  Swen, I managed to add this js to block backspace when
 not
 on focus on form fields. I believe this fix will not be required when we
 get
 Wicket 7 ajax history support ?


Ajax history support is not in the roadmap for Wicket 7.




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/backspace-when-not-on-focus-in-field-tp4664922p4664932.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: More Wicket JSESSION_ID Issues

2014-03-13 Thread Martin Grigorov
Hi,


On Wed, Mar 12, 2014 at 9:52 PM, Aaron J. Garcia agar...@rentec.com wrote:



 Martin Grigorov mgrigorov at apache.org writes:

 
  Hi,
 
  It sounds like an issue with the IDE.
  What is the produced url with the custom jsession id ? Does it work if
 you
  paste this url directly in the browser address bar without involving the
  IDE ?
 
  And what is the sign of my page ?
 
  Martin Grigorov
  Wicket Training and Consulting
 

 Hi Martin,

 Sorry for the delayed response.

 The URLs are identical in both cases: http://machine:8085/appName/

 Wicket turns this into: http://machine:8085/appName/app/SignInPage

 Intellij tries to open the first URL (http://machine:8085/appName/), but
 it
 fails with this error message Cannot open URL. Please check this URL is
 correct:.  When I copy and paste that same URL
 (http://machine:8085/appName/) and paste it into my browser, it works
 fine,
 and directs me to sign in page.

 (That's what I meant by sign of my page... sorry for not catching that
 sooner).

 What is interesting is that if I remove any of the JSESSIONID changes I
 made
 (or downgrade to Wicket 6.13.0), everything works fine, and Intellij opens
 up http://machine:8085/appName/ like I would expect.


There must be something that IDEA hides from you.
http://machine:8085/appName/ is a valid url. But I guess it is actually
something like http://machine:8085/appName/;myjsessionid=123456 and IDEA
thinks that ;myjsessionid=123456 is the invalid part.

Since the url loads the page in the browser then the IDE is the problem.




 -- Aaron

 P.S. I don't need an immediate solution to this, because I figured out a
 workaround yesterday.  I would like to get to the bottom of the issue
 though, as the change in behavior is surprising.


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




Re: The wicket way of getting application base URL

2014-03-13 Thread jchappelle
We just use a configuration property in our application that is stored in our
properties database table. So our solution really doesn't involve wicket
at all.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/The-wicket-way-of-getting-application-base-URL-tp4664925p4664938.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: The wicket way of getting application base URL

2014-03-13 Thread Chris Snyder
I think that such a configuration option is likely your only choice, and is
something I often see in other webapps. The only other option I can think
of would be if the proxy was passing a header with the original requested
URL. However, I don't see such functionality in mod_proxy (at least from a
quick skim of its documentation).

I can imagine a hacky way of using Javascript to pass it in. I'm only
mentioning it to dissuade you from considering it (if you were), as it
would be a huge security risk: Someone could send incorrect data to the
server, causing it to send out the wrong URLs. That would make for an
effective phishing campaign - emails from a legitimate source with links to
the cracker's server.

Best,
Chris


On Thu, Mar 13, 2014 at 9:22 AM, jchappelle jchappe...@4redi.com wrote:

 We just use a configuration property in our application that is stored in
 our
 properties database table. So our solution really doesn't involve wicket
 at all.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/The-wicket-way-of-getting-application-base-URL-tp4664925p4664938.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




-- 
Chris Snyder
Web Developer, BioLogos
biologos.org


Re: Close Browser Behavior

2014-03-13 Thread Daniela L
Hi Martin,
if found the reason why the data is not freed in onInvalidate,
the Spring/Hibernate update to the database issues a There is no
application attached to current thread
ContainerBackgroundProcessor[StandardEngine[Catalina]]. Is this a wicket
or a tomcat issue?
Best Regards
Daniela


2014-03-12 14:31 GMT+01:00 Martin Grigorov mgrigo...@apache.org:

 On Wed, Mar 12, 2014 at 3:20 PM, Daniela L danigal...@gmail.com wrote:

  Hi Martin,
  thank you very much for your quick and brilliant answer :-)
  Changing to AjaxCheckBox did the trick.
  It seems to be very difficult to provide a secure way to invalidate user
  data
  cross browser compliant. I noticed that using a tablet with android or
 IOS
  the
  beforeunload is not triggered at all. Therefor I added a cleanup method
 to
  the onInvalidate
  of my custom session which should be triggered by the tomcats
  session-timeout, but
  it seems using mobile devices onInvalidate is not triggered?
 

 onInvalidate() is called by the server when the client hasn't touched/used
 its http session for session-timeout minutes.
 It shouldn't matter whether it is a desktop or mobile client.


  Best Regards
  Daniela
 
 
  2014-03-12 13:21 GMT+01:00 Martin Grigorov mgrigo...@apache.org:
 
   Hi,
  
   On Wed, Mar 12, 2014 at 1:15 PM, Daniela L danigal...@gmail.com
 wrote:
  
Hi,
I am using a close browser behavior to clean up user data if the user
closes
the browser window. I also use a CheckBox to toggle the visibility of
   some
Textfields. Unfortunately the refresh through the click of the
 CheckBox
triggers the close browser
behavior. How can this be avoided?
Here is what I did (with wicket 6.12.0):
   
   
customerFirstName = new
  RequiredTextFieldString(customer.firstName);
customerFirstName.setOutputMarkupPlaceholderTag(true);
closeBrowserBehavior =  new AbstractDefaultAjaxBehavior() {
   @Override
protected void respond(AjaxRequestTarget target) {
   
AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent();
}
   
@Override
public void renderHead(Component component,
 IHeaderResponse
response) {
super.renderHead(component, response);
response.render(new
OnDomReadyHeaderItem(window.onbeforeunload =
function (e) {
+ if (!window.dontAsk) {
+ Wicket.Ajax.get({u:
'+getCallbackUrl()+', async: false});
+ var message = 'my message.',
+ e = e || window.event; + if (e)
 {
+ e.returnValue = message; + }} +
return message;
+
};));
}
};
customerFirstName.add(closeBrowserBehavior);
form.add(customerFirstName);
   
createAccountCB = new CheckBox(createAccountCB, new
ModelBoolean(createAccount)){
@Override
protected void onSelectionChanged(Boolean newSelection) {
super.onSelectionChanged(newSelection);
createAccount = !createAccount;
}
   
@Override
protected boolean wantOnSelectionChangedNotifications()
{
return true;
   
  
   This uses non-Ajax way to submit the new selection.
   As you noted this leads to 'beforeunload' event being fired.
  
   You will have to use AjaxCheckBox or AjaxFormComponentUpdatingBehavior
 to
   avoid the page reload.
  
  
}
};
form.add(createAccountCB);
   
emailRepeat = new TextFieldString(emailRepeat, new
PropertyModelString(appointCalendar, customer.eMailAdress)){
  @Override
protected void onConfigure(){
super.onConfigure();
setVisibilityAllowed(createAccount);
}
}
};
emailRepeat.setOutputMarkupPlaceholderTag(true);
form.add(emailRepeat):
   
Thanks a lot in advance!
Best Regards
Daniela
   
  
 



Re: Close Browser Behavior

2014-03-13 Thread Martin Grigorov
Hi,

Maybe it is a problem in your code ;-)

 pIn case of session expiration this method is called in a non-worker
thread, i.e.
 * there are no thread locals exported for the Application, RequestCycle
and Session.
 * The Session is the current instance. The Application can be found by
using
 * {@link Application#get(String)}. There is no way to get a reference to a
RequestCycle/p
 */
public void onInvalidate()
{
}

The javadoc clearly says that when this method is called by the web
container due to session expiration there are no thread locals.
The thread locals are available in #onInvalidate() only if the application
code called Session#invalidate[Now]() explicitly.

Martin Grigorov
Wicket Training and Consulting


On Thu, Mar 13, 2014 at 4:34 PM, Daniela L danigal...@gmail.com wrote:

 Hi Martin,
 if found the reason why the data is not freed in onInvalidate,
 the Spring/Hibernate update to the database issues a There is no
 application attached to current thread
 ContainerBackgroundProcessor[StandardEngine[Catalina]]. Is this a wicket
 or a tomcat issue?
 Best Regards
 Daniela


 2014-03-12 14:31 GMT+01:00 Martin Grigorov mgrigo...@apache.org:

  On Wed, Mar 12, 2014 at 3:20 PM, Daniela L danigal...@gmail.com wrote:
 
   Hi Martin,
   thank you very much for your quick and brilliant answer :-)
   Changing to AjaxCheckBox did the trick.
   It seems to be very difficult to provide a secure way to invalidate
 user
   data
   cross browser compliant. I noticed that using a tablet with android or
  IOS
   the
   beforeunload is not triggered at all. Therefor I added a cleanup method
  to
   the onInvalidate
   of my custom session which should be triggered by the tomcats
   session-timeout, but
   it seems using mobile devices onInvalidate is not triggered?
  
 
  onInvalidate() is called by the server when the client hasn't
 touched/used
  its http session for session-timeout minutes.
  It shouldn't matter whether it is a desktop or mobile client.
 
 
   Best Regards
   Daniela
  
  
   2014-03-12 13:21 GMT+01:00 Martin Grigorov mgrigo...@apache.org:
  
Hi,
   
On Wed, Mar 12, 2014 at 1:15 PM, Daniela L danigal...@gmail.com
  wrote:
   
 Hi,
 I am using a close browser behavior to clean up user data if the
 user
 closes
 the browser window. I also use a CheckBox to toggle the visibility
 of
some
 Textfields. Unfortunately the refresh through the click of the
  CheckBox
 triggers the close browser
 behavior. How can this be avoided?
 Here is what I did (with wicket 6.12.0):


 customerFirstName = new
   RequiredTextFieldString(customer.firstName);
 customerFirstName.setOutputMarkupPlaceholderTag(true);
 closeBrowserBehavior =  new AbstractDefaultAjaxBehavior() {
@Override
 protected void respond(AjaxRequestTarget target) {

 AppointmentSession.get().releaseSavedBlockedFreeCalendarEvent();
 }

 @Override
 public void renderHead(Component component,
  IHeaderResponse
 response) {
 super.renderHead(component, response);
 response.render(new

 OnDomReadyHeaderItem(window.onbeforeunload =
 function (e) {
 + if (!window.dontAsk) {
 + Wicket.Ajax.get({u:
 '+getCallbackUrl()+', async: false});
 + var message = 'my message.',
 + e = e || window.event; + if
 (e)
  {
 + e.returnValue = message; +
 }} +
 return message;
 +
 };));
 }
 };
 customerFirstName.add(closeBrowserBehavior);
 form.add(customerFirstName);

 createAccountCB = new CheckBox(createAccountCB, new
 ModelBoolean(createAccount)){
 @Override
 protected void onSelectionChanged(Boolean
 newSelection) {
 super.onSelectionChanged(newSelection);
 createAccount = !createAccount;
 }

 @Override
 protected boolean wantOnSelectionChangedNotifications()
 {
 return true;

   
This uses non-Ajax way to submit the new selection.
As you noted this leads to 'beforeunload' event being fired.
   
You will have to use AjaxCheckBox or
 AjaxFormComponentUpdatingBehavior
  to
avoid the page reload.
   
   
 }
 };
 form.add(createAccountCB);

 emailRepeat = new TextFieldString(emailRepeat, new
 PropertyModelString(appointCalendar, customer.eMailAdress)){
   @Override
 protected void onConfigure(){
 super.onConfigure();
 setVisibilityAllowed(createAccount);
 

Testing Form with AjaxSubmitLink

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


*HomePage.java:*

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

private String email;

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

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

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

*HomePage.html*

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

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

/body
/html

*Unit Test:*

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

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


Re: Testing Form with AjaxSubmitLink

2014-03-13 Thread Martin Grigorov
Hi,

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

Martin Grigorov
Wicket Training and Consulting


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

 How do you submit a form via WicketTester and an AjaxSubmitLink?


 *HomePage.java:*

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

 private String email;

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

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

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

 *HomePage.html*

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

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

 /body
 /html

 *Unit Test:*

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

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



Re: Testing Form with AjaxSubmitLink

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

N


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

 Hi,

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

 Martin Grigorov
 Wicket Training and Consulting


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

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



Re: Testing Form with AjaxSubmitLink

2014-03-13 Thread Gabriel Landon
As Martin said you can use :
tester.clickLink(form:submit, true);

You can also use :
tester.executeAjaxEvent(form:submit, onclick);

Regards,

Gabriel.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Testing-Form-with-AjaxSubmitLink-tp4664946p4664949.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Testing Form with AjaxSubmitLink

2014-03-13 Thread Martin Grigorov
There is something similar already
- org.apache.wicket.util.tester.FormTester#submitLink
But it doesn't support Ajax at the moment.

Feel free to send a PR (preferably with a test case)

Martin Grigorov
Wicket Training and Consulting


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

 Any reason that the FormTester.submit() couldn't be modified to check the
 type of the form submitter, and invoke the correct code accordingly?

 N


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

  Hi,
 
  See the javadoc of
 
 org.apache.wicket.util.tester.BaseWicketTester#clickLink(java.lang.String,
  boolean)
 
  Martin Grigorov
  Wicket Training and Consulting
 
 
  On Thu, Mar 13, 2014 at 8:06 PM, Nick Pratt nbpr...@gmail.com wrote:
 
   How do you submit a form via WicketTester and an AjaxSubmitLink?
  
  
   *HomePage.java:*
  
   public class HomePage extends WebPage
   {
private static final long serialVersionUID = 1L;
  
   private String email;
  
   public HomePage( final PageParameters parameters )
{
   super( parameters );
  
   Form form = new Form( form );
add( form );
  
   form.add( new EmailTextField( email, new PropertyModel(this,
 email) )
   );
form.add( new AjaxSubmitLink(submit)
   {
   @Override
protected void onSubmit( AjaxRequestTarget target, Form? form )
   {
   int i = 0;
}
   });
   }
   }
  
   *HomePage.html*
  
   !DOCTYPE html
   html xmlns:wicket=http://wicket.apache.org;
   body
  
   form wicket:id=form
input type=email wicket:id=email placeholder=Email
   button type=submit wicket:id=submitSign Up/button
/form
  
   /body
   /html
  
   *Unit Test:*
  
   @Test
public void testPanel() throws Exception
   {
   WicketTester tester = new WicketTester();
tester.startPage( HomePage.class );
  
   FormTester formTester = tester.newFormTester( form );
formTester.setValue( email, t...@test.com );
   formTester.submit( submit );
}
  
 



Pass exception to internal error page

2014-03-13 Thread jchappelle
I am using wicket 6.14.0.

I have a RequestCycleListener that listens for onException. I handle
PageExpiredException, UnauthorizedInstantiationException(this is custom),
and by default I redirect to a custom ErrorPage class that takes the
Exception object in the constructor. It also contains a list of ignored
exceptions that it will return null for. This custom ErrorPage actually
reports an error to our JIRA bug tracker when it renders to the user.

The problem I am having is we are getting a lot of bug reports for things
like StalePageException and ComponentNotFoundException when I think wicket
can handle those without the user knowing. While I can add them to the
ignored list, I don't think this is a good design because as wicket changes,
these exceptions can change.

I would like a way to just register my internal error page with
getApplicationSettings().setInternalErrorPage(...) but I can't because I
won't have my Exception passed to my error page. Is there a way to do this?
Or is there some way to access the last exception associated with the
session?

I suppose I can create an Exception variable in my Session class and set it
in my RequestCycleListener but I'm hoping there is a better way.

Thanks!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Pass-exception-to-internal-error-page-tp4664951.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



Extending the DataTable class doesnt work

2014-03-13 Thread chathuraka.waas
Hi,

i'm trying to migrate my application from 1.4 to 6.14. i have a class
extending the DataTable and it seems not working after the migration. 

i tried replacing the extended class with the DataTable class and it worked
fine. 

this is my code for extending the DataTable class. 

public class TestTableT,Object extends DataTableT,Object {

private static final long serialVersionUID = 1L;


public TestTable(String id, ListIColumnlt;T, Object columns,
IDataProviderT dataProvider, int rowsPerPage) {
super(id, columns, dataProvider, rowsPerPage);
}

}

am i doing something wrong here. please shed some light on this. Thanks in
advance. 

Regards,

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Extending-the-DataTable-class-doesnt-work-tp4664952.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