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

[commands] Restart of DelegateCommand #399

Closed
tfleis opened this issue Jun 15, 2016 · 3 comments
Closed

[commands] Restart of DelegateCommand #399

tfleis opened this issue Jun 15, 2016 · 3 comments
Milestone

Comments

@tfleis
Copy link

tfleis commented Jun 15, 2016

A JavaFX Service can be restarted by calling Service.restart(). If there is a current running task it is cancelled. The behaviour of a DelegateCommand is different. When you execute the DelegateCommand twice it is only started once.

if (inBackground) {
  if (!super.isRunning()) {
    reset();
    start();
  }
} 

A DelegateCommand is a Service so we can call DelegateCommand.restart() directly. By doing that we don't gain the advantages of the Command class (e.g. testability).

My expectation is:

if (inBackground) {
  super.restart();
} 
@mainrs
Copy link
Contributor

mainrs commented Jun 26, 2016

I understand your argumentation. I would expect the same behavior as you. Still, would like to here something from @lestard or @sialcasa concerning this.

@manuel-mauky
Copy link
Collaborator

Sorry, I hadn't had time to respond. I will look into this issue on monday.

@manuel-mauky
Copy link
Collaborator

manuel-mauky commented Jun 30, 2016

I've created a test case that verifies that both service and delegate command have equal behaviour regarding restarting. It works with your suggested fix.

As far as I can see this should work but I'm not as experienced as alex when it comes to Services and Commands. @sialcasa can you please review this issue and the provided fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants