Difficulty with related, mutually updating fields

2015-11-23 Thread ChambreNoire
Hello,

I have a form with the following fields : start date, duration (in days) &
end date. I want the user to be able to enter EITHER a duration OR an end
date and the other field will be automatically calculated according to this
and the start date. Each field has an associated feedback label. However,
simple as this seems, I’m having trouble pulling it off. Here’s what I’m
going for in terms of behaviour:

+ If the start date is missing, the others are blanked and disabled.

+ Changing either field results in an ajax update of both and the other
field is calculated.

+ When the form is submitted, the “calculated” field must be null (even
though it displays the calculated value). The underlying domain object
should have either a duration or an end date but not both.

+ If a user removes the value of the calculated field, it just gets
recalculated.

+ If a user changes the value of the calculated field (for a valid value),
the other field is blanked and is updated with a calculated value - it
becomes the calculated field.

+ If a user enters an invalid value into the calculated field this results
in a feedback error and the non-calculated field doesn’t update.

+ Similarly, if the user enters an invalid value into the non-calculated
field the feedback error is shown and the calculated field is NOT updated
(it remains based on the previous valid non-calculated field value).

+ It would be nice to be able to chain these fields – have another duration
/ end date couple which use the first couple’s end date (calculated or not)
as a start date. 

Any pointers would be most appreciated as I’m having trouble seeing this
clearly…

Thanks,

CN


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Difficulty-with-related-mutually-updating-fields-tp4672701.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: Image based on external url model object

2015-11-23 Thread Tobias Soloschenko
https://issues.apache.org/jira/plugins/servlet/mobile#issue/WICKET-6042

kind regards

Tobias

> Am 23.11.2015 um 03:45 schrieb Maxim Solodovnik :
> 
> Actually I'm using "hacky" way:
> 
> if (absolute) {
> profile.add(new
> WebMarkupContainer("img").add(AttributeModifier.append("alt",
> Application.getString(5L)), AttributeModifier.append("src", uri)));
> } else {
> profile.add(new Image("img", new ByteArrayResource("image/jpeg") {
> ..
> 
> Would love to know if is there any better way
> 
>> On Mon, Nov 23, 2015 at 4:34 AM, Sebastien  wrote:
>> 
>> Forgot to mention I've read the following wiki, but as it was a little bit
>> old I was wondering if there was nothing newer...
>> 
>> https://cwiki.apache.org/confluence/display/WICKET/How+to+load+an+external+image
>> 
>> 
>>> On Sun, Nov 22, 2015 at 11:31 PM, Sebastien  wrote:
>>> 
>>> Hi all,
>>> 
>>> I cannot find an Image component that could display an image from an
>>> *external* url, supplied by the model object. My use-case is that I have
>> a
>>> user object, which have a gravatarUrl property, and I would like to do
>>> something like "this.add(new ExternalImage("gravatarUrl"));"...
>>> 
>>> Isn't there any component that actually exists which could do this?
>>> 
>>> Many thanks in advance,
>>> Sebastien
> 
> 
> 
> -- 
> WBR
> Maxim aka solomax

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



Re: Image based on external url model object

2015-11-23 Thread Maxim Solodovnik
Also thanks from me :)

On Mon, Nov 23, 2015 at 9:17 PM, Sebastien  wrote:

> Thanks a million Tobias! :)
>
> On Mon, Nov 23, 2015 at 4:09 PM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
>
> > Hi,
> >
> > sounds good - I am going to change the ticket description soon and try to
> > implement it.
> >
> > kind regards
> >
> > Tobias
> >
> > > Am 23.11.2015 um 15:45 schrieb Sebastien :
> > >
> > > Hi Tobias,
> > >
> > > Sorry for the late reply, busy day...
> > >
> > > Actually Image(String id, IModel model, String url) will not help in
> this
> > > case, I need the url to be in the model, but external url doesn't work
> > with
> > > Image... I was more thinking about an ExternalImage component
> > >
> > > Does it make sense to you?
> > >
> > > Thanks & best regards,
> > > Sebastien.
> > >
> > >
> > > On Mon, Nov 23, 2015 at 6:05 AM, Tobias Soloschenko <
> > > tobiassolosche...@googlemail.com> wrote:
> > >
> > >> Hi,
> > >>
> > >> maybe we can extend the normal image and add a constructor
> Image(String
> > >> id, IModel model, String url) so that the url is used in the src
> > attribute
> > >> (like in MediaComponents)
> > >>
> > >> WDYT?
> > >>
> > >> kind regards
> > >>
> > >> Tobias
> > >>
> > >>> Am 23.11.2015 um 03:45 schrieb Maxim Solodovnik <
> solomax...@gmail.com
> > >:
> > >>>
> > >>> Actually I'm using "hacky" way:
> > >>>
> > >>> if (absolute) {
> > >>> profile.add(new
> > >>> WebMarkupContainer("img").add(AttributeModifier.append("alt",
> > >>> Application.getString(5L)), AttributeModifier.append("src", uri)));
> > >>> } else {
> > >>> profile.add(new Image("img", new ByteArrayResource("image/jpeg") {
> > >>> ..
> > >>>
> > >>> Would love to know if is there any better way
> > >>>
> >  On Mon, Nov 23, 2015 at 4:34 AM, Sebastien 
> wrote:
> > 
> >  Forgot to mention I've read the following wiki, but as it was a
> little
> > >> bit
> >  old I was wondering if there was nothing newer...
> > >>
> >
> https://cwiki.apache.org/confluence/display/WICKET/How+to+load+an+external+image
> > 
> > 
> > > On Sun, Nov 22, 2015 at 11:31 PM, Sebastien 
> > wrote:
> > >
> > > Hi all,
> > >
> > > I cannot find an Image component that could display an image from
> an
> > > *external* url, supplied by the model object. My use-case is that I
> > >> have
> >  a
> > > user object, which have a gravatarUrl property, and I would like to
> > do
> > > something like "this.add(new ExternalImage("gravatarUrl"));"...
> > >
> > > Isn't there any component that actually exists which could do this?
> > >
> > > Many thanks in advance,
> > > Sebastien
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>> WBR
> > >>> Maxim aka solomax
> > >>
> > >> -
> > >> 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
> >
> >
>



-- 
WBR
Maxim aka solomax


Re: Image based on external url model object

2015-11-23 Thread Sebastien
Thanks a million Tobias! :)

On Mon, Nov 23, 2015 at 4:09 PM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> Hi,
>
> sounds good - I am going to change the ticket description soon and try to
> implement it.
>
> kind regards
>
> Tobias
>
> > Am 23.11.2015 um 15:45 schrieb Sebastien :
> >
> > Hi Tobias,
> >
> > Sorry for the late reply, busy day...
> >
> > Actually Image(String id, IModel model, String url) will not help in this
> > case, I need the url to be in the model, but external url doesn't work
> with
> > Image... I was more thinking about an ExternalImage component
> >
> > Does it make sense to you?
> >
> > Thanks & best regards,
> > Sebastien.
> >
> >
> > On Mon, Nov 23, 2015 at 6:05 AM, Tobias Soloschenko <
> > tobiassolosche...@googlemail.com> wrote:
> >
> >> Hi,
> >>
> >> maybe we can extend the normal image and add a constructor Image(String
> >> id, IModel model, String url) so that the url is used in the src
> attribute
> >> (like in MediaComponents)
> >>
> >> WDYT?
> >>
> >> kind regards
> >>
> >> Tobias
> >>
> >>> Am 23.11.2015 um 03:45 schrieb Maxim Solodovnik  >:
> >>>
> >>> Actually I'm using "hacky" way:
> >>>
> >>> if (absolute) {
> >>> profile.add(new
> >>> WebMarkupContainer("img").add(AttributeModifier.append("alt",
> >>> Application.getString(5L)), AttributeModifier.append("src", uri)));
> >>> } else {
> >>> profile.add(new Image("img", new ByteArrayResource("image/jpeg") {
> >>> ..
> >>>
> >>> Would love to know if is there any better way
> >>>
>  On Mon, Nov 23, 2015 at 4:34 AM, Sebastien  wrote:
> 
>  Forgot to mention I've read the following wiki, but as it was a little
> >> bit
>  old I was wondering if there was nothing newer...
> >>
> https://cwiki.apache.org/confluence/display/WICKET/How+to+load+an+external+image
> 
> 
> > On Sun, Nov 22, 2015 at 11:31 PM, Sebastien 
> wrote:
> >
> > Hi all,
> >
> > I cannot find an Image component that could display an image from an
> > *external* url, supplied by the model object. My use-case is that I
> >> have
>  a
> > user object, which have a gravatarUrl property, and I would like to
> do
> > something like "this.add(new ExternalImage("gravatarUrl"));"...
> >
> > Isn't there any component that actually exists which could do this?
> >
> > Many thanks in advance,
> > Sebastien
> >>>
> >>>
> >>>
> >>> --
> >>> WBR
> >>> Maxim aka solomax
> >>
> >> -
> >> 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: Testing for an IEvent

2015-11-23 Thread Martin Grigorov
Hi,

There are several ways:

1) tester.startComponentInPage(new MyComponent(...) { @Override public void
onEvent(IEvent event) { track(event); } })
2) Same as above for Page
3) dependending on the IEventSink and Broadcast type you use you can track
the events also in YourApplication#onEvent(), YourSession#onEvent() and
YourRequestCycle#onEvent()
4) you can setup custom IFrameworkSettings and track the dispatched events

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sun, Nov 22, 2015 at 12:37 PM, calle sollander 
wrote:

> Hello!I have a question about how to test that an IEvent has been sent.
> Say that I have a Panel with a AjaxLink on it and depending on something
> or other diffrentevents are sent when the user clicks the link.Is there a
> way to set up a unit test using the Wickettester that can detect which
> events are sent?
> Regards Calle S


Re: Image based on external url model object

2015-11-23 Thread Sebastien
Hi Tobias,

Sorry for the late reply, busy day...

Actually Image(String id, IModel model, String url) will not help in this
case, I need the url to be in the model, but external url doesn't work with
Image... I was more thinking about an ExternalImage component

Does it make sense to you?

Thanks & best regards,
Sebastien.


On Mon, Nov 23, 2015 at 6:05 AM, Tobias Soloschenko <
tobiassolosche...@googlemail.com> wrote:

> Hi,
>
> maybe we can extend the normal image and add a constructor Image(String
> id, IModel model, String url) so that the url is used in the src attribute
> (like in MediaComponents)
>
> WDYT?
>
> kind regards
>
> Tobias
>
> > Am 23.11.2015 um 03:45 schrieb Maxim Solodovnik :
> >
> > Actually I'm using "hacky" way:
> >
> > if (absolute) {
> > profile.add(new
> > WebMarkupContainer("img").add(AttributeModifier.append("alt",
> > Application.getString(5L)), AttributeModifier.append("src", uri)));
> > } else {
> > profile.add(new Image("img", new ByteArrayResource("image/jpeg") {
> > ..
> >
> > Would love to know if is there any better way
> >
> >> On Mon, Nov 23, 2015 at 4:34 AM, Sebastien  wrote:
> >>
> >> Forgot to mention I've read the following wiki, but as it was a little
> bit
> >> old I was wondering if there was nothing newer...
> >>
> >>
> https://cwiki.apache.org/confluence/display/WICKET/How+to+load+an+external+image
> >>
> >>
> >>> On Sun, Nov 22, 2015 at 11:31 PM, Sebastien  wrote:
> >>>
> >>> Hi all,
> >>>
> >>> I cannot find an Image component that could display an image from an
> >>> *external* url, supplied by the model object. My use-case is that I
> have
> >> a
> >>> user object, which have a gravatarUrl property, and I would like to do
> >>> something like "this.add(new ExternalImage("gravatarUrl"));"...
> >>>
> >>> Isn't there any component that actually exists which could do this?
> >>>
> >>> Many thanks in advance,
> >>> Sebastien
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Image based on external url model object

2015-11-23 Thread Tobias Soloschenko
Hi,

sounds good - I am going to change the ticket description soon and try to 
implement it.

kind regards

Tobias

> Am 23.11.2015 um 15:45 schrieb Sebastien :
> 
> Hi Tobias,
> 
> Sorry for the late reply, busy day...
> 
> Actually Image(String id, IModel model, String url) will not help in this
> case, I need the url to be in the model, but external url doesn't work with
> Image... I was more thinking about an ExternalImage component
> 
> Does it make sense to you?
> 
> Thanks & best regards,
> Sebastien.
> 
> 
> On Mon, Nov 23, 2015 at 6:05 AM, Tobias Soloschenko <
> tobiassolosche...@googlemail.com> wrote:
> 
>> Hi,
>> 
>> maybe we can extend the normal image and add a constructor Image(String
>> id, IModel model, String url) so that the url is used in the src attribute
>> (like in MediaComponents)
>> 
>> WDYT?
>> 
>> kind regards
>> 
>> Tobias
>> 
>>> Am 23.11.2015 um 03:45 schrieb Maxim Solodovnik :
>>> 
>>> Actually I'm using "hacky" way:
>>> 
>>> if (absolute) {
>>> profile.add(new
>>> WebMarkupContainer("img").add(AttributeModifier.append("alt",
>>> Application.getString(5L)), AttributeModifier.append("src", uri)));
>>> } else {
>>> profile.add(new Image("img", new ByteArrayResource("image/jpeg") {
>>> ..
>>> 
>>> Would love to know if is there any better way
>>> 
 On Mon, Nov 23, 2015 at 4:34 AM, Sebastien  wrote:
 
 Forgot to mention I've read the following wiki, but as it was a little
>> bit
 old I was wondering if there was nothing newer...
>> https://cwiki.apache.org/confluence/display/WICKET/How+to+load+an+external+image
 
 
> On Sun, Nov 22, 2015 at 11:31 PM, Sebastien  wrote:
> 
> Hi all,
> 
> I cannot find an Image component that could display an image from an
> *external* url, supplied by the model object. My use-case is that I
>> have
 a
> user object, which have a gravatarUrl property, and I would like to do
> something like "this.add(new ExternalImage("gravatarUrl"));"...
> 
> Isn't there any component that actually exists which could do this?
> 
> Many thanks in advance,
> Sebastien
>>> 
>>> 
>>> 
>>> --
>>> WBR
>>> Maxim aka solomax
>> 
>> -
>> 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