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;
}
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");
}
}
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);
}
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");
}
}
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);
}
}
}
});
}
Aggregations