Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-06 Thread Eelco Hillenius
On 9/6/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> the problem with this stuff is that there is no single pattern that will
> work
>
> sometimes you want a chain where if a link fails the chain shortcircuits
> other times you dont want the shortcircuit
>
> sometimes you care about the order, other times you do not
>
> there are many variations of this and they are almost impossible to
> configure, so this isnt an easy problem.

Yeah, that's the problem. Maybe if we would make the kind of chaining
dependent on the attribute values? Furthermore, AttributeModifier and
SimpleAttributeModifier are two convenience classes, but you can do
the same by e.g. directly implementing IBehavior, not to mention the
AjaxBehaviors that directly change attributes. Which makes that any
chaining would be hard to get water proof.

It's probably not completely impossible though. If someone can make a
good proposal (with working code!) :)

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-06 Thread Igor Vaynberg
the problem with this stuff is that there is no single pattern that will
work

sometimes you want a chain where if a link fails the chain shortcircuits
other times you dont want the shortcircuit

sometimes you care about the order, other times you do not

there are many variations of this and they are almost impossible to
configure, so this isnt an easy problem.

-igor


On 9/6/07, Scott Swank <[EMAIL PROTECTED]> wrote:
>
> Would it make sense to have a behavior that was implemented as a Chain
> of Responsibility
>
> http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern
>
> Then it would just be a matter of adding that behavior to your component.
>
>
> On 9/6/07, Alex Objelean <[EMAIL PROTECTED]> wrote:
> >
> > I am curious, what is your use case for chaining behaviors?
> > I think that if you have two things that you want to chain, then chain
> them
> > in the same handler, or use decorator to add the client-side code.
> >
> > Alex
> >
> >
> > paolo di tommaso wrote:
> > >
> > > Carlos,
> > >
> > > Can you provide an example of your custom implementation of chained
> > > behaviour?
> > >
> > >
> > > Thanks, Paolo
> > >
> > >
> > > On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
> > >>
> > >> > Currently people will have to build it in themselves like you did.
> We
> > >> > can investigate whether this can be improved for future versions,
> but
> > >>
> > >> From my own experience I wouldn't say that wicket should support
> this.
> > >> It's too easy to write it yourself just to fit your specific needs,
> > >> and otoh seems difficult to predict and support a significant number
> > >> of possible use cases in a general way that keeps everyone happy, as
> > >> you remarked.
> > >>
> > >> Regards,
> > >> Carlos
> > >>
> > >> >
> > >> > Eelco
> > >> >
> > >> >
> -
> > >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> > For additional commands, e-mail: [EMAIL PROTECTED]
> > >> >
> > >> >
> > >>
> > >> -
> > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> http://www.nabble.com/Twice-Behavior-on-the-same-event-handler-%28wicket-1.2.x%29-tf4386351.html#a12518265
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Scott Swank
> reformed mathematician
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-06 Thread Carlos Pita
Alex:
We implemented a subclass of Form that has some sophisticated
validation and customized feedback panels built-in. This form
automatically "instruments" its fields with an ajax  validating
behavior. But sometimes -not that often- a field needs to ajax-do a
bit more than just being validated, so this extra behavior is passed
as a handler that knows how to react onSubmit and onError. Well, to
the point: at first we implemented this extra behavior as sort of
chained behavior, but then, as we found out that this generality was
adding extra complexity and didn't really pay off, we moved out to a
simpler schema with a handler implementing an onSubmit/onError
barebones interface, to which the only behavior delegates at last. So
now there is only one behavior and nothing that resembles a chain. In
part, that's the reason why I feel that such a functionality is out of
the scope of a general framework/toolkit as wicket is.

Regards,
Carlos

On 9/6/07, Alex Objelean <[EMAIL PROTECTED]> wrote:
>
> I am curious, what is your use case for chaining behaviors?
> I think that if you have two things that you want to chain, then chain them
> in the same handler, or use decorator to add the client-side code.
>
> Alex
>
>
> paolo di tommaso wrote:
> >
> > Carlos,
> >
> > Can you provide an example of your custom implementation of chained
> > behaviour?
> >
> >
> > Thanks, Paolo
> >
> >
> > On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
> >>
> >> > Currently people will have to build it in themselves like you did. We
> >> > can investigate whether this can be improved for future versions, but
> >>
> >> From my own experience I wouldn't say that wicket should support this.
> >> It's too easy to write it yourself just to fit your specific needs,
> >> and otoh seems difficult to predict and support a significant number
> >> of possible use cases in a general way that keeps everyone happy, as
> >> you remarked.
> >>
> >> Regards,
> >> Carlos
> >>
> >> >
> >> > Eelco
> >> >
> >> > -
> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Twice-Behavior-on-the-same-event-handler-%28wicket-1.2.x%29-tf4386351.html#a12518265
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-06 Thread Scott Swank
Would it make sense to have a behavior that was implemented as a Chain
of Responsibility

http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern

Then it would just be a matter of adding that behavior to your component.


On 9/6/07, Alex Objelean <[EMAIL PROTECTED]> wrote:
>
> I am curious, what is your use case for chaining behaviors?
> I think that if you have two things that you want to chain, then chain them
> in the same handler, or use decorator to add the client-side code.
>
> Alex
>
>
> paolo di tommaso wrote:
> >
> > Carlos,
> >
> > Can you provide an example of your custom implementation of chained
> > behaviour?
> >
> >
> > Thanks, Paolo
> >
> >
> > On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
> >>
> >> > Currently people will have to build it in themselves like you did. We
> >> > can investigate whether this can be improved for future versions, but
> >>
> >> From my own experience I wouldn't say that wicket should support this.
> >> It's too easy to write it yourself just to fit your specific needs,
> >> and otoh seems difficult to predict and support a significant number
> >> of possible use cases in a general way that keeps everyone happy, as
> >> you remarked.
> >>
> >> Regards,
> >> Carlos
> >>
> >> >
> >> > Eelco
> >> >
> >> > -
> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Twice-Behavior-on-the-same-event-handler-%28wicket-1.2.x%29-tf4386351.html#a12518265
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Scott Swank
reformed mathematician

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-06 Thread Alex Objelean

