Search in sources :

Example 6 with NodeContainerUI

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

the class NodeContainerEditPart method checkMetaNodeLockIcon.

private void checkMetaNodeLockIcon() {
    NodeContainerUI nc = getNodeContainer();
    if (nc instanceof WorkflowManagerUI) {
        WorkflowManagerUI wm = (WorkflowManagerUI) nc;
        Image i;
        if (wm.isEncrypted()) {
            if (wm.isUnlocked()) {
                i = META_NODE_UNLOCK_ICON;
            } else {
                i = META_NODE_LOCK_ICON;
            }
        } else {
            i = null;
        }
        NodeContainerFigure fig = (NodeContainerFigure) getFigure();
        fig.setMetaNodeLockIcon(i);
    }
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) SubNodeContainerUI(org.knime.core.ui.node.workflow.SubNodeContainerUI) WorkflowManagerUI(org.knime.core.ui.node.workflow.WorkflowManagerUI) Image(org.eclipse.swt.graphics.Image) NodeContainerFigure(org.knime.workbench.editor2.figures.NodeContainerFigure)

Example 7 with NodeContainerUI

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

the class NodeInPortEditPart method createFigure.

/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    // Create the figure, we need the number of ports from the parent
    // container
    NodeContainerUI container = getNodeContainer();
    boolean isMetaNode = !(container instanceof SingleNodeContainerUI);
    NodeInPortFigure portFigure = new NodeInPortFigure(getType(), getIndex(), container.getNrInPorts(), isMetaNode, container.getInPort(getIndex()).getPortName());
    portFigure.setIsConnected(isConnected());
    return portFigure;
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) SingleNodeContainerUI(org.knime.core.ui.node.workflow.SingleNodeContainerUI) SingleNodeContainerUI(org.knime.core.ui.node.workflow.SingleNodeContainerUI) NodeInPortFigure(org.knime.workbench.editor2.figures.NodeInPortFigure)

Example 8 with NodeContainerUI

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

the class NewWorkflowXYLayoutPolicy method createChangeConstraintCommand.

/**
 * Creates command to move / resize <code>NodeContainer</code> components on
 * the project's client area.
 *
 * {@inheritDoc}
 */
@Override
protected Command createChangeConstraintCommand(final EditPart child, final Object constraint) {
    // only rectangular constraints are supported
    if (!(constraint instanceof Rectangle)) {
        return null;
    }
    Command command = null;
    Rectangle rect = ((Rectangle) constraint).getCopy();
    if (child.getModel() instanceof NodeContainerUI) {
        NodeContainerUI container = (NodeContainerUI) child.getModel();
        if (!Wrapper.wraps(container, NodeContainer.class)) {
            // not supported for others than ordinary NodeContainers
            return null;
        }
        NodeContainerEditPart nodePart = (NodeContainerEditPart) child;
        command = new ChangeNodeBoundsCommand(Wrapper.unwrapNC(container), (NodeContainerFigure) nodePart.getFigure(), rect);
    } else if (child instanceof AbstractWorkflowPortBarEditPart) {
        command = new ChangeWorkflowPortBarCommand((AbstractWorkflowPortBarEditPart) child, rect);
    } else if (child instanceof AnnotationEditPart) {
        AnnotationEditPart annoPart = (AnnotationEditPart) child;
        // TODO the workflow annotation could know what its WFM is?
        WorkflowRootEditPart root = (WorkflowRootEditPart) annoPart.getParent();
        WorkflowManagerUI wm = root.getWorkflowManager();
        if (!Wrapper.wraps(wm, WorkflowManager.class)) {
            // not supported for others than an ordinary workflow manager
            return null;
        }
        command = new ChangeAnnotationBoundsCommand(Wrapper.unwrapWFM(wm), annoPart, rect);
    }
    return command;
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) ChangeNodeBoundsCommand(org.knime.workbench.editor2.commands.ChangeNodeBoundsCommand) AbstractWorkflowPortBarEditPart(org.knime.workbench.editor2.editparts.AbstractWorkflowPortBarEditPart) WorkflowRootEditPart(org.knime.workbench.editor2.editparts.WorkflowRootEditPart) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ChangeWorkflowPortBarCommand(org.knime.workbench.editor2.commands.ChangeWorkflowPortBarCommand) WorkflowManagerUI(org.knime.core.ui.node.workflow.WorkflowManagerUI) NodeContainer(org.knime.core.node.workflow.NodeContainer) NodeContainerFigure(org.knime.workbench.editor2.figures.NodeContainerFigure) ChangeAnnotationBoundsCommand(org.knime.workbench.editor2.commands.ChangeAnnotationBoundsCommand) NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) AnnotationEditPart(org.knime.workbench.editor2.editparts.AnnotationEditPart) NodeAnnotationEditPart(org.knime.workbench.editor2.editparts.NodeAnnotationEditPart) ChangeWorkflowPortBarCommand(org.knime.workbench.editor2.commands.ChangeWorkflowPortBarCommand) ChangeNodeBoundsCommand(org.knime.workbench.editor2.commands.ChangeNodeBoundsCommand) ChangeAnnotationBoundsCommand(org.knime.workbench.editor2.commands.ChangeAnnotationBoundsCommand) Command(org.eclipse.gef.commands.Command)

