cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping TimedTrigger

Former Member
0 Kudos

Hi all

I have an application that uses TimedTrigger, which triggers after each second.

I want it to stop triggering after some time say 10secs.

please help me

Thanks in advance

LakshmiNarayanaChowdary.N

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Lakshmi,

Assume you have defined this at page level

At the very end of your implementation you will get a commented section called

//@@begin others

static int i =0;//write it here

//@@end

Now we assume that we will increment the value of i everytime in the action assigned to timed trigger UI element and don't want the action to be fired after that.

            • Code of your Action called time********

public void onActiontime(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActiontime(ServerEvent)

wdComponentAPI.getMessageManager().reportSuccess((i++) + "");

//@@end

}

**********In WDDoModifyView() write this code to remove action from the timmed trigger UI element once the value of i=5*****************

if(i==5)

{

IWDTimedTrigger trigger = (IWDTimedTrigger)view.getElement("TimedTrigger");

trigger.setOnAction(null);

}

Hope this was the thing you were looking for.

Regards,

Murtuza

Former Member
0 Kudos

No, not like this.

Bind "delay" property to context attribute. Count (using non-static member or context attribute) how often the action was already triggered and set delay to 0 when the trigger should be stopped.

Armin

Former Member
0 Kudos

Thanks Armin It's worked

Regards

LakshmiNarayanaChowdary.N

Former Member
0 Kudos

Hi Murtuza,

If i give like this

if(i==20)

{

IWDTimedTrigger trigger = (IWDTimedTrigger)view.getElement("TimedTrigger");

trigger.setOnAction(null);

}

in mycode, It's raising Nullpointer Exception.. Please suggest me..

Regards

LakshmiNarayanaChowdary.N

Former Member
0 Kudos

Hi Lakshmi,

Just see that the name of your TimedTrigger is exactly(case sesitive) the same to the ID that you provided while inserting a child UI element in your view.

IWDTimedTrigger trigger = (IWDTimedTrigger)view.getElement(<b>"TimedTrigger"</b>);

Regards,

Murtuza

Former Member
0 Kudos

You could create a 2nd timer that triggers after 10 secs.

When this triggers, you could stop the 1st timer.