本文整理了Java中javafx.collections.ObservableList.addListener()
方法的一些代码示例,展示了ObservableList.addListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObservableList.addListener()
方法的具体详情如下:
包路径:javafx.collections.ObservableList
类名称:ObservableList
方法名:addListener
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
protected void setHiddenFieldChildren(ObservableList<TreeItem<T>> list) {
try {
Field childrenField = TreeItem.class.getDeclaredField("children"); //$NON-NLS-1$
childrenField.setAccessible(true);
childrenField.set(this, list);
Field declaredField = TreeItem.class.getDeclaredField("childrenListener"); //$NON-NLS-1$
declaredField.setAccessible(true);
list.addListener((ListChangeListener<? super TreeItem<T>>) declaredField.get(this));
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException("Could not set TreeItem.children", e); //$NON-NLS-1$
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
/**
* Constructs a new JFXMasonryPane
*/
public JFXMasonryPane() {
getChildren().addListener(new WeakListChangeListener<>(childrenListener));
}
代码示例来源:origin: speedment/speedment
/**
* Animates all the children of a Region.
* <code>
* VBox myVbox = new VBox();
* LayoutAnimator animator = new LayoutAnimator();
* animator.observe(myVbox.getChildren());
* </code>
*
* @param nodes the nodes to observe
*/
public void observe(ObservableList<Node> nodes) {
nodes.forEach((node) -> {
this.observe(node);
});
nodes.addListener(this);
}
代码示例来源:origin: speedment/speedment
AddRemoveStringItem(
final DOC column,
final String label,
final StringProperty value,
final String tooltip,
final ObservableBooleanValue enableThis) {
super(label, tooltip, NO_DECORATOR);
final String currentValue = value.get();
if (currentValue == null) {
this.strings = FXCollections.observableArrayList();
} else {
this.strings = FXCollections.observableArrayList(
Stream.of(currentValue.split(","))
.filter(s -> !s.isEmpty())
.toArray(String[]::new)
);
}
this.column = requireNonNull(column);
this.enabled = enableThis;
this.cache = new SimpleStringProperty();
this.strings.addListener((ListChangeListener.Change<? extends String> c) -> {
@SuppressWarnings("unchecked")
final List<String> list = (List<String>) c.getList();
value.setValue(getFormatedString(list));
});
}
代码示例来源:origin: speedment/speedment
change.getValueAdded().addListener(onListChange);
.forEach(list -> list.addListener(onListChange));
代码示例来源:origin: jfoenixadmin/JFoenix
children.addListener((ListChangeListener<T>) change -> {
while (change.next()) {
if (change.wasRemoved()) {
代码示例来源:origin: speedment/speedment
/**
* Creates a new {@link PropertySheet} which will render a collection of
* properties.
*
* @param properties the list of properties to render
*/
public PropertySheet(ObservableList<PropertyEditor.Item> properties) {
requireNonNull(properties);
this.properties = FXCollections.unmodifiableObservableList(properties);
layout = new PropertyLayout(properties);
setCenter(layout);
this.properties.addListener((ListChangeListener.Change<? extends PropertyEditor.Item> c) -> {
while (c.next()) {
if (c.wasRemoved() && properties.isEmpty()) {
layout.remove();
layout = new PropertyLayout(properties);
setCenter(layout);
} else if (c.wasAdded()) {
c.getAddedSubList().stream()
.forEachOrdered(i -> layout.addItem(i));
}
}
});
}
}
代码示例来源:origin: speedment/speedment
.addListener((ListChangeListener.Change<? extends TreeItem<DocumentProperty>> change) -> {
properties.clear();
代码示例来源:origin: jfoenixadmin/JFoenix
parent.getChildrenUnmodifiable().addListener(new ListChangeListener<Node>() {
@Override
public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) {
for (Node component : parent.getChildrenUnmodifiable()) {
if (component instanceof Pane) {
((Pane) component).getChildren().addListener(new ListChangeListener<Node>() {
@Override
public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) {
代码示例来源:origin: jfoenixadmin/JFoenix
createChip(item);
control.getChips().addListener(new WeakListChangeListener<>(chipsChangeListeners));
代码示例来源:origin: jfoenixadmin/JFoenix
suggestionList.setFixedCellSize(control.getFixedCellSize());
control.fixedCellSizeProperty().addListener(observable -> suggestionList.setFixedCellSize(control.getFixedCellSize()));
suggestionList.getItems().addListener((InvalidationListener) observable -> {
itemChanged = true;
updateListHeight();
代码示例来源:origin: jfoenixadmin/JFoenix
sublistsProperty.get().addListener((ListChangeListener.Change<? extends JFXListView<?>> c) -> {
while (c.next()) {
if (c.wasAdded() || c.wasUpdated() || c.wasReplaced()) {
代码示例来源:origin: speedment/speedment
notifications.addListener((ListChangeListener.Change<? extends Notification> change) -> {
while (change.next()) {
if (change.wasAdded()) {
代码示例来源:origin: jfoenixadmin/JFoenix
getSkinnable().getTabs().addListener((ListChangeListener<Tab>) change -> {
List<Tab> tabsToBeRemoved = new ArrayList<>();
List<Tab> tabsToBeAdded = new ArrayList<>();
代码示例来源:origin: jfoenixadmin/JFoenix
colorPicker.getCustomColors().addListener((Change<? extends Color> change) -> buildCustomColors());
VBox paletteBox = new VBox();
paletteBox.getStyleClass().add("color-palette");
代码示例来源:origin: jfoenixadmin/JFoenix
listener.registerChangeListener(getSkinnable().sideProperty(), "SIDE");
listener.registerChangeListener(widthProperty(), "WIDTH");
tab.getStyleClass().addListener(weakStyleClassListener);
代码示例来源:origin: torakiki/pdfsam
getStyleClass().add("selection-table");
initDragAndDrop(canMove);
getSelectionModel().getSelectedIndices().addListener((Change<? extends Integer> c) -> {
代码示例来源:origin: org.controlsfx/controlsfx
private void initializeListeners() {
//listen to backing list and update distinct values accordingly
tableFilter.getBackingList().addListener(new WeakListChangeListener<T>(backingListListener));
//listen to visible items and update visible values accordingly
tableFilter.getTableView().getItems().addListener(new WeakListChangeListener<T>(itemsListener));
//listen to selections on filterValues
filterValues.addListener(new WeakListChangeListener<>(filterValueListChangeListener));
}
代码示例来源:origin: org.controlsfx/controlsfx
private static void checkChangeContextMenu(TableViewSkin<?> skin, TableColumn<?, ?> column, FilterPanel filterPanel) {
ReflectionUtils.getTableHeaderRowFrom(skin).ifPresent(tableHeaderRow -> {
ReflectionUtils.getRootHeaderFrom(tableHeaderRow).ifPresent(header -> {
InvalidationListener listener = filterPanel.getOrCreateChangeListener(header, column);
header.getColumnHeaders().addListener(new WeakInvalidationListener(listener));
changeContextMenu(header, column);
});
});
}
代码示例来源:origin: PhoenicisOrg/phoenicis
/**
* {@inheritDoc}
*/
@Override
public void initialise() {
// ensure that one toggle button is always selected.
getControl().getElements().addListener(
(ListChangeListener.Change<? extends E> change) -> selectFirstToggleButton());
// ensure that the first toggle button is selected at initialization
selectFirstToggleButton();
}
内容来源于网络,如有侵权,请联系作者删除!