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

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

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

ObservableList.stream介绍

暂无

代码示例

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

private void displayMetrics(Node node) {
  ObservableList<MetricResult> metrics = evaluateAllMetrics(node);
  metricResultsListView.setItems(metrics);
  notifyMetricsAvailable(metrics.stream()
                 .map(MetricResult::getValue)
                 .filter(result -> !result.isNaN())
                 .count());
}

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

/** Gets the index of the currently focused item. */
private int getFocusIdx() {
  if (!autoCompletePopup.isShowing()) {
    return -1;
  }
  List<ObservableSet<PseudoClass>> collect =
    autoCompletePopup.getItems()
             .stream()
             .map(this::getStyleableNode)
             .filter(Objects::nonNull)
             .map(Node::getPseudoClassStates)
             .collect(Collectors.toList());
  for (int i = 0; i < collect.size(); i++) {
    if (collect.get(i).contains(PseudoClass.getPseudoClass("focused"))) {
      return i;
    }
  }
  return -1;
}

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

/**
 * Creates a new GridPane, with proper column layout, and adds the editor items
 * in order
 * 
 * @param properties  the properties which should be rendered
 */
PropertyLayout(ObservableList<PropertyEditor.Item> properties){
  this.index = new AtomicInteger(0);
  this.items = new HashSet<>();
  
  getColumnConstraints().add(0, new ColumnConstraints(MIN_LABEL_WIDTH,  USE_COMPUTED_SIZE, USE_PREF_SIZE,    Priority.NEVER,  HPos.LEFT, true));
  getColumnConstraints().add(1, new ColumnConstraints(MIN_EDITOR_WIDTH, USE_COMPUTED_SIZE, Double.MAX_VALUE, Priority.ALWAYS, HPos.LEFT, true));
  getStyleClass().add("properties-layout");
  properties.stream().forEachOrdered( i -> addItem(i) );
}

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

strings.stream()
  .filter(elem -> elem.equalsIgnoreCase(value))
  .forEach(elem -> duplicate.set(true));

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

/**
 * Given a toggle group whose toggles all have user data of type T,
 * maps the selected toggle property to a Var&lt;T>
 */
@SuppressWarnings("unchecked")
public static <T> Var<T> mapToggleGroupToUserData(ToggleGroup toggleGroup) {
  return Var.fromVal(toggleGroup.selectedToggleProperty(), toggleGroup::selectToggle)
       .mapBidirectional(
         item -> (T) item.getUserData(),
         t -> toggleGroup.getToggles()
                 .stream()
                 .filter(toggle -> toggle.getUserData().equals(t))
                 .findFirst()
                 .orElseThrow(() -> new IllegalStateException("Unknown toggle " + t))
       );
}

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

Node currentNode = pathToNode.next();
current = current.getChildren().stream()
         .filter(item -> item.getValue() == currentNode)
         .findAny()

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

change.getValueAdded().stream()
  .filter(HasExpandedProperty.class::isInstance)
  .map(d -> (DocumentProperty & HasExpandedProperty) d)

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

private void registerBasicValidators() {
  Validator<String> noWhitespaceName
      = Validator.createRegexValidator("Name cannot contain whitespace", "\\S*+", Severity.ERROR);
  Validator<String> emptyName = Validator.createEmptyValidator("Name required");
  Validator<String> uniqueName = (c, val) -> {
    long sameNameDescriptors = backingDescriptorList.getOrElse(FXCollections.emptyObservableList())
                            .stream()
                            .map(PropertyDescriptorSpec::getName)
                            .filter(getName()::equals)
                            .count();
    return new ValidationResult().addErrorIf(c, "The name must be unique", sameNameDescriptors > 1);
  };
  validationSupport.registerValidator(nameField, Validator.combine(noWhitespaceName, emptyName, uniqueName));
  Validator<String> noWhitespaceDescription
      = Validator.createRegexValidator("Message cannot be whitespace", "(\\s*+\\S.*)?", Severity.ERROR);
  Validator<String> emptyDescription = Validator.createEmptyValidator("Message required");
  validationSupport.registerValidator(descriptionField, Validator.combine(noWhitespaceDescription, emptyDescription));
}

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

xpath,
                                   ruleBuilder.getRuleProperties()));
xpathResultListView.setItems(results.stream().map(parent::wrapNode).collect(Collectors.toCollection(LiveArrayList::new)));
parent.highlightXPathResults(results);
violationsTitledPane.setTitle("Matched nodes (" + results.size() + ")");

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

builder.usesMultifile(usesMultifile.getValue());
ruleProperties.getValue().stream().map(PropertyDescriptorSpec::build).forEach(builder::defineProperty);
examples.getValue().forEach(builder::addExample);

代码示例来源:origin: torakiki/pdfsam

@Override
public void saveStateTo(Map<String, String> data) {
  data.put("levelCombo.levels", getItems().stream().collect(Collectors.joining(",")));
  data.put("levelCombo.selected", ofNullable(getValue()).orElse(""));
}

