Re: Character ^ added to javascript blocks in Ajax response

2014-03-31 Thread Martin Grigorov
Hi,

Yes. It is added by Wicket and is removed by Wicket before actual
processing.
This character is used as an escape character, so CDATA is not prematurely
ended.

Martin Grigorov
Wicket Training and Consulting


On Tue, Apr 1, 2014 at 8:43 AM, Rakesh A  wrote:

> Hi,
> I am using Wicket v6.12.0, I observed that ^ character is getting added at
> places in javascript blocks in Ajax response. I observed that its for Ajax
> attributes with supports array like 'pre', 'bh', 'dep', etc.
>
> Example:
> "pre":[function(attrs){return false;}]^
> "bh":[function(attrs){if (attrs.event.shiftKey) {
> attrs.event.preventDefault(); }}]^
> "dep":[function(attrs){return {'ctrlKey' : attrs.event.ctrlKey, 'shiftKey'
> :
> attrs.event.shiftKey}}]^
>
> Is it being added by Wicket?
>
> I tried by adding "-Djavax.servlet.request.encoding=UTF-8
> -Dfile.encoding=UTF-8" options to my tomcat startup, thinking its character
> encoding issue, but that didn't help!
>
> Thanks,
> Rakesh.A
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Character-added-to-javascript-blocks-in-Ajax-response-tp4665190.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
>
>


Character ^ added to javascript blocks in Ajax response

2014-03-31 Thread Rakesh A
Hi,
I am using Wicket v6.12.0, I observed that ^ character is getting added at
places in javascript blocks in Ajax response. I observed that its for Ajax
attributes with supports array like 'pre', 'bh', 'dep', etc.

Example:
"pre":[function(attrs){return false;}]^
"bh":[function(attrs){if (attrs.event.shiftKey) {
attrs.event.preventDefault(); }}]^
"dep":[function(attrs){return {'ctrlKey' : attrs.event.ctrlKey, 'shiftKey' :
attrs.event.shiftKey}}]^

Is it being added by Wicket?

I tried by adding "-Djavax.servlet.request.encoding=UTF-8
-Dfile.encoding=UTF-8" options to my tomcat startup, thinking its character
encoding issue, but that didn't help!

Thanks,
Rakesh.A


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Character-added-to-javascript-blocks-in-Ajax-response-tp4665190.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: AjaxLazyLoadPanel loading asynchronously

2014-03-31 Thread vp143
I found that I was received the NPE with the transient variable when
executing the same class twice concurrently, which makes sense now.

I went with the following (stripped back show only necessary code):

@SpringBean
private SupplierConnector supplierPrices;

private class GetPrices extends AjaxLazyLoadPanel {
public GetPrices(String id, final PageParameters changeDatesParam) {
super(id);
}

public Component getLoadingComponent(String markupId) {
return new Label(markupId, "");
}

@Override
public Component getLazyLoadComponent(String markupId) {
Wholesaler1 wholesaler1 = new Wholesaler1();
Wholesaler2 wholesaler2 = new Wholesaler2();

Future> wholesaler1List =
supplierPrices.getWholesaler1Prices(wholesaler1, searchFields);
Future> wholesaler2List =
supplierPrices.getWholesaler2Prices(wholesaler2, searchFields);

while(!(wholesaler1List.isDone() && wholesaler2List.isDone())) {
try {
Thread.sleep(100); //pause between each check
}
catch(Exception e) {
log.error("Thread sleep exception");
}
}

try {
SearchResults.this.results.addAll(wholesaler1.get());
SearchResults.this.results.addAll(wholesaler2.get());
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

AjaxRequestTarget resultsTarget =
resultsContainer.getRequestCycle().find(AjaxRequestTarget.class);
resultsTarget.add(resultsContainer);

AjaxRequestTarget progressTarget =
progressBar.getRequestCycle().find(AjaxRequestTarget.class);
progressTarget.add(progressBar);

return new Label(markupId, "");
}
}


In the SupplierConnector class
@Async
public Future> getWholesaler1Prices(Wholesaler
wholesaler, SearchFields searchFields) {
//Do time consuming operation

return new AsyncResult>(results);
}

I am using a progress bar instead of an ajax indicator and the
resultsContainer contains the display showing the results obtained.

I hope it helps others

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLazyLoadPanel-loading-asynchronously-tp4664035p4665188.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: AbstractFormValidator in Wizard

2014-03-31 Thread N. Metzger
I'll try that, thanks!

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

2014-03-31 Thread Sven Meier
I can't think of a reason why your IFormValidator should cause multiple 
submits.


If #changePassword() takes a long time to complete, you could show a 
veil: Google wicket and veil.


Sven

On 03/31/2014 02:30 PM, N. Metzger wrote:

The form seems to be submitted 2 or 3 times although - as out technical
support assures me - the user clicked the submit button only once. I could
reproduce it only once when I used the enter key to submit the form instead
of clicking "Finish" with the mouse.

I guess I have 2 questions:
1) Obvious: Has anyone ever experienced this and is there a known solution?
2) Is my approach of using an AbstractFormValidator the right one, or should
I have gone about this another way?

