Example usage for javafx.scene.control TextField getUserData

List of usage examples for javafx.scene.control TextField getUserData

Introduction

In this page you can find the example usage for javafx.scene.control TextField getUserData.

Prototype

public Object getUserData() 

Source Link

Document

Returns a previously set Object property, or null if no such property has been set using the Node#setUserData(java.lang.Object) method.

Usage

From source file:de.ks.idnadrev.information.chart.ChartDataEditor.java

private ChangeListener<Boolean> getEditorFocusListener(int rowNum, TextField editor) {
    return (p, o, n) -> {
        if (n) {/*from   ww w.j a v a 2  s . c o m*/
            if (!isRowEmpty(rowNum) && rowNum + ROW_OFFSET == rows.size()) {
                rows.add(new ChartRow());
            }
            editor.setUserData(false);
        } else if (o && !n) {
            boolean edited = (Boolean) (editor.getUserData() == null ? false : editor.getUserData());
            if (edited) {
                triggerRedraw();
                editor.setUserData(false);
            }
        }
    };
}

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

private List<ProcessingStep> extractProcessingSteps() {

    List<ProcessingStep> steps = new ArrayList<>();
    if (!this.chkChain.isSelected()) {
        return steps;
    }//from   w  w w  .  j a v a 2s. 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;
}

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;//  w ww .  j a  va2  s . co m
                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);
                    }
                }
            }
        }
    }
}