Of course, for me, an enforcement aspect does the job :-).
The following version reflects my current understanding, but over time
a more general purpose selection logic (the pointcut) and more
enforcements can be added.
package com.aspectivity.wicket.policyEnforcement;
import wicket.Component;
import wicket.markup.html.list.ListView;
import wicket.behavior.IBehavior;
import wicket.behavior.AbstractAjaxBehavior;
public aspect BehaviorPolicyEnforcementAspect {
before() : call(Component Component.add(IBehavior))
&& target(ListView)
&& args(AbstractAjaxBehavior) {
throw new IllegalArgumentException(
"Adding AJAX behaviors to listview will have no effect."
+ "Consider wrapping the listview in a WebMarkupContainer
"
+ "and adding the behavior to it instead");
}
}
-Ramnivas
Igor Vaynberg wrote:
this would be a pain to maintain. we cant just lock out
/all/ behaviors from being added to listview, some might make sense.
-Igor
On 3/2/06, Riyad
Kalla
<[EMAIL PROTECTED]>
wrote:
I
second this request (about runtime notification of invalid states)
On 3/2/06, Ramnivas Laddad <[EMAIL PROTECTED]>
wrote:
> Thanks, Igor. It works now.
>
> Would it be possible to throw an exception when someone tries to
add an
> unacceptable Behavior such as AjaxSelfUpdatingTimerBehavior to a
listview
> (or any other class doesn't produce any markup itself).
>
> -Ramnivas
>
>
> Igor Vaynberg wrote:
> you cannot update a listview itself directly because it does not
produce any
> markup itself. you need to put it into a webmarkupcontainer and
attach the
> update behavior to that.
>
> WebMarkupContainer wmc=new WebMarkupContainer("wmc");
> wmcv
> add(wmc);
> wmc.add(new ListView(........
> wmc.add(new AjaxSelfUpdatingBehavio.....
>
> and in markup <span wicket:id="wmc">...listview</span>
>
> -Igor
>
>
>
> On 3/2/06, Ramnivas Laddad <[EMAIL PROTECTED]>
wrote:
> > Hi,
> >
> > I have a ListView with a dynamic model. I am trying to update
the view
> > using AjaxSelfUpdatingTimerBehavior. It doesn't seem to be
working,
> > however (with snapshot version 20060227-0200). It seems that
the
> > AjaxSelfUpdatingTimerBehavior.onTimer() methods gets
> called only once.
> >
> > The following code (a much simplified version of the real
code)
> > illustrates the problem.
> >
> > -Ramnivas
> >
> > public class AJAXListHome extends WebPage {
> > public AJAXListHome() {
> > ListView testListView = new TestListView("dates");
> > add(testListView);
> > testListView.add(new
> > AjaxSelfUpdatingTimerBehavior(
Duration.seconds(5)));
> > }
> > }
> >
> > class TestListView extends ListView {
> > public TestListView(String id) {
> > super(id);
> > }
> >
> > public IModel getModel() {
> > List<String> list = new
ArrayList<String>();
> > list.add(new Date().toString());
> > return new Model((Serializable)list);
> > }
> >
> > @Override
> > protected void populateItem(ListItem item) {
> > String date = (String)item.getModelObject();
> > item.add(new Label("date", date));
> > }
> > }
> >
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking
scripting
> language
> > that extends applications into web and mobile media. Attend
the live
> webcast
> > and join the prime developer group breaking into this new
coding
> territory!
> >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> >
https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
> that extends applications into web and mobile media. Attend the
live webcast
> and join the prime developer group breaking into this new coding
territory!
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________ Wicket-user
> mailing list
Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
|