本文整理汇总了Java中javafx.collections.ListChangeListener.Change.wasAdded方法的典型用法代码示例。如果您正苦于以下问题:Java Change.wasAdded方法的具体用法?Java Change.wasAdded怎么用?Java Change.wasAdded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ListChangeListener.Change
的用法示例。
在下文中一共展示了Change.wasAdded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: updateUnsorted
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
private void updateUnsorted(Change<? extends E> c) {
while (c.next()) {
if (c.wasPermutated()) {
Element[] sortedTmp = new Element[sorted.length];
for (int i = 0; i < size; ++i) {
if (i >= c.getFrom() && i < c.getTo()) {
sortedTmp[c.getPermutation(i)] = sorted[i];
} else {
sortedTmp[i] = sorted[i];
}
}
sorted = sortedTmp;
}
if (c.wasRemoved()) {
final int removedTo = c.getFrom() + c.getRemovedSize();
System.arraycopy(sorted, removedTo, sorted, c.getFrom(), size - removedTo);
size -= c.getRemovedSize();
updateIndices(removedTo, -c.getRemovedSize());
}
if (c.wasAdded()) {
ensureSize(size + c.getAddedSize());
updateIndices(c.getFrom(), c.getAddedSize());
System.arraycopy(sorted, c.getFrom(), sorted, c.getTo(), size - c.getFrom());
size += c.getAddedSize();
for (int i = c.getFrom(); i < c.getTo(); ++i) {
sorted[i] = new Element<E>(c.getList().get(i), i);
}
}
}
}
示例3: onChanged
import javafx.collections.ListChangeListener.Change; //导入方法依赖的package包/类
@Override
public void onChanged(Change<? extends Object> change) {
while (change.next()) {
if (change.wasAdded()) {
System.out.println("添加事件" + change.getAddedSubList());
for (Object o : change.getAddedSubList()) {
if (o instanceof Table) {
System.out.println("变成可绑定的 ");
}
}
}
}
}