Thanks,
Natalie

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




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



Re: AbstractFormValidator in Wizard

2014-03-31 Thread N. Metzger
The form seems to be submitted 2 or 3 times although - as out technical
support assures me - the user clicked the submit button only once. I could
reproduce it only once when I used the enter key to submit the form instead
of clicking "Finish" with the mouse.

I guess I have 2 questions:
1) Obvious: Has anyone ever experienced this and is there a known solution?
2) Is my approach of using an AbstractFormValidator the right one, or should
I have gone about this another way?

Thanks,
Natalie

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



Adding/Remiving Panels

2014-03-31 Thread David Beer
Hi All

I am in the process of building a user account page, which will have a menu
on the left, and the related content on the right.

I would like the content on the right to be swapped depending on the
selection on the left. As in the content on the right might well be
generated by panels or fragments and then added to the page and the
previous unrelated removed.

Is it better to have all the code added to the html and then hide certain
components and then re-enable them on selection and disable them or is it
better to use a panels and a page hierarchy and to pass information between
panels and parent page.

Any thoughts and examples are always appreciated.

Thanks

David


AW: EqualInputValidator for PasswortTextfield

2014-03-31 Thread Collinson, Alasdair
Hi!

In such a case the error with the key "EqualInputValidator" is used; the 
Application_de.properties-file defines the message you see. You could override 
that in your local properties file. However you probably want to use the 
EqualPasswordInputValidator anyway which is a specialisation of the 
EqualInputValidator which should produce the output you want. Here you could of 
course override the value as well if you like.

Best regards,
Alasdair

-Ursprüngliche Nachricht-
Von: Daniela L [mailto:danigal...@gmail.com] 
Gesendet: Montag, 31. März 2014 12:24
An: users@wicket.apache.org
Betreff: EqualInputValidator for PasswortTextfield

Hi,
I have two PasswordTextfields with a EqualInputValidator using wicket 6.12.0 
the 2 fields have Labels with localized Names. When the user leaves one 
PasswordTextfield empty the feedback message presented is containing the word 
Label like this:
'' vom Label E-Mail und 'testemailaddr...@test.com' vom Label E-Mail Adresse 
wiederholen müssen gleich sein.
How can I avoid the word Label in the feedback message?
Best regards
Daniela

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



EqualInputValidator for PasswortTextfield

2014-03-31 Thread Daniela L
Hi,
I have two PasswordTextfields with a EqualInputValidator using wicket 6.12.0
the 2 fields have Labels with localized Names. When the user leaves one
PasswordTextfield empty
the feedback message presented is containing the word Label like this:
'' vom Label E-Mail und 'testemailaddr...@test.com' vom Label E-Mail
Adresse wiederholen müssen gleich sein.
How can I avoid the word Label in the feedback message?
Best regards
Daniela


Re: AbstractFormValidator in Wizard

2014-03-31 Thread Sven Meier

Hi,

what's the actual problem you're trying to fix?

Sven

On 03/28/2014 12:45 AM, N. Metzger wrote:

