javafx.collections.ObservableList类的使用及代码示例

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

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

ObservableList介绍

暂无

代码示例

代码示例来源: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

/**
 * creates empty dialog layout
 */
public JFXDialogLayout() {
  initialize();
  heading.getStyleClass().addAll("jfx-layout-heading", "title");
  body.getStyleClass().add("jfx-layout-body");
  VBox.setVgrow(body, Priority.ALWAYS);
  actions.getStyleClass().add("jfx-layout-actions");
  getChildren().setAll(heading, body, actions);
}

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

@Override
protected void updateChildren() {
  super.updateChildren();
  if(buttonRippler!=null)
    getChildren().add(0, buttonRippler);
  for (int i = 1; i < getChildren().size(); i++) {
    final Node child = getChildren().get(i);
    if(child instanceof Text)
      child.setMouseTransparent(true);
  }
}

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

private void setValue(String value) {
  if (value == null) {
    strings.clear();
  } else {
    strings.setAll(value.split(","));
  }
}

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

public void reGroup() {
  if (!groupOrder.isEmpty()) {
    ArrayList<TreeTableColumn<S, ?>> tempGroups = new ArrayList<>(groupOrder);
    groupOrder.clear();
    group(tempGroups.toArray(new TreeTableColumn[0]));
  }
}

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

/**
 * Animates all the children of a Region.
 * <code>
 *   VBox myVbox = new VBox();
 *   LayoutAnimator animator = new LayoutAnimator();
 *   animator.observe(myVbox.getChildren());
 * </code>
 *
 * @param nodes  the nodes to observe
 */
public void observe(ObservableList<Node> nodes) {
  nodes.forEach((node) -> {
    this.observe(node);
  });
  nodes.addListener(this);
}

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

originalItems.add(treeItem);
  itemsMap.put(child, treeItem);
