@Override public Set<Entry<K, V>> entrySet() { return getDelegate().entrySet(); }
/** * Creates a string binding that constructs a sequence of characters separated by a delimiter. * * @param items the observable map of items. * @param delimiter the sequence of characters to be used between each element. * @param mapper a non-interfering, stateless function to apply to the each entry. * * @return a string binding. */ @Nonnull public static <K, V> StringBinding joinMap(@Nonnull final ObservableMap<K, V> items, @Nullable final String delimiter, @Nonnull final Function<Map.Entry<K, V>, String> mapper) { requireNonNull(items, ERROR_ITEMS_NULL); requireNonNull(mapper, ERROR_MAPPER_NULL); final String value = delimiter == null ? "," : delimiter; return createStringBinding(() -> items.entrySet().stream().map(mapper).collect(joining(value)), items); }
@Override public void extractValues(ReadOnlyMapProperty<?, ?> originalValue, ValueExtractor.ValueReceiver receiver) { Optional.ofNullable(originalValue.getValue()).ifPresent( m -> m.entrySet().forEach(e -> receiver.keyedValue("<map value>", e.getKey(), e.getValue()))); } }
@Override public void extractValues(ReadOnlyMapProperty<?, ?> originalValue, ValueExtractor.ValueReceiver receiver) { Optional.ofNullable(originalValue.getValue()).ifPresent( m -> m.entrySet().forEach(e -> receiver.keyedValue("<map value>", e.getKey(), e.getValue()))); } }
/** * Creates a string binding that constructs a sequence of characters separated by a delimiter. * * @param items the observable map of items. * @param delimiter the sequence of characters to be used between each entry. * * @return a string binding. */ @Nonnull public static <K, V> StringBinding joinMap(@Nonnull final ObservableMap<K, V> items, @Nonnull final ObservableValue<String> delimiter) { requireNonNull(items, ERROR_ITEMS_NULL); requireNonNull(delimiter, ERROR_DELIMITER_NULL); final Function<Map.Entry<K, V>, String> mapper = entry -> String.valueOf(entry.getKey()) + "=" + String.valueOf(entry.getValue()); return createStringBinding(() -> { String value = delimiter.getValue(); value = value == null ? "" : value; return items.entrySet().stream().map(mapper).collect(joining(value)); }, items, delimiter); }
/** * Creates a string binding that constructs a sequence of characters separated by a delimiter. * * @param items the observable map of items. * @param delimiter the sequence of characters to be used between each element. * @param mapper a non-interfering, stateless function to apply to the each entry. * * @return a string binding. */ @Nonnull public static <K, V> StringBinding joinMap(@Nonnull final ObservableMap<K, V> items, @Nonnull final ObservableValue<String> delimiter, @Nonnull final ObservableValue<Function<Map.Entry<K, V>, String>> mapper) { requireNonNull(items, ERROR_ITEMS_NULL); requireNonNull(delimiter, ERROR_DELIMITER_NULL); requireNonNull(mapper, ERROR_MAPPER_NULL); final Function<Map.Entry<K, V>, String> mv = entry -> String.valueOf(entry.getKey()) + "=" + String.valueOf(entry.getValue()); return createStringBinding(() -> { String value = delimiter.getValue(); value = value == null ? "" : value; final Function<Map.Entry<K, V>, String> mapperValue = mapper.getValue() != null ? mapper.getValue() : mv; return items.entrySet().stream().map(mapperValue).collect(joining(value)); }, items, delimiter, mapper); }
/** * Updates the shortcutProperties of the shortcut in the given {@link GridPane propertiesGrid} * * @param propertiesGrid The shortcutProperties grid */ private void updateProperties(final GridPane propertiesGrid) { propertiesGrid.getChildren().clear(); for (Map.Entry<String, Object> entry : shortcutProperties.entrySet()) { final int row = propertiesGrid.getRowCount(); final Label keyLabel = new Label(tr(decamelize(entry.getKey())) + ":"); keyLabel.getStyleClass().add("captionTitle"); GridPane.setValignment(keyLabel, VPos.TOP); final Label valueLabel = new Label(entry.getValue().toString()); valueLabel.setWrapText(true); propertiesGrid.addRow(row, keyLabel, valueLabel); } }
/** * Updates the user data of the selected engine in the given {@link GridPane userDataGrid} * * @param userDataGrid The user data grid */ private void updateUserData(final GridPane userDataGrid) { userDataGrid.getChildren().clear(); final Text versionLabel = new Text(tr("Version:")); versionLabel.getStyleClass().add("captionTitle"); final Label name = new Label(); name.textProperty().bind(engineVersionName); name.setWrapText(true); userDataGrid.addRow(0, versionLabel, name); for (Map.Entry<String, String> userData : engineUserData.entrySet()) { final int row = userDataGrid.getRowCount(); final Text userDataLabel = new Text(tr(userData.getKey())); userDataLabel.getStyleClass().add("captionTitle"); final Label path = new Label(userData.getValue()); path.setWrapText(true); userDataGrid.addRow(row, userDataLabel, path); } }
for (Map.Entry<String, Object> entry : shortcutProperties.entrySet()) { final int row = propertiesGrid.getRowCount();