Re: problem submitting a form twice - quickstart joined

2015-07-03 Thread Sven Meier

Hi,

forms are not allowed to be direct children of :



 

http://stackoverflow.com/questions/5967564/form-inside-a-table

After the first ajax request the browser will reshuffle the dom 
elements, so that the form is no longer the parent of the input field:



action="./?9-1.IFormSubmitListener-AddItemPanelEdit-form" method="post" 
id="form25" wicket:id="form">



checked="checked" wicket:id="onOff">





Have fun
Sven


On 03.07.2015 00:23, Francois Meillet wrote:

Wicket version is 7.0.M6


Le 2 juil. 2015 à 23:47, Francois Meillet  a écrit :


Description
-
In the quickstart, the HomePage contains a form.

The form's model is a CompoundPropertyModel<>(new QuestionUnit(Boolean.TRUE));
The QuestionUnit class has 2 properties, one is mandatory (string 'question').
Properties use validation annotations.

The validation is done with javax.validation.Validator,
so a call to BeanValidationConfiguration().configure(this) is done in the 
application init.

The form contains 2 formcomponents (1 TextField 'question' mandatory and 1 
CheckBox 'onoff' ) + 1 FeedbackLabel (extends Label).
If an error occurs when the form is submitted, a call from within the 
AjaxButton's onError method
to the FormFieldEnlighter helper class is done.

The FormFieldEnlighter updates the FeedbackLabel's model's value,
and add an AttributeModifier to the TextField to modify the 'title' attribute.
Then the textfield and the feedbackLabel are resent via ajax.

When this form is submitted, for the first time, with nothing typed, an error 
occurs.
Which is normal.
The FeedbackLabel displays an error message.

If some characters are typed in the textfield and the form submitted again,
the textfield is still invalid.
Which is the problem.

But if, at the first submit with the error, the helper class FormFieldEnlighter 
does not resent the invalid textfield,
the second submit works correctly, the form is valid and the ResultPage is 
displayed.



What I have found
-
Looking at FormComponent - line 755
List list = 
getRequest().getRequestParameters().getParameterValues(getInputName());
list is null
The textfield id is not in the parameters name.



environnement
-
mac osx / jdk 8 / safari & firefox


Thanks for your help
François





-
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: problem submitting a form twice - quickstart joined

2015-07-03 Thread Francois Meillet
1000 thanks !

François 








Le 3 juil. 2015 à 09:47, Sven Meier  a écrit :

> Hi,
> 
> forms are not allowed to be direct children of :
> 
>
>
> 
> 
>http://stackoverflow.com/questions/5967564/form-inside-a-table
> 
> After the first ajax request the browser will reshuffle the dom elements, so 
> that the form is no longer the parent of the input field:
> 
>
> action="./?9-1.IFormSubmitListener-AddItemPanelEdit-form" method="post" 
> id="form25" wicket:id="form">
> 
>
> checked="checked" wicket:id="onOff">
> 
>
>
> 
> Have fun
> Sven
> 
> 
> On 03.07.2015 00:23, Francois Meillet wrote:
>> Wicket version is 7.0.M6
>> 
>> 
>> Le 2 juil. 2015 à 23:47, Francois Meillet  a 
>> écrit :
>> 
>>> Description
>>> -
>>> In the quickstart, the HomePage contains a form.
>>> 
>>> The form's model is a CompoundPropertyModel<>(new 
>>> QuestionUnit(Boolean.TRUE));
>>> The QuestionUnit class has 2 properties, one is mandatory (string 
>>> 'question').
>>> Properties use validation annotations.
>>> 
>>> The validation is done with javax.validation.Validator,
>>> so a call to BeanValidationConfiguration().configure(this) is done in the 
>>> application init.
>>> 
>>> The form contains 2 formcomponents (1 TextField 'question' mandatory and 1 
>>> CheckBox 'onoff' ) + 1 FeedbackLabel (extends Label).
>>> If an error occurs when the form is submitted, a call from within the 
>>> AjaxButton's onError method
>>> to the FormFieldEnlighter helper class is done.
>>> 
>>> The FormFieldEnlighter updates the FeedbackLabel's model's value,
>>> and add an AttributeModifier to the TextField to modify the 'title' 
>>> attribute.
>>> Then the textfield and the feedbackLabel are resent via ajax.
>>> 
>>> When this form is submitted, for the first time, with nothing typed, an 
>>> error occurs.
>>> Which is normal.
>>> The FeedbackLabel displays an error message.
>>> 
>>> If some characters are typed in the textfield and the form submitted again,
>>> the textfield is still invalid.
>>> Which is the problem.
>>> 
>>> But if, at the first submit with the error, the helper class 
>>> FormFieldEnlighter does not resent the invalid textfield,
>>> the second submit works correctly, the form is valid and the ResultPage is 
>>> displayed.
>>> 
>>> 
>>> 
>>> What I have found
>>> -
>>> Looking at FormComponent - line 755
>>> List list = 
>>> getRequest().getRequestParameters().getParameterValues(getInputName());
>>> list is null
>>> The textfield id is not in the parameters name.
>>> 
>>> 
>>> 
>>> environnement
>>> -
>>> mac osx / jdk 8 / safari & firefox
>>> 
>>> 
>>> Thanks for your help
>>> François
>>> 
>>> 
>>> 
>> 
>> -
>> 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
> 



