Trait j4rs::jfx::JavaFxSupport

source ·
pub trait JavaFxSupport {
    // Required methods
    fn start_javafx_app(&self) -> Result<InstanceReceiver>;
    fn deploy_javafx_dependencies(&self) -> Result<()>;
    fn get_javafx_event_receiver(
        &self,
        instance: &Instance,
        fx_event_type: FxEventType
    ) -> Result<InstanceReceiver>;
    fn on_close_event_receiver(
        &self,
        stage: &Instance
    ) -> Result<InstanceReceiver>;
    fn load_fxml(
        &self,
        path: &PathBuf,
        stage: &Instance
    ) -> Result<FxController>;
}
Expand description

Provides JavaFx support.

Required Methods§

source

fn start_javafx_app(&self) -> Result<InstanceReceiver>

Triggers the start of a JavaFX application. When the JavaFX application starts, the InstanceReceiver channel will receive an Instance of javafx.stage.Stage.

The UI may start being built using the provided Stage

source

fn deploy_javafx_dependencies(&self) -> Result<()>

Deploys the required dependencies to run a JavaFX application in order to be able to be used by j4rs.

source

fn get_javafx_event_receiver( &self, instance: &Instance, fx_event_type: FxEventType ) -> Result<InstanceReceiver>

Creates an instance receiver that will be receiving Instances of events. The fx_event_type argument is the type of the event that we want to handle and receive Instances for.

For example, to create an InstanceReceiver for a ‘javafx.scene.control.Button’, you need to call the method by using the button as the instance argument FxEventType::ActionEvent_Action as the fx_event_type argument

source

fn on_close_event_receiver(&self, stage: &Instance) -> Result<InstanceReceiver>

Creates an instance receiver that will be receiving Instances of events for onclose requests of a Stage.

The instance passed as argument needs to be of class javafx.stage.Stage.

source

fn load_fxml(&self, path: &PathBuf, stage: &Instance) -> Result<FxController>

Loads a FXML and returns a Result of a FxController for it.

Implementors§