Skip to content

Commit

Permalink
Merge pull request #407 from sialcasa/release
Browse files Browse the repository at this point in the history
merge release branch into stable for version 1.5.1
  • Loading branch information
manuel-mauky authored Jun 22, 2016
2 parents 88c6ed0 + 87c5ad5 commit 40e603e
Show file tree
Hide file tree
Showing 31 changed files with 652 additions and 183 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This is the stable release that can be used in production.
<dependency>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
```

Expand All @@ -32,7 +32,7 @@ Here we make bug fixes for the current stable release.
<dependency>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.5.2-SNAPSHOT</version>
</dependency>
```

Expand All @@ -56,9 +56,9 @@ If you need help you can use the forums on [Google Groups](https://groups.google
### Links

- [Project Page](http://sialcasa.github.io/mvvmFX/)
- [javadoc mvvmfx core](http://sialcasa.github.io/mvvmFX/javadoc/1.4.0/mvvmfx/)
- [javadoc mvvmfx-cdi](http://sialcasa.github.io/mvvmFX/javadoc/1.4.0/mvvmfx-cdi/)
- [javadoc mvvmfx-guice](http://sialcasa.github.io/mvvmFX/javadoc/1.4.0/mvvmfx-guice/)
- [javadoc mvvmfx-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.4.0/mvvmfx-utils/)
- [javadoc mvvmfx-testing-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.4.0/mvvmfx-testing-utils/)
- [javadoc mvvmfx core](http://sialcasa.github.io/mvvmFX/javadoc/1.5.0/mvvmfx/)
- [javadoc mvvmfx-cdi](http://sialcasa.github.io/mvvmFX/javadoc/1.5.0/mvvmfx-cdi/)
- [javadoc mvvmfx-guice](http://sialcasa.github.io/mvvmFX/javadoc/1.5.0/mvvmfx-guice/)
- [javadoc mvvmfx-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.5.0/mvvmfx-utils/)
- [javadoc mvvmfx-testing-utils](http://sialcasa.github.io/mvvmFX/javadoc/1.5.0/mvvmfx-testing-utils/)

2 changes: 1 addition & 1 deletion examples/books-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.saxsys.mvvmfx</groupId>
<artifactId>examples</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/contacts-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>de.saxsys.mvvmfx</groupId>
<artifactId>examples</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<artifactId>contacts-example</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion examples/mini-examples/fx-root-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mini-examples</artifactId>
<groupId>de.saxsys.mvvmfx</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/mini-examples/helloworld-without-fxml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mini-examples</artifactId>
<groupId>de.saxsys.mvvmfx</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/mini-examples/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mini-examples</artifactId>
<groupId>de.saxsys.mvvmfx</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/mini-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>examples</artifactId>
<groupId>de.saxsys.mvvmfx</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion examples/mini-examples/scopes-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mini-examples</artifactId>
<groupId>de.saxsys.mvvmfx</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/mini-examples/synchronizefx-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mini-examples</artifactId>
<groupId>de.saxsys.mvvmfx</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/mini-examples/welcome-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mini-examples</artifactId>
<groupId>de.saxsys.mvvmfx</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-parent</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>

<groupId>de.saxsys.mvvmfx</groupId>
Expand Down
2 changes: 1 addition & 1 deletion examples/todomvc-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.saxsys.mvvmfx</groupId>
<artifactId>examples</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion mvvmfx-archetype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-parent</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependency>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-parent</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion mvvmfx-cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-parent</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>

<artifactId>mvvmfx-cdi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mvvmfx-guice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-parent</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>

<artifactId>mvvmfx-guice</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mvvmfx-testing-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mvvmfx-parent</artifactId>
<groupId>de.saxsys</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion mvvmfx-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>mvvmfx-parent</artifactId>
<groupId>de.saxsys</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion mvvmfx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx-parent</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>

<artifactId>mvvmfx</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public interface Command {

/**
* This method will be called when the command is invoked.
* This method will be called when the command is invoked. This has to get called from FX Thread
*/
void execute();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

import java.util.function.Supplier;

import javafx.beans.property.ObjectProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import eu.lestard.doc.Beta;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.ReadOnlyBooleanProperty;
Expand All @@ -25,7 +30,6 @@
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import eu.lestard.doc.Beta;

/**
* A {@link Command} implementation of a {@link Service<Void>} that encapsulates an {@link Action} ({@link Task<Void>})
Expand All @@ -44,9 +48,10 @@ public class DelegateCommand extends Service<Void> implements Command {
protected final ReadOnlyBooleanWrapper executable = new ReadOnlyBooleanWrapper(true);
protected ReadOnlyBooleanWrapper notExecutable;
protected ReadOnlyBooleanWrapper notRunning;
private Exception occuredException;



Logger LOG = LoggerFactory.getLogger(DelegateCommand.class);

/**
* Creates a command without a condition about the executability.
Expand Down Expand Up @@ -121,6 +126,8 @@ public DelegateCommand(final Supplier<Action> actionSupplier, ObservableValue<Bo
*/
@Override
public void execute() {
occuredException = null;

if (!isExecutable()) {
throw new RuntimeException("The execute()-method of the command was called while it wasn't executable.");
} else {
Expand All @@ -130,18 +137,43 @@ public void execute() {
start();
}
} else {
try {
actionSupplier.get().action();
} catch (Exception e) {
throw new RuntimeException(e);
}
// When the command is not executed in background, we have to imitate a service execution, so the
// service statemachine provides the
// correct service state to the command.
callActionAndSynthesizeServiceRun();
}
}
}

/**
* For internal purposes we need to change the state property of the service.
*/
private ObjectProperty<State> getStateObjectPropertyReadable() {
return (ObjectProperty<State>) stateProperty();
}

private void callActionAndSynthesizeServiceRun() {
try {
getStateObjectPropertyReadable().setValue(State.SCHEDULED);

// We call the User Action. If an exception occurs we save it, therefore we can use it in the Test
// (createSynthesizedTask) to throw it during the Service invocation.
actionSupplier.get().action();

getStateObjectPropertyReadable().setValue(State.SUCCEEDED);
} catch (Exception e) {
LOG.error("Exception in Command Execution", occuredException);
this.occuredException = e;
getStateObjectPropertyReadable().setValue(State.FAILED);
}
}

@Override
protected Task<Void> createTask() {
return actionSupplier.get();
if (inBackground) {
return actionSupplier.get();
}
return createSynthesizedTask();
}

@Override
Expand Down Expand Up @@ -182,4 +214,16 @@ public final ReadOnlyBooleanProperty notRunningProperty() {
public final boolean isNotRunning() {
return notRunningProperty().get();
}

private Task<Void> createSynthesizedTask() {
return new Task<Void>() {
@Override
protected Void call() throws Exception {
if (occuredException != null) {
throw occuredException;
}
return null;
}
};
}
}
Loading

0 comments on commit 40e603e

Please sign in to comment.