Search in sources :

Example 11 with NodeIDSuffix

use of org.knime.core.node.workflow.NodeID.NodeIDSuffix in project knime-core by knime.

the class AbstractPageManager method createWizardPageInternal.

/**
 * Performs a transformation from {@link WizardPageContent} to {@link JSONWebNodePage} which can be used for serialization.
 * @param page the {@link WizardPageContent} to transform
 * @return the transformed {@link JSONWebNodePage}
 * @throws IOException if layout of page can not be generated
 */
protected JSONWebNodePage createWizardPageInternal(final WizardPageContent page) throws IOException {
    // process layout
    JSONLayoutPage layout = new JSONLayoutPage();
    try {
        String lString = page.getLayoutInfo();
        if (StringUtils.isNotEmpty(lString)) {
            layout = getJSONLayoutFromSubnode(page.getPageNodeID(), page.getLayoutInfo());
        }
    } catch (IOException e) {
        throw new IOException("Layout for page could not be generated: " + e.getMessage(), e);
    }
    // process selection translators
    List<JSONSelectionTranslator> selectionTranslators = new ArrayList<JSONSelectionTranslator>();
    if (page.getHiLiteTranslators() != null) {
        for (HiLiteTranslator hiLiteTranslator : page.getHiLiteTranslators()) {
            if (hiLiteTranslator != null) {
                selectionTranslators.add(new JSONSelectionTranslator(hiLiteTranslator));
            }
        }
    }
    if (page.getHiliteManagers() != null) {
        for (HiLiteManager hiLiteManager : page.getHiliteManagers()) {
            if (hiLiteManager != null) {
                selectionTranslators.add(new JSONSelectionTranslator(hiLiteManager));
            }
        }
    }
    if (selectionTranslators.size() < 1) {
        selectionTranslators = null;
    }
    JSONWebNodePageConfiguration pageConfig = new JSONWebNodePageConfiguration(layout, null, selectionTranslators);
    Map<String, JSONWebNode> nodes = new HashMap<String, JSONWebNode>();
    for (Map.Entry<NodeIDSuffix, WizardPageNodeInfo> e : page.getInfoMap().entrySet()) {
        WizardPageNodeInfo pInfo = e.getValue();
        JSONWebNode jsonNode = new JSONWebNode();
        JSONWebNodeInfo info = new JSONWebNodeInfo();
        info.setNodeName(pInfo.getNodeName());
        info.setNodeAnnotation(pInfo.getNodeAnnotation());
        NodeContainerState state = pInfo.getNodeState();
        if (state.isIdle()) {
            info.setNodeState(JSONNodeState.IDLE);
        }
        if (state.isConfigured()) {
            info.setNodeState(JSONNodeState.CONFIGURED);
        }
        if (state.isExecutionInProgress() || state.isExecutingRemotely()) {
            info.setNodeState(JSONNodeState.EXECUTING);
        }
        if (state.isExecuted()) {
            info.setNodeState(JSONNodeState.EXECUTED);
        }
        NodeMessage message = pInfo.getNodeMessage();
        if (org.knime.core.node.workflow.NodeMessage.Type.ERROR.equals(message.getMessageType())) {
            info.setNodeErrorMessage(message.getMessage());
        }
        if (org.knime.core.node.workflow.NodeMessage.Type.WARNING.equals(message.getMessageType())) {
            info.setNodeWarnMessage(message.getMessage());
        }
        WizardNode<?, ?> wizardNode = page.getPageMap().get(e.getKey());
        if (wizardNode == null) {
            info.setDisplayPossible(false);
        } else {
            info.setDisplayPossible(true);
            WebTemplate template = WebResourceController.getWebTemplateFromJSObjectID(wizardNode.getJavascriptObjectID());
            List<String> jsList = new ArrayList<String>();
            List<String> cssList = new ArrayList<String>();
            for (WebResourceLocator locator : template.getWebResources()) {
                if (locator.getType() == WebResourceType.JAVASCRIPT) {
                    jsList.add(locator.getRelativePathTarget());
                } else if (locator.getType() == WebResourceType.CSS) {
                    cssList.add(locator.getRelativePathTarget());
                }
            }
            jsonNode.setJavascriptLibraries(jsList);
            jsonNode.setStylesheets(cssList);
            jsonNode.setNamespace(template.getNamespace());
            jsonNode.setInitMethodName(template.getInitMethodName());
            jsonNode.setValidateMethodName(template.getValidateMethodName());
            jsonNode.setSetValidationErrorMethodName(template.getSetValidationErrorMethodName());
            jsonNode.setGetViewValueMethodName(template.getPullViewContentMethodName());
            jsonNode.setViewRepresentation((JSONViewContent) wizardNode.getViewRepresentation());
            jsonNode.setViewValue((JSONViewContent) wizardNode.getViewValue());
        }
        jsonNode.setNodeInfo(info);
        nodes.put(e.getKey().toString(), jsonNode);
    }
    return new JSONWebNodePage(pageConfig, nodes);
}
Also used : JSONLayoutPage(org.knime.js.core.layout.bs.JSONLayoutPage) HashMap(java.util.HashMap) JSONWebNodePageConfiguration(org.knime.js.core.JSONWebNodePageConfiguration) ArrayList(java.util.ArrayList) JSONWebNode(org.knime.js.core.JSONWebNode) HiLiteTranslator(org.knime.core.node.property.hilite.HiLiteTranslator) IOException(java.io.IOException) HiLiteManager(org.knime.core.node.property.hilite.HiLiteManager) JSONWebNodePage(org.knime.js.core.JSONWebNodePage) NodeContainerState(org.knime.core.node.workflow.NodeContainerState) WebResourceLocator(org.knime.core.node.web.WebResourceLocator) JSONWebNodeInfo(org.knime.js.core.JSONWebNodeInfo) NodeIDSuffix(org.knime.core.node.workflow.NodeID.NodeIDSuffix) WebTemplate(org.knime.core.node.web.WebTemplate) JSONSelectionTranslator(org.knime.js.core.selections.json.JSONSelectionTranslator) NodeMessage(org.knime.core.node.workflow.NodeMessage) HashMap(java.util.HashMap) Map(java.util.Map) WizardPageNodeInfo(org.knime.core.node.workflow.WebResourceController.WizardPageContent.WizardPageNodeInfo)

