Example usage for javafx.scene Node getClass

List of usage examples for javafx.scene Node getClass

Introduction

In this page you can find the example usage for javafx.scene Node getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:de.bayern.gdi.gui.Controller.java

private void extractStoredQuery() {
    ItemModel data = this.dataBean.getDatatype();
    if (data instanceof StoredQueryModel) {
        this.dataBean.setAttributes(new ArrayList<DataBean.Attribute>());

        ObservableList<Node> children = this.simpleWFSContainer.getChildren();
        for (Node n : children) {
            if (n.getClass() == HBox.class) {
                HBox hbox = (HBox) n;/*from   w  w  w  .  j ava2 s .com*/
                ObservableList<Node> hboxChildren = hbox.getChildren();
                String value = "";
                String name = "";
                String type = "";
                Label l1 = null;
                Label l2 = null;
                TextField tf = null;
                ComboBox cb = null;
                for (Node hn : hboxChildren) {
                    if (hn.getClass() == ComboBox.class) {
                        cb = (ComboBox) hn;
                    }
                    if (hn.getClass() == TextField.class) {
                        tf = (TextField) hn;
                    }
                    if (hn.getClass() == Label.class) {
                        if (l1 == null) {
                            l1 = (Label) hn;
                        }
                        if (l1 != (Label) hn) {
                            l2 = (Label) hn;
                        }
                    }
                    if (tf != null && (l1 != null || l2 != null)) {
                        name = tf.getUserData().toString();
                        value = tf.getText();
                        if (l2 != null && l1.getText().equals(name)) {
                            type = l2.getText();
                        } else {
                            type = l1.getText();
                        }
                    }
                    if (cb != null && (l1 != null || l2 != null)
                            && cb.getId().equals(UIFactory.getDataFormatID())) {
                        name = OUTPUTFORMAT;
                        if (cb.getSelectionModel() != null
                                && cb.getSelectionModel().getSelectedItem() != null) {
                            value = cb.getSelectionModel().getSelectedItem().toString();
                            type = "";
                        } else {
                            Platform.runLater(() -> setStatusTextUI(I18n.getMsg(GUI_FORMAT_NOT_SELECTED)));
                        }
                    }
                    if (!name.isEmpty() && !value.isEmpty()) {
                        this.dataBean.addAttribute(name, value, type);
                    }
                }
            }
        }
    }
}

From source file:org.sleuthkit.autopsy.imageanalyzer.FXMLConstructor.java

static public void construct(Node n, String fxmlFileName) {
    final String name = "nbres:/" + StringUtils.replace(n.getClass().getPackage().getName(), ".", "/") + "/"
            + fxmlFileName;// w w w . j  av a 2  s. c o m
    //        System.out.println(name);

    try {
        FXMLLoader fxmlLoader = new FXMLLoader(new URL(name));
        fxmlLoader.setRoot(n);
        fxmlLoader.setController(n);

        try {
            fxmlLoader.load();
        } catch (IOException exception) {
            try {
                fxmlLoader.setClassLoader(FXMLLoader.getDefaultClassLoader());
                fxmlLoader.load();
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    } catch (MalformedURLException ex) {
        Exceptions.printStackTrace(ex);
    }

}

From source file:org.sleuthkit.autopsy.timeline.FXMLConstructor.java

static public void construct(Node n, String fxmlFileName) {
    final String name = "nbres:/" + StringUtils.replace(n.getClass().getPackage().getName(), ".", "/") + "/"
            + fxmlFileName; // NON-NLS
    System.out.println(name);//from  w  w  w . jav  a  2 s .c om

    try {
        FXMLLoader fxmlLoader = new FXMLLoader(new URL(name));
        fxmlLoader.setRoot(n);
        fxmlLoader.setController(n);

        try {
            fxmlLoader.load();
        } catch (IOException exception) {
            try {
                fxmlLoader.setClassLoader(FXMLLoader.getDefaultClassLoader());
                fxmlLoader.load();
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    } catch (MalformedURLException ex) {
        Exceptions.printStackTrace(ex);
    }
}