I have a problem with form validation within a wizard. The wizard is used for
account setup which concludes in setting a password as the final step.
Originally this wasn't inside a wizard, but a panel with an embedded form.
As I was dealing with this panel, I added it to the wizard, disabling the
form buttons. Now I had to add form validation again and used an
AbstractFormValidator (see below). It usually works, but occasionally the
form seems to be submitted multiple times although I clicked "Finish" only
once. I rarely can reproduce it, but it happens to our users every now and
then.

Maybe someone can shed light on what I might be doing wrong.

The method below is called in the constructor of the WizardStep, and just so
you know, the form component "password2" has validators checking if the
required number of letters, numbers, special characters etc. are fulfilled.

 private void addFormValidator(){
   add(new AbstractFormValidator() {
 public FormComponent[] getDependentFormComponents() {
 try{
 log.debug("{}:{}: Retrieving form coponents", uniqueId,
midm);
 FormComponent passwd = (FormComponent)
passwordPanel.getPasswordForm().get("password");
 FormComponent passwd2 = (FormComponent)
passwordPanel.getPasswordForm().get("password2");
 log.debug("{}:{}: Found 2 form coponents", uniqueId,
midm);
 return new FormComponent[] { passwd, passwd2 };
 } catch (Exception e){
 return null;
 }
 }

 public void validate(Form form) {

 try {
 log.debug("{}:{}: Before password change", uniqueId,
midm);

passwordPanel.changePassword(passwordPanel.getNewPassword(), null);

 log.debug("{}:{}: After password change", uniqueId,
midm);
 if (!authenticated){
 log.debug("{}:{}: Before authentication", uniqueId,
midm);
 authenticateUser();
 log.debug("{}:{}: After authentication", uniqueId,
midm);
 }
 } catch (UnavailableDataSourceException e) {
 form.error("There was a database error changing your
password, please try again later.");
 } catch (UpdatePasswordException e) {
 form.error("There was an error changing your password: "
+ e.getMessage());
 } catch (PreviousPasswordException e) {
 form.error("The submitted password was previously used!
Please choose a " +
 "different password");
 } catch (ExpiredPasswordException e) {
 log.error("{}:{}: Unable to update password for user,
reason: " + e.getMessage(),
 uniqueId, midm);
 form.error ("An internal error occurred while updating
your password, the password was NOT changed!");
 } catch (ServicePasswordIsMidasPasswordException e) {
 form.error("The submitted service password was your
MIDAS password. " +
  "This is not allowed.");
 } catch (ErrorUserCreationException e) {
 log.error("{}:{}: Unable to update password for user,
reason: " + e.getMessage(),
 uniqueId, midm);
 form.error ("An internal error occurred while updating
your password, the password was NOT changed!");
 } catch (PasswordChangedTodayException e) {
 form.error("Your password can only be changed once a
day!");
 } catch (PasswordExpirationUpdateException e) {
 log.error("{}:{}: Unable to update password for user,
reason: " + e.getMessage(),
 uniqueId, midm);
 form.error ("An internal error occurred while updating
your password, the password was NOT changed!");
 } catch (Exception e) {
 log.error("{}:{}: Unable to update password for user,
reason: " + e.getMessage(),
 uniqueId, midm);
 form.error ("An internal error occurred while updating
your password, the password was NOT changed!");
 }
 }
   });
 }

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AbstractFormValidator-in-Wizard-tp4665164.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: One field enabled in a disabled container

2014-03-31 Thread niestroj
I do it using a behavior. For Components i want to keep enabled i need to
make fields. Then i pass them to the behavior in the constructor.

public class ComponentEnabledBehavior extends Behavior {

   private final Component[] notDisabledComponents;

   public ComponentEnabledBehavior (Component... notDisabledComponent) {
  notDisabledComponents = notDisabledComponent;
   }

   public ComponentEnabledBehavior () {
  notDisabledComponents = null;
   }

   @Override
   public void onConfigure(Component component) {
  super.onConfigure(component);
  if (someCondition) {
 for (Iterator it = ((WebMarkupContainer) component).iterator();
it.hasNext();) {
Component comp = (Component) (it.next());
comp.setEnabled(ArrayUtils.contains(notDisabledComponents,
comp));
 }
  }
   }
}




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/One-field-enabled-in-a-disabled-container-tp4665156p4665180.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