use of org.knime.core.node.wizard.ViewHideable in project knime-core by knime.
the class SubNodeContainer method setHideNodeFromWizard.
/**
* Sets a flag on a given {@link WizardNode} of nested subnode, whether or not it is hidden from wizard execution
* @param id the node to set the flag on
* @param hide true if the node is supposed to be hidden from WebPortal or wizard execution, false otherwise
* @since 3.5
* @noreference This method is not intended to be referenced by clients.
*/
public void setHideNodeFromWizard(final NodeID id, final boolean hide) {
try (WorkflowLock lock = lock()) {
NodeContainer container = m_wfm.getNodeContainer(id, NodeContainer.class, true);
ViewHideable vh = null;
NativeNodeContainer nnc = null;
if (container instanceof SubNodeContainer) {
vh = (SubNodeContainer) container;
} else if (container instanceof NativeNodeContainer) {
nnc = (NativeNodeContainer) container;
NodeModel model = nnc.getNodeModel();
CheckUtils.checkArgument(model instanceof WizardNode, "Can't set hide in wizard flag on non-wizard nodes.");
vh = (WizardNode<?, ?>) model;
} else {
throw new IllegalArgumentException("Node with id " + id + " needs to be a native node or a subnode container!");
}
if (vh != null) {
if (hide != vh.isHideInWizard()) {
vh.setHideInWizard(hide);
if (nnc != null) {
nnc.saveNodeSettingsToDefault();
nnc.setDirty();
}
}
}
}
}
use of org.knime.core.node.wizard.ViewHideable in project knime-core by knime.
the class WizardPageUtil method collectWizardPageNodes.
private static void collectWizardPageNodes(final WorkflowManager wfm, final boolean recurseIntoComponents, final boolean includeHiddenNodes, final List<NativeNodeContainer> res) {
for (NodeContainer nc : wfm.getNodeContainers()) {
if (nc instanceof NativeNodeContainer) {
NativeNodeContainer nnc = (NativeNodeContainer) nc;
var nodeModel = nnc.getNodeModel();
if (!includeHiddenNodes && nodeModel instanceof ViewHideable && ((ViewHideable) nodeModel).isHideInWizard()) {
continue;
}
if (isWizardPageNode(nnc)) {
res.add(nnc);
}
} else if (recurseIntoComponents && nc instanceof SubNodeContainer) {
collectWizardPageNodes(((SubNodeContainer) nc).getWorkflowManager(), recurseIntoComponents, includeHiddenNodes, res);
}
}
}
Aggregations