Search in sources :

Example 1 with AbstractNodeExecutionJobManager

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

the class WorkflowEditor method updateJobManagerDisplay.

private void updateJobManagerDisplay() {
    NodeExecutionJobManager jobManager = m_manager.findJobManager();
    URL url;
    if (jobManager instanceof AbstractNodeExecutionJobManager) {
        url = ((AbstractNodeExecutionJobManager) jobManager).getIconForWorkflow();
    } else {
        url = null;
    }
    Image image;
    if (url != null) {
        image = ImageRepository.getUnscaledImage(url);
    } else {
        image = null;
    }
    WorkflowFigure workflowFigure = ((WorkflowRootEditPart) getViewer().getRootEditPart().getContents()).getFigure();
    workflowFigure.setJobManagerFigure(image);
}
Also used : WorkflowFigure(org.knime.workbench.editor2.figures.WorkflowFigure) WorkflowRootEditPart(org.knime.workbench.editor2.editparts.WorkflowRootEditPart) AbstractNodeExecutionJobManager(org.knime.core.node.workflow.AbstractNodeExecutionJobManager) Image(org.eclipse.swt.graphics.Image) URL(java.net.URL) AbstractNodeExecutionJobManager(org.knime.core.node.workflow.AbstractNodeExecutionJobManager) NodeExecutionJobManager(org.knime.core.node.workflow.NodeExecutionJobManager)

Example 2 with AbstractNodeExecutionJobManager

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

the class NodeContainerEditPart method updateJobManagerIcon.

private void updateJobManagerIcon() {
    NodeContainerUI nc = getNodeContainer();
    NodeExecutionJobManager jobManager = nc.getJobManager();
    URL iconURL;
    if (jobManager != null) {
        iconURL = jobManager.getIcon();
    } else {
        NodeExecutionJobManager parentJobManager = nc.findJobManager();
        if (parentJobManager instanceof AbstractNodeExecutionJobManager) {
            if (Wrapper.wraps(nc, NodeContainer.class)) {
                iconURL = ((AbstractNodeExecutionJobManager) parentJobManager).getIconForChild(Wrapper.unwrapNC(nc));
            } else {
                iconURL = null;
            }
        } else {
            iconURL = null;
        }
    }
    Image icon = null;
    if (iconURL != null) {
        icon = ImageDescriptor.createFromURL(iconURL).createImage();
    }
    ((NodeContainerFigure) getFigure()).setJobExecutorIcon(icon);
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) SubNodeContainerUI(org.knime.core.ui.node.workflow.SubNodeContainerUI) AbstractNodeExecutionJobManager(org.knime.core.node.workflow.AbstractNodeExecutionJobManager) Image(org.eclipse.swt.graphics.Image) URL(java.net.URL) AbstractNodeExecutionJobManager(org.knime.core.node.workflow.AbstractNodeExecutionJobManager) NodeExecutionJobManager(org.knime.core.node.workflow.NodeExecutionJobManager) NodeContainerFigure(org.knime.workbench.editor2.figures.NodeContainerFigure)

Aggregations

URL (java.net.URL)2 Image (org.eclipse.swt.graphics.Image)2 AbstractNodeExecutionJobManager (org.knime.core.node.workflow.AbstractNodeExecutionJobManager)2 NodeExecutionJobManager (org.knime.core.node.workflow.NodeExecutionJobManager)2 NodeContainerUI (org.knime.core.ui.node.workflow.NodeContainerUI)1 SubNodeContainerUI (org.knime.core.ui.node.workflow.SubNodeContainerUI)1 WorkflowRootEditPart (org.knime.workbench.editor2.editparts.WorkflowRootEditPart)1 NodeContainerFigure (org.knime.workbench.editor2.figures.NodeContainerFigure)1 WorkflowFigure (org.knime.workbench.editor2.figures.WorkflowFigure)1