Example 12 with NodeIDSuffix

use of org.knime.core.node.workflow.NodeID.NodeIDSuffix in project knime-core by knime.

the class SubnodeLayoutJSONEditorPage method fillBasicComposite.

private void fillBasicComposite() {
    if (!m_basicPanelAvailable) {
        GridData gridData = new GridData();
        gridData.grabExcessHorizontalSpace = true;
        gridData.horizontalAlignment = SWT.CENTER;
        Label infoLabel = new Label(m_basicComposite, SWT.CENTER);
        infoLabel.setText("A basic configuration of the layout is not possible. \nPlease use the \"Advanced\" tab.");
        infoLabel.setLayoutData(gridData);
        return;
    }
    m_basicComposite.setLayout(new GridLayout(7, false));
    m_basicComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
    Label titleLabel = new Label(m_basicComposite, SWT.LEFT);
    FontData fontData = titleLabel.getFont().getFontData()[0];
    Font boldFont = new Font(Display.getCurrent(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
    titleLabel.setText("Node");
    titleLabel.setFont(boldFont);
    new Composite(m_basicComposite, SWT.NONE);
    /* Warning placeholder */
    Label rowLabel = new Label(m_basicComposite, SWT.CENTER);
    rowLabel.setText("Row");
    rowLabel.setFont(boldFont);
    Label colLabel = new Label(m_basicComposite, SWT.CENTER);
    colLabel.setText("Column");
    colLabel.setFont(boldFont);
    Label widthLabel = new Label(m_basicComposite, SWT.CENTER);
    widthLabel.setText("Width");
    widthLabel.setFont(boldFont);
    new Composite(m_basicComposite, SWT.NONE);
    /* More placeholder */
    new Composite(m_basicComposite, SWT.NONE);
    for (final Entry<NodeIDSuffix, BasicLayoutInfo> entry : m_basicMap.entrySet()) {
        NodeIDSuffix suffix = entry.getKey();
        BasicLayoutInfo layoutInfo = entry.getValue();
        NodeID nodeID = suffix.prependParent(m_subNodeContainer.getWorkflowManager().getID());
        NodeContainer nodeContainer = m_viewNodes.containsKey(suffix) ? m_wfManager.getNodeContainer(nodeID) : null;
        createNodeLabelComposite(m_basicComposite, nodeID, nodeContainer);
        final Label warningLabel = new Label(m_basicComposite, SWT.CENTER);
        if (nodeContainer != null && m_viewNodes.get(suffix).isHideInWizard()) {
            warningLabel.setImage(ImageRepository.getIconImage(KNIMEEditorPlugin.PLUGIN_ID, "icons/layout/warning.png"));
            warningLabel.setToolTipText("Node is set to 'Hide in Wizard'. It might not be displayed in the layout.");
        }
        GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
        gridData.widthHint = 50;
        final Spinner rowSpinner = createBasicPanelSpinner(m_basicComposite, layoutInfo.getRow(), 1, 999);
        rowSpinner.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                layoutInfo.setRow(rowSpinner.getSelection());
                tryUpdateJsonFromBasic();
            }
        });
        final Spinner colSpinner = createBasicPanelSpinner(m_basicComposite, layoutInfo.getCol(), 1, 99);
        colSpinner.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                layoutInfo.setCol(colSpinner.getSelection());
                tryUpdateJsonFromBasic();
            }
        });
        final Spinner widthSpinner = createBasicPanelSpinner(m_basicComposite, layoutInfo.getColWidth(), 1, 12);
        widthSpinner.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                layoutInfo.setColWidth(widthSpinner.getSelection());
                tryUpdateJsonFromBasic();
            }
        });
        final Button advancedButton = new Button(m_basicComposite, SWT.PUSH | SWT.CENTER);
        advancedButton.setImage(ImageRepository.getIconImage(KNIMEEditorPlugin.PLUGIN_ID, "icons/layout/settings.png"));
        advancedButton.setToolTipText("Additional layout settings");
        if (nodeContainer == null) {
            advancedButton.setEnabled(false);
        } else {
            advancedButton.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    JSONLayoutViewContent defaultViewContent = m_layoutCreator.getDefaultViewContentForNode(suffix, m_viewNodes.get(suffix));
                    ViewContentSettingsDialog settingsDialog = new ViewContentSettingsDialog(m_basicComposite.getShell(), layoutInfo.getView(), defaultViewContent);
                    if (settingsDialog.open() == Window.OK) {
                        layoutInfo.setView(settingsDialog.getViewSettings());
                        tryUpdateJsonFromBasic();
                    }
                }
            });
        }
        final Button removeButton = new Button(m_basicComposite, SWT.PUSH | SWT.CENTER);
        removeButton.setImage(ImageRepository.getIconImage(KNIMEEditorPlugin.PLUGIN_ID, "icons/layout/remove.png"));
        removeButton.setToolTipText("Remove node from layout");
        removeButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                if (nodeContainer != null) {
                    if (!MessageDialog.openConfirm(m_basicComposite.getShell(), "Confirm deletion", "Are you sure you want to delete node " + suffix + " from the layout?")) {
                        return;
                    }
                }
                m_basicMap.remove(suffix);
                tryUpdateJsonFromBasic();
            }
        });
    }
    for (@SuppressWarnings("rawtypes") final Entry<NodeIDSuffix, WizardNode> entry : m_viewNodes.entrySet()) {
        if (m_basicMap.containsKey(entry.getKey())) {
            continue;
        }
        // Node not in layout
        NodeID nodeID = entry.getKey().prependParent(m_subNodeContainer.getWorkflowManager().getID());
        NodeContainer nodeContainer = m_wfManager.getNodeContainer(nodeID);
        createNodeLabelComposite(m_basicComposite, nodeID, nodeContainer);
        final Label warningLabel = new Label(m_basicComposite, SWT.CENTER);
        if (nodeContainer != null && m_viewNodes.get(entry.getKey()).isHideInWizard()) {
            warningLabel.setImage(ImageRepository.getIconImage(KNIMEEditorPlugin.PLUGIN_ID, "icons/layout/warning.png"));
            warningLabel.setToolTipText("Node is set to 'Hide in Wizard'. It might not be displayed in the layout.");
        }
        final Button addButton = new Button(m_basicComposite, SWT.PUSH | SWT.CENTER);
        addButton.setImage(ImageRepository.getIconImage(KNIMEEditorPlugin.PLUGIN_ID, "icons/layout/add.png"));
        addButton.setToolTipText("Add node to layout");
        addButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                int lastRow = 0;
                for (BasicLayoutInfo basicLayoutInfo : m_basicMap.values()) {
                    lastRow = Math.max(lastRow, basicLayoutInfo.getRow());
                }
                BasicLayoutInfo newInfo = new BasicLayoutInfo();
                newInfo.setRow(lastRow + 1);
                newInfo.setCol(1);
                newInfo.setColWidth(12);
                newInfo.setView(m_layoutCreator.getDefaultViewContentForNode(entry.getKey(), entry.getValue()));
                m_basicMap.put(entry.getKey(), newInfo);
                tryUpdateJsonFromBasic();
            }
        });
        GridData gridData = new GridData();
        gridData.horizontalSpan = 4;
        Label space = new Label(m_basicComposite, SWT.NONE);
        space.setLayoutData(gridData);
    }
    GridData fillRow = new GridData();
    fillRow.grabExcessHorizontalSpace = true;
    fillRow.horizontalAlignment = SWT.CENTER;
    fillRow.horizontalSpan = 7;
    Button resetButton = new Button(m_basicComposite, SWT.PUSH | SWT.CENTER);
    resetButton.setImage(ImageRepository.getIconImage(KNIMEEditorPlugin.PLUGIN_ID, "icons/layout/reset.png"));
    resetButton.setText("Reset");
    resetButton.setToolTipText("Reset layout to default according to currently available nodes.");
    resetButton.setLayoutData(fillRow);
    resetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (!MessageDialog.openConfirm(m_basicComposite.getShell(), "Confirm reset", "Are you sure you want to reset the layout according to the currently available nodes?")) {
                return;
            }
            resetLayout();
            if (isWindows()) {
                m_textArea.setText(m_jsonDocument);
            } else {
                m_text.setText(m_jsonDocument);
            }
            updateModelFromJson();
        }
    });
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Spinner(org.eclipse.swt.widgets.Spinner) FontData(org.eclipse.swt.graphics.FontData) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) NodeContainer(org.knime.core.node.workflow.NodeContainer) SubNodeContainer(org.knime.core.node.workflow.SubNodeContainer) WizardNode(org.knime.core.node.wizard.WizardNode) Font(org.eclipse.swt.graphics.Font) GridLayout(org.eclipse.swt.layout.GridLayout) NodeIDSuffix(org.knime.core.node.workflow.NodeID.NodeIDSuffix) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) NodeID(org.knime.core.node.workflow.NodeID) SelectionEvent(org.eclipse.swt.events.SelectionEvent) JSONLayoutViewContent(org.knime.js.core.layout.bs.JSONLayoutViewContent)

