Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
FXMLConstructor.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2013-15 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package org.sleuthkit.autopsy.timeline;
20
21import java.io.IOException;
22import java.net.MalformedURLException;
23import java.net.URL;
24import java.util.logging.Level;
25import javafx.fxml.FXMLLoader;
26import javafx.scene.Node;
27import org.sleuthkit.autopsy.coreutils.Logger;
28import org.sleuthkit.autopsy.coreutils.ThreadConfined;
29
46public class FXMLConstructor {
47
48 private static final Logger LOGGER = Logger.getLogger(FXMLConstructor.class.getName());
49
60 static public void construct(Node node, String fxmlFileName) {
61 construct(node, node.getClass(), fxmlFileName);
62 }
63
76 static public void construct(Node node, Class<? extends Node> clazz, String fxmlFileName) {
77 final String name = "nbres:/" + clazz.getPackage().getName().replace(".", "/") + "/" + fxmlFileName; // NON-NLS
78
79 try {
80 FXMLLoader fxmlLoader = new FXMLLoader(new URL(name));
81 fxmlLoader.setRoot(node);
82 fxmlLoader.setController(node);
83
84 try {
85 fxmlLoader.load();
86 } catch (IOException exception) {
87 LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, falling back on default Class Loader, and trying again.", exception); //NON-NLS
88 try {
89 fxmlLoader.setClassLoader(FXMLLoader.getDefaultClassLoader());
90 fxmlLoader.load();
91 } catch (IOException ex) {
92 LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, node initialization may not be complete.", ex); //NON-NLS
93 }
94 }
95 } catch (MalformedURLException ex) {
96 LOGGER.log(Level.SEVERE, "FXMLConstructor was unable to load FXML, node initialization may not be complete.", ex); //NON-NLS
97 }
98 }
99
100 private FXMLConstructor() {
101 }
102}
synchronized static Logger getLogger(String name)
Definition Logger.java:124
static void construct(Node node, String fxmlFileName)

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.