Example 9 with NodeContainerUI

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

the class NodeMonitorView method dispose.

/**
 * {@inheritDoc}
 */
@Override
public void dispose() {
    NodeContainerUI cont = m_lastNode;
    if (cont != null) {
        cont.removeNodeStateChangeListener(this);
        m_lastNode = null;
    }
    getViewSite().getPage().removeSelectionListener(this);
    super.dispose();
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI)

Example 10 with NodeContainerUI

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

the class NodeMonitorView method selectionChanged.

/**
 * The method updating the content of the monitor.
 *
 * {@inheritDoc}
 */
@Override
public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
    if (!(selection instanceof IStructuredSelection)) {
        return;
    }
    IStructuredSelection structSel = (IStructuredSelection) selection;
    if (m_pinned) {
        m_lastSelectionWhilePinned = structSel;
        return;
    }
    if (structSel.equals(m_lastSelection)) {
        // selection hasn't changed - return.
        return;
    }
    m_lastSelection = structSel;
    if (structSel.size() < 1) {
        // Nothing selected
        m_title.setText("");
        m_state.setText("no node selected");
        m_table.removeAll();
        return;
    }
    if (structSel.size() > 1) {
        // too many selected items
        m_title.setText("");
        m_state.setText("more than one element selected.");
        m_table.removeAll();
        return;
    }
    // retrieve first (and only!) selection:
    Iterator<?> selIt = structSel.iterator();
    Object sel = selIt.next();
    // 
    if (sel instanceof NodeContainerEditPart) {
        // a NodeContainer was selected, display it's name and status
        NodeContainerUI nc = ((NodeContainerEditPart) sel).getNodeContainer();
        updateNodeContainerInfo(nc);
    } else {
        // unsupported selection
        unsupportedSelection(sel);
    }
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) PortObject(org.knime.core.node.port.PortObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

NodeContainerUI (org.knime.core.ui.node.workflow.NodeContainerUI)59 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)28 SubNodeContainerUI (org.knime.core.ui.node.workflow.SubNodeContainerUI)17 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)16 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)10 NodeContainerFigure (org.knime.workbench.editor2.figures.NodeContainerFigure)9 SingleNodeContainerUI (org.knime.core.ui.node.workflow.SingleNodeContainerUI)8 NodeUIInformation (org.knime.core.node.workflow.NodeUIInformation)7 HashMap (java.util.HashMap)5 Point (org.eclipse.draw2d.geometry.Point)5 Image (org.eclipse.swt.graphics.Image)5 ConnectionUIInformation (org.knime.core.node.workflow.ConnectionUIInformation)5 NativeNodeContainer (org.knime.core.node.workflow.NativeNodeContainer)5 NodeID (org.knime.core.node.workflow.NodeID)5 ArrayList (java.util.ArrayList)4 EditPart (org.eclipse.gef.EditPart)4 LoopEndNode (org.knime.core.node.workflow.LoopEndNode)4 IContainer (org.eclipse.core.resources.IContainer)3 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3