Example 13 with NodeIDSuffix

use of org.knime.core.node.workflow.NodeID.NodeIDSuffix in project knime-core by knime.

the class SubnodeLayoutJSONEditorPage method processBasicLayoutRow.

/**
 * Processes one layout row, creates {@link BasicLayoutInfo} for each contained node and determines if basic layout
 * is available. Some advanced configurations (additional styles or classes, HTML content or nested layouts) can not
 * be represented in a basic layout.
 *
 * @param row the row to process
 * @param rowIndex the index of the row as it appears in the layout
 */
private void processBasicLayoutRow(final JSONLayoutRow row, final int rowIndex) {
    if (listNotNullOrEmpty(row.getAdditionalStyles()) || listNotNullOrEmpty(row.getAdditionalClasses())) {
        // basic layout not possible, show only advanced tab
        m_basicPanelAvailable = false;
        return;
    }
    List<JSONLayoutColumn> columns = row.getColumns();
    for (int colIndex = 0; colIndex < columns.size(); colIndex++) {
        JSONLayoutColumn column = columns.get(colIndex);
        if (listNotNullOrEmpty(column.getAdditionalStyles()) || listNotNullOrEmpty(column.getAdditionalClasses())) {
            // basic layout not possible, show only advanced tab
            m_basicPanelAvailable = false;
            return;
        }
        List<JSONLayoutContent> content = column.getContent();
        if (content != null) {
            for (JSONLayoutContent jsonLayoutContent : content) {
                if (jsonLayoutContent != null) {
                    if (jsonLayoutContent instanceof JSONLayoutViewContent) {
                        JSONLayoutViewContent viewContent = (JSONLayoutViewContent) jsonLayoutContent;
                        if (listNotNullOrEmpty(viewContent.getAdditionalStyles()) || listNotNullOrEmpty(viewContent.getAdditionalClasses())) {
                            // basic layout not possible, show only advanced tab
                            m_basicPanelAvailable = false;
                            return;
                        }
                        BasicLayoutInfo basicInfo = new BasicLayoutInfo();
                        basicInfo.setRow(rowIndex + 1);
                        basicInfo.setCol(colIndex + 1);
                        basicInfo.setColWidth(column.getWidthMD());
                        basicInfo.setView(viewContent);
                        NodeIDSuffix id = NodeIDSuffix.fromString(viewContent.getNodeID());
                        m_basicMap.put(id, basicInfo);
                    } else {
                        // basic layout not possible, show only advanced tab
                        m_basicPanelAvailable = false;
                        return;
                    }
                }
            }
        }
    }
}
Also used : JSONLayoutContent(org.knime.js.core.layout.bs.JSONLayoutContent) NodeIDSuffix(org.knime.core.node.workflow.NodeID.NodeIDSuffix) JSONLayoutColumn(org.knime.js.core.layout.bs.JSONLayoutColumn) JSONLayoutViewContent(org.knime.js.core.layout.bs.JSONLayoutViewContent) Point(org.eclipse.swt.graphics.Point)

