Search in sources :

Example 1 with NodeOutPortUI

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

the class WorkflowInPortEditPart method createFigure.

/**
 * Creates {@link WorkflowInPortFigure}, sets the tooltip and adds a
 * {@link MouseListener} to the figure in order to detect if the figure was
 * clicked and a context menu entry should be provided to open the port
 * view.
 *
 * @see WorkflowContextMenuProvider#buildContextMenu(
 * org.eclipse.jface.action.IMenuManager)
 * @see WorkflowInPortFigure
 *
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    NodeOutPortUI port = getManager().getInPort(getIndex()).getUnderlyingPort();
    String tooltip = getTooltipText(PORT_NAME + ": " + getIndex(), port);
    WorkflowInPortFigure f = new WorkflowInPortFigure(getType(), getManager().getNrInPorts(), getIndex(), tooltip);
    f.addMouseListener(new MouseListener() {

        @Override
        public void mouseDoubleClicked(final MouseEvent me) {
        }

        /**
         * Set the selection state of the figure to true. This is
         * evaluated in the context menu. If it is selected a context menu
         * entry is provided to open the port view.
         *
         * @see WorkflowContextMenuProvider#buildContextMenu(
         *  org.eclipse.jface.action.IMenuManager)
         *
         * {@inheritDoc}
         */
        @Override
        public void mousePressed(final MouseEvent me) {
            setSelected(true);
        }

        /**
         * Set the selection state of the figure to true. This is
         * evaluated in the context menu. If it is selected a context menu
         * entry is provided to open the port view.
         *
         * @see WorkflowContextMenuProvider#buildContextMenu(
         *  org.eclipse.jface.action.IMenuManager)
         *
         * {@inheritDoc}
         */
        @Override
        public void mouseReleased(final MouseEvent me) {
            setSelected(false);
        }
    });
    return f;
}
Also used : WorkflowInPortFigure(org.knime.workbench.editor2.figures.WorkflowInPortFigure) NodeOutPortUI(org.knime.core.ui.node.workflow.NodeOutPortUI) MouseListener(org.eclipse.draw2d.MouseListener) MouseEvent(org.eclipse.draw2d.MouseEvent)

Example 2 with NodeOutPortUI

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

the class AbstractPortEditPart method rebuildTooltip.

/**
 * Tries to build the tooltip from the port name and if this is a data
 * outport and the node is configured/executed, it appends also the number
 * of columns and rows.
 */
public void rebuildTooltip() {
    if (isInPort()) {
        if (getIndex() < getNodeContainer().getNrInPorts()) {
            NodeInPortUI port = getNodeContainer().getInPort(getIndex());
            String tooltip = getTooltipText(port.getPortName(), port);
            ((NewToolTipFigure) getFigure().getToolTip()).setText(tooltip);
        }
    } else {
        if (getIndex() < getNodeContainer().getNrOutPorts()) {
            NodeOutPortUI port = getNodeContainer().getOutPort(getIndex());
            String tooltip = getTooltipText(port.getPortName(), port);
            ((NewToolTipFigure) getFigure().getToolTip()).setText(tooltip);
        }
    }
}
Also used : NodeOutPortUI(org.knime.core.ui.node.workflow.NodeOutPortUI) NewToolTipFigure(org.knime.workbench.editor2.figures.NewToolTipFigure) NodeInPortUI(org.knime.core.ui.node.workflow.NodeInPortUI)

Example 3 with NodeOutPortUI

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

the class NodeOutPortEditPart method createFigure.

/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    // Create the figure, we need the number of ports from the parent
    // container
    NodeContainerUI container = getNodeContainer();
    NodeOutPortUI port = container.getOutPort(getIndex());
    String tooltip = getTooltipText(port.getPortName(), port);
    boolean isMetaNode = !(container instanceof SingleNodeContainerUI);
    NodeOutPortFigure portFigure = new NodeOutPortFigure(getType(), getIndex(), container.getNrOutPorts(), isMetaNode, tooltip);
    portFigure.setInactive(port.isInactive());
    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) NodeOutPortUI(org.knime.core.ui.node.workflow.NodeOutPortUI) NodeOutPortFigure(org.knime.workbench.editor2.figures.NodeOutPortFigure)

Example 4 with NodeOutPortUI

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

the class NodeOutPortEditPart method activate.

/**
 * {@inheritDoc}
 */
@Override
public void activate() {
    super.activate();
    NodeOutPortUI outPort = (NodeOutPortUI) getModel();
    outPort.addNodeStateChangeListener(this);
}
Also used : NodeOutPortUI(org.knime.core.ui.node.workflow.NodeOutPortUI)

Example 5 with NodeOutPortUI

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

the class NodeOutPortEditPart method deactivate.

/**
 * {@inheritDoc}
 */
@Override
public void deactivate() {
    NodeOutPortUI outPort = (NodeOutPortUI) getModel();
    outPort.removeNodeStateChangeListener(this);
    super.deactivate();
}
Also used : NodeOutPortUI(org.knime.core.ui.node.workflow.NodeOutPortUI)

Aggregations

NodeOutPortUI (org.knime.core.ui.node.workflow.NodeOutPortUI)9 NodeContainerUI (org.knime.core.ui.node.workflow.NodeContainerUI)2 NodeInPortUI (org.knime.core.ui.node.workflow.NodeInPortUI)2 SingleNodeContainerUI (org.knime.core.ui.node.workflow.SingleNodeContainerUI)2 WorkflowInPortUI (org.knime.core.ui.node.workflow.WorkflowInPortUI)2 WorkflowOutPortUI (org.knime.core.ui.node.workflow.WorkflowOutPortUI)2 NewToolTipFigure (org.knime.workbench.editor2.figures.NewToolTipFigure)2 NodeOutPortFigure (org.knime.workbench.editor2.figures.NodeOutPortFigure)2 MouseEvent (org.eclipse.draw2d.MouseEvent)1 MouseListener (org.eclipse.draw2d.MouseListener)1 EditPart (org.eclipse.gef.EditPart)1 Display (org.eclipse.swt.widgets.Display)1 Annotation (org.knime.core.node.workflow.Annotation)1 NodeAnnotation (org.knime.core.node.workflow.NodeAnnotation)1 ConnectionContainerUI (org.knime.core.ui.node.workflow.ConnectionContainerUI)1 NodePortUI (org.knime.core.ui.node.workflow.NodePortUI)1 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)1 AnnotationEditPart (org.knime.workbench.editor2.editparts.AnnotationEditPart)1 ConnectionContainerEditPart (org.knime.workbench.editor2.editparts.ConnectionContainerEditPart)1 MetaNodeOutPortEditPart (org.knime.workbench.editor2.editparts.MetaNodeOutPortEditPart)1