Example usage for javafx.scene Node lookup

List of usage examples for javafx.scene Node lookup

Introduction

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

Prototype

public Node lookup(String selector) 

Source Link

Document

Finds this Node , or the first sub-node, based on the given CSS selector.

Usage

From source file:Main.java

public static Node lookup(Node root, String id) {
    if (id.startsWith("#")) {
        id = id.substring(1);/*from  w w w .j  a  v a2 s .  c om*/
    }
    Node node = root.lookup('#' + id);
    if (node == null) {
        return lookupInternal(root, id);
    }
    return node;
}

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

private List<ProcessingStep> extractProcessingSteps() {

    List<ProcessingStep> steps = new ArrayList<>();
    if (!this.chkChain.isSelected()) {
        return steps;
    }//  www  .j a v a 2 s.  c o  m

    Set<Node> parameter = this.chainContainer.lookupAll("#process_parameter");

    if (parameter.isEmpty()) {
        return steps;
    }

    String format = this.dataBean.getAttributeValue(OUTPUTFORMAT);
    if (format == null || format.isEmpty()) {
        setStatusTextUI(I18n.getMsg(GUI_PROCESS_NO_FORMAT));
        logToAppLog(I18n.getMsg(GUI_PROCESS_NO_FORMAT));
        return steps;
    }

    MIMETypes mtypes = Config.getInstance().getMimeTypes();
    MIMEType mtype = mtypes.findByName(format);
    if (mtype == null) {
        setStatusTextUI(I18n.getMsg(GUI_PROCESS_FORMAT_NOT_FOUND));
        logToAppLog(I18n.getMsg(GUI_PROCESS_FORMAT_NOT_FOUND));
        return steps;
    }

    for (Node n : parameter) {
        Set<Node> vars = n.lookupAll("#process_var");
        Node nameNode = n.lookup("#process_name");
        ComboBox namebox = (ComboBox) nameNode;
        ProcessingStepConfiguration psc = (ProcessingStepConfiguration) namebox.getValue();

        String name = psc.getName();

        if (!psc.isCompatibleWithFormat(mtype.getType())) {
            setStatusTextUI(I18n.format(GUI_PROCESS_NOT_COMPATIBLE, name));
            logToAppLog(I18n.format(GUI_PROCESS_NOT_COMPATIBLE, name));
            continue;
        }

        ProcessingStep step = new ProcessingStep();
        steps.add(step);
        step.setName(name);
        ArrayList<Parameter> parameters = new ArrayList<>();
        step.setParameters(parameters);

        for (Node v : vars) {
            String varName = null;
            String varValue = null;
            if (v instanceof TextField) {
                TextField input = (TextField) v;
                varName = input.getUserData().toString();
                varValue = input.getText();
            } else if (v instanceof ComboBox) {
                ComboBox input = (ComboBox) v;
                varName = input.getUserData().toString();
                varValue = input.getValue() != null ? ((Option) input.getValue()).getValue() : null;
            }
            if (varName != null && varValue != null) {
                Parameter p = new Parameter(varName, varValue);
                parameters.add(p);
            }
        }
    }
    return steps;
}