Skip to content

Instantly share code, notes, and snippets.

@hendrikebbers
Created November 1, 2014 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendrikebbers/2fe09e4ad2f971fd3ffc to your computer and use it in GitHub Desktop.
Save hendrikebbers/2fe09e4ad2f971fd3ffc to your computer and use it in GitHub Desktop.
JWrap JavaFX Controller
public class JavaFXDemoController {
@ViewNode
@ActionTrigger("copy-action")
private Button myButton;
@ViewNode
private TextField myTextField;
@ViewNode
private Label myLabel;
@ActionMethod("copy-action")
private void copy() {
ProcessChain.create().
addSupplierInPlatformThread(() -> myTextField.getText()).
addFunctionInExecutor((t) -> WeatherService.getWeather(t)).
addConsumerInPlatformThread((t) -> myLabel.setText(t)).onException((e) -> {
myLabel.setText("Error");
e.printStackTrace();
}).run();
}
@PostConstruct
private void init() {
System.out.println("TADA");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment