use of org.knime.core.node.workflow.NodeContainer.NodeContainerSettings.SplitType in project knime-core by knime.
the class SubNodeContainer method getDialogPane.
/**
* {@inheritDoc}
*/
@Override
NodeDialogPane getDialogPane() {
if (m_nodeDialogPane == null) {
if (hasDialog()) {
// create sub node dialog with dialog nodes
m_nodeDialogPane = new MetaNodeDialogPane(MetaNodeDialogType.SUBNODE);
// job managers tab
if (NodeExecutionJobManagerPool.getNumberOfJobManagersFactories() > 1) {
// TODO: set the SplitType depending on the nodemodel
SplitType splitType = SplitType.USER;
m_nodeDialogPane.addJobMgrTab(splitType);
}
Node.addMiscTab(m_nodeDialogPane);
} else {
throw new IllegalStateException("Workflow has no dialog");
}
}
return m_nodeDialogPane;
}
use of org.knime.core.node.workflow.NodeContainer.NodeContainerSettings.SplitType in project knime-core by knime.
the class OpenMultiDialogAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
NodeID[] nodes = new NodeID[nodeParts.length];
SplitType splitType = SplitType.USER;
for (int i = 0; i < nodeParts.length; i++) {
NodeContainerUI nc = nodeParts[i].getNodeContainer();
nodes[i] = nc.getID();
if (nc instanceof WorkflowManagerUI) {
// one metanode disables splitting
splitType = SplitType.DISALLOWED;
}
}
WrappedMultipleNodeDialog dlg = new WrappedMultipleNodeDialog(Display.getCurrent().getActiveShell(), getManager(), splitType, nodes);
// the dialog applies new settings on OK
dlg.open();
}
use of org.knime.core.node.workflow.NodeContainer.NodeContainerSettings.SplitType in project knime-core by knime.
the class Node method createDialogPane.
/**
* Helper method to create a node dialog pane from a {@link NodeFactory} instance.
*
* @param factory the factory instance to create the node dialog pane from
* @param nrOutPorts the number of output ports (mainly used to determine whether to add a misc ("Memory Policy")
* tab; if this value is greater than zero, such a tab will be added)
* @param addJobMgrTab whether the job manager tab should be added
* @param creationConfig the node creation configuration, must be non-null if the provided factory is of type
* {@link ConfigurableNodeFactory}
*
* @return Reference to dialog pane.
* @throws IllegalStateException If node has no dialog.
* @since 4.1
*/
public static NodeDialogPane createDialogPane(final NodeFactory<NodeModel> factory, final int nrOutPorts, final boolean addJobMgrTab, final NodeCreationConfiguration creationConfig) {
AtomicReference<NodeDialogPane> dialogPaneRef = new AtomicReference<>();
if (factory.hasDialog()) {
final AtomicReference<Throwable> exRef = new AtomicReference<Throwable>();
Runnable r = new Runnable() {
@Override
public void run() {
try {
final NodeDialogPane dialogPane;
if (creationConfig != null) {
dialogPane = factory.createNodeDialogPane(creationConfig);
} else {
dialogPane = factory.createNodeDialogPane();
}
dialogPaneRef.set(dialogPane);
} catch (Throwable ex) {
exRef.set(ex);
}
}
};
ViewUtils.invokeAndWaitInEDT(r);
if (exRef.get() instanceof Error) {
throw (Error) exRef.get();
} else if (exRef.get() instanceof RuntimeException) {
NodeLogger.getLogger(Node.class).error("Error while creating node dialog for '" + factory.getNodeName() + "': " + exRef.get().getMessage(), exRef.get());
throw (RuntimeException) exRef.get();
} else {
// not possible since createNodeDialogPane does not throw Exceptions
}
} else {
dialogPaneRef.set(new EmptyNodeDialogPane());
}
if (nrOutPorts > 0) {
dialogPaneRef.get().addMiscTab();
}
if (addJobMgrTab && (NodeExecutionJobManagerPool.getNumberOfJobManagersFactories() > 1)) {
// TODO: set the splittype depending on the nodemodel
SplitType splitType = SplitType.USER;
dialogPaneRef.get().addJobMgrTab(splitType);
}
return dialogPaneRef.get();
}
Aggregations