Example 14 with NodeIDSuffix

use of org.knime.core.node.workflow.NodeID.NodeIDSuffix in project knime-core by knime.

the class SubnodeLayoutJSONEditorPage method compareNodeIDs.

private void compareNodeIDs() {
    Set<Integer> missingIDs = new HashSet<Integer>();
    Set<Integer> notExistingIDs = new HashSet<Integer>(m_documentNodeIDs);
    Set<Integer> duplicateIDCheck = new HashSet<Integer>(m_documentNodeIDs);
    Set<Integer> duplicateIDs = new HashSet<Integer>();
    for (NodeIDSuffix id : m_viewNodes.keySet()) {
        int i = NodeID.fromString(id.toString()).getIndex();
        if (m_documentNodeIDs.contains(i)) {
            notExistingIDs.remove(i);
        } else {
            missingIDs.add(i);
        }
    }
    for (int id : m_documentNodeIDs) {
        if (!duplicateIDCheck.remove(id)) {
            duplicateIDs.add(id);
        }
    }
    StringBuilder error = new StringBuilder();
    if (notExistingIDs.size() > 0) {
        error.append("Node IDs referenced in layout, but do not exist in node: ");
        for (int id : notExistingIDs) {
            error.append(id);
            error.append(", ");
        }
        error.setLength(error.length() - 2);
        if (missingIDs.size() > 0 || duplicateIDs.size() > 0) {
            error.append("\n");
        }
    }
    if (missingIDs.size() > 0) {
        error.append("Node IDs missing in layout: ");
        for (int id : missingIDs) {
            error.append(id);
            error.append(", ");
        }
        error.setLength(error.length() - 2);
        if (duplicateIDs.size() > 0) {
            error.append("\n");
        }
    }
    if (duplicateIDs.size() > 0) {
        error.append("Multiple references to node IDs: ");
        for (int id : duplicateIDs) {
            error.append(id);
            error.append(", ");
        }
        error.setLength(error.length() - 2);
    }
    if (error.length() > 0 && m_statusLine != null && !m_statusLine.isDisposed()) {
        int textWidth = isWindows() ? m_textArea.getSize().width : m_text.getSize().x;
        Point newSize = m_statusLine.computeSize(textWidth, m_statusLine.getSize().y, true);
        m_statusLine.setSize(newSize);
        m_statusLine.setForeground(new Color(Display.getCurrent(), 255, 140, 0));
        m_statusLine.setText(error.toString());
    }
}
Also used : NodeIDSuffix(org.knime.core.node.workflow.NodeID.NodeIDSuffix) Color(org.eclipse.swt.graphics.Color) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) HashSet(java.util.HashSet)

