it's true that I can skip the return false part and this will continue automatically only that the actual function waits for some input and has a callback method when this input is received. So actually continuing the wicket actions is done upon activation of that callback and not when call_function() terminates...this was just a rough description
On Thu, Sep 3, 2009 at 3:57 PM, Arie Fishler <[email protected]> wrote: > let's say this behavior is adding this to the onclik just before the > wicket ajax > > ....onclick="call_function();return false;original_wicket_stuff_for_ajax()" > > Now on oncomponenttag I can read the "original_wicket_stuff_for_ajax()" > > I will modifiy call_function() to get the > "original_wicket_stuff_for_ajax()" as a parameter > > and upon completion of call_function() it will call > ""original_wicket_stuff_for_ajax()" > > This is roughly the idea...naturally it needs to take care of situations > when the component is either a regular Link or a form button.....I think it > can be managed this way or the other. > > On Thu, Sep 3, 2009 at 3:41 PM, Pedro Santos <[email protected]>wrote: > >> I agree with you, the best solution for an attachable behavior is >> composition. I just don't see it resolve that especial complexity: "I want >> this function call to resume the wicket action". >> For example: the oncomponenttag is called on the page rendering, >> idependent >> of the user interactions with the component were behavior is attached on, >> and by default the behavior is stateless (they don’t have to keep the >> reference to the components they’re attached to). >> I'm curious to know your final solution >> >> >> On Thu, Sep 3, 2009 at 9:14 AM, Arie Fishler <[email protected]> wrote: >> >> > Wel...this is the solution I wanted to avoid since this behavior can be >> > attached to buttons, links, ajax links...don't want to create onr for >> each. >> > >> > I can use the tag from the oncomponenttag and find out where it is >> supposed >> > to go originally....this seems to be the option that will work >> > >> > On Thu, Sep 3, 2009 at 3:04 PM, Pedro Santos <[email protected]> >> wrote: >> > >> > > "value that is placed in the onClick event (which has the action for >> the >> > > link or button that has the behavior placed on)" >> > > You has an parameter determining the action to be take, why don't you >> use >> > > polimorfism? >> > > >> > > "My behavior just adds a function call before any other action and I >> want >> > > this function call to resume the wicket action" >> > > You has an behavior common to onClick of a link or onSubmit of a >> button. >> > Do >> > > you consider to use inheritance instead of composition in this >> especific >> > > case because: >> > > >> > > "I want this function call to resume the wicket action" >> > > >> > > public class CustomLink/CustomButton extends Link/Button{ >> > > @override >> > > onClick or onSubmit(){ >> > > callFunctionBeforeAnyOtherAction(); >> > > callAction(); >> > > } >> > > protected abstrat void callAction(); >> > > } >> > > >> > > >> > > >> > > On Thu, Sep 3, 2009 at 8:42 AM, Arie Fishler <[email protected]> >> wrote: >> > > >> > > > The behvavior is not AbstractDefaultAjaxBehavior just one extending >> > > > AbstractBehavior. >> > > > >> > > > Can I get it somehow from the onComponentTag of the behavior? I >> > actually >> > > > need the value that is placed in the onClick event (which has the >> > action >> > > > for >> > > > the link or button that has the behavior placed on) >> > > > >> > > > My behavior just adds a function call before any other action and I >> > want >> > > > this function call to resume the wicket action (ajax click on a link >> or >> > > > submit of a button) right after the function of the behavior is >> > executed >> > > > >> > > > On Thu, Sep 3, 2009 at 2:09 PM, Pedro Santos <[email protected]> >> > > wrote: >> > > > >> > > > > To one of the decorations script must to be appended the script >> > > > responsible >> > > > > to call the behavior. You can get it invoking the >> > > > > AbstractDefaultAjaxBehavior.getCallbackScript() protected method. >> > > > > >> > > > > On Thu, Sep 3, 2009 at 7:59 AM, Arie Fishler <[email protected]> >> > > wrote: >> > > > > >> > > > > > Hi, >> > > > > > >> > > > > > We have been implementing the getAjaxCallDecorator for links >> that >> > > > > > extends AjaxLink >> > > > > > in order to manipulate the way the wicket-ajax is called on >> these >> > > > links. >> > > > > > >> > > > > > I have a need to do something similar with a behavior and not >> sure >> > > how >> > > > to >> > > > > > implement. >> > > > > > >> > > > > > I have a behavior that is applied (added) to different links. >> This >> > > > > behavior >> > > > > > needs to manipulate and control when the actual wicket-ajax call >> is >> > > > > > executed >> > > > > > for the link it is on. >> > > > > > >> > > > > > It is like the behavior needs an access to the function call >> that >> > > > > activates >> > > > > > the ajax on the link. Is there a way for a behavior to get it? >> > > > > > >> > > > > > Cheers, >> > > > > > Arie >> > > > > > >> > > > > >> > > > >> > > >> > >> > >
