-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from sialcasa/#136_unify_cdi_guice
#136 unify cdi guice
- Loading branch information
Showing
8 changed files
with
121 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/MvvmfxApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package de.saxsys.mvvmfx.internal; | ||
|
||
import javafx.application.Application; | ||
import javafx.stage.Stage; | ||
|
||
/** | ||
* This interface defines a common set of methods that the root application classes of extensions of mvvmfx should | ||
* implement. | ||
* | ||
* The interface is intended as an internal helper to unify the API of the official mvvmFX extensions (Guice and CDI at the | ||
* moment). It is <strong>not</strong> intended to be used for other use cases. | ||
* | ||
* A mvvmfx extension has to do the following: | ||
* <ol> | ||
* <li>Overwrite {@link Application#init()} method with <string>final</string>. In this method the extension can do some | ||
* bootstrapping (if needed).</li> | ||
* <li>Call {@link #initMvvmfx()} as last step in the overwritten init method. The contract is that the | ||
* {@link #initMvvmfx()} is called when the basic container bootstrapping is done so that the user can do her own | ||
* initialization in this method.</li> | ||
* <li>Implement {@link Application#start(Stage)} method. In this method own startup logic can be done (if needed).</li> | ||
* <li>Call {@link #startMvvmfx(Stage)} as last step in the overwritten start method. Pass the stage instance from the | ||
* original {@link Application#start(Stage)} method to {@link #startMvvmfx(Stage)}.</li> | ||
* <li>Implement {@link Application#stop()} method. In this method own shutdown logic can be done (if needed).</li> | ||
* <li>Call {@link #stopMvvmfx()} as last step in the overwritten stop method.</li> | ||
* </ol> | ||
* | ||
*/ | ||
public interface MvvmfxApplication { | ||
|
||
/** | ||
* This method is called when the javafx application is initialized. See | ||
* {@link javafx.application.Application#init()} for more details. | ||
* | ||
* @throws Exception | ||
*/ | ||
default void initMvvmfx() throws Exception { | ||
} | ||
|
||
/** | ||
* Override this method with your application startup logic. | ||
* <p/> | ||
* This method is a wrapper method for javafx's {@link javafx.application.Application#start(javafx.stage.Stage)}. | ||
*/ | ||
void startMvvmfx(Stage stage) throws Exception; | ||
|
||
/** | ||
* This method is called when the application should stop. See {@link javafx.application.Application#stop()} for | ||
* more details. | ||
* | ||
* @throws Exception | ||
*/ | ||
default void stopMvvmfx() throws Exception { | ||
} | ||
|
||
} |