javafx.collections.ObservableList.remove()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中javafx.collections.ObservableList.remove()方法的一些代码示例,展示了ObservableList.remove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObservableList.remove()方法的具体详情如下:
包路径:javafx.collections.ObservableList
类名称:ObservableList
方法名:remove

ObservableList.remove介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

private void removeTabContentHolder(Tab tab) {
  for (TabContentHolder tabContentHolder : tabContentHolders) {
    if (tabContentHolder.tab.equals(tab)) {
      tabContentHolder.removeListeners(tab);
      getChildren().remove(tabContentHolder);
      tabContentHolders.remove(tabContentHolder);
      tabsContainer.getChildren().remove(tabContentHolder);
      break;
    }
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void clearPlaceholder() {
  view.getChildren().remove(placeholder);
}

代码示例来源:origin: speedment/speedment

private void enable() {
  while (getStyleClass().remove("gui-disabled")) {
    // Do nothing.
  }
}

代码示例来源:origin: speedment/speedment

private static void remove(Node node) {
  siblingsOf(node).remove(node);
}

代码示例来源:origin: jfoenixadmin/JFoenix

public void setGraphic(Node node) {
  if (graphic != null) {
    graphicContainer.getChildren().remove(graphic);
  }
  if (node != null) {
    graphicContainer.getChildren().add(0, node);
  }
  graphic = node;
}

代码示例来源:origin: jfoenixadmin/JFoenix

@Override
protected void updateChildren() {
  super.updateChildren();
  if (container != null) {
    getChildren().remove(1);
    getChildren().add(container);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void removeTab(Tab tab) {
  TabHeaderContainer tabHeaderContainer = getTabHeaderContainer(tab);
  if (tabHeaderContainer != null) {
    if (isTabsFitHeaderWidth()) {
      headersRegion.getChildren().remove(tabHeaderContainer);
    } else {
      // we need to keep track of the removed tab headers
      // to compute scroll offset of the header
      removedTabsHeaders.add(tabHeaderContainer);
      tabHeaderContainer.removeListeners();
    }
  }
}

代码示例来源:origin: speedment/speedment

@Override
public void prepareWorkspace(SplitPane parent, Node workspace) {
  if (!workspaceVisible.get()) {
    parent.getItems().remove(workspace);
  }
  workspaceVisible.addListener((ob, o, visible) -> {
    if (visible) {
      parent.getItems().add(0, workspace);
    } else {
      parent.getItems().remove(workspace);
    }
  });
}

代码示例来源:origin: speedment/speedment

@Override
public void prepareOutput(SplitPane parent, Node output) {
  if (!outputVisible.get()) {
    parent.getItems().remove(output);
  }
  outputVisible.addListener((ob, o, visible) -> {
    if (visible) {
      parent.getItems().add(output);
    } else {
      parent.getItems().remove(output);
    }
  });
}

代码示例来源:origin: speedment/speedment

@Override
public void prepareProjectTree(SplitPane parent, Node projectTree) {
  if (!projectTreeVisible.get()) {
    parent.getItems().remove(projectTree);
  }
  projectTreeVisible.addListener((ob, o, visible) -> {
    if (visible) {
      parent.getItems().add(0, projectTree);
    } else {
      parent.getItems().remove(projectTree);
    }
  });
}

代码示例来源:origin: pmd/pmd

private void onRemoveFileClicked() {
  File f = fileListView.getSelectionModel().getSelectedItem();
  fileListView.getItems().remove(f);
}

代码示例来源:origin: jfoenixadmin/JFoenix

public void unregisterSnackbarContainer(Pane snackbarContainer) {
  if (snackbarContainer != null) {
    if (this.snackbarContainer == null) {
      throw new IllegalArgumentException("Snackbar Container not set");
    }
    this.snackbarContainer.getChildren().remove(this);
    this.snackbarContainer.heightProperty().removeListener(weakSizeListener);
    this.snackbarContainer.widthProperty().removeListener(weakSizeListener);
    this.snackbarContainer = null;
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void resetOverLay() {
  if (rippler.overlayRect != null) {
    rippler.overlayRect.inAnimation.stop();
    final RippleGenerator.OverLayRipple oldOverlay = rippler.overlayRect;
    rippler.overlayRect.outAnimation.setOnFinished((finish) -> rippler.getChildren().remove(oldOverlay));
    rippler.overlayRect.outAnimation.play();
    rippler.overlayRect = null;
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void removeRadio() {
  for (int i = 0; i < getChildren().size(); i++) {
    if ("radio".equals(getChildren().get(i).getStyleClass().get(0))) {
      getChildren().remove(i);
      break;
    }
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void closeDialog() {
  resetProperties();
  Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.CLOSED));
  if (tempContent == null) {
    dialogContainer.getChildren().remove(this);
  } else {
    dialogContainer.getChildren().setAll(tempContent);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void releaseRipple() {
  Ripple ripple = ripplesQueue.poll();
  if(ripple!=null) {
    ripple.inAnimation.stop();
    ripple.outAnimation = new Timeline(
      new KeyFrame(Duration.millis(Math.min(800, (0.9 * 500) / ripple.getScaleX()))
        , ripple.outKeyValues));
    ripple.outAnimation.setOnFinished((event) -> getChildren().remove(ripple));
    ripple.outAnimation.play();
    if (generating.getAndSet(false)) {
      if (overlayRect != null) {
        overlayRect.inAnimation.stop();
        if (!forceOverlay)
          overlayRect.outAnimation.play();
      }
    }
  }
}

代码示例来源:origin: pmd/pmd

private void moveItem(int direction) {
  // Checking selected item
  if (fileListView.getSelectionModel().getSelectedItem() == null) {
    return;
  }
  // Calculate new index using move direction
  int newIndex = fileListView.getSelectionModel().getSelectedIndex() + direction;
  if (newIndex < 0 || newIndex >= fileListView.getItems().size()) {
    return;
  }
  File selected = fileListView.getSelectionModel().getSelectedItem();
  // Removing removable element
  fileListView.getItems().remove(selected);
  // Insert it in new position
  fileListView.getItems().add(newIndex, selected);
  //Restore Selection
  fileListView.scrollTo(newIndex);
  fileListView.getSelectionModel().select(newIndex);
}

代码示例来源:origin: speedment/speedment

private Button removeButton(final ListView<String> listView) {
  final Button button = new Button("Remove Selected", FontAwesome.TIMES.view());
  
  button.setOnAction(e -> {
    final int selectedIdx = listView.getSelectionModel().getSelectedIndex();
    if (selectedIdx != -1 && listView.getItems().size() > 1) {
      final int newSelectedIdx = (selectedIdx == listView.getItems().size() - 1) ? selectedIdx - 1
        : selectedIdx;
      listView.getItems().remove(selectedIdx);
      listView.getSelectionModel().select(newSelectedIdx);
    }
  });
  
  return button;
}

代码示例来源:origin: jfoenixadmin/JFoenix

public JFXDefaultChip(JFXChipView<T> view, T item) {
    super(view, item);
    JFXButton closeButton = new JFXButton(null, new SVGGlyph());
    closeButton.getStyleClass().add("close-button");
    closeButton.setOnAction((event) -> view.getChips().remove(item));

    String tagString = null;
    if (getItem() instanceof String) {
      tagString = (String) getItem();
    } else {
      tagString = view.getConverter().toString(getItem());
    }
    Label label = new Label(tagString);
    label.setWrapText(true);
    root = new HBox(label, closeButton);
    getChildren().setAll(root);
    label.setMaxWidth(100);
  }
}

代码示例来源:origin: jfoenixadmin/JFoenix

private void updateDisclosureNode() {
  Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode();
  if (disclosureNode != null) {
    TreeItem<S> item = getSkinnable().getTreeTableRow().getTreeItem();
    final S value = item == null ? null : item.getValue();
    boolean disclosureVisible = value != null
                  && !item.isLeaf()
                  && value instanceof RecursiveTreeObject
                  && ((RecursiveTreeObject) value).getGroupedColumn() == getSkinnable().getTableColumn();
    disclosureNode.setVisible(disclosureVisible);
    if (!disclosureVisible) {
      getChildren().remove(disclosureNode);
    } else if (disclosureNode.getParent() == null) {
      getChildren().add(disclosureNode);
      disclosureNode.toFront();
    } else {
      disclosureNode.toBack();
    }
    if (disclosureNode.getScene() != null) {
      disclosureNode.applyCss();
    }
  }
}

相关文章