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


Java Change类代码示例

本文整理汇总了Java中javafx.collections.ListChangeListener.Change的典型用法代码示例。如果您正苦于以下问题:Java Change类的具体用法?Java Change怎么用?Java Change使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Change类属于javafx.collections.ListChangeListener包,在下文中一共展示了Change类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: seriesChanged

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
@Override
protected void seriesChanged(Change<? extends MultiAxisChart.Series<X, Y>> c) {
	// Update style classes for all series lines and symbols
	// Note: is there a more efficient way of doing this?
	for (int i = 0; i < getDataSize(); i++) {
		final MultiAxisChart.Series<X, Y> s = getData().get(i);
		Path seriesLine = (Path) ((Group) s.getNode()).getChildren().get(1);
		Path fillPath = (Path) ((Group) s.getNode()).getChildren().get(0);
		seriesLine.getStyleClass().setAll("chart-series-area-line", "series" + i, s.defaultColorStyleClass);
		fillPath.getStyleClass().setAll("chart-series-area-fill", "series" + i, s.defaultColorStyleClass);
		for (int j = 0; j < s.getData().size(); j++) {
			final Data<X, Y> item = s.getData().get(j);
			final Node node = item.getNode();
			if (node != null)
				node.getStyleClass().setAll("chart-area-symbol", "series" + i, "data" + j,
						s.defaultColorStyleClass);
		}
	}
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:20,代码来源:MultiAxisAreaChart.java

示例2: bind

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
/**
 * 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);
    }
  });
}
 
开发者ID:comtel2000,项目名称:opc-ua-client,代码行数:24,代码来源:PersistenceService.java

示例3: Flyout

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
/**
 * Constructs a new {@code Flyout} using the specified "anchor"
 * as the location from which the specified "contents" will 
 * fly out.
 * 
 * @param anchor        Node used to define the start point of the flyout animation
 * @param contents      Node containing the "control" to fly out
 */
public Flyout(Node anchor, Node contents) {
    this.anchor = anchor;
    this.flyoutContents = contents;
    userNodeContainer = new Pane();
    
    getChildren().addListener((Change<? extends Node> c) -> {
        if(getChildren().size() > 1) {
            throw new IllegalStateException("May only add one child to a Flyout");
        }
    });
    
    layoutBoundsProperty().addListener((v, o, n) -> {
        if(getChildren().size() < 1) return;
        
        if(getChildren().size() > 1) {
            throw new IllegalStateException("May only add one child to a Flyout");
        }
    });
    
    getChildren().add(anchor);
    
    popup = new Stage();
}
 
开发者ID:fxpresso,项目名称:tidbit,代码行数:32,代码来源:Flyout.java

示例4: sourceChanged

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
@Override
protected void sourceChanged(Change<? extends E> c) {
    if (elementComparator != null) {
        beginChange();
        while (c.next()) {
            if (c.wasPermutated()) {
                updatePermutationIndexes(c);
            } else if (c.wasUpdated()) {
                update(c);
            } else {
                addRemove(c);
            }
        }
        endChange();
    } else {
        updateUnsorted(c);
        fireChange(new SourceAdapterChange<>(this, c));
    }
}
 
开发者ID:tortlepp,项目名称:SimpleTaskList,代码行数:20,代码来源:CustomSortedList.java

示例5: addRemove

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
private void addRemove(Change<? extends E> c) {
    if (c.getFrom() == 0 && c.getRemovedSize() == size) {
        removeAllFromMapping();
    } else {
        for (int i = 0, sz = c.getRemovedSize(); i < sz; ++i) {
            removeFromMapping(c.getFrom(), c.getRemoved().get(i));
        }
    }
    if (size == 0) {
        setAllToMapping(c.getList(), c.getTo()); // This is basically equivalent to getAddedSubList
                                                 // as size is 0, only valid "from" is also 0
    } else {
        for (int i = c.getFrom(), to = c.getTo(); i < to; ++i) {
            insertToMapping(c.getList().get(i), i);
        }
    }
}
 
开发者ID:tortlepp,项目名称:SimpleTaskList,代码行数:18,代码来源:CustomSortedList.java

示例6: permute

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
protected void permute(Change<? extends F> c) {
    int from = c.getFrom();
    int to = c.getTo();

    if (to > from) {
        List<E> clone = new ArrayList<E>(mappedValues);
        int[] perm = IntStream.range(0, size()).toArray();

        for (int i = from; i < to; ++i) {
            perm[i] = c.getPermutation(i);
            mappedValues.set(i, clone.get(c.getPermutation(i)));
        }

        nextPermutation(from, to, perm);
    }
}
 
开发者ID:PhoenicisOrg,项目名称:POL-POM-5,代码行数:17,代码来源:MappedList.java

示例7: rightsProperty

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
public ListProperty<AtomicRight> rightsProperty() {
    if ( rightsProperty == null ) {
        rightsProperty = new SimpleListProperty<>(FXCollections.observableList(rights));
        rightsProperty.get().addListener(new ListChangeListener<AtomicRight>() {

            @Override
            public void onChanged(Change<? extends AtomicRight> change) {
                while (change.next()) {
                    if ( !change.wasAdded() ) continue;
                    for (AtomicRight addedRight : change.getAddedSubList()) {
                        for (Persona persona : personas) {
                            if ( persona.getPersonaRights().contains(addedRight) ) {
                                change.getList().remove(addedRight);
                            }
                        }
                        if ( containsMoreThanOnce(rights, addedRight) ) {
                            change.getList().remove(addedRight);
                        }
                    }
                }
            }
        });
    }
    return rightsProperty;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:26,代码来源:Operator.java

示例8: personasProperty

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
public ListProperty<Persona> personasProperty() {
    if ( personasProperty == null ) {
        personasProperty = new SimpleListProperty<>(FXCollections.observableList(personas));
        personasProperty.get().addListener(new ListChangeListener<Persona>() {

            @Override
            public void onChanged(Change<? extends Persona> change) {
                while (change.next()) {
                    if ( change.wasAdded() ) {
                        for (Persona persona : change.getAddedSubList()) {
                            // Remove local duplicates
                            for (AtomicRight personaRight : persona.getPersonaRights()) {
                                if ( getRights().contains(personaRight) ) {
                                    remove(personaRight);
                                }
                            }
                        }

                    }
                }
            }
        });
    }
    return personasProperty;
}
 
开发者ID:gg-net,项目名称:dwoss,代码行数:26,代码来源:Operator.java

示例9: selectNewTab

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
private void selectNewTab(Change<View> change) {
	while (change.next()) {

		if (change.wasAdded()) {
			List<View> added = change.getAddedSubList();
			View lastAdded = added.get(added.size() - 1);
			selectedTabProperty.set(lastAdded);
		} else if (change.wasRemoved()) {
			int newIndex = tabsProperty.indexOf(selectedTabProperty.get()) - 1;
			if (newIndex < 0) {
				newIndex = 0;
			}
			View selectedTab = change.getList().get(newIndex);
			selectedTabProperty.set(selectedTab);
		}
	}
}
 
开发者ID:ntenhoeve,项目名称:Introspect-Framework,代码行数:18,代码来源:RfxWindow.java

示例10: setupEventHandlers

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
private void setupEventHandlers() {

        this.setUpEventHandler(this.topCenterNodeProperty);
        this.setUpEventHandler(this.topRightNodeProperty);
        this.setUpEventHandler(this.centerRightNodeProperty);
        this.setUpEventHandler(this.bottomRightNodeProperty);
        this.setUpEventHandler(this.bottomCenterNodeProperty);
        this.setUpEventHandler(this.bottomLeftNodeProperty);
        this.setUpEventHandler(this.centerLeftNodeProperty);
        this.setUpEventHandler(this.topLeftNodeProperty);
        this.setUpEventHandler(this.wrappedControlProperty);

        this.contextMenuActions.addListener(
                (final Change<? extends Action> change) -> this
                        .getWrappedControl()
                        .contextMenuProperty()
                        .set(ActionUtils.createContextMenu(
                                this.contextMenuActions())));
    }
 
开发者ID:aftenkap,项目名称:jutility-javafx,代码行数:20,代码来源:ControlWrapper.java

示例11: fromCurrentStateOf

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
static <E, F extends E> QuasiListModification<E> fromCurrentStateOf(
        Change<F> ch) {
    List<F> list = ch.getList();
    int from = ch.getFrom();
    int addedSize = ch.getTo() - from; // use (to - from), because
                                       // ch.getAddedSize() is 0 on permutation

    List<F> removed;
    if(ch.wasPermutated()) {
        removed = new ArrayList<>(addedSize);
        for(int i = 0; i < addedSize; ++i) {
            int pi = ch.getPermutation(from + i);
            removed.add(list.get(pi));
        }
    } else {
        removed = ch.getRemoved();
    }
    return new QuasiListModificationImpl<>(from, removed, addedSize);
}
 
开发者ID:TomasMikula,项目名称:ReactFX,代码行数:20,代码来源:QuasiListModification.java

示例12: listInsertionTest

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
@Test
public void listInsertionTest()
{
    final ObservableList<Integer> list1 = FXCollections.observableArrayList(0, 1, 2);
    final ObservableList<Integer> list2 = FXCollections.observableArrayList(4, 5);

    final ObservableListAggregation<Integer> listAggregation = new ObservableListAggregation<>(list1, list2);
    final AtomicReference<Change<? extends Integer>> change = new AtomicReference<>(null);
    listAggregation.addListener((ListChangeListener<Integer>) c -> {
        change.set(c);
    });

    listAggregation.getLists().add(1, FXCollections.observableArrayList(3));

    assertNotNull("Change event", change.get());
    assertTrue("Has change", change.get().next());
    assertTrue("Was added", change.get().wasAdded());
    assertFalse("Was removed", change.get().wasRemoved());
    assertFalse("Was update", change.get().wasUpdated());
    assertFalse("Was permuted", change.get().wasPermutated());
    assertEquals("from", 3, change.get().getFrom());
    assertEquals("to", 4, change.get().getTo());
    assertEquals("Added sub-list", Arrays.asList(3), change.get().getAddedSubList());
    assertFalse("Has more change", change.get().next());

    assertEquals("size", 6, listAggregation.size());
    assertEquals("get(0)", Integer.valueOf(0), listAggregation.get(0));
    assertEquals("get(1)", Integer.valueOf(1), listAggregation.get(1));
    assertEquals("get(2)", Integer.valueOf(2), listAggregation.get(2));
    assertEquals("get(3)", Integer.valueOf(3), listAggregation.get(3));
    assertEquals("get(4)", Integer.valueOf(4), listAggregation.get(4));
    assertEquals("get(5)", Integer.valueOf(5), listAggregation.get(5));
}
 
开发者ID:ben12,项目名称:infxnity,代码行数:34,代码来源:ObservableListAggregationTest.java

示例13: listRemoveTest

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
@Test
public void listRemoveTest()
{
    final ObservableList<Integer> list1 = FXCollections.observableArrayList(0, 1, 2);
    final ObservableList<Integer> list2 = FXCollections.observableArrayList(3);
    final ObservableList<Integer> list3 = FXCollections.observableArrayList(4, 5);

    final ObservableListAggregation<Integer> listAggregation = new ObservableListAggregation<>(list1, list2, list3);
    final AtomicReference<Change<? extends Integer>> change = new AtomicReference<>(null);
    listAggregation.addListener((ListChangeListener<Integer>) c -> {
        change.set(c);
    });

    listAggregation.getLists().remove(1);

    assertNotNull("Change event", change.get());
    assertTrue("Has change", change.get().next());
    assertFalse("Was added", change.get().wasAdded());
    assertTrue("Was removed", change.get().wasRemoved());
    assertFalse("Was update", change.get().wasUpdated());
    assertFalse("Was permuted", change.get().wasPermutated());
    assertEquals("from", 3, change.get().getFrom());
    assertEquals("to", 3, change.get().getTo());
    assertEquals("Removed", Arrays.asList(3), change.get().getRemoved());
    assertFalse("Has more change", change.get().next());

    assertEquals("size", 5, listAggregation.size());
    assertEquals("get(0)", Integer.valueOf(0), listAggregation.get(0));
    assertEquals("get(1)", Integer.valueOf(1), listAggregation.get(1));
    assertEquals("get(2)", Integer.valueOf(2), listAggregation.get(2));
    assertEquals("get(3)", Integer.valueOf(4), listAggregation.get(3));
    assertEquals("get(4)", Integer.valueOf(5), listAggregation.get(4));
}
 
开发者ID:ben12,项目名称:infxnity,代码行数:34,代码来源:ObservableListAggregationTest.java

示例14: listReplaceTest

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
@Test
public void listReplaceTest()
{
    final ObservableList<Integer> list1 = FXCollections.observableArrayList(0, 1, 2);
    final ObservableList<Integer> list2 = FXCollections.observableArrayList(3);
    final ObservableList<Integer> list3 = FXCollections.observableArrayList(4, 5);

    final ObservableList<Integer> list2bis = FXCollections.observableArrayList(6, 7);

    final ObservableListAggregation<Integer> listAggregation = new ObservableListAggregation<>(list1, list2, list3);
    final AtomicReference<Change<? extends Integer>> change = new AtomicReference<>(null);
    listAggregation.addListener((ListChangeListener<Integer>) c -> {
        change.set(c);
    });

    listAggregation.getLists().set(1, list2bis);

    assertNotNull("Change event", change.get());
    assertTrue("Has change", change.get().next());
    assertTrue("Was added", change.get().wasAdded());
    assertTrue("Was removed", change.get().wasRemoved());
    assertFalse("Was update", change.get().wasUpdated());
    assertFalse("Was permuted", change.get().wasPermutated());
    assertEquals("from", 3, change.get().getFrom());
    assertEquals("to", 5, change.get().getTo());
    assertEquals("Added sub-list", Arrays.asList(6, 7), change.get().getAddedSubList());
    assertEquals("Removed", Arrays.asList(3), change.get().getRemoved());
    assertFalse("Has more change", change.get().next());

    assertEquals("size", 7, listAggregation.size());
    assertEquals("get(0)", Integer.valueOf(0), listAggregation.get(0));
    assertEquals("get(1)", Integer.valueOf(1), listAggregation.get(1));
    assertEquals("get(2)", Integer.valueOf(2), listAggregation.get(2));
    assertEquals("get(3)", Integer.valueOf(6), listAggregation.get(3));
    assertEquals("get(4)", Integer.valueOf(7), listAggregation.get(4));
    assertEquals("get(5)", Integer.valueOf(4), listAggregation.get(5));
    assertEquals("get(6)", Integer.valueOf(5), listAggregation.get(6));
}
 
开发者ID:ben12,项目名称:infxnity,代码行数:39,代码来源:ObservableListAggregationTest.java

示例15: addElementsTest

import javafx.collections.ListChangeListener.Change; //导入依赖的package包/类
@Test
public void addElementsTest()
{
    final ObservableList<Integer> list1 = FXCollections.observableArrayList(0, 1, 2);
    final ObservableList<Integer> list2 = FXCollections.observableArrayList(3);
    final ObservableList<Integer> list3 = FXCollections.observableArrayList(4, 5);

    final ObservableListAggregation<Integer> listAggregation = new ObservableListAggregation<>(list1, list2, list3);
    final AtomicReference<Change<? extends Integer>> change = new AtomicReference<>(null);
    listAggregation.addListener((ListChangeListener<Integer>) c -> {
        change.set(c);
    });

    list2.addAll(6, 7);

    assertNotNull("Change event", change.get());
    assertTrue("Has change", change.get().next());
    assertTrue("Was added", change.get().wasAdded());
    assertFalse("Was removed", change.get().wasRemoved());
    assertFalse("Was update", change.get().wasUpdated());
    assertFalse("Was permuted", change.get().wasPermutated());
    assertEquals("from", 4, change.get().getFrom());
    assertEquals("to", 6, change.get().getTo());
    assertEquals("Added sub-list", Arrays.asList(6, 7), change.get().getAddedSubList());
    assertFalse("Has more change", change.get().next());

    assertEquals("size", 8, listAggregation.size());
    assertEquals("get(0)", Integer.valueOf(0), listAggregation.get(0));
    assertEquals("get(1)", Integer.valueOf(1), listAggregation.get(1));
    assertEquals("get(2)", Integer.valueOf(2), listAggregation.get(2));
    assertEquals("get(3)", Integer.valueOf(3), listAggregation.get(3));
    assertEquals("get(4)", Integer.valueOf(6), listAggregation.get(4));
    assertEquals("get(5)", Integer.valueOf(7), listAggregation.get(5));
    assertEquals("get(6)", Integer.valueOf(4), listAggregation.get(6));
    assertEquals("get(7)", Integer.valueOf(5), listAggregation.get(7));
}
 
开发者ID:ben12,项目名称:infxnity,代码行数:37,代码来源:ObservableListAggregationTest.java


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