-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connect VirtualTreeGroup to FxSceneBuilderProcessors
- Loading branch information
1 parent
0bdf4af
commit 2e75698
Showing
13 changed files
with
113 additions
and
20 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
9 changes: 9 additions & 0 deletions
9
module-fx/src/main/java/place/sita/modulefx/annotations/FxMessageListener.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,9 @@ | ||
package place.sita.modulefx.annotations; | ||
|
||
import java.lang.annotation.*; | ||
|
||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface FxMessageListener { | ||
} |
12 changes: 12 additions & 0 deletions
12
module-fx/src/main/java/place/sita/modulefx/annotations/ModuleFx.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,12 @@ | ||
package place.sita.modulefx.annotations; | ||
|
||
import java.lang.annotation.*; | ||
|
||
/** | ||
* Generic annotation to autowire a ModuleFx utility. | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.FIELD) | ||
public @interface ModuleFx { | ||
} |
10 changes: 10 additions & 0 deletions
10
module-fx/src/main/java/place/sita/modulefx/messagebus/MessageSender.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,10 @@ | ||
package place.sita.modulefx.messagebus; | ||
|
||
/** | ||
* See {@link place.sita.modulefx.annotations.ModuleFx}. | ||
*/ | ||
public interface MessageSender { | ||
|
||
void send(Object message); | ||
|
||
} |
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
26 changes: 26 additions & 0 deletions
26
module-fx/src/main/java/place/sita/modulefx/processors/MessageBusSupportProcessor.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,26 @@ | ||
package place.sita.modulefx.processors; | ||
|
||
import place.sita.modulefx.FxSceneBuilderProcessor; | ||
import place.sita.modulefx.FxSetupContext; | ||
import place.sita.modulefx.annotations.FxChild; | ||
import place.sita.modulefx.vtg.VirtualTreeGroupElement; | ||
|
||
import java.util.Arrays; | ||
|
||
public class MessageBusSupportProcessor implements FxSceneBuilderProcessor { | ||
@Override | ||
public void process(FxSetupContext context) { | ||
VirtualTreeGroupElement element = new VirtualTreeGroupElement(); | ||
boolean addedToAnyVirtualTreeGroup = false; | ||
|
||
|
||
Object controller = context.controller(); | ||
|
||
Class<?> controllerClass = controller.getClass(); | ||
Arrays.stream(controllerClass.getDeclaredFields()) | ||
.filter(field -> field.isAnnotationPresent(FxChild.class)) | ||
.forEach(field -> { | ||
injectChild(controller, field, controllerClass, context); | ||
}); | ||
} | ||
} |
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