use of org.knime.core.node.workflow.SinglePageWebResourceController in project knime-core by knime.
the class SinglePageManager method applyValidatedViewValues.
/**
* Applies a given map of view values to a given subnode which have already been validated.
* @param viewValues an already validated map with {@link NodeIDSuffix} string as key and parsed view value as value
* @param containerNodeId the {@link NodeID} of the subnode
* @param useAsDefault true, if values are supposed to be applied as new defaults, false if applied temporarily
* @throws IOException on serialization error
*/
public void applyValidatedViewValues(final Map<String, String> viewValues, final NodeID containerNodeId, final boolean useAsDefault) throws IOException {
try (WorkflowLock lock = getWorkflowManager().lock()) {
/*ObjectMapper mapper = new ObjectMapper();
for (String key : viewValues.keySet()) {
String content = mapper.writeValueAsString(viewValues.get(key));
viewValues.put(key, content);
}*/
if (!viewValues.isEmpty()) {
SinglePageWebResourceController sec = getController(containerNodeId);
sec.loadValuesIntoPage(viewValues, false, useAsDefault);
}
}
}
use of org.knime.core.node.workflow.SinglePageWebResourceController in project knime-core by knime.
the class SinglePageManager method createWizardPage.
/**
* Creates a wizard page object from a given node id
*
* @param containerNodeID the node id to create the wizard page for
* @return a {@link JSONWebNodePage} object which can be used for serialization
* @throws IOException if the layout of the wizard page can not be generated
*/
public JSONWebNodePage createWizardPage(final NodeID containerNodeID) throws IOException {
SinglePageWebResourceController sec = getController(containerNodeID);
WizardPageContent page = sec.getWizardPage();
return createWizardPageInternal(page);
}
use of org.knime.core.node.workflow.SinglePageWebResourceController in project knime-core by knime.
the class SinglePageManager method createWizardPageViewValueMap.
/**
* Creates a map of node id string to JSON view value string for all appropriate wizard nodes from a given node id.
*
* @param containerNodeID the node id to create the view value map for
* @return a map containing all appropriate view values
* @throws IOException on serialization error
*/
public Map<String, String> createWizardPageViewValueMap(final NodeID containerNodeID) throws IOException {
SinglePageWebResourceController sec = getController(containerNodeID);
Map<NodeIDSuffix, WebViewContent> viewMap = sec.getWizardPageViewValueMap();
Map<String, String> resultMap = new HashMap<String, String>();
for (Entry<NodeIDSuffix, WebViewContent> entry : viewMap.entrySet()) {
WebViewContent c = entry.getValue();
resultMap.put(entry.getKey().toString(), new String(((ByteArrayOutputStream) c.saveToStream()).toByteArray()));
}
return resultMap;
}
Aggregations