cryptomapper uses the same wicket-crypt params for each user

2015-07-03 Thread Steve Swinsburg
Hi all,

I am using the cryptomapper to encrypt some URLs and am finding that every
logged in user is getting the same encrypted URL for the same pages.
ie to go to x page is http://url?wicket-crypt=Uqcgp... for both user A and
user B.

Is there any way to make this unique for each user?

In my Application class I have:

IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(),
this);
setRootRequestMapper(cryptoMapper);

Wicket 6.18.0

Thanks,
Steve


Best Practice - Create component by entity type?

2015-07-03 Thread Per Newgro
Hi,

i think about that problem for some time now. Maybe someone alrady has a good 
solution.

Let's assume we have a Manager entity and a Tainee entity. Both are Person 
entities.
In Model we ask for all persons. So we get a mix from Managers and Trainees in 
a list.

Both concrete entity types shall be displayed in their own component (a custom 
panel for every1).

I would ask for simple, decoupled (extendible) solution of this problem.
So far i've tried the obvious "instance of" approach. But this is not 
extendible.
Maybe someone can send me some ideas.

Thanks for your support
Per

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



Re: Wicket7: MediaComponent and Source classes

2015-07-03 Thread Tobias Soloschenko
@Maxim: Is there anything left to be done within the media components? 
Otherwise I am going to vote +1

kind regards

Tobias

> Am 03.07.2015 um 07:43 schrieb Maxim Solodovnik :
> 
> OK, will try
> Thanks
> 
> On Fri, Jul 3, 2015 at 11:38 AM, Martin Grigorov 
> wrote:
> 
>> HI Maxim,
>> 
>> This will lead to a big API break.
>> If we change this signature then we will have to change many more to keep
>> it consistent, and this will lead to a lot of work for the application
>> developers to change AjaxRequestTarget with IPartialPageRequestHandler.
>> 
>> We may need to make this change for Wicket 8.x if there are many users
>> wanting this change, but for now I'd suggest you to create an adapter.
>> 
>> Martin Grigorov
>> Freelancer. Available for hire!
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>> 
>> On Fri, Jul 3, 2015 at 7:46 AM, Maxim Solodovnik 
>> wrote:
>> 
>>> Hello Martin,
>>> 
>>> I guess following method need to be additionally updated:
>>> 
>>> org.apache.wicket.ajax.AbstractAjaxTimerBehavior.onTimer
>>> 
>>> On Thu, Jul 2, 2015 at 6:11 PM, Martin Grigorov 
>>> wrote:
>>> 
 The change is rather big:
>> https://github.com/sebfz1/wicket-jquery-ui/commit/e94f89d8f07f2b1af2b327a4aaec5ddd4b1400af
 I guess many other methods will need to be changed too if one needs to
>>> use
 them with WebSocket.
 The improvement in the Wicket API looked so innocent ...
 
 Martin Grigorov
 Freelancer. Available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Thu, Jul 2, 2015 at 2:28 PM, Maxim Solodovnik >> 
 wrote:
 
> Done: https://github.com/sebfz1/wicket-jquery-ui/issues/177
> Sorry, forgot about Sebastians vacation :(
> 
> On Thu, Jul 2, 2015 at 5:23 PM, Martin Grigorov <
>> mgrigo...@apache.org>
> wrote:
> 
>> @Maxim: Please create an issue at Wicket jQuery UI github.
>> Sebastien is on vacation. I can do it but first I need a good
>> reason
 for
>> the change :-)
>> 
>> Martin Grigorov
>> Freelancer. Available for hire!
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>> 
>> On Thu, Jul 2, 2015 at 12:33 PM, Maxim Solodovnik <
 solomax...@gmail.com>
