Search in sources :

Example 1 with JFXRepresentation

use of org.csstudio.display.builder.representation.javafx.JFXRepresentation in project org.csstudio.display.builder by kasemir.

the class RepresentationDemoJavaFXinSWT method main.

public static void main(final String[] args) throws Exception {
    // final DisplayModel model = ExampleModels.getModel(1);
    final DisplayModel model = ExampleModels.createModel();
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText(model.getPropertyValue(propName));
    shell.setLayout(new FillLayout());
    final JFX_SWT_Wrapper wrapper = new JFX_SWT_Wrapper(shell, () -> {
        toolkit = new JFXRepresentation(false);
        return new Scene(toolkit.createModelRoot());
    });
    final Scene scene = wrapper.getScene();
    JFXRepresentation.setSceneStyle(scene);
    final Parent parent = toolkit.getModelParent();
    toolkit.representModel(parent, model);
    final DummyRuntime runtime = new DummyRuntime(model);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    runtime.shutdown();
    toolkit.shutdown();
    display.dispose();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) DisplayModel(org.csstudio.display.builder.model.DisplayModel) Parent(javafx.scene.Parent) JFXRepresentation(org.csstudio.display.builder.representation.javafx.JFXRepresentation) FillLayout(org.eclipse.swt.layout.FillLayout) JFX_SWT_Wrapper(org.csstudio.javafx.swt.JFX_SWT_Wrapper) Scene(javafx.scene.Scene) Display(org.eclipse.swt.widgets.Display)

Example 2 with JFXRepresentation

use of org.csstudio.display.builder.representation.javafx.JFXRepresentation in project org.csstudio.display.builder by kasemir.

the class RepresentationDemoJavaFX method close.

public void close(final DisplayModel model) {
    final JFXRepresentation toolkit = model.getUserData(DisplayModel.USER_DATA_TOOLKIT);
    toolkit.disposeRepresentation(model);
}
Also used : JFXRepresentation(org.csstudio.display.builder.representation.javafx.JFXRepresentation)

Aggregations

JFXRepresentation (org.csstudio.display.builder.representation.javafx.JFXRepresentation)2 Parent (javafx.scene.Parent)1 Scene (javafx.scene.Scene)1 DisplayModel (org.csstudio.display.builder.model.DisplayModel)1 JFX_SWT_Wrapper (org.csstudio.javafx.swt.JFX_SWT_Wrapper)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Display (org.eclipse.swt.widgets.Display)1 Shell (org.eclipse.swt.widgets.Shell)1