Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Close Timer and Custom Timer - How to use?
Close Timer and Custom Timer - How to use? [message #1580511] Fri, 23 January 2015 14:40 Go to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
Hi all,
I'm interesting to understand
- the differences between Close Timer and Custom Timer,
- when is properly use Close Timer and when Custom Timer
- how to use them.

Someone can give me an explanation and/or suggests where find a description and an example?

Thanks in advance for your collaboration
Re: Close Timer and Custom Timer - How to use? [message #1585539 is a reply to message #1580511] Mon, 26 January 2015 10:22 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I never used this feature of the Scout Forms. I investigated it for you. Here is what I could find:

Custom timer

If you defined a value in the custom timer property, this will start a timer when the form is opened.
index.php/fa/20579/0/
@Override
protected int getConfiguredCustomTimer() {
  return 3;
}

The provided value is a period in second.

When a the timer is started, the method execTimer(String timerId) will be called when the time is elapsed and the timer will be restarted (using the same period). The timerId String identifies the timer (see next section). For the custom timer the id is "custom".

This means that in this example the method execTimer(..) will be called each 3 seconds with the parameter timerId.equals("custom")

You can remove the custom timer by calling:
removeTimer("custom")


You can modify the period of the custom timer by calling:
setTimer("custom", period)

The period is provided in second and should be strictly bigger than 0.
Notice that in this case, the timer is removed and added again (so it will start with a new period, even if the timer was already active and in a middle of a period).

Additional custom timers

You can have additional timers like the custom timer. Just use setTimer(..) and removeTimer(..) with another id.

The parameter in execTimer(..) will be the id you have provided.

Warning: During my tests, I have noticed that you can produce some cases where multiple timers are not supported very well.

Close timer

Like for the custom timer, you set the close timer with a property:
index.php/fa/20580/0/
@Override
protected int getConfiguredCloseTimer() {
  return 30;
}


This adds a count down in the title bar.
index.php/fa/20581/0/

When the time is elapsed, the method execCloseTimer() is called. The default implementation calls doClose() on the form. You could override it to call doOk() or doCancel().

You can disarm the close timer with:
setCloseTimerArmed(false)


You can remove the close timer with
removeCloseTimer()

icon14.gif  Re: Close Timer and Custom Timer - How to use? [message #1585642 is a reply to message #1585539] Mon, 26 January 2015 11:44 Go to previous message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
Thanks Jeremie for this usefull explanation; it's a great help for me.

In the next future, I would report here my experience and I hope is usefully for other persons
Previous Topic:Table HeaderCollumn Wrap Text
Next Topic:Button width and style
Goto Forum:
  


Current Time: Sat Apr 27 02:17:02 GMT 2024

Powered by FUDForum. Page generated in 0.02681 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top