/**
* Generates a bidirectional binding between the {@link ObservableList} and the application store
* value identified by the {@code key} {@link String}.
*
* @param observableList {@link ObservableList} to bind
* @param key unique application store key
*/
public void bind(final ObservableList<String> observableList, String key) {
String value = prefs.get(validateKey(key), null);
if (value != null && value.length() > 1) {
for (String v : value.split("\u001e")) {
if (v != null && v.trim().length() > 0 && !observableList.contains(v.trim())) {
observableList.add(v.trim());
}
}
}
observableList.addListener((Change<? extends CharSequence> c) -> {
if (c.next()) {
String joined = c.getList().stream().collect(Collectors.joining("\u001e"));
prefs.put(key, joined);
}
});
}
PersistenceService.java 文件源码
java
阅读 32
收藏 0
点赞 0
评论 0
项目:opc-ua-client
作者:
评论列表
文章目录