>> wrote:
>> 
>>> @Sebastian could you please modify AbstractDialog.open method to
>> be
>>> 
>>> public final void open(IPartialPageRequestHandler target)
>>> instead of
>>> public final void open(AjaxRequestTarget target)
>>> 
>>> Thanks in advance!
>>> 
>>> 
>>> On Thu, Jul 2, 2015 at 2:58 PM, Martin Grigorov <
 mgrigo...@apache.org>
>>> wrote:
>>> 
 Yes, another minor cleanup: there is now
>> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPartialPageRequestHandler.java
 A base interface for Ajax and WebSocket.
 
 Martin Grigorov
 Freelancer. Available for hire!
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 On Thu, Jul 2, 2015 at 11:45 AM, Maxim Solodovnik <
>> solomax...@gmail.com>
 wrote:
 
> Additionally it looks like WebSocketRequestHandler can not be
 used
> as AjaxRequestTarget any longer
> Previously it was possible to use WebSocketRequestHandler to
>>> push
>>> updated
> component .
> 
> On Thu, Jul 2, 2015 at 2:42 PM, Maxim Solodovnik <
>> solomax...@gmail.com
 
> wrote:
> 
>> Thanks a lot Tobias!
>> 
>> On Thu, Jul 2, 2015 at 1:03 PM, Tobias Soloschenko <
>> tobiassolosche...@googlemail.com> wrote:
>> 
>>> Hi Maxim,
>>> 
>>> no problem I am going to add the getter this evening.
>> Thank
 you
>> for
 your
>>> suggestions! :-)
>>> 
>>> Maybe the SNAPSHOT isn't refreshed because of the downtime
>>> of
> the
>>> buildbot server. However the build was triggered already.
>>> 
>>> kind regards
>>> 
>>> Tobias
>>> 
 Am 02.07.2015 um 08:45 schrieb Maxim Solodovnik <
 solomax...@gmail.com
>> :
 
 Thanks a lot for the changes Tobias,
 Unfortunately I'm unable to test it due to latest
> 7.0.0-SNAPSHOT
 seems
 doesn't contain it :(
 
 And one more question: I would like to be able to modify
> PageParameters
 passed to source, maybe it would be possible to add
>> public
>> getter
 for
>>> it?
 
 Thanks in advance
 
 On Mon, Jun 29, 2015 at 9:41 PM, Tobias Soloschenko <
 tobiassolosche...@googlemail.com> wrote:
 
> Hi Maxim,
> 
> hope the chang

Re: Best Practice - Create component by entity type?

2015-07-03 Thread Rob Audenaerde
Hi Per,

You can do something like this:

Create a set of compontents that will be your panels to display specific
Persons.

Let's call them PersonPanels.

You can introduce a PersonPanelFactory, which might give you the
appropriate PersonPanel based on the class of the Person (
 person.getClass() ) . This is however not yet nicely extensible, but you
decoupled the logic for creating panels from your list-code.

Next step: you need to register the classes somehow so you can provide
panels for in the factory, so the factory can for example use a map to
provide the proper PersonPanel. You can use reflection to call the
constructors, which will need to have the same arguments for their
constructors. This is the biggest disadvantage I think in this approach.

Somewhat like this:

class PersonPanelFactory
{
   public PersonPanel getPanelFor( Class personClass) ...
  public registerPanelFor ( Class personClass, Class personPanelClass ...
}



On Fri, Jul 3, 2015 at 2:32 PM, Per Newgro  wrote:

> Hi,
>
> i think about that problem for some time now. Maybe someone alrady has a
> good solution.
>
> Let's assume we have a Manager entity and a Tainee entity. Both are Person
> entities.
> In Model we ask for all persons. So we get a mix from Managers and
> Trainees in a list.
>
> Both concrete entity types shall be displayed in their own component (a
> custom panel for every1).
>
> I would ask for simple, decoupled (extendible) solution of this problem.
> So far i've tried the obvious "instance of" approach. But this is not
> extendible.
> Maybe someone can send me some ideas.
>
> Thanks for your support
> Per
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: cryptomapper uses the same wicket-crypt params for each user

2015-07-03 Thread Steve Swinsburg
OK solved:

getSecuritySettings().setCryptFactory(new
KeyInSessionSunJceCryptFactory()); //diff key per user
final IRequestMapper cryptoMapper = new
CryptoMapper(getRootRequestMapper(), this);
setRootRequestMapper(cryptoMapper);

On Fri, Jul 3, 2015 at 9:58 PM, Steve Swinsburg 
wrote:

> Hi all,
>
> I am using the cryptomapper to encrypt some URLs and am finding that every
> logged in user is getting the same encrypted URL for the same pages.
> ie to go to x page is http://url?wicket-crypt=Uqcgp... for both user A
> and user B.
>
> Is there any way to make this unique for each user?
>
> In my Application class I have:
>
> IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(),
> this);
> setRootRequestMapper(cryptoMapper);
>
> Wicket 6.18.0
>
> Thanks,
> Steve
>


