Package javafx.beans.value

Examples of javafx.beans.value.ChangeListener


        final InvalidationListener textBoxListener = createTextBoxListener(controller, textBox);
        textBox.textProperty().addListener(textBoxListener);
        if (controller.getValue() != null) {
            textBox.textProperty().setValue(formatProvider.getFormat(controller.getElement()).format(controller.getValue()));
        }
        final ChangeListener controllerListener = createControllerListener(textBox, controller);
        controller.addListener(controllerListener);
        textBox.promptTextProperty().bind(controller.getPromptText());

        return new DisposableNodeWrapper(textBox, new Callback<Node, Void>() {
            public Void call(Node node) {
View Full Code Here


            }
        };
    }

    protected ChangeListener createControllerListener(final TextField textBox, final PropertyElementController<T> controller) {
        return new ChangeListener() {

            public void changed(ObservableValue observableValue, Object o, Object o1) {
                if (controller.getValue() != null) {
                    Number currentTextboxNumber = null;
                    try {
View Full Code Here

                    fontDefaultCheckBox.setSelected(false);
                }
            }
        });
        // create listener to call update css
        ChangeListener updateCssListener = new ChangeListener() {
            @Override public void changed(ObservableValue arg0, Object arg1, Object arg2) {
                updateCss();
            }
        };
        // add listeners to call update css
View Full Code Here

        super(fxForm, element);
    }

    @Override
    protected void bind(final FXFormNode fxFormNode) {
        changeListener = new ChangeListener() {
            @Override
            public void changed(ObservableValue observableValue, Object o, Object o2) {
                fxFormNode.getProperty().setValue(getFxForm().getAdapterProvider().getAdapter(getElement().getWrappedType(), getNode().getProperty().getClass(), getElement(), getNode()).adaptTo(getElement().getValue()));
            }
        };
View Full Code Here

        this.constraintViolations = constraintViolations;
    }

    @Override
    protected void bind(final FXFormNode fxFormNode) {
        viewChangeListener = new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                Object newValue = getFxForm().getAdapterProvider().getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode()).adaptFrom(o1);
                if (validator != null) {
                    Set<ConstraintViolation<Object>> constraintViolationSet = validator.validateValue((Class<Object>) (getElement().getBean().getClass()), getElement().getName(), newValue);
                    constraintViolations.clear();
                    constraintViolations.addAll(constraintViolationSet);
                }
                if (constraintViolations.size() == 0) {
                    ((PropertyElement) getElement()).setValue(newValue);
                }
            }
        };
        fxFormNode.getProperty().addListener(viewChangeListener);
        modelChangeListener = new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                Object newValue = getFxForm().getAdapterProvider().getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode()).adaptTo(o1);
                fxFormNode.getProperty().setValue(newValue);
            }
        };
View Full Code Here

    @Override
    protected void bind(final FXFormNode fxFormNode) {
        if (fxFormNode.isEditable()) {
            fxFormNode.getNode().setDisable(true);
        }
        changeListener = new ChangeListener() {
            @Override
            public void changed(ObservableValue observableValue, Object o, Object o2) {
                updateView(fxFormNode);
            }
        };
View Full Code Here

    }

    @Override
    protected void bind(final FXFormNode fxFormNode) {
        viewChangeListener = new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                try {
                    Adapter adapter = annotationAdapterProvider.getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode());
                    if (adapter == null) {
                        adapter = getFxForm().getAdapterProvider().getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode());
                    }
                    Object newValue = propertyElementValidator.adapt(o1, adapter);
                    propertyElementValidator.validate(newValue);
                    if (!propertyElementValidator.isInvalid()) {
                        ((PropertyElement) getElement()).setValue(newValue);
                    }
                } catch (AdapterException e) {
                    // The input value can not be adapted as model value
                    // Nothing to do, a constraint violation should have been reported by the PropertyElementValidator
                }
            }
        };
        fxFormNode.getProperty().addListener(viewChangeListener);
        modelChangeListener = new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                updateView(o1, fxFormNode);
                // The element value was updated, so request a class level check again
                getFxForm().getClassLevelValidator().validate();
            }
View Full Code Here

    @Override
    protected void bind(final FXFormNode fxFormNode) {
        if (fxFormNode.isEditable()) {
            fxFormNode.getNode().setDisable(true);
        }
        changeListener = new ChangeListener() {
            @Override
            public void changed(ObservableValue observableValue, Object o, Object o2) {
                updateView(fxFormNode);
            }
        };
View Full Code Here

    }

    @Override
    protected void bind(final FXFormNode fxFormNode) {
        viewChangeListener = new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                try {
                    Adapter adapter = annotationAdapterProvider.getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode());
                    if (adapter == null) {
                        adapter = getFxForm().getAdapterProvider().getAdapter(getElement().getType(), getNode().getProperty().getClass(), getElement(), getNode());
                    }
                    Object newValue = propertyElementValidator.adapt(o1, adapter);
                    propertyElementValidator.validate(newValue);
                    if (!propertyElementValidator.isInvalid()) {
                        if (!((PropertyElement) getElement()).isBound()) {
                            ((PropertyElement) getElement()).setValue(newValue);
                        }
                    }
                } catch (AdapterException e) {
                    // The input value can not be adapted as model value
                    // Nothing to do, a constraint violation should have been reported by the PropertyElementValidator
                }
            }
        };
        fxFormNode.getProperty().addListener(viewChangeListener);
        modelChangeListener = new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                updateView(o1, fxFormNode);
                // The element value was updated, so request a class level check again
                getFxForm().getClassLevelValidator().validate();
            }
View Full Code Here

    private final ListProperty<ConstraintViolation> constraintViolations = new SimpleListProperty<ConstraintViolation>(FXCollections.<ConstraintViolation>observableArrayList());


    public ClassLevelValidator() {
        bean.addListener(new ChangeListener() {
            @Override
            public void changed(ObservableValue observableValue, Object o, Object o2) {
                validate();
            }
        });
View Full Code Here

TOP

Related Classes of javafx.beans.value.ChangeListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.