Example 15 with NodeIDSuffix

use of org.knime.core.node.workflow.NodeID.NodeIDSuffix in project knime-core by knime.

the class WebResourceController method getWizardPageInternal.

/**
 * Crates the wizard page for a given node id. Throws exception if no wizard page available.
 *
 * @param subnodeID the node id for the subnode to retrieve the wizard page for
 * @return The wizard page for the given node id
 */
@SuppressWarnings("rawtypes")
protected WizardPageContent getWizardPageInternal(final NodeID subnodeID) {
    if (subnodeID == null) {
        LOGGER.error("No node ID supplied for creating wizard page");
        return null;
    }
    final WorkflowManager manager = m_manager;
    assert manager.isLockedByCurrentThread();
    // int currentSubnodeIDSuffix = m_promptedSubnodeIDSuffixes.peek();
    // final NodeID subNodeID = toNodeID(currentSubnodeIDSuffix);
    SubNodeContainer subNC = manager.getNodeContainer(subnodeID, SubNodeContainer.class, true);
    WorkflowManager subWFM = subNC.getWorkflowManager();
    Map<NodeID, WizardNode> wizardNodeMap = subWFM.findNodes(WizardNode.class, NOT_HIDDEN_FILTER, false);
    LinkedHashMap<NodeIDSuffix, WizardNode> resultMap = new LinkedHashMap<NodeIDSuffix, WizardNode>();
    // LinkedHashMap<NodeIDSuffix, WizardNode> errorMap = new LinkedHashMap<NodeIDSuffix, WizardNode>();
    LinkedHashMap<NodeIDSuffix, WizardPageNodeInfo> infoMap = new LinkedHashMap<NodeIDSuffix, WizardPageNodeInfo>();
    Set<HiLiteHandler> initialHiliteHandlerSet = new HashSet<HiLiteHandler>();
    for (Map.Entry<NodeID, WizardNode> entry : wizardNodeMap.entrySet()) {
        NodeContainer nc = subWFM.getNodeContainer(entry.getKey());
        if ((nc instanceof SingleNodeContainer) && ((SingleNodeContainer) nc).isInactive()) {
            // skip nodes in inactive branches
            continue;
        }
        NodeID.NodeIDSuffix idSuffix = NodeID.NodeIDSuffix.create(manager.getID(), entry.getKey());
        WizardPageNodeInfo nodeInfo = new WizardPageNodeInfo();
        nodeInfo.setNodeName(nc.getName());
        nodeInfo.setNodeAnnotation(nc.getNodeAnnotation().toString());
        nodeInfo.setNodeState(nc.getInternalState());
        nodeInfo.setNodeMessage(nc.getNodeMessage());
        infoMap.put(idSuffix, nodeInfo);
        if (EXECUTED.equals(nc.getInternalState())) {
            // regular viewable nodes need to be executed
            resultMap.put(idSuffix, entry.getValue());
        }
        for (int i = 0; i < nc.getNrInPorts() - 1; i++) {
            HiLiteHandler hiLiteHandler = ((NodeModel) entry.getValue()).getInHiLiteHandler(i);
            if (hiLiteHandler != null) {
                initialHiliteHandlerSet.add(hiLiteHandler);
            }
        }
    }
    NodeID.NodeIDSuffix pageID = NodeID.NodeIDSuffix.create(manager.getID(), subWFM.getID());
    String pageLayout = subNC.getLayoutJSONString();
    if (StringUtils.isEmpty(pageLayout)) {
        try {
            pageLayout = LayoutUtil.createDefaultLayout(resultMap);
        } catch (IOException ex) {
            LOGGER.error("Default page layout could not be created: " + ex.getMessage(), ex);
        }
    }
    Set<HiLiteHandler> knownHiLiteHandlers = new HashSet<HiLiteHandler>();
    Set<HiLiteTranslator> knownTranslators = new HashSet<HiLiteTranslator>();
    Set<HiLiteManager> knownManagers = new HashSet<HiLiteManager>();
    for (HiLiteHandler initialHandler : initialHiliteHandlerSet) {
        getHiLiteTranslators(initialHandler, knownHiLiteHandlers, knownTranslators, knownManagers);
    }
    List<HiLiteTranslator> translatorList = knownTranslators.size() > 0 ? new ArrayList<HiLiteTranslator>(knownTranslators) : null;
    List<HiLiteManager> managerList = knownManagers.size() > 0 ? new ArrayList<HiLiteManager>(knownManagers) : null;
    WizardPageContent page = new WizardPageContent(pageID, resultMap, pageLayout, translatorList, managerList);
    page.setInfoMap(infoMap);
    return page;
}
Also used : HiLiteHandler(org.knime.core.node.property.hilite.HiLiteHandler) NodeIDSuffix(org.knime.core.node.workflow.NodeID.NodeIDSuffix) LinkedHashMap(java.util.LinkedHashMap) NodeModel(org.knime.core.node.NodeModel) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) HiLiteTranslator(org.knime.core.node.property.hilite.HiLiteTranslator) IOException(java.io.IOException) HiLiteManager(org.knime.core.node.property.hilite.HiLiteManager) WizardNode(org.knime.core.node.wizard.WizardNode) NodeIDSuffix(org.knime.core.node.workflow.NodeID.NodeIDSuffix) WizardPageNodeInfo(org.knime.core.node.workflow.WebResourceController.WizardPageContent.WizardPageNodeInfo) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

NodeIDSuffix (org.knime.core.node.workflow.NodeID.NodeIDSuffix)19 NodeID (org.knime.core.node.workflow.NodeID)7 HashSet (java.util.HashSet)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 WizardNode (org.knime.core.node.wizard.WizardNode)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 NativeNodeContainer (org.knime.core.node.workflow.NativeNodeContainer)4 SubNodeContainer (org.knime.core.node.workflow.SubNodeContainer)4 LinkedHashMap (java.util.LinkedHashMap)3 List (java.util.List)3 PortObjectInNodeModel (org.knime.core.node.exec.dataexchange.in.PortObjectInNodeModel)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 File (java.io.File)2 LinkedHashSet (java.util.LinkedHashSet)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Font (org.eclipse.swt.graphics.Font)2