Search in sources :

Example 1 with LoopStatus

use of org.knime.core.node.workflow.NativeNodeContainer.LoopStatus in project knime-core by knime.

the class NodeContainerFigure method setStateFromNC.

/**
 * @param nc new state of underlying node
 */
public void setStateFromNC(final NodeContainerUI nc) {
    boolean isInactive = false;
    LoopStatus loopStatus = LoopStatus.NONE;
    if (nc instanceof SingleNodeContainerUI) {
        SingleNodeContainerUI snc = (SingleNodeContainerUI) nc;
        isInactive = snc.isInactive();
        if (Wrapper.wraps(snc, NativeNodeContainer.class)) {
            NativeNodeContainer nnc = Wrapper.unwrap(snc, NativeNodeContainer.class);
            loopStatus = nnc.getLoopStatus();
        }
    }
    NodeContainerState state = nc.getNodeContainerState();
    if (!isInactive) {
        if (state.isIdle()) {
            setStatusAmple();
            m_statusFigure.setIcon(RED);
        } else if (state.isConfigured()) {
            setStatusAmple();
            m_statusFigure.setIcon(YELLOW);
        } else if (state.isExecuted()) {
            setStatusAmple();
            m_statusFigure.setIcon(GREEN);
        } else if (state.isWaitingToBeExecuted()) {
            if (LoopStatus.PAUSED.equals(loopStatus)) {
                setProgressBar(ProgressMode.PAUSED);
            } else {
                setProgressBar(ProgressMode.QUEUED);
            }
        } else if (state.isExecutionInProgress()) {
            setProgressBar(ProgressMode.EXECUTING);
        } else {
            setStatusAmple();
            m_statusFigure.setIcon(INACTIVE);
        }
    } else {
        setStatusAmple();
        m_statusFigure.setIcon(INACTIVE);
    }
    setLoopStatus(loopStatus, state.isExecuted());
    repaint();
}
Also used : SingleNodeContainerUI(org.knime.core.ui.node.workflow.SingleNodeContainerUI) NodeContainerState(org.knime.core.node.workflow.NodeContainerState) LoopStatus(org.knime.core.node.workflow.NativeNodeContainer.LoopStatus) NativeNodeContainer(org.knime.core.node.workflow.NativeNodeContainer)

Aggregations

NativeNodeContainer (org.knime.core.node.workflow.NativeNodeContainer)1 LoopStatus (org.knime.core.node.workflow.NativeNodeContainer.LoopStatus)1 NodeContainerState (org.knime.core.node.workflow.NodeContainerState)1 SingleNodeContainerUI (org.knime.core.ui.node.workflow.SingleNodeContainerUI)1