Re: Best Practice - Create component by entity type?

2015-07-03 Thread Per Newgro
This sounds good. I already have a registry where i can register services in a 
decoupled way. With spring and @PostConstruct no Problem :-). I would ASK then 
every factory if it is responsible for my entity type. But i still see a 
problem here. How to prioritize factory if i have more than one factory for a 
Person type. For instance if a boss is a manager. Then i can't use instanceof 
in the manager factory because boss entity would match twice.

Am 03.07.2015 3:14 nachm. schrieb Rob Audenaerde :
>
> Hi Per, 
>
> You can do something like this: 
>
> Create a set of compontents that will be your panels to display specific 
> Persons. 
>
> Let's call them PersonPanels. 
>
> You can introduce a PersonPanelFactory, which might give you the 
> appropriate PersonPanel based on the class of the Person ( 
> person.getClass() ) . This is however not yet nicely extensible, but you 
> decoupled the logic for creating panels from your list-code. 
>
> Next step: you need to register the classes somehow so you can provide 
> panels for in the factory, so the factory can for example use a map to 
> provide the proper PersonPanel. You can use reflection to call the 
> constructors, which will need to have the same arguments for their 
> constructors. This is the biggest disadvantage I think in this approach. 
>
> Somewhat like this: 
>
> class PersonPanelFactory 
> { 
>    public PersonPanel getPanelFor( Class personClass) ... 
>   public registerPanelFor ( Class personClass, Class extends PersonPanel> personPanelClass ... 
> } 
>
>
>
> On Fri, Jul 3, 2015 at 2:32 PM, Per Newgro  wrote: 
>
> > Hi, 
> > 
> > i think about that problem for some time now. Maybe someone alrady has a 
> > good solution. 
> > 
> > Let's assume we have a Manager entity and a Tainee entity. Both are Person 
> > entities. 
> > In Model we ask for all persons. So we get a mix from Managers and 
> > Trainees in a list. 
> > 
> > Both concrete entity types shall be displayed in their own component (a 
> > custom panel for every1). 
> > 
> > I would ask for simple, decoupled (extendible) solution of this problem. 
> > So far i've tried the obvious "instance of" approach. But this is not 
> > extendible. 
> > Maybe someone can send me some ideas. 
> > 
> > Thanks for your support 
> > Per 
> > 
> > - 
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
> > For additional commands, e-mail: users-h...@wicket.apache.org 
> > 
> > 


Re: cryptomapper uses the same wicket-crypt params for each user

2015-07-03 Thread Martin Grigorov
Hi,

Yes. This is the correct way.
It is the default in 6.19.0
On Jul 4, 2015 2:51 AM, "Steve Swinsburg"  wrote:

> OK solved:
>
> getSecuritySettings().setCryptFactory(new
> KeyInSessionSunJceCryptFactory()); //diff key per user
> final IRequestMapper cryptoMapper = new
> CryptoMapper(getRootRequestMapper(), this);
> setRootRequestMapper(cryptoMapper);
>
> On Fri, Jul 3, 2015 at 9:58 PM, Steve Swinsburg  >
> wrote:
>
> > Hi all,
> >
> > I am using the cryptomapper to encrypt some URLs and am finding that
> every
> > logged in user is getting the same encrypted URL for the same pages.
> > ie to go to x page is http://url?wicket-crypt=Uqcgp... for both user A
> > and user B.
> >
> > Is there any way to make this unique for each user?
> >
> > In my Application class I have:
> >
> > IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(),
> > this);
> > setRootRequestMapper(cryptoMapper);
> >
> > Wicket 6.18.0
> >
> > Thanks,
> > Steve
> >
>