當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。