Package javafx.beans.value

Examples of javafx.beans.value.ChangeListener


                    }
                }
            }
        });
        textBox.textProperty().setValue(getFormat().format(controller.getValue()));
        controller.addListener(new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                textBox.textProperty().setValue(getFormat().format(controller.getValue()));
            }
        });
        numberProperty.addListener(new ChangeListener<T>() {
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

        /*######################################
         * CHANGE LISTENERS
         ######################################*/


        xLcd.valueProperty().addListener(new ChangeListener() {
            @Override
            public void changed(ObservableValue ov, Object oldValue, Object newValue) {
                double tmp = TinygDriver.getInstance().machine.getAxisByName("y").getWorkPosition().doubleValue() + 5;
            }
        });


        yLcd.valueProperty().addListener(new ChangeListener() {
            @Override
            public void changed(ObservableValue ov, Object oldValue, Object newValue) {
                double tmp = TinygDriver.getInstance().machine.getAxisByName("y").getWorkPosition().doubleValue() + 5;
            }
        });

        TinygDriver.getInstance().machine.getGcodeUnitMode().addListener(new ChangeListener() {
            @Override
            public void changed(ObservableValue ov, Object oldValue, Object newValue) {
                String tmp = TinygDriver.getInstance().machine.getGcodeUnitMode().get();

//                gcodeUnitMode.getSelectionModel().select(TinygDriver.getInstance().m.getGcodeUnitModeAsInt());
                if (TinygDriver.getInstance().machine.getGcodeUnitModeAsInt() == 0) {
                    //A bug in the jfxtras does not allow for units to be updated.. we hide them if they are not mm
                    xLcd.lcdUnitVisibleProperty().setValue(false);
                    yLcd.lcdUnitVisibleProperty().setValue(false);
                    zLcd.lcdUnitVisibleProperty().setValue(false);
                    aLcd.lcdUnitVisibleProperty().setValue(false);
                    velLcd.lcdUnitVisibleProperty().setValue(false);
                } else {
                    xLcd.lcdUnitVisibleProperty().setValue(true);
                    yLcd.lcdUnitVisibleProperty().setValue(true);
                    zLcd.lcdUnitVisibleProperty().setValue(true);
                    aLcd.lcdUnitVisibleProperty().setValue(true);
                    velLcd.lcdUnitVisibleProperty().setValue(true);
                }
                tgfx.Main.postConsoleMessage("[+]Gcode Unit Mode Changed to: " + tmp + "\n");

                try {
                    TinygDriver.getInstance().serialWriter.setThrottled(true);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_1_SETTINGS);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_2_SETTINGS);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_3_SETTINGS);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_MOTOR_4_SETTINGS);

                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_X);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_Y);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_Z);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_A);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_B);
                    TinygDriver.getInstance().priorityWrite(CommandManager.CMD_QUERY_AXIS_C);
                    Thread.sleep(400);
                    TinygDriver.getInstance().serialWriter.setThrottled(false);
                } catch (Exception ex) {
                    logger.error("Error querying tg model state on gcode unit change.  Main.java binding section.");
                }
            }
        });

        cncMachine.heightProperty().addListener(new ChangeListener() {
            @Override
            public void changed(ObservableValue o, Object oldVal,
                    Object newVal) {
                logger.info("cncHeightChanged: " + cncMachine.getHeight());
//                Main.print(cncHeightString
            }
        });
        cncMachine.maxWidthProperty().addListener(new ChangeListener() {
            @Override
            public void changed(ObservableValue ov, Object oldValue, Object newValue) {
                handleMaxWithChange();
            }
        });
        cncMachine.maxHeightProperty()
                .addListener(new ChangeListener() {
            @Override
            public void changed(ObservableValue ov, Object oldValue, Object newValue) {
                handleMaxHeightChange();
            }
        });
View Full Code Here

        final TextField text = new TextField();
        String value = controller.getValue();
        if (value != null) {
            text.setText(value);
        }
        final ChangeListener textPropertyListener = new ChangeListener<String>() {
            public void changed(ObservableValue<? extends String> observableValue, String s, String s1) {
                controller.setValue(s1);
            }
        };
        text.textProperty().addListener(textPropertyListener);
View Full Code Here

        this.formatProvider = formatProvider;
    }

    public DisposableNode createNode(final PropertyElementController<T> controller) {
        final TextField textBox = new TextField();
        final ChangeListener 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);
        return new DisposableNodeWrapper(textBox, new Callback<Node, Void>() {
            public Void call(Node node) {
                controller.removeListener(controllerListener);
                textBox.textProperty().removeListener(textBoxListener);
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) {
                textBox.textProperty().setValue(formatProvider.getFormat(controller.getElement()).format(controller.getValue()));
            }
        };
    }
View Full Code Here

            public void changed(ObservableValue<? extends Enum> observableValue, Enum anEnum, Enum anEnum1) {
                controller.setValue(anEnum1);
            }
        });
        controller.addListener(new ChangeListener() {
            public void changed(ObservableValue observableValue, Object o, Object o1) {
                if (o1 != null) {
                    choiceBox.getSelectionModel().select((Enum) o1);
                } else {
                    choiceBox.getSelectionModel().clearSelection();
View Full Code Here

      }
    });
    if (controller.getValue() != null) {
      textBox.textProperty().setValue(getFormat().format(controller.getValue()));
    }
    controller.addListener(new ChangeListener() {
      public void changed(ObservableValue observableValue, Object o, Object o1) {
        textBox.textProperty().setValue(getFormat().format(controller.getValue()));
      }
    });
    numberProperty.addListener(new ChangeListener<T>() {
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.