Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion org.knime.core.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
point="org.knime.workbench.repository.nodes">
<node
hidden="true"
factory-class="org.knime.core.webui.node.dialog.defaultdialog.hiddenfeaturesnode.HiddenFeaturesNodeFactory">
factory-class="org.knime.node.parameters.examples.impl.DefaultNodeDialogExamplesNodeFactory">
</node>
Comment on lines 23 to 26
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change replaces the registered hidden node factory (HiddenFeaturesNodeFactory) with DefaultNodeDialogExamplesNodeFactory, effectively removing the existing “hidden features” node from the repository extension. If the old node is still needed for QA/UX workflows, it should remain registered (e.g., as an additional hidden node) or the PR description should explicitly call out the removal/migration plan.

Copilot uses AI. Check for mistakes.
</extension>
<extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@
package org.knime.node.parameters.examples;

import org.knime.node.parameters.NodeParameters;
import org.knime.node.parameters.Widget;
import org.knime.node.parameters.array.ArrayWidget;
import org.knime.node.parameters.examples.ArrayWidgetExample.ElementClass.ArrayWidgetElementLayout.HorizontalLayout1;
import org.knime.node.parameters.examples.ArrayWidgetExample.ElementClass.ArrayWidgetElementLayout.HorizontalLayout2;
import org.knime.node.parameters.examples.ArrayWidgetExample.OuterSection;
import org.knime.node.parameters.examples.impl.ExampleNodeParameters;
import org.knime.node.parameters.examples.impl.ExampleNodeParameters.NodeParametersExample;
import org.knime.node.parameters.layout.After;
import org.knime.node.parameters.layout.HorizontalLayout;
import org.knime.node.parameters.layout.Layout;
Expand All @@ -63,20 +66,25 @@
*
* @author Paul Bärnreuther
*/
@NodeParametersExample(name = "Array Widget", searchTags = {"array", "list", "element", "layout"})
@Layout(OuterSection.class)
public final class ArrayWidgetExample implements NodeParameters {
public final class ArrayWidgetExample implements ExampleNodeParameters {

@Section(title = "Outer Section")
interface OuterSection {

}

@Widget(title = "Array Widget",
description = "Even though this widget wraps other widgets, @Widget is still required here.")
ElementClass[] m_arraySetting1;

/**
* Optionally specify annotation to configure the UI.
*/
@ArrayWidget(addButtonText = "Next", elementTitle = "Element", showSortButtons = false, hasFixedSize = false)
@Widget(title = "Array Widget (customized)",
description = "Customize the UI of the array widget using @ArrayWidget.")
@ArrayWidget(addButtonText = "Next", elementTitle = "Item", showSortButtons = true, hasFixedSize = false)
ElementClass[] m_arraySetting2;

/**
Expand All @@ -101,13 +109,17 @@ interface HorizontalLayout2 {
}
}

@Widget(title = "Some string", description = "This is a string element in the array widget")
String m_el1;

@Widget(title = "Some integer", description = "This is an integer element in the array widget")
int m_el2;

@Widget(title = "Some boolean", description = "This is a boolean element in the array widget")
@Layout(HorizontalLayout2.class)
boolean m_el3;

@Widget(title = "Some double", description = "This is a double element in the array widget")
@Layout(HorizontalLayout2.class)
double m_el4;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* ------------------------------------------------------------------------
*
* Copyright by KNIME AG, Zurich, Switzerland
* Website: http://www.knime.com; Email: contact@knime.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, Version 3, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
* Additional permission under GNU GPL version 3 section 7:
*
* KNIME interoperates with ECLIPSE solely via ECLIPSE's plug-in APIs.
* Hence, KNIME and ECLIPSE are both independent programs and are not
* derived from each other. Should, however, the interpretation of the
* GNU GPL Version 3 ("License") under any applicable laws result in
* KNIME and ECLIPSE being a combined program, KNIME AG herewith grants
* you the additional permission to use and propagate KNIME together with
* ECLIPSE with only the license terms in place for ECLIPSE applying to
* ECLIPSE and the GNU GPL Version 3 applying for KNIME, provided the
* license terms of ECLIPSE themselves allow for the respective use and
* propagation of ECLIPSE together with KNIME.
*
* Additional permission relating to nodes for KNIME that extend the Node
* Extension (and in particular that are based on subclasses of NodeModel,
* NodeDialog, and NodeView) and that only interoperate with KNIME through
* standard APIs ("Nodes"):
* Nodes are deemed to be separate and independent programs and to not be
* covered works. Notwithstanding anything to the contrary in the
* License, the License does not apply to Nodes, you are not required to
* license Nodes under the License, and you are granted a license to
* prepare and propagate Nodes, in each case even if such Nodes are
* propagated with or for interoperation with KNIME. The owner of a Node
* may freely choose the license terms applicable to such Node, including
* when such Node is propagated with or for interoperation with KNIME.
* ---------------------------------------------------------------------
*
* History
* Apr 16, 2026 (paulbaernreuther): created
*/
package org.knime.node.parameters.examples;

import org.knime.node.parameters.Widget;
import org.knime.node.parameters.examples.impl.ExampleNodeParameters;
import org.knime.node.parameters.examples.impl.ExampleNodeParameters.NodeParametersExample;
import org.knime.node.parameters.widget.file.FileReaderWidget;
import org.knime.node.parameters.widget.file.FileSelection;
import org.knime.node.parameters.widget.file.FileSelectionWidget;
import org.knime.node.parameters.widget.file.FileSystemOption;
import org.knime.node.parameters.widget.file.FileWriterWidget;
import org.knime.node.parameters.widget.file.SingleFileSelectionMode;
import org.knime.node.parameters.widget.file.WithFileSystem;

/**
* Demonstrates {@link FileSelection} fields for file chooser widgets. A file reader accepts CSV and TXT files from all
* file systems, while a folder writer restricts to LOCAL and SPACE.
*
* @author Paul Bärnreuther
*/
@NodeParametersExample(name = "File Selection", searchTags = {"file", "reader", "writer", "folder", "path"})
public final class FileSelectionExample implements ExampleNodeParameters {

@Widget(title = "Input file", description = "Select a CSV or TXT file to read from any available file system.")
@FileReaderWidget(fileExtensions = {"csv", "txt"})
FileSelection m_inputFile = new FileSelection();

@Widget(title = "Output folder",
description = "Select a folder to write to. Only LOCAL and SPACE file systems are available.")
@FileWriterWidget
@FileSelectionWidget(SingleFileSelectionMode.FOLDER)
@WithFileSystem({FileSystemOption.LOCAL, FileSystemOption.SPACE})
FileSelection m_outputFolder = new FileSelection();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
/*
* ------------------------------------------------------------------------
*
* Copyright by KNIME AG, Zurich, Switzerland
* Website: http://www.knime.com; Email: contact@knime.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, Version 3, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
* Additional permission under GNU GPL version 3 section 7:
*
* KNIME interoperates with ECLIPSE solely via ECLIPSE's plug-in APIs.
* Hence, KNIME and ECLIPSE are both independent programs and are not
* derived from each other. Should, however, the interpretation of the
* GNU GPL Version 3 ("License") under any applicable laws result in
* KNIME and ECLIPSE being a combined program, KNIME AG herewith grants
* you the additional permission to use and propagate KNIME together with
* ECLIPSE with only the license terms in place for ECLIPSE applying to
* ECLIPSE and the GNU GPL Version 3 applying for KNIME, provided the
* license terms of ECLIPSE themselves allow for the respective use and
* propagation of ECLIPSE together with KNIME.
*
* Additional permission relating to nodes for KNIME that extend the Node
* Extension (and in particular that are based on subclasses of NodeModel,
* NodeDialog, and NodeView) and that only interoperate with KNIME through
* standard APIs ("Nodes"):
* Nodes are deemed to be separate and independent programs and to not be
* covered works. Notwithstanding anything to the contrary in the
* License, the License does not apply to Nodes, you are not required to
* license Nodes under the License, and you are granted a license to
* prepare and propagate Nodes, in each case even if such Nodes are
* propagated with or for interoperation with KNIME. The owner of a Node
* may freely choose the license terms applicable to such Node, including
* when such Node is propagated with or for interoperation with KNIME.
* ---------------------------------------------------------------------
*
* History
* Apr 16, 2026 (paulbaernreuther): created
*/
package org.knime.node.parameters.examples;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

import org.knime.core.node.InvalidSettingsException;
import org.knime.core.node.NodeSettingsRO;
import org.knime.core.node.NodeSettingsWO;
import org.knime.node.parameters.NodeParameters;
import org.knime.node.parameters.Widget;
import org.knime.node.parameters.examples.impl.ExampleNodeParameters;
import org.knime.node.parameters.examples.impl.ExampleNodeParameters.NodeParametersExample;
import org.knime.node.parameters.experimental.persistence.array.ArrayPersistor;
import org.knime.node.parameters.experimental.persistence.array.ElementFieldPersistor;
import org.knime.node.parameters.experimental.persistence.array.PersistArray;
import org.knime.node.parameters.experimental.persistence.array.PersistArrayElement;

/**
* Demonstrates the indexed config keys pattern for custom array persistence. Array elements are persisted with config
* keys that include the element's index (e.g. "value0", "value1", "number0", "number1"). This is useful for
* compatibility with existing settings formats that use indexed keys.
*
* @author Paul Bärnreuther
*/
@NodeParametersExample(name = "Indexed Config Keys Persistence",
searchTags = {"array", "persistence", "custom", "legacy", "indexed"})
public final class IndexedConfigKeysPersistenceExample implements ExampleNodeParameters {

@Widget(title = "Indexed items",
description = "Each element is persisted with indexed config keys (e.g. value0, number0, value1, number1).")
@PersistArray(IndexedArrayPersistor.class)
Item[] m_items = new Item[0];

/**
* Element class representing a single item with indexed persistence.
*/
public static final class Item implements NodeParameters {

@Widget(title = "Value", description = "A string value persisted as 'valueN'.")
@PersistArrayElement(ValuePersistor.class)
String m_value = "";

@Widget(title = "Number", description = "An integer value persisted as 'numberN'.")
@PersistArrayElement(NumberPersistor.class)
int m_number;
}

static final class IndexedSaveDTO {
private final int m_index;

private final List<Consumer<NodeSettingsWO>> m_nodeSettingsConsumers = new ArrayList<>();

IndexedSaveDTO(final int index) {
m_index = index;
}

int getIndex() {
return m_index;
}

void addNodeSettingsModification(final Consumer<NodeSettingsWO> consumer) {
m_nodeSettingsConsumers.add(consumer);
}

List<Consumer<NodeSettingsWO>> getNodeSettingsConsumers() {
return m_nodeSettingsConsumers;
}
}

static final class IndexedArrayPersistor implements ArrayPersistor<Integer, IndexedSaveDTO> {

private static final String NUMBER_OF_ITEMS = "numberOfItems";

@Override
public int getArrayLength(final NodeSettingsRO nodeSettings) {
return nodeSettings.getInt(NUMBER_OF_ITEMS, 0);
}

@Override
public Integer createElementLoadContext(final int index) {
return index;
}

@Override
public IndexedSaveDTO createElementSaveDTO(final int index) {
return new IndexedSaveDTO(index);
}

@Override
public void save(final List<IndexedSaveDTO> savedElements, final NodeSettingsWO nodeSettings) {
nodeSettings.addInt(NUMBER_OF_ITEMS, savedElements.size());
for (IndexedSaveDTO saveDTO : savedElements) {
for (Consumer<NodeSettingsWO> consumer : saveDTO.getNodeSettingsConsumers()) {
consumer.accept(nodeSettings);
}
}
}
}

static final class ValuePersistor implements ElementFieldPersistor<String, Integer, IndexedSaveDTO> {

private static final String VALUE_KEY = "value";

@Override
public String load(final NodeSettingsRO nodeSettings, final Integer loadContext)
throws InvalidSettingsException {
return nodeSettings.getString(VALUE_KEY + loadContext);
}

@Override
public void save(final String param, final IndexedSaveDTO saveDTO) {
final var index = saveDTO.getIndex();
saveDTO.addNodeSettingsModification(settings -> settings.addString(VALUE_KEY + index, param));
}

@Override
public String[][] getConfigPaths() {
return new String[][]{{VALUE_KEY + ARRAY_INDEX_PLACEHOLDER}};
}
}

static final class NumberPersistor implements ElementFieldPersistor<Integer, Integer, IndexedSaveDTO> {

private static final String NUMBER_KEY = "number";

@Override
public Integer load(final NodeSettingsRO nodeSettings, final Integer loadContext)
throws InvalidSettingsException {
return nodeSettings.getInt(NUMBER_KEY + loadContext);
}

@Override
public void save(final Integer param, final IndexedSaveDTO saveDTO) {
final var index = saveDTO.getIndex();
saveDTO.addNodeSettingsModification(settings -> settings.addInt(NUMBER_KEY + index, param));
}

@Override
public String[][] getConfigPaths() {
return new String[][]{{NUMBER_KEY + ARRAY_INDEX_PLACEHOLDER}};
}
}

}
Loading