Examples of FXMLLoader


Examples of at.bestsolution.efxclipse.tooling.fxgraph.converter.FXMLLoader

public class ConvertFXMLHandler extends AbstractConverterHandler {

  @Override
  protected String convert(IFile outFile, IFile file)
      throws ExecutionException {
    FXMLLoader loader = new FXMLLoader();
    Model m = loader.loadModel(file);
    return new FXGraphConverter().generate(m).toString();
  }
View Full Code Here

Examples of javafx.fxml.FXMLLoader

    private EscalationsPresenterBindings bindings;
    private Stage dialogStage;

    public Scripts(EscalationsPresenterBindings bindings) {
        this.bindings = bindings;
        this.loader = new FXMLLoader(Scripts.class.getResource("scripts.fxml"));
        try {
            this.loader.load();
        } catch (IOException ex) {
            throw new IllegalStateException("Cannot load scripts.fxml");
        }
View Full Code Here

Examples of javafx.fxml.FXMLLoader

  private final FXMLLoader fxmlLoader;
 
  public FxmlForm(String dynamicTitle, C controller, MessageProvider messageProvider, ShowFormStrategy<?> showFormStrategie) {
    super(dynamicTitle, showFormStrategie, controller);
    if (controller.getFxmlResource()!=GenericFilterController.EMPTY_DUMMY_URL){
      fxmlLoader = new FXMLLoader(controller.getFxmlResource());
      fxmlLoader.setController(controller);
      fxmlLoader.setResources(messageProvider.getBundle());
    } else {
      fxmlLoader = null;
    }
View Full Code Here

Examples of javafx.fxml.FXMLLoader

        this.init(getClass(), getFXMLName());
    }

    private void init(Class clazz, String conventionalName) {
        final URL resource = clazz.getResource(conventionalName);
        this.loader = new FXMLLoader(resource);
        this.loader.setControllerFactory(new Callback<Class<?>, Object>() {
            @Override
            public Object call(Class<?> p) {
                return InjectionProvider.instantiatePresenter(p);
            }
View Full Code Here

Examples of javafx.fxml.FXMLLoader

        };
        this.lazyLoader = (Future<FXMLLoader>) THREAD_POOL.submit(initialization);
    }

    FXMLLoader loadAsynchronously(final URL resource, ResourceBundle bundle, final String conventionalName) throws IllegalStateException {
        final FXMLLoader loader = new FXMLLoader(resource, bundle);
        loader.setControllerFactory(new Callback<Class<?>, Object>() {
            @Override
            public Object call(Class<?> p) {
                return InjectionProvider.instantiatePresenter(p);
            }
        });
        final Runnable runnable = new Runnable() {

            @Override
            public void run() {
                try {
                    loader.load();
                } catch (IOException ex) {
                    throw new IllegalStateException("Cannot load " + conventionalName, ex);
                }
            }
        };
View Full Code Here

Examples of javafx.fxml.FXMLLoader

                location = new URL(locationString);
            } catch (final MalformedURLException e) {
                throw new RuntimeException(String.format("Cannot construct URL from string '%s'.", locationString), e);
            }
        }
        final FXMLLoader fxmlLoader = new FXMLLoader();
        fxmlLoader.setLocation(location);
        final String resourcesString = annotation.resources();
        if (!resourcesString.isEmpty()) {
            fxmlLoader.setResources(ResourceBundle.getBundle(resourcesString));
        }
        fxmlLoader.setCharset(Charset.forName(annotation.charset()));
        fxmlLoader.setController(instance);
        fxmlLoader.setRoot(instance);
        fxmlLoader.setBuilderFactory(injector.getInstance(FXMLComponentBuilderFactory.class));

        // Invoke "fxmlLoader.setTemplate(true)" if we are using JavaFX 8.0 or
        // higher to improve performance on objects that are created multiple times.
        try {
            final Method setTemplateMethod = FXMLLoader.class.getMethod("setTemplate", boolean.class);
            setTemplateMethod.invoke(fxmlLoader, Boolean.TRUE);
        } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            // We simply ignore this exception. It means that we are using
            // a JavaFX runtime prior to JavaFX 8.0.
        }

        // Actual instantiation of the component has to happen on the JavaFX thread.
        // We simply delegate the loading.
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                try {
                    final Object loaded = fxmlLoader.load();
                    if (loaded != instance) {
                        throw new IllegalStateException("Loading of FXML component went terribly wrong! :-(");
                    }
                } catch (final IOException e) {
                    throw new RuntimeException(e);
View Full Code Here

Examples of javafx.fxml.FXMLLoader

        this.bundleName = getBundleName();
        this.bundle = getResourceBundle(bundleName);
    }

    FXMLLoader loadSynchronously(final URL resource, ResourceBundle bundle, final String conventionalName) throws IllegalStateException {
        final FXMLLoader loader = new FXMLLoader(resource, bundle);
        loader.setControllerFactory((Class<?> p) -> Injector.instantiatePresenter(p, this.injectionContext));
        try {
            loader.load();
        } catch (IOException ex) {
            throw new IllegalStateException("Cannot load " + conventionalName, ex);
        }
        return loader;
    }
View Full Code Here

Examples of javafx.fxml.FXMLLoader

    public void start(final Stage stage) throws Exception {
        // load main window layout and resources
        // final Parent root = FXMLLoader.load(getClass().getResource(FXML_MAIN), ResourceBundle.getBundle("ApplicationResources"));

        final URL location = getClass().getResource(FXML_MAIN);
        final FXMLLoader loader = new FXMLLoader();
        loader.setLocation(location);
        loader.setBuilderFactory(new JavaFXBuilderFactory());
        loader.setResources(ResourceBundle.getBundle("ApplicationResources"));
        final Parent root = (Parent) loader.load(location.openStream());

        // set controller into provider
        ControllerProvider.getInstance().setMainController((MainController) loader.getController());

        // create scene and display window
        final Scene scene = new Scene(root, 1300, 900);
        scene.getStylesheets().add(FILE_STYLESHEETS);
        stage.setTitle(APPLICATION_TITLE);
View Full Code Here

Examples of javafx.fxml.FXMLLoader

import javafx.scene.Node;
import javafx.scene.layout.Region;

public class FXMLScreen extends Region {
    public FXMLScreen(String fxmlFile) {
        FXMLLoader loader = new FXMLLoader(FXMLScreen.class.getResource(fxmlFile));
        loader.setController(this);

        try {
            this.getChildren().add((Node) loader.load());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of javafx.fxml.FXMLLoader

     */
    public Result load(final URL url, final ResourceBundle resources) throws IOException  {

        fxmlLoadingScope.enter(this);

        final FXMLLoader loader = new FXMLLoader();
        loader.setLocation(url);
        if (resources != null) {
            loader.setResources(resources);
        }
        loader.setBuilderFactory(injector.getInstance(FXMLComponentBuilderFactory.class));
        loader.setControllerFactory(new Callback<Class<?>, Object>() {
            @Override
            public Object call(final Class<?> param) {
                // Use our Guice injector to fetch an instance of the desired
                // controller class
                return param == null ? null : injector.getInstance(param);
            }
        });

        final Node root = (Node) loader.load(url.openStream());

        // Prepares the result that is being returned after loading the FXML hierarchy.
        final Result result = new Result();
        result.location.set(loader.getLocation());
        result.resources.set(loader.getResources());
        result.controller.set(loader.getController());
        result.root.set(root);
        result.charset.set(loader.getCharset());

        fxmlLoadingScope.exit();

        return result;

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.