代码示例来源:origin: torakiki/pdfsam

@Override
public void restoreStateFrom(Map<String, String> data) {
  field.setText(Optional.ofNullable(data.get("size")).orElse(EMPTY));
  group.getToggles().stream().map(t -> {
    return (SizeUnitRadio) t;
  }).forEach(s -> s.restoreStateFrom(data));
}

代码示例来源:origin: torakiki/pdfsam

@Override
public void saveStateTo(Map<String, String> data) {
  data.put("size", defaultString(field.getText()));
  group.getToggles().stream().map(t -> {
    return (SizeUnitRadio) t;
  }).forEach(s -> s.saveStateTo(data));
}

代码示例来源:origin: torakiki/pdfsam

@EventListener
public void onSetPageRanges(SetPageRangesRequest event) {
  getItems().stream().forEach(i -> i.pageSelection.set(event.range));
}

代码示例来源:origin: torakiki/pdfsam

@Override
  public void apply(MergeParametersBuilder builder, Consumer<String> onError) {
    try {
      table().getItems().stream().filter(s -> !Objects.equals("0", trim(s.pageSelection.get())))
          .map(i -> new PdfMergeInput(i.descriptor().toPdfFileSource(), i.toPageRangeSet()))
          .forEach(builder::addInput);
      if (!builder.hasInput()) {
        onError.accept(DefaultI18nContext.getInstance().i18n("No PDF document has been selected"));
      }
    } catch (ConversionException e) {
      LOG.error(e.getMessage());
      onError.accept(e.getMessage());
    }
  }
}

代码示例来源:origin: torakiki/pdfsam

@Override
  public void apply(RotateParametersBuilder builder, Consumer<String> onError) {
    try {
      table().getItems().stream().filter(s -> !Objects.equals("0", trim(s.pageSelection.get())))
          .forEach(i -> builder.addInput(i.descriptor().toPdfFileSource(), i.toPageRangeSet()));
      if (!builder.hasInput()) {
        onError.accept(DefaultI18nContext.getInstance().i18n("No PDF document has been selected"));
      }
    } catch (ConversionException e) {
      LOG.error(e.getMessage());
      onError.accept(e.getMessage());
    }
  }
}

代码示例来源:origin: torakiki/pdfsam

@Override
  public void apply(ExtractParametersBuilder builder, Consumer<String> onError) {
    try {
      table().getItems().stream().forEach(i -> builder.addSource(i.descriptor().toPdfFileSource()));
      if (!builder.hasInput()) {
        onError.accept(DefaultI18nContext.getInstance().i18n("No PDF document has been selected"));
      }
    } catch (ConversionException e) {
      LOG.error(e.getMessage());
      onError.accept(e.getMessage());
    }
  }
}

代码示例来源:origin: torakiki/pdfsam

private void copySelectedToClipboard() {
  ClipboardContent content = new ClipboardContent();
  writeContent(getSelectionModel().getSelectedItems().stream().map(item -> {
    return item.descriptor().getFile().getAbsolutePath() + ", " + item.descriptor().getFile().length() + ", "
        + item.descriptor().pages().getValue();
  }).collect(Collectors.toList())).to(content);
  Clipboard.getSystemClipboard().setContent(content);
}

代码示例来源:origin: torakiki/pdfsam

SplitOptionsPane() {
  this.field.setOnEnterValidation(true);
  this.field.setEnableInvalidStyle(true);
  this.field.setPromptText(DefaultI18nContext.getInstance().i18n("Set the size to split at"));
  this.field.setValidator(Validators.positiveInteger());
  this.field.setErrorMessage(DefaultI18nContext.getInstance().i18n("Size must be a number"));
  this.field.setId("sizeField");
  getStyleClass().addAll(Style.CONTAINER.css());
  getStyleClass().addAll(Style.HCONTAINER.css());
  getChildren().addAll(new Label(DefaultI18nContext.getInstance().i18n("Split at this size:")), this.field);
  Arrays.stream(SizeUnit.values()).map(SizeUnitRadio::new).forEach(r -> {
    r.setToggleGroup(group);
    getChildren().add(r);
  });
  group.getToggles().stream().findFirst().ifPresent(t -> t.setSelected(true));
}

代码示例来源:origin: org.controlsfx/controlsfx

private void removeValue(R value) {
  boolean removedLastDuplicate = filterValuesDupeCounter.remove(value) == 0;
  if (removedLastDuplicate) {
    // Remove the FilterValue associated with the value
    Optional<FilterValue<T,R>> existingFilterValue = getFilterValues().stream()
        .filter(fv -> Objects.equals(fv.getValue(), value)).findAny();
    if (existingFilterValue.isPresent())
      getFilterValues().remove(existingFilterValue.get());
  }
}
private void addVisibleItem(ObservableValue<R>  cellValue) {

相关文章