this.getChildren().addAll(originalItems);
children.addListener((ListChangeListener<T>) change -> {
  while (change.next()) {
    if (change.wasRemoved()) {
      if (originalItems.size() == removedItems.size()) {
        originalItems.clear();
        getChildren().clear();
      } else {
        getChildren().removeAll(removedItems);
        originalItems.removeAll(removedItems);
        itemsMap.put(newChild, newTreeItem);
      getChildren().addAll(addedItems);
      originalItems.addAll(addedItems);

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

private void initialize() {
  this.getStyleClass().add(DEFAULT_STYLE_CLASS);
  if ("dalvik".equals(System.getProperty("java.vm.name").toLowerCase())) {
    this.setStyle("-fx-skin: \"com.jfoenix.android.skins.JFXTextFieldSkinAndroid\";");
  }
}

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

public JFXColorPalette(final ColorPicker colorPicker) {
  getStyleClass().add("color-palette-region");
  this.colorPicker = colorPicker;
  colorPickerGrid = new JFXColorGrid();
  colorPickerGrid.getChildren().get(0).requestFocus();
  customColorLabel.setAlignment(Pos.CENTER_LEFT);
  customColorLink.setPrefWidth(colorPickerGrid.prefWidth(-1));
        Color customColor = customColorDialog.customColorProperty().get();
        buildCustomColors();
        colorPicker.getCustomColors().add(customColor);
        updateSelection(customColor);
        Event.fireEvent(colorPicker, new ActionEvent());
  customColorGrid.getStyleClass().add("color-picker-grid");
  customColorGrid.setVisible(false);
  colorPicker.getCustomColors().addListener((Change<? extends Color> change) -> buildCustomColors());
  VBox paletteBox = new VBox();
  paletteBox.getStyleClass().add("color-palette");
  paletteBox.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
  paletteBox.setBorder(new Border(new BorderStroke(Color.valueOf("#9E9E9E"),
    CornerRadii.EMPTY,
    BorderWidths.DEFAULT)));
  paletteBox.getChildren().addAll(colorPickerGrid, customColorLabel, customColorGrid, customColorLink);
  hoverSquare.getStyleClass().addAll("hover-square");
  setFocusedSquare(null);

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

public void setContent(Node content) {
  if (contentContainer.getChildren().size() == 2) {
    contentContainer.getChildren().set(1, content);
  } else if (contentContainer.getChildren().size() == 1) {
    contentContainer.getChildren().add(content);
  } else {
    contentContainer.getChildren().setAll(headerSpace, content);
  }
  VBox.setVgrow(content, Priority.ALWAYS);
}

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

public TabHeaderContainer(final Tab tab) {
  this.tab = tab;
  getStyleClass().setAll(tab.getStyleClass());
  setId(tab.getId());
  setStyle(tab.getStyle());
  tabLabel.getStyleClass().setAll("tab-label");
  closeButton.getStyleClass().add("tab-close-button");
  closeButton.setOnAction(action->{
    TabPaneBehavior behavior = getBehavior();
  inner.getChildren().setAll(tabLabel, closeButton);
  inner.setAlignment(Pos.CENTER);
  inner.getStyleClass().add("tab-container");
  inner.setRotate(getSkinnable().getSide().equals(Side.BOTTOM) ? 180.0F : 0.0F);
  getChildren().addAll(rippler);
  listener.registerChangeListener(getSkinnable().sideProperty(), "SIDE");
  listener.registerChangeListener(widthProperty(), "WIDTH");
  tab.getStyleClass().addListener(weakStyleClassListener);

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

@Override
public void setValidators(ValidatorBase... validators) {
  this.validators.addAll(validators);
}

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

private void createChip(T item) {
  JFXChip<T> chip = null;
  try {
    if (getSkinnable().getChipFactory() != null) {
      chip = getSkinnable().getChipFactory().apply(getSkinnable(), item);
    } else {
      chip = new JFXDefaultChip<T>(getSkinnable(), item);
    }
  } catch (Exception e) {
    throw new RuntimeException("can't create chip for item '" + item +
                  "' make sure to override the string converter and return null if text input is not valid.", e);
  }
  int size = root.getChildren().size();
  root.getChildren().add(size - 1, chip);
}

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

@Override
public <U> void setViewContext(ViewContext<U> context) {
  updatePlaceholder(context.getRootNode());
  if (animation != null) {
    animation.stop();
  }
  animation = new Timeline();
  animation.getKeyFrames().addAll(animationProducer.apply(this));
  animation.getKeyFrames().add(new KeyFrame(duration, (e) -> clearPlaceholder()));
  animation.play();
}

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

root.getStyleClass().add("chips-pane");
setupEditor();
scrollPane.setFitToWidth(true);
getChildren().add(scrollPane);
    selectedItem = getSkinnable().getSelectionHandler().apply(selectedItem);
  getSkinnable().getChips().add(selectedItem);
  editor.clear();
});
  createChip(item);
control.getChips().addListener(new WeakListChangeListener<>(chipsChangeListeners));

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

private void initialize() {
  this.getStyleClass().add(DEFAULT_STYLE_CLASS);
  expanded.addListener((o, oldVal, newVal) -> {
    if (newVal) {
  sublistsProperty.get().addListener((ListChangeListener.Change<? extends JFXListView<?>> c) -> {
    while (c.next()) {
      if (c.wasAdded() || c.wasUpdated() || c.wasReplaced()) {
        if (sublistsProperty.get().size() == 1) {
          this.getSelectionModel()
            .selectedItemProperty()

代码示例来源: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

public JFXAutoCompletePopup() {
  super();
  bridge = new CSSBridge();
  getContent().setAll(bridge);
  setAutoFix(true);
  setAutoHide(true);
  setHideOnEscape(true);
  getStyleClass().add(DEFAULT_STYLE_CLASS);
}

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

notifications.addListener((ListChangeListener.Change<? extends Notification> change) -> {
  while (change.next()) {
    if (change.wasAdded()) {
        );
        notifications.remove(n);
      });
while (!notifications.isEmpty()) {
  final Notification n = notifications.get(0);
  NotificationController.showNotification(
    notificationArea,
    n.onClose()
  );
  notifications.remove(0);

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

public JFXTextAreaSkinAndroid(JFXTextArea textArea) {
  super(textArea);
  // init text area properties
  scrollPane = (ScrollPane) getChildren().get(0);
  textArea.setWrapText(true);
  linesWrapper = new PromptLinesWrapper<>(
    textArea,
    super.promptTextFill,
    textArea.textProperty(),
    textArea.promptTextProperty(),
    () -> promptText);
  linesWrapper.init(() -> createPromptNode(), scrollPane);
  errorContainer = new ValidationPane<>(textArea);
  getChildren().addAll(linesWrapper.line, linesWrapper.focusedLine, linesWrapper.promptContainer, errorContainer);
  registerChangeListener(textArea.disableProperty(), "DISABLE_NODE");
  registerChangeListener(textArea.focusColorProperty(), "FOCUS_COLOR");
  registerChangeListener(textArea.unFocusColorProperty(), "UNFOCUS_COLOR");
  registerChangeListener(textArea.disableAnimationProperty(), "DISABLE_ANIMATION");
}

相关文章