本文整理汇总了Java中javafx.collections.MapChangeListener.Change方法的典型用法代码示例。如果您正苦于以下问题:Java MapChangeListener.Change方法的具体用法?Java MapChangeListener.Change怎么用?Java MapChangeListener.Change使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.MapChangeListener
的用法示例。
在下文中一共展示了MapChangeListener.Change方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialiseSystemUnderTest
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
@Before public void initialiseSystemUnderTest(){
addedResultsList = new ArrayList<>();
removedResultsList = new ArrayList<>();
observableMap = FXCollections.observableHashMap();
systemUnderTest = new MapChangeListenerRegistrationImpl<>(
observableMap,
( MapChangeListener.Change< ? extends String, ? extends Object > change ) -> {
if ( !observableMap.containsKey( change.getKey() ) ) {
removedResultsList.add( new Pair<>( change.getKey(), change.getValueRemoved() ) );
} else {
addedResultsList.add( new Pair<>( change.getKey(), change.getValueAdded() ) );
}
}
);
}
示例2: onChanged
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
@Override
public void onChanged(final MapChangeListener.Change<? extends Object, ? extends Object> change) {
final ObservableMap<?, ?> map = change.getMap();
if (disabledFor.containsKey(map)) {
return;
}
try {
final UUID mapId = objectRegistry.getIdOrFail(map);
final Object key = change.getKey();
if (change.wasAdded()) {
final Object value = change.getValueAdded();
final List<Command> commands = creator.putToMap(mapId, key, value);
registerListenersOnEverything(key);
if (value != null) {
registerListenersOnEverything(value);
}
distributeCommands(commands);
} else {
distributeCommands(creator.removeFromMap(mapId, key));
}
} catch (final SynchronizeFXException e) {
topology.onError(e);
}
}
示例3: onSourceCellsChange
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
private void onSourceCellsChange(
MapChangeListener.Change<? extends String, ? extends ConstraintCell> change) {
if (change.wasAdded()) {
getCells().put(change.getKey(), new HybridCell<>(change.getValueAdded()));
}
if (change.wasRemoved()) {
getCells().put(change.getKey(), new HybridCell<>(change.getValueRemoved()));
}
}
示例4: cellsMapChanged
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
/**
* Called when cells were added or removed to this row.
*
* @param change The change event
*/
private void cellsMapChanged(MapChangeListener.Change<? extends String, ? extends C> change) {
if (change.wasAdded()) {
subscribeToCell(change.getValueAdded());
}
if (change.wasRemoved()) {
unsubscribeFromCell(change.getValueRemoved());
}
}
示例5: onColorServerChanged
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
private void onColorServerChanged(
MapChangeListener.Change<? extends String, ? extends String> change) {
if (change.wasAdded()) {
highlighted = true;
addStyle(change.getValueAdded());
} else {
highlighted = false;
removeStyle(change.getValueRemoved());
}
}
示例6: onColorServerChanged
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
private void onColorServerChanged(
MapChangeListener.Change<? extends String, ? extends String> change) {
if (!sources.contains(change.getKey())) {
return;
}
if (change.wasAdded()) {
addStyle(change.getValueAdded());
} else if (change.wasRemoved()) {
removeStyle(change.getValueRemoved());
}
}
示例7: onChanged
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
@Override
public void onChanged(MapChangeListener.Change<? extends String, ? extends List<Parameterizable>> change) {
if (change.wasAdded()) {
if (!styleClasses.contains(change.getKey())) {
styleClasses.add(change.getKey());
Collections.sort(styleClasses);
}
} else if (change.wasRemoved()) {
styleClasses.remove(change.getKey());
}
}
示例8: changesOf
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
public static <K, V> EventStream<MapChangeListener.Change<? extends K, ? extends V>> changesOf(ObservableMap<K, V> map) {
return new EventStreamBase<MapChangeListener.Change<? extends K, ? extends V>>() {
@Override
protected Subscription observeInputs() {
MapChangeListener<K, V> listener = c -> emit(c);
map.addListener(listener);
return () -> map.removeListener(listener);
}
};
}
示例9: onChanged
import javafx.collections.MapChangeListener; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final void onChanged(
MapChangeListener.Change<? extends Object, ? extends Object> change) {
syncCollectionValues(getDirty(), true, false, null, null, change);
}