use of org.knime.core.node.workflow.action.InteractiveWebViewsResult.Builder in project knime-core by knime.
the class SubNodeContainer method getInteractiveWebViews.
/**
* A {@link InteractiveWebViewsResult} for a subnode containing either a single page view on all appropriate wizard views or a set of all individual wizard views (no recursion).
*
* @param combinedView
* @return
*/
public InteractiveWebViewsResult getInteractiveWebViews(final boolean combinedView) {
try (WorkflowLock lock = m_wfm.lock()) {
Builder builder = InteractiveWebViewsResult.newBuilder();
if (combinedView) {
} else {
// collect all the nodes first, then do make names unique (in case there are 2+ scatterplot)
NativeNodeContainer[] nodesWithViews = m_wfm.getWorkflow().getNodeValues().stream().filter(n -> n instanceof NativeNodeContainer).filter(n -> n.getInteractiveWebViews().size() > 0).map(n -> (NativeNodeContainer) n).toArray(NativeNodeContainer[]::new);
// count how often certain names are in use
Map<String, Long> uniqueNameBag = Arrays.stream(nodesWithViews).map(n -> n.getInteractiveViewName()).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
for (NativeNodeContainer n : nodesWithViews) {
String name = n.getInteractiveViewName();
if (uniqueNameBag.get(name) >= 2L) {
name = name.concat(" (ID " + n.getID().getIndex() + ")");
}
builder.add(n, name);
}
}
return builder.build();
}
}
Aggregations