Search in sources :

Example 1 with EnabledDialogNodeModelFilter

use of org.knime.core.node.dialog.EnabledDialogNodeModelFilter in project knime-core by knime.

the class SubNodeContainer method getDialogDescriptions.

/**
 * @return a list of descriptions for all the visible dialog options
 * @since 4.3
 */
// raw types
@SuppressWarnings({ "java:S1452", "java:S3740", "rawtypes" })
public List<SubNodeDescriptionProvider<? extends DialogNodeValue>> getDialogDescriptions() {
    Map<NodeID, DialogNode> nodes = m_wfm.findNodes(DialogNode.class, new EnabledDialogNodeModelFilter(), false);
    List<Integer> order = ConfigurationLayoutUtil.getConfigurationOrder(m_subnodeConfigurationStringProvider, nodes, m_wfm);
    // Will contain the nodes in the ordering given by `order`.
    // Nodes not mentioned in `order` will be placed at the end in arbitrary order.
    TreeMap<Integer, DialogNode> orderedNodes = new TreeMap<>();
    List<DialogNode> unorderedNodes = new ArrayList<>(nodes.size());
    nodes.forEach((nodeId, metaNodeDialogNode) -> {
        int targetIndex = order.indexOf(nodeId.getIndex());
        if (targetIndex == -1) {
            unorderedNodes.add(metaNodeDialogNode);
        } else {
            orderedNodes.put(targetIndex, metaNodeDialogNode);
        }
    });
    List<DialogNode> res = new ArrayList<>();
    // `values` is ordered
    res.addAll(orderedNodes.values());
    res.addAll(unorderedNodes);
    return res.stream().map(DialogNode::getDialogRepresentation).filter(r -> r instanceof SubNodeDescriptionProvider).map(p -> (SubNodeDescriptionProvider) p).collect(toList());
}
Also used : WizardNode(org.knime.core.node.wizard.WizardNode) VirtualSubNodeInputNodeFactory(org.knime.core.node.workflow.virtual.subnode.VirtualSubNodeInputNodeFactory) Arrays(java.util.Arrays) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) ReferencedFile(org.knime.core.internal.ReferencedFile) CanceledExecutionException(org.knime.core.node.CanceledExecutionException) StringUtils(org.apache.commons.lang3.StringUtils) NodeContainerExecutionStatus(org.knime.core.node.workflow.execresult.NodeContainerExecutionStatus) VirtualSubNodeOutputNodeModel(org.knime.core.node.workflow.virtual.subnode.VirtualSubNodeOutputNodeModel) Node(org.knime.core.node.Node) Document(org.w3c.dom.Document) Map(java.util.Map) ComponentMetadataBuilder(org.knime.core.node.workflow.ComponentMetadata.ComponentMetadataBuilder) NodeDescription(org.knime.core.node.NodeDescription) LockFailedException(org.knime.core.util.LockFailedException) ExecutionMonitor(org.knime.core.node.ExecutionMonitor) ThreadPool(org.knime.core.util.ThreadPool) Set(java.util.Set) ThreadNodeExecutionJobManager(org.knime.core.node.exec.ThreadNodeExecutionJobManager) FlowVariablePortObject(org.knime.core.node.port.flowvariable.FlowVariablePortObject) Callable(java.util.concurrent.Callable) SplitType(org.knime.core.node.workflow.NodeContainer.NodeContainerSettings.SplitType) ArrayList(java.util.ArrayList) NotConfigurableException(org.knime.core.node.NotConfigurableException) WorkflowExecutionResult(org.knime.core.node.workflow.execresult.WorkflowExecutionResult) DialogNode(org.knime.core.node.dialog.DialogNode) InactiveBranchPortObject(org.knime.core.node.port.inactive.InactiveBranchPortObject) InteractiveView(org.knime.core.node.interactive.InteractiveView) FileOutputStream(java.io.FileOutputStream) PortObjectSpec(org.knime.core.node.port.PortObjectSpec) IOException(java.io.IOException) DialogNodeValue(org.knime.core.node.dialog.DialogNodeValue) File(java.io.File) ViewContent(org.knime.core.node.interactive.ViewContent) ExecutionException(java.util.concurrent.ExecutionException) EnabledDialogNodeModelFilter(org.knime.core.node.dialog.EnabledDialogNodeModelFilter) CSSModifiable(org.knime.core.node.wizard.CSSModifiable) XmlException(org.apache.xmlbeans.XmlException) TreeMap(java.util.TreeMap) VirtualSubNodeOutputNodeFactory(org.knime.core.node.workflow.virtual.subnode.VirtualSubNodeOutputNodeFactory) FlowVariablePortObjectSpec(org.knime.core.node.port.flowvariable.FlowVariablePortObjectSpec) NodeType(org.knime.core.node.NodeFactory.NodeType) ViewHideable(org.knime.core.node.wizard.ViewHideable) Builder(org.knime.core.node.workflow.action.InteractiveWebViewsResult.Builder) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) URL(java.net.URL) NodeConfigureHelper(org.knime.core.node.NodeConfigureHelper) NodeDialogPane(org.knime.core.node.NodeDialogPane) ByteArrayInputStream(java.io.ByteArrayInputStream) VirtualSubNodeExchange(org.knime.core.node.workflow.virtual.subnode.VirtualSubNodeExchange) AbstractNodeView(org.knime.core.node.AbstractNodeView) URI(java.net.URI) InactiveBranchPortObjectSpec(org.knime.core.node.port.inactive.InactiveBranchPortObjectSpec) PortType(org.knime.core.node.port.PortType) Collection(java.util.Collection) VirtualSubNodeInputNodeModel(org.knime.core.node.workflow.virtual.subnode.VirtualSubNodeInputNodeModel) NodeModel(org.knime.core.node.NodeModel) Collectors(java.util.stream.Collectors) List(java.util.List) BufferedDataTable(org.knime.core.node.BufferedDataTable) WorkflowPortTemplate(org.knime.core.node.workflow.WorkflowPersistor.WorkflowPortTemplate) NodeContainerTemplateLinkUpdateResult(org.knime.core.node.workflow.WorkflowPersistor.NodeContainerTemplateLinkUpdateResult) HiLiteHandler(org.knime.core.node.property.hilite.HiLiteHandler) Optional(java.util.Optional) CheckUtils(org.knime.core.node.util.CheckUtils) PortObject(org.knime.core.node.port.PortObject) NodeContainerExecutionResult(org.knime.core.node.workflow.execresult.NodeContainerExecutionResult) SubNodeDescriptionProvider(org.knime.core.node.dialog.SubNodeDescriptionProvider) NodeExecutionJobManagerPool(org.knime.core.node.util.NodeExecutionJobManagerPool) LoadVersion(org.knime.core.util.LoadVersion) HashMap(java.util.HashMap) ArrayUtils(org.apache.commons.lang3.ArrayUtils) NodeSettings(org.knime.core.node.NodeSettings) ConnectionType(org.knime.core.node.workflow.ConnectionContainer.ConnectionType) Function(java.util.function.Function) Pair(org.knime.core.util.Pair) ExecutionContext(org.knime.core.node.ExecutionContext) ConnectionContainerTemplate(org.knime.core.node.workflow.WorkflowPersistor.ConnectionContainerTemplate) ObjectUtils(org.apache.commons.lang3.ObjectUtils) NodeLogger(org.knime.core.node.NodeLogger) DOMException(org.w3c.dom.DOMException) EXECUTED(org.knime.core.node.workflow.InternalNodeContainerState.EXECUTED) LoadResult(org.knime.core.node.workflow.WorkflowPersistor.LoadResult) Role(org.knime.core.node.workflow.MetaNodeTemplateInformation.Role) InteractiveWebViewsResult(org.knime.core.node.workflow.action.InteractiveWebViewsResult) NodeDescription27Proxy(org.knime.core.node.NodeDescription27Proxy) OutputStream(java.io.OutputStream) Iterator(java.util.Iterator) ReentrantLock(java.util.concurrent.locks.ReentrantLock) TemplateType(org.knime.core.node.workflow.MetaNodeTemplateInformation.TemplateType) NodeModelFilter(org.knime.core.node.workflow.WorkflowManager.NodeModelFilter) MetaPortInfo(org.knime.core.node.port.MetaPortInfo) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) Type(org.knime.core.node.workflow.NodeMessage.Type) TimeUnit(java.util.concurrent.TimeUnit) Collectors.toList(java.util.stream.Collectors.toList) Element(org.w3c.dom.Element) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) ConfigurationLayoutUtil(org.knime.core.node.dialog.util.ConfigurationLayoutUtil) NodeProperty(org.knime.core.node.workflow.NodePropertyChangedEvent.NodeProperty) MetaNodeDialogType(org.knime.core.node.workflow.MetaNodeDialogPane.MetaNodeDialogType) SubnodeContainerExecutionResult(org.knime.core.node.workflow.execresult.SubnodeContainerExecutionResult) Collections(java.util.Collections) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) DialogNode(org.knime.core.node.dialog.DialogNode) TreeMap(java.util.TreeMap) SubNodeDescriptionProvider(org.knime.core.node.dialog.SubNodeDescriptionProvider) EnabledDialogNodeModelFilter(org.knime.core.node.dialog.EnabledDialogNodeModelFilter)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 URI (java.net.URI)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 TreeMap (java.util.TreeMap)1 Callable (java.util.concurrent.Callable)1