当前位置: 首页>>代码示例>>Java>>正文


Java MapChangeListener.Change方法代码示例

本文整理汇总了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() ) );
               }
            }
   );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:17,代码来源:MapChangeListenerRegistrationImplTest.java

示例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);
    }
}
 
开发者ID:saxsys,项目名称:SynchronizeFX,代码行数:25,代码来源:Listeners.java

示例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()));
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:10,代码来源:HybridRow.java

示例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());
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:14,代码来源:SpecificationRow.java

示例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());
	}
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:11,代码来源:LeafNode.java

示例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());
	}
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:13,代码来源:ClusterDrawable.java

示例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());
   }
}
 
开发者ID:eduarddrenth,项目名称:iText-GUI,代码行数:12,代码来源:Controller.java

示例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);
        }
    };
}
 
开发者ID:TomasMikula,项目名称:ReactFX,代码行数:11,代码来源:EventStreams.java

示例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);
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:9,代码来源:BeanPathAdapter.java


注:本文中的javafx.collections.MapChangeListener.Change方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。