/** * Invalidates the info being displayed. */ private void invalidateInfo() { metricResultsListView.setItems(FXCollections.emptyObservableList()); xpathAttributesListView.setItems(FXCollections.emptyObservableList()); scopeHierarchyTreeView.setRoot(null); }
private ObservableList<MetricResult> evaluateAllMetrics(Node n) { LanguageMetricsProvider<?, ?> provider = parent.getLanguageVersion().getLanguageVersionHandler().getLanguageMetricsProvider(); if (provider == null) { return FXCollections.emptyObservableList(); } List<MetricResult> resultList = provider.computeAllMetricsFor(n) .entrySet() .stream() .map(e -> new MetricResult(e.getKey(), e.getValue())) .collect(Collectors.toList()); return FXCollections.observableArrayList(resultList); }
/** * Gets the XPath attributes of the node for display within a listview. */ private ObservableList<String> getAttributes(Node node) { if (node == null) { return FXCollections.emptyObservableList(); } ObservableList<String> result = FXCollections.observableArrayList(); Iterator<Attribute> attributeAxisIterator = node.getXPathAttributesIterator(); while (attributeAxisIterator.hasNext()) { Attribute attribute = attributeAxisIterator.next(); if (!(isHideCommonAttributes() && IGNORABLE_ATTRIBUTES.contains(attribute.getName()))) { // TODO the display should be handled in a ListCell result.add(attribute.getName() + " = " + ((attribute.getValue() != null) ? attribute.getStringValue() : "null")); } } // TODO maybe put some equivalent to TypeNode inside pmd-core // if (node instanceof TypeNode) { // result.add("typeIs() = " + ((TypeNode) node).getType()); // } Collections.sort(result); return result; } }
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)); }
eventLogTableView.itemsProperty().setValue(logEntries); binding = binding.and( () -> eventLogTableView.itemsProperty().setValue(FXCollections.emptyObservableList()) );
@Override public void detachFrom(@Nonnull TableView<E> tableView) { requireNonNull(tableView, ERROR_TABLE_VIEW_NULL); tableView.setItems(FXCollections.<E>emptyObservableList()); tableView.getColumns().removeAll(columns); } }
@Override public void detachFrom(@Nonnull TableView<E> tableView) { requireNonNull(tableView, ERROR_TABLE_VIEW_NULL); tableView.setItems(FXCollections.emptyObservableList()); tableView.getColumns().removeAll(columns); } }
@Override public void detachFrom(@Nonnull TableView<E> tableView) { requireNonNull(tableView, ERROR_TABLE_VIEW_NULL); tableView.setItems(FXCollections.<E>emptyObservableList()); tableView.getColumns().removeAll(columns); } }
public static List<Node> getChildren(Parent p, boolean useReflection) { ObservableList<Node> children = null; // previously we used reflection immediately, now we try to avoid reflection // by checking the type of the Parent. Still not great... if (p instanceof Pane) { // This should cover the majority of layout containers, including // AnchorPane, FlowPane, GridPane, HBox, Pane, StackPane, TilePane, VBox children = ((Pane)p).getChildren(); } else if (p instanceof Group) { children = ((Group)p).getChildren(); } else if (p instanceof Control) { Control c = (Control) p; Skin<?> s = c.getSkin(); children = s instanceof SkinBase ? ((SkinBase<?>)s).getChildren() : getChildrenReflectively(p); } else if (useReflection) { // we really want to avoid using this!!!! children = getChildrenReflectively(p); } if (children == null) { throw new RuntimeException("Unable to get children for Parent of type " + p.getClass() + //$NON-NLS-1$ ". useReflection is set to " + useReflection); //$NON-NLS-1$ } return children == null ? FXCollections.emptyObservableList() : children; }
/** * {@inheritDoc} */ @Override public void initialise() { final ObservableList<ToggleButton> mappedToggleButtons = new MappedList<>(getControl().getElements(), this::convertToToggleButton); final ObservableList<ToggleButton> allToggleButton = createAllButton() .map(FXCollections::singletonObservableList) .orElse(FXCollections.emptyObservableList()); final ConcatenatedList<ToggleButton> adhocToggleButtons = ConcatenatedList.create(allToggleButton, mappedToggleButtons); Bindings.bindContent(toggleGroup.getToggles(), adhocToggleButtons); SidebarGroup<ToggleButton> sidebarGroup = new SidebarGroup<>(getControl().titleProperty(), adhocToggleButtons); getChildren().addAll(sidebarGroup); }