Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the possibility to stop the internal timer in ViewControlsSelectListener #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/gov/nasa/worldwind/layers/ViewControlsSelectListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,29 @@ public void actionPerformed(ActionEvent event)
/**
* Set the repeat timer delay in milliseconds.
*
* If the delay <= 0 then the internal timer will be stopped.
*
* Here are some explaination why stopping the timer could be a good idea :
* Some developpers don't uses System.exit() to terminate a java process (the jvm
* is terminated automatically if no more (non-deamons) threads are running, this way
* it's possible to check that every code is managed correctly when the app is quitting).
* The internal timer does not allow this behaviour, because if the timer is not stopped
* the jvm will never terminate...
*
* @param delay the repeat timer delay in milliseconds.
*
* @throws IllegalArgumentException
*/
public void setRepeatTimerDelay(int delay)
{
if (delay <= 0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", delay);
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
if (delay <= 0) {
this.repeatTimer.stop();

} else {
this.repeatTimer.setDelay(delay);
this.repeatTimer.restart();
}
this.repeatTimer.setDelay(delay);

}

/**
Expand Down