Search in sources :

Example 16 with NodeContainerFigure

use of org.knime.workbench.editor2.figures.NodeContainerFigure 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)

Example 17 with NodeContainerFigure

use of org.knime.workbench.editor2.figures.NodeContainerFigure in project knime-core by knime.

the class NodeContainerEditPart method checkNodeLockIcon.

private void checkNodeLockIcon() {
    NodeContainerUI nc = getNodeContainer();
    Image i;
    StringBuilder toolTip = new StringBuilder();
    // node is considered being locked if it is either lock from being reseted, it's not deletable, or the dialog is locked
    if (nc.getNodeLocks().hasResetLock() || nc.getNodeLocks().hasDeleteLock() || nc.getNodeLocks().hasConfigureLock()) {
        toolTip.append("Node Locked (");
        i = NODE_LOCK_ICON;
        if (nc.getNodeLocks().hasResetLock()) {
            toolTip.append("Reset, ");
        }
        if (nc.getNodeLocks().hasDeleteLock()) {
            toolTip.append("Delete, ");
        }
        if (nc.getNodeLocks().hasConfigureLock()) {
            toolTip.append("Configure, ");
        }
        toolTip.setLength(toolTip.length() - 2);
        toolTip.append(")");
    } else {
        i = null;
    }
    NodeContainerFigure fig = (NodeContainerFigure) getFigure();
    fig.setNodeLockIcon(i, toolTip.toString());
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) SubNodeContainerUI(org.knime.core.ui.node.workflow.SubNodeContainerUI) Image(org.eclipse.swt.graphics.Image) NodeContainerFigure(org.knime.workbench.editor2.figures.NodeContainerFigure)

Aggregations

NodeContainerFigure (org.knime.workbench.editor2.figures.NodeContainerFigure)17 NodeContainerUI (org.knime.core.ui.node.workflow.NodeContainerUI)9 SubNodeContainerUI (org.knime.core.ui.node.workflow.SubNodeContainerUI)8 Image (org.eclipse.swt.graphics.Image)5 Point (org.eclipse.draw2d.geometry.Point)4 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 NodeAnnotationEditPart (org.knime.workbench.editor2.editparts.NodeAnnotationEditPart)3 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)3 IFigure (org.eclipse.draw2d.IFigure)2 EditPart (org.eclipse.gef.EditPart)2 NodeAnnotation (org.knime.core.node.workflow.NodeAnnotation)2 NodeUIInformation (org.knime.core.node.workflow.NodeUIInformation)2 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)2 ChangeAnnotationBoundsCommand (org.knime.workbench.editor2.commands.ChangeAnnotationBoundsCommand)2 ChangeNodeBoundsCommand (org.knime.workbench.editor2.commands.ChangeNodeBoundsCommand)2 AnnotationEditPart (org.knime.workbench.editor2.editparts.AnnotationEditPart)2 WorkflowRootEditPart (org.knime.workbench.editor2.editparts.WorkflowRootEditPart)2 URL (java.net.URL)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1