Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shadskii/fxcellent
Provides support for JavaFX integration with various technologies
https://github.com/shadskii/fxcellent
javafx javafx-frameworks javafx-library reactor-core spring-boot springframework
Last synced: about 1 month ago
JSON representation
Provides support for JavaFX integration with various technologies
- Host: GitHub
- URL: https://github.com/shadskii/fxcellent
- Owner: shadskii
- Created: 2017-11-01T04:10:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-06T03:08:05.000Z (about 7 years ago)
- Last Synced: 2024-10-13T18:41:17.220Z (2 months ago)
- Topics: javafx, javafx-frameworks, javafx-library, reactor-core, spring-boot, springframework
- Language: Java
- Homepage:
- Size: 78.1 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# (fx)cellent
(fx)cellent is a JavaFX integration library. The purpose of this is to provide support for integrating JavaFX with other frameworks. The following libraries are supported currently:
* [Project Reactor](http://projectreactor.io/)
* [Spring Framework](https://projects.spring.io/spring-framework/)### Spring Integration
fxcellent-spring allows for better integration of the Spring Framework and JavaFX. By leveraging the dependency injection power of spring we are able to reduce coupling between .fxml files and their controllers. This allows for greater flexibility in moving code around and reduces the overall size of controllers.JavaFX components are loaded as spring beans during application initialization.
```java
public class ExampleApplication extends Application
{
private static ClassPathResource FXML = new ClassPathResource("MainScreen.fxml");public static void main(String[] args)
{
launch(args);
}private Scene mainScene;
private ConfigurableApplicationContext ctx;@Override
public void init() throws Exception
{
FXMLLoader loader = new FXMLLoader(FXML.getURL());
mainScene = new Scene(loader.load());
SpringApplication application = new SpringApplication(ExampleApplicationConfig.class);
application.addInitializers(SpringFXLoader.loadFX(mainScene));
ctx = application.run();
}@Override
public void start(Stage primaryStage) throws Exception
{
primaryStage.setTitle("Example application");
primaryStage.setScene(mainScene);
primaryStage.show();
}
}
```Controllers now can inject JavaFX components via `@Autowired`
```java
@Autowired
private Button button1;@Autowired
private Label middleText;
````intialize` is now replaced with a `@PostConstruct`
```java
@FXML
public void intialize(){}
// Is replaced with
@PostConstruct
void intialize(){}
```### Reactor Integration
(fx)cellent-reactor provides an easy to use and fluent API for leveraging reactor for JavaFX event handling.```java
private Button btn;FxFluxFrom.nodeActionEvent(btn)
.publishOn(anotherScheduler)
.map(ActionEvent::getSource)
.subscribe(System.out::println);```