I am curious, what is your use case for chaining behaviors? 
I think that if you have two things that you want to chain, then chain them
in the same handler, or use decorator to add the client-side code.

Alex


paolo di tommaso wrote:
> 
> Carlos,
> 
> Can you provide an example of your custom implementation of chained
> behaviour?
> 
> 
> Thanks, Paolo
> 
> 
> On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
>>
>> > Currently people will have to build it in themselves like you did. We
>> > can investigate whether this can be improved for future versions, but
>>
>> From my own experience I wouldn't say that wicket should support this.
>> It's too easy to write it yourself just to fit your specific needs,
>> and otoh seems difficult to predict and support a significant number
>> of possible use cases in a general way that keeps everyone happy, as
>> you remarked.
>>
>> Regards,
>> Carlos
>>
>> >
>> > Eelco
>> >
>> > -
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Twice-Behavior-on-the-same-event-handler-%28wicket-1.2.x%29-tf4386351.html#a12518265
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-06 Thread Paolo Di Tommaso
Carlos,

Can you provide an example of your custom implementation of chained
behaviour?


Thanks, Paolo


On 9/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
>
> > Currently people will have to build it in themselves like you did. We
> > can investigate whether this can be improved for future versions, but
>
> From my own experience I wouldn't say that wicket should support this.
> It's too easy to write it yourself just to fit your specific needs,
> and otoh seems difficult to predict and support a significant number
> of possible use cases in a general way that keeps everyone happy, as
> you remarked.
>
> Regards,
> Carlos
>
> >
> > Eelco
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-05 Thread Carlos Pita
> Currently people will have to build it in themselves like you did. We
> can investigate whether this can be improved for future versions, but

>From my own experience I wouldn't say that wicket should support this.
It's too easy to write it yourself just to fit your specific needs,
and otoh seems difficult to predict and support a significant number
of possible use cases in a general way that keeps everyone happy, as
you remarked.

Regards,
Carlos

>
> Eelco
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-05 Thread Eelco Hillenius
On 9/5/07, Carlos Pita <[EMAIL PROTECTED]> wrote:
> We use some kind of custom cascading behavior to achieve this
> "pipeline of behaviors" effect. The first behavior does it thing,
> calls the next in the sequence and so on. I don't think wicket
> provides a standard mechanism for this. The main case of use we found
> is for ajax form component updating behaviors that do something more,
> as a country dropdown that must be validated and afterwards shows a
> state dropdown. But all in all these are just marginal cases.

Currently people will have to build it in themselves like you did. We
can investigate whether this can be improved for future versions, but
the problem is that changing/ setting tag attributes is so generic, it
is hard to decide what to do with piping, as most of the time it
probably won't make sense.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-05 Thread Carlos Pita
We use some kind of custom cascading behavior to achieve this
"pipeline of behaviors" effect. The first behavior does it thing,
calls the next in the sequence and so on. I don't think wicket
provides a standard mechanism for this. The main case of use we found
is for ajax form component updating behaviors that do something more,
as a country dropdown that must be validated and afterwards shows a
state dropdown. But all in all these are just marginal cases.

Regards,
Carlos

On 9/5/07, Matej Knopp <[EMAIL PROTECTED]> wrote:
> I believe it will only fire the last added behavior.
>
> -Matej
>
> On 9/5/07, Paolo Di Tommaso <[EMAIL PROTECTED]> wrote:
> > Dear Community,
> >
> > what happens if two or event behavior are added on the save event handler.
> >
> > I mean something like that
> >
> > Button b = new Button("the-button");l
> > b.add(new AjaxEventBehavior("onclick") {
> > protected void onEvent(AjaxRequestTarget target)
> > {
> > //DO THIS
> > }
> > });
> >
> >
> > b.add(new AjaxEventBehavior("onclick") {
> > protected void onEvent(AjaxRequestTarget target)
> > {
> > //DO THAT
> > }
> > });
> >
> >
> > Will be fired both? just the first? just the last?
> >
> > Thank to all.
> >
> > - P
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-05 Thread Matej Knopp
I believe it will only fire the last added behavior.

-Matej

On 9/5/07, Paolo Di Tommaso <[EMAIL PROTECTED]> wrote:
> Dear Community,
>
> what happens if two or event behavior are added on the save event handler.
>
> I mean something like that
>
> Button b = new Button("the-button");l
> b.add(new AjaxEventBehavior("onclick") {
> protected void onEvent(AjaxRequestTarget target)
> {
> //DO THIS
> }
> });
>
>
> b.add(new AjaxEventBehavior("onclick") {
> protected void onEvent(AjaxRequestTarget target)
> {
> //DO THAT
> }
> });
>
>
> Will be fired both? just the first? just the last?
>
> Thank to all.
>
> - P
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Twice Behavior on the same event handler (wicket 1.2.x)

2007-09-05 Thread Paolo Di Tommaso
Dear Community,

what happens if two or event behavior are added on the save event handler.

I mean something like that

Button b = new Button("the-button");l
b.add(new AjaxEventBehavior("onclick") {
protected void onEvent(AjaxRequestTarget target)
{
//DO THIS
}
});


b.add(new AjaxEventBehavior("onclick") {
protected void onEvent(AjaxRequestTarget target)
{
//DO THAT
}
});


Will be fired both? just the first? just the last?

Thank to all.

- P