Thank you for the isTemporary() suggestion.. . BTW before i got your reply i
tried implementing following way, by extending AbstractBehavior , not sure
if this is a good way..
@Override
    public void onRendered(Component component) {
        IRequestTarget reqTarget = RequestCycle.get()
        .getRequestTarget();
        if (reqTarget!=null && reqTarget instanceof AjaxRequestTarget) {
                    AjaxRequestTarget ajaxTarget = (AjaxRequestTarget)
RequestCycle
                            .get().getRequestTarget();
                    if (ajaxTarget != null) {
                        ajaxTarget.appendJavascript("new Effect.Fade($('"
                                + component.getMarkupId() + "'));");
            }
        }
    }

Is it possible to have a chaining behaviour class in wicket which is not a
request listener??



On Mon, Mar 10, 2008 at 12:11 PM, Igor Vaynberg <[EMAIL PROTECTED]>
wrote:

> there are two ways to do it:
>
> either use ajaxrequesttarget.appendjavascript() instead of behavior
>
> or write a behavior that uses renderhead() to output the javascript
> and override istemporary to return true - that way it is removed at
> the end of the request.
>
> -igor
>
>
> On Sun, Mar 9, 2008 at 6:39 PM, atul singh <[EMAIL PROTECTED]> wrote:
> > How can i write an ajax behaviour which does not have its own callback,
> but
> >  just appends javascript to an existing AjaxRequestTarget.
> >  I want this so that i can write a fading feed back panel, which will be
> >  added to AjaxRequestTarget of an ajax form submission.
> >
> >  What I want is something like this::
> >  *the behaviour---*
> >  public class AjaxFadeBehaviour extends AbstractAjaxBehavior{
> >     private IModel fadingNeededIModel;
> >     public AjaxFadeBehaviour() {
> >         super();
> >     }
> >
> >     /**
> >      * Use a boolean value wrapped in an IModel to know if fading effect
> is
> >  needed.
> >      * This can be useful in situations for example when info messages
> need
> >  to fade away while error messages need not.
> >      * @param fadingNeededIModel
> >      */
> >     public AjaxFadeBehaviour(IModel fadingNeededIModel) {
> >         super();
> >         this.fadingNeededIModel = fadingNeededIModel;
> >     }
> >
> >     public void onRequest() {
> >         System.out.println("on request called");
> >         if(fadingNeededIModel!=null){
> >             if(Strings.isTrue((String) fadingNeededIModel.getObject()))
> >
> >
>  
> ((AjaxRequestTarget)RequestCycle.get().getRequestTarget()).appendJavascript("new
> >  Effect.Fade($('"
> >                     + getComponent().getMarkupId() + "'));");
> >             }
> >     }
> >  }
> >
> >  *the feedback component ---
> >  *public class AjaxFadingFeedbackPanel extends FeedbackPanel{
> >
> >     public AjaxFadingFeedbackPanel(String id, IFeedbackMessageFilter
> filter)
> >  {
> >         super(id, filter);
> >         setOutputMarkupId(true);
> >         final AbstractReadOnlyModel fadingNeededModel=new
> >  AbstractReadOnlyModel(){
> >             @Override
> >             public Object getObject() {
> >                 return anyMessage(FeedbackMessage.INFO);
> >             }
> >         };
> >         add(new AjaxFadeBehaviour(fadingNeededModel));
> >     }
> >
> >     public AjaxFadingFeedbackPanel(String id) {
> >         this(id,null);
> >     }
> >
> >  }
> >
> >  I am not able to achieve this because onRequest() does not get called
> for
> >  AjaxFadeBehaviour.
> >  I am confused about which class I should extend to achieve this??
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to