Java 类javafx.fxml.LoadException 实例源码

项目:openjfx-8u-dev-tests    文件:staticPropertyLoadApp.java   
@Override
protected Node impl_drawNode() throws IOException
{
    final Label label = new Label();
    label.setId(LOADER_LOG_ID);
    FXMLLoader fxmlLoader = new FXMLLoader(resource);
    fxmlLoader.impl_setStaticLoad(true);
    try
    {
         fxmlLoader.load();
         label.setText(SUCCESSFUL_STATIC_LOAD);
    }
    catch(LoadException e)
    {
        e.printStackTrace();
        for(ParseTraceElement trace: fxmlLoader.impl_getParseTrace())
        {
            label.setText(label.getText() + trace.toString() + '\n');
        }
    }

    return label;
}
项目:openjfx-8u-dev-tests    文件:staticPropertyLoadApp.java   
@Override
public Node impl_drawNode() throws IOException {
Button button = null;
InputStream is = null;
FXMLLoader fxmlLoader = new FXMLLoader();
MyRootElement myRootElement = new MyRootElement();
    try {
is = resource.openStream();
fxmlLoader.load(is);
fxmlLoader.setController(myRootElement);
    } catch (Exception e) {

if(e instanceof LoadException && e.getMessage().contains("No controller specified."))
{
    return retRec;
}
        e.printStackTrace();
        System.out.println("message: " + e.getMessage());
        reportGetterFailure("exception thrown.");
    } finally {
        is.close();
    }
reportGetterFailure("Controller is not null.");
return redRectangle;
}
项目:RichTextFX    文件:FxmlTester.java   
@Test
public void test_fxml_construction_of_area() throws IOException, LoadException
{
    // FxmlTest.fxml is located in resources folder: src/integrationTest/resources/org/fxmisc/richtext/api/
    FXMLLoader fxml = new FXMLLoader( getClass().getResource( "FxmlTest.fxml" ) );
    StyleClassedTextArea area = (StyleClassedTextArea) fxml.load();
    // fxml.load() will throw a LoadException if any properties failed to be set,
    // so if 'area' is not null then all properties are guaranteed to have been set.
    org.junit.Assert.assertNotNull( area );

    FxmlTest ctrl = fxml.getController();
    // Check that the controller was loaded and that it has the relevant
    // test methods which are referenced in the loaded fxml file.
    org.junit.Assert.assertNotNull( ctrl );
    ctrl.testWithMouseEvent( null );
    ctrl.testWithOutMouseEvent();
}
项目:EasyFXML    文件:BaseEasyFxmlTest.java   
@Test
public void load_with_type_single_invalid_file_failure() {
    final Try<? extends Node> failingLoadResult = this.easyFxml.loadNode(TEST_NODES.INVALID);

    this.assertPaneFailedLoadingAndDidNotRegister(
        failingLoadResult,
        this.controllerManager.getSingle(TEST_NODES.INVALID),
        LoadException.class
    );
}
项目:EasyFXML    文件:BaseEasyFxmlTest.java   
@Test
public void load_with_type_multiple_invalid_file_failure() {
    final Try<Pane> testPaneLoadResult = this.easyFxml.loadNode(TEST_NODES.INVALID, SELECTOR);

    this.assertPaneFailedLoadingAndDidNotRegister(
        testPaneLoadResult,
        this.controllerManager.getMultiple(TEST_NODES.INVALID, SELECTOR),
        LoadException.class
    );
}
项目:openjfx-8u-dev-tests    文件:staticPropertyLoadApp.java   
@Override
        public Node impl_drawNode() throws IOException {
        VBox vb = new VBox();
        vb.setId("vb_root");
        Node node = null;
        FXMLLoader fxmlLoader = new FXMLLoader();
            InputStream is = null;
            try {
        is = resource.openStream();
        node = (Node) fxmlLoader.load(is);
        fxmlLoader.setRoot(vb);
            } catch (LoadException e) {
                e.printStackTrace();
                System.out.println("message: " + e.getMessage());
                return retRec;
            } catch (Exception exc) {
                exc.printStackTrace();
                System.out.println("message: " + exc.getMessage());
                reportGetterFailure("exception thrown.");
            } finally {
                is.close();
            }
//      if(node.getId() == null || !node.getId().equals("default_root"))
//      {
//      reportGetterFailure("Root id: " + node.getId());
//      }
        return redRectangle;
        }
项目:exchange    文件:FxmlViewLoaderTests.java   
@Test
public void malformedFxmlFileShouldThrow() {
    thrown.expect(ViewfxException.class);
    thrown.expectMessage("Failed to load view from FXML file");
    thrown.expectCause(instanceOf(LoadException.class));
    viewLoader.load(Malformed.class);
}