本文整理汇总了Java中javafx.collections.ObservableList.remove方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableList.remove方法的具体用法?Java ObservableList.remove怎么用?Java ObservableList.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ObservableList
的用法示例。
在下文中一共展示了ObservableList.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lazyLoadChildren
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Show loaded children in the tree.
*
* @param treeItem the tree item.
* @param children the loaded children.
* @param callback the loading callback.
*/
@FXThread
private void lazyLoadChildren(@NotNull final TreeItem<ResourceElement> treeItem,
@NotNull final Array<ResourceElement> children,
@Nullable final Consumer<@NotNull TreeItem<ResourceElement>> callback) {
final ObservableList<TreeItem<ResourceElement>> items = treeItem.getChildren();
if (items.size() != 1 || items.get(0).getValue() != LoadingResourceElement.getInstance()) {
return;
}
children.forEach(child -> items.add(new TreeItem<>(child)));
items.remove(0);
items.forEach(this::fill);
if (isNeedCleanup()) {
cleanup(treeItem);
}
if (callback != null) {
callback.accept(treeItem);
}
}
示例2: remove
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override public void remove(Node node) {
node.getProperties().remove(DockingDesktop.DOCKING_CONTAINER);
ObservableList<Tab> tabs = getTabs();
Tab found = null;
for (Tab tab : tabs) {
if (tab.getContent() == node) {
found = tab;
break;
}
}
if (found != null) {
tabs.remove(found);
}
if (tabs.size() == 0) {
((IDockingContainer) getProperties().get(DockingDesktop.DOCKING_CONTAINER)).remove(this);
}
}
示例3: cleanup
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Cleanup the tree.
*/
@FXThread
private void cleanup(@NotNull final TreeItem<ResourceElement> treeItem) {
final ResourceElement element = treeItem.getValue();
if (element instanceof FileResourceElement || element instanceof LoadingResourceElement) return;
final ObservableList<TreeItem<ResourceElement>> children = treeItem.getChildren();
for (int i = children.size() - 1; i >= 0; i--) {
cleanup(children.get(i));
}
if (children.isEmpty() && treeItem.getParent() != null) {
final TreeItem<ResourceElement> parent = treeItem.getParent();
final ObservableList<TreeItem<ResourceElement>> parentChildren = parent.getChildren();
parentChildren.remove(treeItem);
}
}
示例4: setBarColor
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void setBarColor() {
ObservableList<String> styleClass = bar.getStyleClass();
String sucessColor = "green-bar";
String failureColor = "red-bar";
if (error) {
if (styleClass.contains(sucessColor)) {
styleClass.remove(sucessColor);
}
styleClass.add(failureColor);
} else {
if (styleClass.contains(failureColor)) {
styleClass.remove(failureColor);
}
styleClass.add(sucessColor);
}
}
示例5: notifyRemoved
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Notify about removing the element.
*
* @param parent the parent
* @param child the child
*/
@FXThread
public void notifyRemoved(@Nullable final Object parent, @NotNull final Object child) {
final TreeItem<TreeNode<?>> treeItem = tryToFindItem(parent, child);
if (treeItem == null) return;
final TreeItem<TreeNode<?>> parentItem = treeItem.getParent();
final TreeNode<?> parentNode = parentItem.getValue();
final TreeNode<?> node = treeItem.getValue();
final ObservableList<TreeItem<TreeNode<?>>> children = parentItem.getChildren();
parentNode.notifyChildPreRemove(node);
children.remove(treeItem);
parentNode.notifyChildRemoved(node);
if (parentItem.isExpanded() && children.isEmpty()) {
parentItem.setExpanded(false);
}
}
示例6: addDependency
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Handle the 'Add dependency' button action
*/
public void addDependency()
{
// Table items:
ObservableList<Task> list = FXCollections.observableArrayList(MainController.getSPC().getCurrentTasks());
list.removeAll(this.dependencies.getItems());
if (this.task != null)
{
list.remove(this.task);
list.removeAll(this.task.getDependencies());
}
// =================
// Parse selected Tasks:
this.dependencies.getItems().addAll(TaskController.taskSelectionWindow(list));
// =================
}
示例7: processRemove
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Remove a selected level.
*/
@FXThread
private void processRemove() {
final ListView<Number> levelsList = getLevelsList();
final MultipleSelectionModel<Number> selectionModel = levelsList.getSelectionModel();
final ObservableList<Number> items = levelsList.getItems();
items.remove(selectionModel.getSelectedIndex());
}
示例8: removeFromWarnings
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private static void removeFromWarnings(final Component component, final Message message) {
if(!ENABLED) return;
final ObservableList<Message> list = getWarnings(component);
list.remove(message);
warnings.remove(message);
}
示例9: handle
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override public void handle(ActionEvent event) {
MultipleSelectionModel<JSONObject> selectionModel = historyView.getSelectionModel();
ObservableList<JSONObject> items = historyView.getItems();
int selectedIndex = selectionModel.getSelectedIndex();
JSONObject selectedItem = selectionModel.getSelectedItem();
items.remove(selectedItem);
if (shouldMoveUp) {
items.add(selectedIndex - 1, selectedItem);
} else {
items.add(selectedIndex + 1, selectedItem);
}
selectionModel.select(selectedItem);
TestRunnerHistory.getInstance().rewrite("favourites", items);
}
示例10: notifyDeleted
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Handle a removed file.
*
* @param file the file
*/
@FXThread
public void notifyDeleted(@NotNull final Path file) {
final ResourceElement element = createFor(file);
final TreeItem<ResourceElement> treeItem = findItemForValue(getRoot(), element);
if (treeItem == null) return;
final TreeItem<ResourceElement> parent = treeItem.getParent();
if (parent == null) return;
final ObservableList<TreeItem<ResourceElement>> children = parent.getChildren();
children.remove(treeItem);
}
示例11: onChanged
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
public void onChanged(Change<? extends F> change) {
if (updating.get()) {
return;
}
ObservableList<F> sourceList = this.sourceList.get();
ObservableList<T> targetList = this.targetList.get();
if (sourceList == null || targetList == null) {
if (sourceList != null) {
sourceList.removeListener(this);
}
return;
}
if (updating.get()) {
return;
}
updating.set(true);
while (change.next()) {
if (change.wasPermutated()) {
targetList.remove(change.getFrom(), change.getTo());
targetList.addAll(change.getFrom(),
Lists.transform(change.getList().subList(change.getFrom(), change.getTo()), function::apply));
} else {
if (change.wasRemoved()) {
targetList.remove(change.getFrom(), change.getFrom() + change.getRemovedSize());
}
if (change.wasAdded()) {
targetList.addAll(change.getFrom(), Lists.transform(change.getAddedSubList(), function::apply));
}
}
}
updating.set(false);
}
示例12: removeFromErrors
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private static void removeFromErrors(final Component component, final Message message) {
if(!ENABLED) return;
final ObservableList<Message> list = getErrors(component);
list.remove(message);
errors.remove(message);
}
示例13: RemoveTypeClassRepFromList
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public static void RemoveTypeClassRepFromList(ObservableList<Node> children, TypeClassRepresentationController t) {
for (Object object : children) {
TypeClassRepresentationController tmp = (TypeClassRepresentationController) object;
if(tmp.getClasse().equals(t.getClasse())) {
children.remove(tmp);
break;
}
}
}
示例14: add
import javafx.collections.ObservableList; //导入方法依赖的package包/类
public void add(Node node, ElementEditController controller) {
ObservableList<Node> list = getList();
Node addBtn = list.get(list.size() - 1);
list.remove(addBtn);
list.addAll(node, addBtn);
addElements.put(controller, node);
}
示例15: removeElementsTest
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Test
public void removeElementsTest()
{
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);
});
list3.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", 5, change.get().getFrom());
assertEquals("to", 5, change.get().getTo());
assertEquals("Removed", Arrays.asList(5), 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(3), listAggregation.get(3));
assertEquals("get(4)", Integer.valueOf(4), listAggregation.get(4));
}