A JacpFX application has a hierarchical structure composed of a Workbench, Perspective(s) and Component(s). All references to them are handled by ID's inside the component annotation of the parent component.
@Workbench(id = "id1", name = "workbench",
perspectives = {
BaseConfiguration.PERSPECTIVETWO,
BaseConfiguration.PERSPECTIVEONE
})
@Perspective(id = BaseConfiguration.PERSPECTIVEONE, name = "contactPerspective",
components = {
BaseConfiguration.COMPONENTONE,
BaseConfiguration.COMPONENT_TWO
},
resourceBundleLocation = "bundles.languageBundle")
Perspectives are defining the layout structure of your view. You can define "render-targets" in your Perspective by ID, to mark areas where Component views should be rendered. Each Component of a Perspective can register to a specific "render-target", so the resulting view of a Component will be included at that specific area. The "render-target" of a Component can also be changed at runtime, so a Component view can be moved from one area in Perspective to an other.
@Perspective(id = BaseConfig.ID, name = "p1",components = {…},
viewLocation = "/fxml/ExamplePerspective.fxml")
public class ExampleFXMLPerspective implements FXPerspective {
@FXML
private HBox contentTop;
@FXML
private BorderPane contentBottom;
@PostConstruct
public void onStartPerspective(final PerspectiveLayout perspectiveLayout, final FXComponentLayout layout,
final ResourceBundle resourceBundle) {
// register left menu
perspectiveLayout.registerTargetLayoutComponent(PerspectiveIds.TARGET_CONTAINER_TOP, contentTop);
// register main content
perspectiveLayout.registerTargetLayoutComponent(PerspectiveIds.TARGET_CONTAINER_BOTTOM, contentBottom);
}
}
@DeclarativeView(id = ComponentIds.COMPONENT_ONE,
name = "SimpleView",
active = true,
resourceBundleLocation = "bundles.languageBundle",
initialTargetLayoutId = PerspectiveIds.TARGET_CONTAINER_TOP,
viewLocation = "/fxml/ComponentOne.fxml")
public class ComponentOne implements FXComponent {
...
}