use of org.knime.core.node.property.hilite.HiLiteTranslator in project knime-core by knime.
the class Unpivot2NodeModel method setInHiLiteHandler.
/**
* {@inheritDoc}
*/
@Override
protected void setInHiLiteHandler(final int inIndex, final HiLiteHandler hiLiteHdl) {
if (m_trans != null && m_trans.getFromHiLiteHandler() != hiLiteHdl) {
m_trans.dispose();
m_trans = null;
}
if (hiLiteHdl != null) {
m_trans = new HiLiteTranslator(hiLiteHdl);
m_trans.addToHiLiteHandler(m_hilite);
}
}
use of org.knime.core.node.property.hilite.HiLiteTranslator in project knime-core by knime.
the class UnpivotNodeModel method setInHiLiteHandler.
/**
* {@inheritDoc}
*/
@Override
protected void setInHiLiteHandler(final int inIndex, final HiLiteHandler hiLiteHdl) {
if (m_trans == null) {
m_trans = new HiLiteTranslator(hiLiteHdl);
m_trans.addToHiLiteHandler(m_hilite);
} else if (m_trans.getFromHiLiteHandler() != hiLiteHdl) {
m_trans.removeAllToHiliteHandlers();
m_trans.setMapper(null);
m_trans.addToHiLiteHandler(m_hilite);
}
}
use of org.knime.core.node.property.hilite.HiLiteTranslator in project knime-core by knime.
the class WebResourceController method getHiLiteTranslators.
private void getHiLiteTranslators(final HiLiteHandler handler, final Set<HiLiteHandler> knownHiLiteHandlers, final Set<HiLiteTranslator> knownTranslators, final Set<HiLiteManager> knownManagers) {
if (handler == null || !knownHiLiteHandlers.add(handler)) {
return;
}
Set<HiLiteTranslator> translators = handler.getHiLiteTranslators();
for (HiLiteTranslator translator : translators) {
if (translator != null && knownTranslators.add(translator)) {
followHiLiteTranslator(translator, knownHiLiteHandlers, knownTranslators, knownManagers);
}
}
Set<HiLiteManager> managers = handler.getHiLiteManagers();
for (HiLiteManager manager : managers) {
if (manager != null && knownManagers.add(manager)) {
followHiLiteManager(manager, knownHiLiteHandlers, knownTranslators, knownManagers);
}
}
}
use of org.knime.core.node.property.hilite.HiLiteTranslator in project knime-core by knime.
the class WizardPageUtil method createWizardPage.
/**
* Creates the wizard page for a given node id. Throws exception if no wizard page available.
*
* Note: the workflow manager must be locked!
*
* @param manager the workflow that contains the component to create the wizard page for
* @param subnodeID the node id for the subnode to create the wizard page for
* @return The wizard page for the given node id
* @throws IllegalArgumentException if there is no component for the given id
*/
public static WizardPage createWizardPage(final WorkflowManager manager, final NodeID subnodeID) {
if (subnodeID == null) {
LOGGER.error("No node ID supplied for creating wizard page");
return null;
}
// NOSONAR
assert manager.isLockedByCurrentThread();
LinkedHashMap<NodeIDSuffix, NativeNodeContainer> resultMap = new LinkedHashMap<>();
Set<HiLiteHandler> initialHiliteHandlerSet = new HashSet<>();
SubNodeContainer subNC = manager.getNodeContainer(subnodeID, SubNodeContainer.class, true);
LinkedHashMap<NodeIDSuffix, SubNodeContainer> sncMap = new LinkedHashMap<>();
findNestedViewNodes(subNC, resultMap, sncMap, initialHiliteHandlerSet);
SubnodeContainerLayoutStringProvider layoutStringProvider = subNC.getSubnodeLayoutStringProvider();
if (layoutStringProvider.isEmptyLayout() || layoutStringProvider.isPlaceholderLayout()) {
try {
var subWfm = subNC.getWorkflowManager();
Map<NodeIDSuffix, SingleNodeContainer> viewMap = new LinkedHashMap<>();
getWizardPageNodes(subWfm).stream().forEach(n -> viewMap.put(toNodeIDSuffix(manager, n.getID()), n));
Map<NodeID, SubNodeContainer> nestedSubs = getSubPageNodes(subWfm);
nestedSubs.entrySet().stream().forEach(e -> viewMap.put(toNodeIDSuffix(manager, e.getKey()), e.getValue()));
layoutStringProvider.setLayoutString(LayoutUtil.createDefaultLayout(viewMap));
} catch (IOException ex) {
LOGGER.error("Default page layout could not be created: " + ex.getMessage(), ex);
}
}
try {
LayoutUtil.expandNestedLayout(layoutStringProvider, subNC.getWorkflowManager());
} catch (IOException ex) {
LOGGER.error("Nested layouts could not be expanded: " + ex.getMessage(), ex);
}
try {
var containerID = NodeID.fromString(NodeIDSuffix.create(manager.getID(), subNC.getWorkflowManager().getID()).toString());
LayoutUtil.addUnreferencedViews(layoutStringProvider, resultMap, sncMap, containerID);
} catch (IOException ex) {
LOGGER.error("Layout could not be amended by unreferenced views: " + ex.getMessage(), ex);
}
try {
LayoutUtil.updateLayout(layoutStringProvider);
} catch (Exception ex) {
// NOSONAR
LOGGER.error("Layout could not be updated: " + ex.getMessage(), ex);
}
Set<HiLiteHandler> knownHiLiteHandlers = new HashSet<>();
Set<HiLiteTranslator> knownTranslators = new HashSet<>();
Set<HiLiteManager> knownManagers = new HashSet<>();
for (HiLiteHandler initialHandler : initialHiliteHandlerSet) {
getHiLiteTranslators(initialHandler, knownHiLiteHandlers, knownTranslators, knownManagers);
}
List<HiLiteTranslator> translatorList = !knownTranslators.isEmpty() ? new ArrayList<>(knownTranslators) : null;
List<HiLiteManager> managerList = !knownManagers.isEmpty() ? new ArrayList<>(knownManagers) : null;
return new WizardPage(subnodeID, resultMap, layoutStringProvider.getLayoutString(), translatorList, managerList);
}
use of org.knime.core.node.property.hilite.HiLiteTranslator in project knime-core by knime.
the class Joiner2NodeModel method setInHiLiteHandler.
/**
* {@inheritDoc}
*/
@Override
protected void setInHiLiteHandler(final int inIndex, final HiLiteHandler hiLiteHdl) {
if (0 == inIndex) {
m_leftTranslator.removeAllToHiliteHandlers();
m_leftTranslator = new HiLiteTranslator(hiLiteHdl, m_leftMapper);
m_leftTranslator.addToHiLiteHandler(m_outHandler);
} else {
m_rightTranslator.removeAllToHiliteHandlers();
m_rightTranslator = new HiLiteTranslator(hiLiteHdl, m_rightMapper);
m_rightTranslator.addToHiLiteHandler(m_outHandler);
}
}
Aggregations