Search in sources :

Example 71 with ObservableValue

use of javafx.beans.value.ObservableValue in project DeskChan by DeskChan.

the class ControlsPanel method initItem.

PluginOptionsControlItem initItem(Map controlInfo, Window window) {
    PluginOptionsControlItem item = PluginOptionsControlItem.create(window, controlInfo);
    if (item == null)
        return item;
    String id = (String) controlInfo.get("id");
    if (id != null) {
        namedControls.put(id, item);
        item.getNode().setId(id);
        if (item.getProperty() != null) {
            item.getProperty().addListener(new ChangeListener() {

                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                    controlInfo.put("value", newValue);
                }
            });
        }
    }
    return item;
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Example 72 with ObservableValue

use of javafx.beans.value.ObservableValue in project jphp by jphp-compiler.

the class UXNode method watch.

@Signature
public void watch(final String property, final Invoker invoker) throws InvocationTargetException, IllegalAccessException {
    String name = property + "Property";
    Class<? extends Node> aClass = getWrappedObject().getClass();
    try {
        Method method = aClass.getMethod(name);
        ReadOnlyProperty bindProperty = (ReadOnlyProperty) method.invoke(getWrappedObject());
        bindProperty.addListener(new ChangeListener() {

            @Override
            public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                invoker.callAny(UXNode.this, property, oldValue, newValue);
            }
        });
    } catch (NoSuchMethodException | ClassCastException e) {
        throw new IllegalArgumentException("Unable to find the '" + property + "' property for watching");
    }
}
Also used : ReadOnlyProperty(javafx.beans.property.ReadOnlyProperty) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) IObject(php.runtime.lang.IObject) Method(java.lang.reflect.Method)

Example 73 with ObservableValue

use of javafx.beans.value.ObservableValue in project jphp by jphp-compiler.

the class UXValue method addOnceListener.

@Signature
public WrapInvoker addOnceListener(final Environment env, final Invoker invoker) {
    ChangeListener changeListener = new ChangeListener() {

        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            try {
                invoker.callAny(oldValue, newValue);
            } catch (Throwable throwable) {
                env.wrapThrow(throwable);
            } finally {
                getWrappedObject().removeListener(this);
            }
        }
    };
    getWrappedObject().addListener(changeListener);
    invoker.setUserData(changeListener);
    return new WrapInvoker(env, invoker);
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) WrapInvoker(php.runtime.ext.core.classes.WrapInvoker) Signature(php.runtime.annotation.Reflection.Signature)

Example 74 with ObservableValue

use of javafx.beans.value.ObservableValue in project jphp by jphp-compiler.

the class UXWindow method watch.

@Signature
public void watch(final String property, final Invoker invoker) throws InvocationTargetException, IllegalAccessException {
    String name = property + "Property";
    Class<? extends Window> aClass = getWrappedObject().getClass();
    try {
        Method method = aClass.getMethod(name);
        ReadOnlyProperty bindProperty = (ReadOnlyProperty) method.invoke(getWrappedObject());
        bindProperty.addListener(new ChangeListener() {

            @Override
            public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                invoker.callAny(UXWindow.this, property, oldValue, newValue);
            }
        });
    } catch (NoSuchMethodException | ClassCastException e) {
        throw new IllegalArgumentException("Unable to find the '" + property + "' property for watching");
    }
}
Also used : ReadOnlyProperty(javafx.beans.property.ReadOnlyProperty) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) Method(java.lang.reflect.Method)

Example 75 with ObservableValue

use of javafx.beans.value.ObservableValue in project financial by greatkendy123.

the class TeamProxyService method initTeamSelectAction.

@SuppressWarnings("unchecked")
public static void initTeamSelectAction(ComboBox<String> teamIDCombox, CheckBox isZjManage, TableView<ProxyTeamInfo> tableProxyTeam, HBox proxySumHBox) {
    teamIDCombox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {

        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            refresh_TableTeamProxy_TableProxySum(newValue);
            // add 团队保险比例为0默认将hasTeamBaoxian打勾
            if (newValue != null && StringUtil.isNotBlank(newValue.toString())) {
                Huishui huishui = DataConstans.huishuiMap.get(newValue);
                if (huishui != null) {
                    if ("0".equals(huishui.getShowInsure()) || StringUtil.isBlank(huishui.getShowInsure())) {
                        hasTeamBaoxian.setSelected(false);
                    } else {
                        hasTeamBaoxian.setSelected(true);
                    }
                } else {
                    ShowUtil.show("团队" + newValue + "对应的huishui字段为空!");
                    hasTeamBaoxian.setSelected(false);
                }
            }
        }
    });
    isZjManage.selectedProperty().addListener(new ChangeListener<Boolean>() {

        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            String teamId = teamIDCombox.getSelectionModel().getSelectedItem();
            if (!StringUtil.isBlank(teamId)) {
                Huishui hs = DataConstans.huishuiMap.get(teamId);
                if (hs != null) {
                    hs.setZjManaged(new_val ? "是" : "否");
                    DataConstans.huishuiMap.put(teamId, hs);
                }
            }
        }
    });
    hasTeamBaoxian.selectedProperty().addListener(new ChangeListener<Boolean>() {

        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            String teamId = teamIDCombox.getSelectionModel().getSelectedItem();
            if (!StringUtil.isBlank(teamId)) {
                Huishui hs = DataConstans.huishuiMap.get(teamId);
                if (hs != null) {
                    // 修改缓存
                    String showInsure = new_val ? "1" : "0";
                    hs.setShowInsure(showInsure);
                    DataConstans.huishuiMap.put(teamId, hs);
                    // 更新到数据库
                    DBUtil.updateTeamHsShowInsure(teamId, showInsure);
                }
            }
        }
    });
}
Also used : Huishui(com.kendy.entity.Huishui) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener)

Aggregations

ObservableValue (javafx.beans.value.ObservableValue)85 ChangeListener (javafx.beans.value.ChangeListener)53 FXML (javafx.fxml.FXML)13 Scene (javafx.scene.Scene)13 ImageView (javafx.scene.image.ImageView)13 KeyEvent (javafx.scene.input.KeyEvent)11 ArrayList (java.util.ArrayList)10 Label (javafx.scene.control.Label)10 TableColumn (javafx.scene.control.TableColumn)10 TableView (javafx.scene.control.TableView)10 ActionEvent (javafx.event.ActionEvent)9 MouseEvent (javafx.scene.input.MouseEvent)9 TextField (javafx.scene.control.TextField)8 Color (javafx.scene.paint.Color)8 ObservableList (javafx.collections.ObservableList)7 MenuItem (javafx.scene.control.MenuItem)7 CellDataFeatures (javafx.scene.control.TableColumn.CellDataFeatures)7 List (java.util.List)6 Set (java.util.Set)6 Platform (javafx.application.Platform)6