{"id":21322100,"url":"https://github.com/advantageous/guicefx","last_synced_at":"2025-03-15T22:44:52.693Z","repository":{"id":14288873,"uuid":"16997116","full_name":"advantageous/guicefx","owner":"advantageous","description":"Lightweight Guice integration for JavaFX","archived":false,"fork":false,"pushed_at":"2015-09-09T05:29:35.000Z","size":266,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-22T11:47:58.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/advantageous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-19T20:08:55.000Z","updated_at":"2015-08-14T03:56:01.000Z","dependencies_parsed_at":"2022-09-16T00:40:46.478Z","dependency_job_id":null,"html_url":"https://github.com/advantageous/guicefx","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fguicefx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fguicefx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fguicefx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fguicefx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/advantageous","download_url":"https://codeload.github.com/advantageous/guicefx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801612,"owners_count":20350106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T20:13:16.164Z","updated_at":"2025-03-15T22:44:52.661Z","avatar_url":"https://github.com/advantageous.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/advantageous/guicefx.png)](https://travis-ci.org/advantageous/guicefx)\n##Lightweight Guice integration for JavaFX\n\nThis is a simple library for creating a [MVP](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter)\nJavaFX application that uses [Google Guice](https://code.google.com/p/google-guice/).\n\n##Quickstart\n\n###1. Add maven/gradle dependency\n\nIf you are using Maven, add the dependency to your pom.xml\n```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.advantageous.guicefx\u003c/groupId\u003e\n        \u003cartifactId\u003eguicefx\u003c/artifactId\u003e\n        \u003cversion\u003e0.2.3\u003c/version\u003e\n    \u003c/dependency\u003e\n```\nIf you are using Gradle\n```groovy\n    compile 'io.advantageous.guicefx:guicefx:0.2.3'\n```\n\n###2. Create an FXML view.\n\nYou will need to access the root of your view from your presenter, so make sure you put an fx:id on your root element.\n\n```xml\n    \u003cVBox fx:id=\"root\" xmlns:fx=\"http://javafx.com/fxml\"\u003e\n        \u003cchildren\u003e\n            \u003cLabel fx:id=\"myText\" text=\"Hello, world!\"/\u003e\n        \u003c/children\u003e\n    \u003c/VBox\u003e\n```\n\n###3. Use either the @Presents or @LoadedBy annotations on your controller/presenter classes.\n\nUse the @LoadedBy annotation if your FXML contains a fx:controller attribute.\n\n```java\n    @LoadedBy(value = \"MyView.fxml\")\n    public class MyController {\n        ...\n    }\n```\n\nUse @Presents if your fxml does not contain a fx:controller.\n\n```java\n    @Presents(value = \"MyView.fxml\")\n    public class MyPresenter {\n        ...\n    }\n```\n\n###4. Map an FXML field to your root element and provide an accessor.\n\nYou will be injecting your presenters throughout your application and will need this accessor to get the view.\n\n```java\n    @FXML\n    private VBox root;\n\n    public VBox getRoot() {\n        return root;\n    }\n```\n\n###5. Create a JavaFXModule just like you would create a Guice module.\n\n```java\n    public class MyApplicationModule extends JavaFXModule {\n\n        @Override\n        protected void configureFXApplication() {\n            //Do your Guice config here\n        }\n    }\n```\n\n###6. Initialize your Guice module in the application entry-point and inject your presenter.\n\n```java\n    public class MyApplication extends Application {\n\n        @Inject\n        private MyPresenter myPresenter;\n\n        @Override\n        public void start(final Stage stage) throws Exception {\n            Guice.createInjector(new MyApplicationModule()).injectMembers(this);\n            stage.setScene(new Scene(myPresenter.getRoot()));\n            stage.show();\n        }\n\n    }\n```\n\n###7. Bind your entry-point class. (Optional, but recommended)\n\nThe entry-point class does a injectMembers on itself, so you may wonder why you would want to also add it in the binder.\nThe reason that it is here is so when Guice constructs it's graph of dependencies, it will throw an nice readable error\nif there is a problem in the entry-point class.  Without this bind here, if there were injection problems in\nthe entry point, you would get an ugly exception when you did the injectMembers.\n\n```java\n    public class MyApplicationModule extends JavaFXModule {\n\n        @Override\n        protected void configureFXApplication() {\n            bind(MyApplication.class);\n        }\n    }\n```\n\n####A complete working example can be found in the examples folder of the project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fguicefx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadvantageous%2Fguicefx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fguicefx/lists"}